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: cda98df162 ("OvmfPkg/QemuFwCfgLib: remove mQemuFwCfgSupported + mQemuFwCfgDmaSupported")
Signed-off-by: Corvin Köhne <corvink@FreeBSD.org>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
This commit is contained in:
Corvin Köhne 2023-07-24 14:59:33 +02:00 committed by mergify[bot]
parent eaffa1d7ff
commit 48089f3a7c
2 changed files with 22 additions and 0 deletions

View File

@ -17,6 +17,7 @@
// //
// The Library classes this module consumes // The Library classes this module consumes
// //
#include <Library/BaseMemoryLib.h>
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/HobLib.h> #include <Library/HobLib.h>
@ -27,6 +28,7 @@
#include <Library/PciLib.h> #include <Library/PciLib.h>
#include <Library/PeimEntryPoint.h> #include <Library/PeimEntryPoint.h>
#include <Library/PeiServicesLib.h> #include <Library/PeiServicesLib.h>
#include <Library/PlatformInitLib.h>
#include <Library/ResourcePublicationLib.h> #include <Library/ResourcePublicationLib.h>
#include <Guid/MemoryTypeInformation.h> #include <Guid/MemoryTypeInformation.h>
#include <Ppi/MasterBootMode.h> #include <Ppi/MasterBootMode.h>
@ -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. Perform Platform PEI initialization.
@ -551,6 +571,7 @@ InitializePlatform (
) )
{ {
DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n")); DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));
BuildPlatformInfoHob ();
// //
// Initialize Local APIC Timer hardware and disable Local APIC Timer // Initialize Local APIC Timer hardware and disable Local APIC Timer

View File

@ -44,6 +44,7 @@
[Guids] [Guids]
gEfiMemoryTypeInformationGuid gEfiMemoryTypeInformationGuid
gUefiOvmfPkgPlatformInfoGuid
[LibraryClasses] [LibraryClasses]
BaseLib BaseLib