MdeModulePkg: DxeCore: Update Memory Statistics from PEI

If memory bins are enabled for PEI, PEI will produce
Memory Allocation HOBs marked with gEfiMemoryTypeInformationGuid.
If these exist, DXE core will now process the stats from them
to have accurate numbers.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This commit is contained in:
Oliver Smith-Denny 2026-01-29 09:51:48 -08:00 committed by mergify[bot]
parent 2e7aa4810b
commit cf1a2a541e

View file

@ -2785,6 +2785,21 @@ CoreInitializeGcdServices (
RShiftU64 (MemoryHob->AllocDescriptor.MemoryLength, EFI_PAGE_SHIFT),
Descriptor.Capabilities & (~EFI_MEMORY_RUNTIME)
);
// if this Memory Allocation HOB came from PEI, update the memory bin statistics
if (CompareGuid (&MemoryHob->AllocDescriptor.Name, &gEfiMemoryTypeInformationGuid)) {
UpdateMemoryStatistics (
EfiConventionalMemory,
MemoryHob->AllocDescriptor.MemoryType,
MemoryHob->AllocDescriptor.MemoryBaseAddress,
EFI_SIZE_TO_PAGES ((UINT32)MemoryHob->AllocDescriptor.MemoryLength),
&mMemoryTypeInformationInitialized,
mMemoryTypeStatistics,
gMemoryTypeInformation,
mDefaultBaseAddress,
mDefaultMaximumAddress
);
}
}
}
}