summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2023-01-17 13:16:29 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-01-17 16:36:59 +0000
commit015a001b03db14f791476f817b8b125b195b6d10 (patch)
tree343387c67cc49d86f1dbc26ad713cf068f3382c5
parentc0a0b9bc3534b71ad90c022b0cab10910697de69 (diff)
downloadedk2-015a001b03db14f791476f817b8b125b195b6d10.tar.gz
edk2-015a001b03db14f791476f817b8b125b195b6d10.tar.bz2
edk2-015a001b03db14f791476f817b8b125b195b6d10.zip
OvmfPkg/PlatformInitLib: reorder PlatformQemuUc32BaseInitialization
First handle the cases which do not need know the value of PlatformInfoHob->LowMemory (microvm and cloudhv). Then call PlatformGetSystemMemorySizeBelow4gb() to get LowMemory. Finally handle the cases (q35 and pc) which need to look at LowMemory, Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
-rw-r--r--OvmfPkg/Library/PlatformInitLib/MemDetect.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index 6c30566db9..5aeeeff89f 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -55,8 +55,15 @@ PlatformQemuUc32BaseInitialization (
return;
}
+ if (PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) {
+ PlatformInfoHob->Uc32Size = CLOUDHV_MMIO_HOLE_SIZE;
+ PlatformInfoHob->Uc32Base = CLOUDHV_MMIO_HOLE_ADDRESS;
+ return;
+ }
+
+ PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob);
+
if (PlatformInfoHob->HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
- PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob);
ASSERT (PcdGet64 (PcdPciExpressBaseAddress) <= MAX_UINT32);
ASSERT (PcdGet64 (PcdPciExpressBaseAddress) >= PlatformInfoHob->LowMemory);
@@ -78,19 +85,12 @@ PlatformQemuUc32BaseInitialization (
return;
}
- if (PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) {
- PlatformInfoHob->Uc32Size = CLOUDHV_MMIO_HOLE_SIZE;
- PlatformInfoHob->Uc32Base = CLOUDHV_MMIO_HOLE_ADDRESS;
- return;
- }
-
ASSERT (PlatformInfoHob->HostBridgeDevId == INTEL_82441_DEVICE_ID);
//
// On i440fx, start with the [LowerMemorySize, 4GB) range. Make sure one
// variable MTRR suffices by truncating the size to a whole power of two,
// while keeping the end affixed to 4GB. This will round the base up.
//
- PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob);
PlatformInfoHob->Uc32Size = GetPowerOfTwo32 ((UINT32)(SIZE_4GB - PlatformInfoHob->LowMemory));
PlatformInfoHob->Uc32Base = (UINT32)(SIZE_4GB - PlatformInfoHob->Uc32Size);
//