summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library
diff options
context:
space:
mode:
authorThomas Barrett <tbarrett@crusoeenergy.com>2024-01-12 18:31:43 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-01-15 15:57:42 +0000
commit6d204e8fbcfe4b38de0c5462ee68ebce6f426a2c (patch)
treebb0a5b1b16e436fb26155ea92e9a025c590a0998 /OvmfPkg/Library
parentbfad87ceec39eae9f836a5e2c9597948fc1a7395 (diff)
downloadedk2-6d204e8fbcfe4b38de0c5462ee68ebce6f426a2c.tar.gz
edk2-6d204e8fbcfe4b38de0c5462ee68ebce6f426a2c.tar.bz2
edk2-6d204e8fbcfe4b38de0c5462ee68ebce6f426a2c.zip
OvmfPkg: Update PlatformAddressWidthInitialization for CloudHv
In addition to initializing the PhysMemAddressWidth and FirstNonAddress fields in PlatformInfoHob, the PlatformAddressWidthInitialization function is responsible for initializing the PcdPciMmio64Base and PcdPciMmio64Size fields. Currently, for CloudHv guests, the PcdPciMmio64Base is placed immediately after either the 4G boundary or the last RAM region, whichever is greater. We do not change this behavior. Previously, when booting CloudHv guests with greater than 1TiB of high memory, the PlatformAddressWidthInitialization function incorrect calculates the amount of RAM using the overflowed 24-bit CMOS register. Now, we update the PlatformAddressWidthInitialization behavior on CloudHv to scan the E820 entries to detect the amount of RAM. This allows CloudHv guests to boot with greater than 1TiB of RAM Signed-off-by: Thomas Barrett <tbarrett@crusoeenergy.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'OvmfPkg/Library')
-rw-r--r--OvmfPkg/Library/PlatformInitLib/MemDetect.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index 76a9dc9211..f042517bb6 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -874,6 +874,18 @@ PlatformAddressWidthInitialization (
if (PlatformInfoHob->HostBridgeDevId == 0xffff /* microvm */) {
PlatformAddressWidthFromCpuid (PlatformInfoHob, FALSE);
return;
+ } else if (PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) {
+ PlatformInfoHob->FirstNonAddress = BASE_4GB;
+ Status = PlatformScanE820 (PlatformGetFirstNonAddressCB, PlatformInfoHob);
+ if (EFI_ERROR (Status)) {
+ PlatformInfoHob->FirstNonAddress = BASE_4GB + PlatformGetSystemMemorySizeAbove4gb ();
+ }
+
+ PlatformInfoHob->PcdPciMmio64Base = PlatformInfoHob->FirstNonAddress;
+ PlatformAddressWidthFromCpuid (PlatformInfoHob, FALSE);
+ PlatformInfoHob->PcdPciMmio64Size = PlatformInfoHob->FirstNonAddress - PlatformInfoHob->PcdPciMmio64Base;
+
+ return;
}
//