UefiPayloadPkg: Add MemoryTypeInformation HOB
MemoryTypeInformation HOB was built in FD and FIT image format UEFI payload. But this HOB was not built in ELF image format UEFI payload. Adding this HOB for ELF image format to keep payload consistent in different image format. When this HOB is missing, DXE/SMM driver might be dispatched above 4GB and MemoryType information HOB assists GCD with defragmenting the memory map. Signed-off-by: Guo Dong <guo.dong@intel.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Guid/MemoryTypeInformation.h>
|
||||
#include "UefiPayloadEntry.h"
|
||||
|
||||
#define MEMORY_ATTRIBUTE_MASK (EFI_RESOURCE_ATTRIBUTE_PRESENT | \
|
||||
@@ -35,6 +35,15 @@ PrintHob (
|
||||
IN CONST VOID *HobStart
|
||||
);
|
||||
|
||||
EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
|
||||
{ EfiACPIReclaimMemory, FixedPcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory) },
|
||||
{ EfiACPIMemoryNVS, FixedPcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS) },
|
||||
{ EfiReservedMemoryType, FixedPcdGet32 (PcdMemoryTypeEfiReservedMemoryType) },
|
||||
{ EfiRuntimeServicesData, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServicesData) },
|
||||
{ EfiRuntimeServicesCode, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode) },
|
||||
{ EfiMaxMemoryType, 0 }
|
||||
};
|
||||
|
||||
/**
|
||||
Some bootloader may pass a pcd database, and UPL also contain a PCD database.
|
||||
Dxe PCD driver has the assumption that the two PCD database can be catenated and
|
||||
@@ -482,6 +491,17 @@ _ModuleEntryPoint (
|
||||
Status = BuildHobs (BootloaderParameter, &DxeFv);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Create Memory Type Information HOB
|
||||
//
|
||||
if (GetFirstGuidHob (&gEfiMemoryTypeInformationGuid) == NULL) {
|
||||
BuildGuidDataHob (
|
||||
&gEfiMemoryTypeInformationGuid,
|
||||
mDefaultMemoryTypeInformation,
|
||||
sizeof (mDefaultMemoryTypeInformation)
|
||||
);
|
||||
}
|
||||
|
||||
FixUpPcdDatabase (DxeFv);
|
||||
Status = UniversalLoadDxeCore (DxeFv, &DxeCoreEntryPoint);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@@ -84,6 +84,11 @@
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIMES_CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## SOMETIMES_CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy ## SOMETIMES_CONSUMES
|
||||
|
||||
Reference in New Issue
Block a user