[edk2-devel] [PATCH v1 1/1] OvmfPkg/Bhyve: build platform info HOB

Corvin Köhne corvink at FreeBSD.org
Mon Aug 7 11:31:38 UTC 2023


On Mon, 2023-07-24 at 14:59 +0200, Corvin Köhne wrote:
> 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 at FreeBSD.org>
> Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
> Cc: Jiewen Yao <jiewen.yao at intel.com>
> Cc: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Gerd Hoffmann <kraxel at redhat.com>
> Cc: Rebecca Cran <rebecca at bsdio.com>
> Cc: Peter Grehan <grehan at freebsd.org>
> ---
>  OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf |  1 +
>  OvmfPkg/Bhyve/PlatformPei/Platform.c      | 20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
> b/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
> index 739d63098b1e..07570d4e30ca 100644
> --- a/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
> +++ b/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
> @@ -44,6 +44,7 @@ [Packages]
>  
>  [Guids]
>    gEfiMemoryTypeInformationGuid
> +  gUefiOvmfPkgPlatformInfoGuid
>  
>  [LibraryClasses]
>    BaseLib
> diff --git a/OvmfPkg/Bhyve/PlatformPei/Platform.c
> b/OvmfPkg/Bhyve/PlatformPei/Platform.c
> index 5bfe435327c1..bdfc1614d284 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>
> @@ -534,6 +536,23 @@ MaxCpuCountInitialization (
>      ));
>  }
>  
> +/**
> + * @brief Builds PlatformInfo Hob
> + */
> +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 +570,7 @@ InitializePlatform (
>    )
>  {
>    DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));
> +  BuildPlatformInfoHob();
>  
>    //
>    // Initialize Local APIC Timer hardware and disable Local APIC
> Timer

Any comments?

CI: https://github.com/tianocore/edk2/pull/4676


-- 
Kind regards,
Corvin


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107616): https://edk2.groups.io/g/devel/message/107616
Mute This Topic: https://groups.io/mt/100597527/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20230807/ef87b65e/attachment.sig>


More information about the edk2-devel-archive mailing list