]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/PlatformInitLib/MemDetect.c
OvmfPkg/PlatformInitLib: detect physical address space
[mirror_edk2.git] / OvmfPkg / Library / PlatformInitLib / MemDetect.c
index 143a01ceb01e073f2670f5f4dea5d4a90f7589e4..16ecbfadc30cdd35bb6575bf957c6ce21cc84b2f 100644 (file)
@@ -761,6 +761,19 @@ PlatformAddressWidthInitialization (
     FirstNonAddress = PlatformGetFirstNonAddress (PlatformInfoHob);\r
   }\r
 \r
+  PlatformAddressWidthFromCpuid (PlatformInfoHob, TRUE);\r
+  if (PlatformInfoHob->PhysMemAddressWidth != 0) {\r
+    // physical address width is known\r
+    PlatformInfoHob->FirstNonAddress = FirstNonAddress;\r
+    return;\r
+  }\r
+\r
+  //\r
+  // physical address width is NOT known\r
+  //   -> do some guess work, mostly based on installed memory\r
+  //   -> try be conservstibe to stay below the guaranteed minimum of\r
+  //      36 phys bits (aka 64 GB).\r
+  //\r
   PhysMemAddressWidth = (UINT8)HighBitSet64 (FirstNonAddress);\r
 \r
   //\r