summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCeping Sun <cepingx.sun@intel.com>2025-01-20 01:33:22 -0500
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-03-20 02:37:31 +0000
commit63408b289565c719b2ae759dc815e147820a8d3e (patch)
treec0564b37314cc825db1d968bb550574e541a99c1
parentf66078a71324cc2878ff7a3ec71fb9fdcb218785 (diff)
downloadedk2-63408b289565c719b2ae759dc815e147820a8d3e.zip
edk2-63408b289565c719b2ae759dc815e147820a8d3e.tar.gz
edk2-63408b289565c719b2ae759dc815e147820a8d3e.tar.bz2
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>
-rw-r--r--OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c
index 42db1a6..2b9566d 100644
--- a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c
+++ b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c
@@ -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
//