Skip to content

Commit b904377

Browse files
makubackimergify[bot]
authored andcommitted
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 <michael.kubacki@microsoft.com>
1 parent d137272 commit b904377

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

EmbeddedPkg/Library/PrePiHobLib/Hob.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ BuildMemoryTypeInformationHob (
845845
VOID
846846
)
847847
{
848-
EFI_MEMORY_TYPE_INFORMATION Info[10];
848+
EFI_MEMORY_TYPE_INFORMATION Info[6];
849849

850850
Info[0].Type = EfiACPIReclaimMemory;
851851
Info[0].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory);
@@ -857,18 +857,9 @@ BuildMemoryTypeInformationHob (
857857
Info[3].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiRuntimeServicesData);
858858
Info[4].Type = EfiRuntimeServicesCode;
859859
Info[4].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode);
860-
Info[5].Type = EfiBootServicesCode;
861-
Info[5].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiBootServicesCode);
862-
Info[6].Type = EfiBootServicesData;
863-
Info[6].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiBootServicesData);
864-
Info[7].Type = EfiLoaderCode;
865-
Info[7].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiLoaderCode);
866-
Info[8].Type = EfiLoaderData;
867-
Info[8].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiLoaderData);
868-
869860
// Terminator for the list
870-
Info[9].Type = EfiMaxMemoryType;
871-
Info[9].NumberOfPages = 0;
861+
Info[5].Type = EfiMaxMemoryType;
862+
Info[5].NumberOfPages = 0;
872863

873864
BuildGuidDataHob (&gEfiMemoryTypeInformationGuid, &Info, sizeof (Info));
874865
}

EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@
4747
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
4848
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
4949
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
50-
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode
51-
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData
52-
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode
53-
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData
5450

5551
[FeaturePcd]
5652
gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob

0 commit comments

Comments
 (0)