From d1372720a83b83057a034a95ee1316078d05f51b Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Wed, 31 Jul 2024 20:46:04 -0400 Subject: ArmVirtPkg/MemoryInitPei: Remove Non-RT Types from Mem Type Info HOB Removes the following types from the memory type information HOBs produced in the MemoryInitPei PEIM: - `EfiBootServicesCode` - `EfiBootServicesData` - `EfiLoaderCode` - `EfiLoaderData` Our platform has a memory type information validation routine that currently expects those types to be excluded as they would not impact the UEFI memory map since they are not runtime memory types. This follows the guidance in the whitepaper "A Tour Beyond BIOS Memory Map and Practices in UEFI BIOS". https://github.com/tianocore-docs/Docs/raw/master/White_Papers/A_Tour_Beyond_BIOS_Memory_Map_And_Practices_in_UEFI_BIOS_V2.pdf "NOTE: We recommend a platform only define the ReservedMemory, ACPINvs, ACPIReclaim, RuntimeCode, RuntimeData in Memory Type Information table, because OSes only request these regions to be consistent. There is no need to add BootServicesCode, BootServicesData, LoaderCode, LoaderData in memory type information table, because these regions will not be reserved during S4 resume." Since these memory types are not tracked in memory type information any longer it also reduces the number of resets that may need to occur to update memory type buckets that are not needed. Signed-off-by: Michael Kubacki --- ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c | 15 +++------------ ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf | 4 ---- 2 files changed, 3 insertions(+), 16 deletions(-) (limited to 'ArmVirtPkg') diff --git a/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c b/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c index ef88a9df1d..f8a0ef93cb 100644 --- a/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c +++ b/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c @@ -33,7 +33,7 @@ BuildMemoryTypeInformationHob ( VOID ) { - EFI_MEMORY_TYPE_INFORMATION Info[10]; + EFI_MEMORY_TYPE_INFORMATION Info[6]; Info[0].Type = EfiACPIReclaimMemory; Info[0].NumberOfPages = FixedPcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory); @@ -45,18 +45,9 @@ BuildMemoryTypeInformationHob ( Info[3].NumberOfPages = FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServicesData); Info[4].Type = EfiRuntimeServicesCode; Info[4].NumberOfPages = FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode); - Info[5].Type = EfiBootServicesCode; - Info[5].NumberOfPages = FixedPcdGet32 (PcdMemoryTypeEfiBootServicesCode); - Info[6].Type = EfiBootServicesData; - Info[6].NumberOfPages = FixedPcdGet32 (PcdMemoryTypeEfiBootServicesData); - Info[7].Type = EfiLoaderCode; - Info[7].NumberOfPages = FixedPcdGet32 (PcdMemoryTypeEfiLoaderCode); - Info[8].Type = EfiLoaderData; - Info[8].NumberOfPages = FixedPcdGet32 (PcdMemoryTypeEfiLoaderData); - // Terminator for the list - Info[9].Type = EfiMaxMemoryType; - Info[9].NumberOfPages = 0; + Info[5].Type = EfiMaxMemoryType; + Info[5].NumberOfPages = 0; BuildGuidDataHob (&gEfiMemoryTypeInformationGuid, &Info, sizeof (Info)); } diff --git a/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf b/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf index 2039f71a0e..a35f8f4dc6 100644 --- a/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf +++ b/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf @@ -50,10 +50,6 @@ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData [Depex] TRUE -- cgit v1.2.3