OvmfPkg/PlatformInitLib: Differentiate TDX case for Cloud Hypervisor

Rely on the CcProbe() function to identify when running on TDX. This
allows the firmware to follow a different codepath for Cloud Hypervisor,
which means it doesn't rely on PVH to find out about memory below 4GiB.
instead it falls back onto the CMOS to retrieve that information.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
Sebastien Boeuf 2022-12-15 23:10:02 +08:00 committed by mergify[bot]
parent 0adc35fccd
commit e03b0d0672
1 changed files with 4 additions and 1 deletions

View File

@ -26,6 +26,7 @@ Module Name:
//
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/CcProbeLib.h>
#include <Library/DebugLib.h>
#include <Library/HardwareInfoLib.h>
#include <Library/HobLib.h>
@ -312,7 +313,9 @@ PlatformGetSystemMemorySizeBelow4gb (
UINT8 Cmos0x34;
UINT8 Cmos0x35;
if (PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) {
if ((PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) &&
(CcProbe () != CcGuestTypeIntelTdx))
{
// Get the information from PVH memmap
return (UINT32)GetHighestSystemMemoryAddressFromPvhMemmap (TRUE);
}