From 48089f3a7cdf308651234f5bf8d8a301f4b8acf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corvin=20K=C3=B6hne?= Date: Mon, 24 Jul 2023 14:59:33 +0200 Subject: [PATCH] OvmfPkg/Bhyve: build platform info HOB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Rebecca Cran --- OvmfPkg/Bhyve/PlatformPei/Platform.c | 21 +++++++++++++++++++++ OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf | 1 + 2 files changed, 22 insertions(+) diff --git a/OvmfPkg/Bhyve/PlatformPei/Platform.c b/OvmfPkg/Bhyve/PlatformPei/Platform.c index 5bfe435327..f6d9a9038e 100644 --- a/OvmfPkg/Bhyve/PlatformPei/Platform.c +++ b/OvmfPkg/Bhyve/PlatformPei/Platform.c @@ -17,6 +17,7 @@ // // The Library classes this module consumes // +#include #include #include #include @@ -27,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -534,6 +536,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. @@ -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 739d63098b..07570d4e30 100644 --- a/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf @@ -44,6 +44,7 @@ [Guids] gEfiMemoryTypeInformationGuid + gUefiOvmfPkgPlatformInfoGuid [LibraryClasses] BaseLib