summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony PERARD <anthony.perard@citrix.com>2022-12-20 00:36:20 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-12-21 08:53:58 +0000
commit0b633b14944903c32aa061befaf38bd8d994cf13 (patch)
tree6a759e4c660303cb3a1821d77f80c427a8b43505
parent451521ccbcaa45de27fbcd2565cb363fd05e3661 (diff)
downloadedk2-0b633b14944903c32aa061befaf38bd8d994cf13.tar.gz
edk2-0b633b14944903c32aa061befaf38bd8d994cf13.tar.bz2
edk2-0b633b14944903c32aa061befaf38bd8d994cf13.zip
OvmfPkg/OvmfXen: Build platform info HOB in XenPlatformPei
Copy the function BuildPlatformInfoHob() from OvmfPkg/PlatformPei. QemuFwCfgLib expect this HOB to be present, or fails to do anything. InternalQemuFwCfgIsAvailable() from QemuFwCfgPeiLib module will not check if the HOB is actually present for example and try to use a NULL pointer. Fixes: cda98df16228 ("OvmfPkg/QemuFwCfgLib: remove mQemuFwCfgSupported + mQemuFwCfgDmaSupported") Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
-rw-r--r--OvmfPkg/XenPlatformPei/Platform.c20
-rw-r--r--OvmfPkg/XenPlatformPei/Platform.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Platform.c
index 2d97a41ca7..6c1886c158 100644
--- a/OvmfPkg/XenPlatformPei/Platform.c
+++ b/OvmfPkg/XenPlatformPei/Platform.c
@@ -17,6 +17,7 @@
//
// The Library classes this module consumes
//
+#include <Library/BaseMemoryLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
@@ -409,6 +410,20 @@ DebugDumpCmos (
}
}
+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);
+}
+
/**
Perform Platform PEI initialization.
@@ -429,6 +444,11 @@ InitializeXenPlatform (
DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));
+ //
+ // Platform Info HOB used by QemuFw libraries
+ //
+ BuildPlatformInfoHob ();
+
DebugDumpCmos ();
if (!XenDetect ()) {
diff --git a/OvmfPkg/XenPlatformPei/Platform.h b/OvmfPkg/XenPlatformPei/Platform.h
index 039af50ffa..7b4de128e7 100644
--- a/OvmfPkg/XenPlatformPei/Platform.h
+++ b/OvmfPkg/XenPlatformPei/Platform.h
@@ -12,6 +12,7 @@
#define _PLATFORM_PEI_H_INCLUDED_
#include <IndustryStandard/E820.h>
+#include <Library/PlatformInitLib.h>
VOID
AddIoMemoryBaseSizeHob (