From b904377d0d54a784f9a9348d05088afc80de5c54 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Thu, 24 Oct 2024 19:08:03 -0400 Subject: EmbeddedPkg/PrePiHobLib: Remove Non-RT Types from Mem Type Info HOB Removes the following types from the memory type information HOB produced: - `EfiBootServicesCode` - `EfiBootServicesData` - `EfiLoaderCode` - `EfiLoaderData` 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 --- EmbeddedPkg/Library/PrePiHobLib/Hob.c | 15 +++------------ EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf | 4 ---- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/EmbeddedPkg/Library/PrePiHobLib/Hob.c b/EmbeddedPkg/Library/PrePiHobLib/Hob.c index 49b2fecb8a..9c450c0c87 100644 --- a/EmbeddedPkg/Library/PrePiHobLib/Hob.c +++ b/EmbeddedPkg/Library/PrePiHobLib/Hob.c @@ -845,7 +845,7 @@ BuildMemoryTypeInformationHob ( VOID ) { - EFI_MEMORY_TYPE_INFORMATION Info[10]; + EFI_MEMORY_TYPE_INFORMATION Info[6]; Info[0].Type = EfiACPIReclaimMemory; Info[0].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory); @@ -857,18 +857,9 @@ BuildMemoryTypeInformationHob ( Info[3].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiRuntimeServicesData); Info[4].Type = EfiRuntimeServicesCode; Info[4].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode); - Info[5].Type = EfiBootServicesCode; - Info[5].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiBootServicesCode); - Info[6].Type = EfiBootServicesData; - Info[6].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiBootServicesData); - Info[7].Type = EfiLoaderCode; - Info[7].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiLoaderCode); - Info[8].Type = EfiLoaderData; - Info[8].NumberOfPages = PcdGet32 (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/EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf b/EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf index 55de4511fc..1d0b2ddb42 100644 --- a/EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf +++ b/EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf @@ -47,10 +47,6 @@ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData [FeaturePcd] gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob -- cgit