ArmVirtPkg/QemuVirtMemInfoLib: use HOB not PCD to record the memory size
Due to the way we inherited the formerly fixed PCDs to describe the system memory base and size from ArmPlatformPkg, we ended up with a MemoryInit PEIM that relies on dynamic PCDs to communicate the size of system memory between the constructor of one of its library dependencies and the core module. This is unnecessary, and forces us to incorporate the PCD PEIM as well, for no good reason. So instead, let's use a HOB. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
committed by
mergify[bot]
parent
fead469a3b
commit
7136d5491e
@@ -52,10 +52,19 @@ MemoryPeim (
|
||||
{
|
||||
EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;
|
||||
UINT64 SystemMemoryTop;
|
||||
UINT64 SystemMemorySize;
|
||||
VOID *Hob;
|
||||
|
||||
// Ensure PcdSystemMemorySize has been set
|
||||
ASSERT (PcdGet64 (PcdSystemMemorySize) != 0);
|
||||
|
||||
SystemMemorySize = PcdGet64 (PcdSystemMemorySize);
|
||||
|
||||
Hob = GetFirstGuidHob (&gArmVirtSystemMemorySizeGuid);
|
||||
if (Hob != NULL) {
|
||||
SystemMemorySize = *(UINT64 *)GET_GUID_HOB_DATA (Hob);
|
||||
}
|
||||
|
||||
//
|
||||
// Now, the permanent memory has been installed, we can call AllocatePages()
|
||||
//
|
||||
@@ -66,8 +75,7 @@ MemoryPeim (
|
||||
EFI_RESOURCE_ATTRIBUTE_TESTED
|
||||
);
|
||||
|
||||
SystemMemoryTop = PcdGet64 (PcdSystemMemoryBase) +
|
||||
PcdGet64 (PcdSystemMemorySize);
|
||||
SystemMemoryTop = PcdGet64 (PcdSystemMemoryBase) + SystemMemorySize;
|
||||
|
||||
if (SystemMemoryTop - 1 > MAX_ALLOC_ADDRESS) {
|
||||
BuildResourceDescriptorHob (
|
||||
@@ -87,7 +95,7 @@ MemoryPeim (
|
||||
EFI_RESOURCE_SYSTEM_MEMORY,
|
||||
ResourceAttributes,
|
||||
PcdGet64 (PcdSystemMemoryBase),
|
||||
PcdGet64 (PcdSystemMemorySize)
|
||||
SystemMemorySize
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,7 @@
|
||||
CacheMaintenanceLib
|
||||
|
||||
[Guids]
|
||||
gArmVirtSystemMemorySizeGuid
|
||||
gEfiMemoryTypeInformationGuid
|
||||
|
||||
[FeaturePcd]
|
||||
|
Reference in New Issue
Block a user