]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/PlatformInitLib: reorder PlatformQemuUc32BaseInitialization
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 17 Jan 2023 12:16:29 +0000 (13:16 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 17 Jan 2023 16:36:59 +0000 (16:36 +0000)
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>
OvmfPkg/Library/PlatformInitLib/MemDetect.c

index 6c30566db937188e359dec8bcb1c16abe5222538..5aeeeff89f574be785a2bfed70d774c6e4ce23f8 100644 (file)
@@ -55,8 +55,15 @@ PlatformQemuUc32BaseInitialization (
     return;\r
   }\r
 \r
+  if (PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) {\r
+    PlatformInfoHob->Uc32Size = CLOUDHV_MMIO_HOLE_SIZE;\r
+    PlatformInfoHob->Uc32Base = CLOUDHV_MMIO_HOLE_ADDRESS;\r
+    return;\r
+  }\r
+\r
+  PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob);\r
+\r
   if (PlatformInfoHob->HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {\r
-    PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob);\r
     ASSERT (PcdGet64 (PcdPciExpressBaseAddress) <= MAX_UINT32);\r
     ASSERT (PcdGet64 (PcdPciExpressBaseAddress) >= PlatformInfoHob->LowMemory);\r
 \r
@@ -78,19 +85,12 @@ PlatformQemuUc32BaseInitialization (
     return;\r
   }\r
 \r
-  if (PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) {\r
-    PlatformInfoHob->Uc32Size = CLOUDHV_MMIO_HOLE_SIZE;\r
-    PlatformInfoHob->Uc32Base = CLOUDHV_MMIO_HOLE_ADDRESS;\r
-    return;\r
-  }\r
-\r
   ASSERT (PlatformInfoHob->HostBridgeDevId == INTEL_82441_DEVICE_ID);\r
   //\r
   // On i440fx, start with the [LowerMemorySize, 4GB) range. Make sure one\r
   // variable MTRR suffices by truncating the size to a whole power of two,\r
   // while keeping the end affixed to 4GB. This will round the base up.\r
   //\r
-  PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob);\r
   PlatformInfoHob->Uc32Size = GetPowerOfTwo32 ((UINT32)(SIZE_4GB - PlatformInfoHob->LowMemory));\r
   PlatformInfoHob->Uc32Base = (UINT32)(SIZE_4GB - PlatformInfoHob->Uc32Size);\r
   //\r