Skip to content

Commit

Permalink
OvmfPkg/PlatformInitLib: reorder PlatformQemuUc32BaseInitialization
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
  • Loading branch information
kraxel authored and mergify[bot] committed Jan 17, 2023
1 parent c0a0b9b commit 015a001
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions OvmfPkg/Library/PlatformInitLib/MemDetect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
//
Expand Down

0 comments on commit 015a001

Please sign in to comment.