]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/OvmfXen: Build platform info HOB in XenPlatformPei
authorAnthony PERARD <anthony.perard@citrix.com>
Mon, 19 Dec 2022 16:36:20 +0000 (00:36 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 21 Dec 2022 08:53:58 +0000 (08:53 +0000)
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>
OvmfPkg/XenPlatformPei/Platform.c
OvmfPkg/XenPlatformPei/Platform.h

index 2d97a41ca78e5d7be4b18f82f105febb4037cba4..6c1886c158b5f4516efe57f2acc09aa0da874df7 100644 (file)
@@ -17,6 +17,7 @@
 //\r
 // The Library classes this module consumes\r
 //\r
+#include <Library/BaseMemoryLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/HobLib.h>\r
@@ -409,6 +410,20 @@ DebugDumpCmos (
   }\r
 }\r
 \r
+EFI_HOB_PLATFORM_INFO *\r
+BuildPlatformInfoHob (\r
+  VOID\r
+  )\r
+{\r
+  EFI_HOB_PLATFORM_INFO  PlatformInfoHob;\r
+  EFI_HOB_GUID_TYPE      *GuidHob;\r
+\r
+  ZeroMem (&PlatformInfoHob, sizeof PlatformInfoHob);\r
+  BuildGuidDataHob (&gUefiOvmfPkgPlatformInfoGuid, &PlatformInfoHob, sizeof (EFI_HOB_PLATFORM_INFO));\r
+  GuidHob = GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid);\r
+  return (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob);\r
+}\r
+\r
 /**\r
   Perform Platform PEI initialization.\r
 \r
@@ -429,6 +444,11 @@ InitializeXenPlatform (
 \r
   DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));\r
 \r
+  //\r
+  // Platform Info HOB used by QemuFw libraries\r
+  //\r
+  BuildPlatformInfoHob ();\r
+\r
   DebugDumpCmos ();\r
 \r
   if (!XenDetect ()) {\r
index 039af50ffa32ae2ded6908d652d63d35c8764952..7b4de128e7139438d048ff231a7afe727c67ed07 100644 (file)
@@ -12,6 +12,7 @@
 #define _PLATFORM_PEI_H_INCLUDED_\r
 \r
 #include <IndustryStandard/E820.h>\r
+#include <Library/PlatformInitLib.h>\r
 \r
 VOID\r
 AddIoMemoryBaseSizeHob (\r