summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorvin Köhne <corvink@freebsd.org>2023-07-24 14:59:33 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-08-18 12:24:35 +0000
commit48089f3a7cdf308651234f5bf8d8a301f4b8acf9 (patch)
treef365d97f4c344e41c977850f98a3f1baa97544b9
parenteaffa1d7ff915d5af484e5e230a4dde41e4b9a00 (diff)
downloadedk2-48089f3a7cdf308651234f5bf8d8a301f4b8acf9.zip
edk2-48089f3a7cdf308651234f5bf8d8a301f4b8acf9.tar.gz
edk2-48089f3a7cdf308651234f5bf8d8a301f4b8acf9.tar.bz2
OvmfPkg/Bhyve: build platform info HOB
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: cda98df16228970dcf9a4ce2af5368219711b4b0 ("OvmfPkg/QemuFwCfgLib: remove mQemuFwCfgSupported + mQemuFwCfgDmaSupported") Signed-off-by: Corvin Köhne <corvink@FreeBSD.org> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
-rw-r--r--OvmfPkg/Bhyve/PlatformPei/Platform.c21
-rw-r--r--OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf1
2 files changed, 22 insertions, 0 deletions
diff --git a/OvmfPkg/Bhyve/PlatformPei/Platform.c b/OvmfPkg/Bhyve/PlatformPei/Platform.c
index 5bfe435..f6d9a90 100644
--- a/OvmfPkg/Bhyve/PlatformPei/Platform.c
+++ b/OvmfPkg/Bhyve/PlatformPei/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>
@@ -27,6 +28,7 @@
#include <Library/PciLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/PeiServicesLib.h>
+#include <Library/PlatformInitLib.h>
#include <Library/ResourcePublicationLib.h>
#include <Guid/MemoryTypeInformation.h>
#include <Ppi/MasterBootMode.h>
@@ -535,6 +537,24 @@ MaxCpuCountInitialization (
}
/**
+ * @brief Builds PlatformInfo Hob
+ */
+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);
+}
+
+/**
Perform Platform PEI initialization.
@param FileHandle Handle of the file being invoked.
@@ -551,6 +571,7 @@ InitializePlatform (
)
{
DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));
+ BuildPlatformInfoHob ();
//
// Initialize Local APIC Timer hardware and disable Local APIC Timer
diff --git a/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf b/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
index 739d630..07570d4 100644
--- a/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
@@ -44,6 +44,7 @@
[Guids]
gEfiMemoryTypeInformationGuid
+ gUefiOvmfPkgPlatformInfoGuid
[LibraryClasses]
BaseLib