diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2022-09-25 16:53:27 +0200 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-10-26 17:28:39 +0000 |
commit | 7136d5491e225c57f1d73e4a1b7ac27ed656ff72 (patch) | |
tree | 16f18103d73b26d7dfc6959afe8a83e23ae5b80a /ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib | |
parent | fead469a3b3174fbf9ec2df97f54f3ebcc786ca5 (diff) | |
download | edk2-7136d5491e225c57f1d73e4a1b7ac27ed656ff72.tar.gz |
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>
Diffstat (limited to 'ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib')
-rw-r--r-- | ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c | 14 | ||||
-rw-r--r-- | ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c index 98d90ad420..72e5c65af7 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c @@ -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
);
}
diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf index 21327f79f4..48d9c66b22 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf @@ -34,6 +34,7 @@ CacheMaintenanceLib
[Guids]
+ gArmVirtSystemMemorySizeGuid
gEfiMemoryTypeInformationGuid
[FeaturePcd]
|