OvmfPkg/PeilessStartupLib: Build PlatformInfoHob before InitializePlatform
Since the QEMU_FW_CFG_WORK_AREA is saved in EFI_HOB_PLATFORM_INFO and InitializePlatform would read by QemuFwCfg, TDVF should build the PlatformInfoHob before InitializePlatform. Cc: Erdem Aktas <erdemaktas@google.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Elena Reshetova <elena.reshetova@intel.com> Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
This commit is contained in:
parent
f66078a713
commit
63408b2895
|
@ -7,6 +7,7 @@
|
|||
**/
|
||||
|
||||
#include <PiPei.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
@ -116,6 +117,21 @@ InitializePlatform (
|
|||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_HOB_PLATFORM_INFO *
|
||||
BuildPlatformInfoHob (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_HOB_PLATFORM_INFO PlatformInfoHob;
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
|
||||
ZeroMem (&PlatformInfoHob, sizeof PlatformInfoHob);
|
||||
BuildGuidDataHob (&gUefiOvmfPkgPlatformInfoGuid, &PlatformInfoHob, sizeof (EFI_HOB_PLATFORM_INFO));
|
||||
GuidHob = GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid);
|
||||
return (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function brings up the Tdx guest from SEC phase to DXE phase.
|
||||
* PEI phase is skipped because most of the components in PEI phase
|
||||
|
@ -134,7 +150,7 @@ PeilessStartup (
|
|||
EFI_SEC_PEI_HAND_OFF *SecCoreData;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *BootFv;
|
||||
EFI_STATUS Status;
|
||||
EFI_HOB_PLATFORM_INFO PlatformInfoHob;
|
||||
EFI_HOB_PLATFORM_INFO *PlatformInfoHob;
|
||||
UINT32 DxeCodeBase;
|
||||
UINT32 DxeCodeSize;
|
||||
TD_RETURN_DATA TdReturnData;
|
||||
|
@ -145,8 +161,6 @@ PeilessStartup (
|
|||
VmmHobList = NULL;
|
||||
SecCoreData = (EFI_SEC_PEI_HAND_OFF *)Context;
|
||||
|
||||
ZeroMem (&PlatformInfoHob, sizeof (PlatformInfoHob));
|
||||
|
||||
if (TdIsEnabled ()) {
|
||||
VmmHobList = (VOID *)(UINTN)FixedPcdGet32 (PcdOvmfSecGhcbBase);
|
||||
Status = TdCall (TDCALL_TDINFO, 0, 0, 0, &TdReturnData);
|
||||
|
@ -184,17 +198,17 @@ PeilessStartup (
|
|||
}
|
||||
}
|
||||
|
||||
PlatformInfoHob = BuildPlatformInfoHob ();
|
||||
|
||||
//
|
||||
// Initialize the Platform
|
||||
//
|
||||
Status = InitializePlatform (&PlatformInfoHob);
|
||||
Status = InitializePlatform (PlatformInfoHob);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (FALSE);
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
||||
BuildGuidDataHob (&gUefiOvmfPkgPlatformInfoGuid, &PlatformInfoHob, sizeof (EFI_HOB_PLATFORM_INFO));
|
||||
|
||||
//
|
||||
// SecFV
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue