Add the PrePiHobListPointerLib required for RISC-V Qemu Virt machine since it follows PEIless design.
Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org> Cc: Jiewen Yao <jiewen....@intel.com> Cc: Jordan Justen <jordan.l.jus...@intel.com> Cc: Gerd Hoffmann <kra...@redhat.com> Signed-off-by: Sunil V L <suni...@ventanamicro.com> Acked-by: Abner Chang <abner.ch...@amd.com> --- OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf | 23 +++++++ OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c | 65 ++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf b/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf new file mode 100644 index 000000000000..c539682e8d0b --- /dev/null +++ b/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf @@ -0,0 +1,23 @@ +#/** @file +# +# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = PrePiHobListPointerLib + FILE_GUID = E3FAFC60-758C-471B-A333-FE704A4C11B4 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PrePiHobListPointerLib + +[Sources.RISCV64] + PrePiHobListPointer.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + UefiCpuPkg/UefiCpuPkg.dec diff --git a/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c b/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c new file mode 100644 index 000000000000..a58b7aae6bee --- /dev/null +++ b/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c @@ -0,0 +1,65 @@ +/** @file +* +* Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include <PiPei.h> +#include <Library/PrePiHobListPointerLib.h> +#include <Library/DebugLib.h> +#include <Library/HobLib.h> +#include <Library/BaseRiscVSbiLib.h> + +/** + Returns the pointer to the HOB list. + + This function returns the pointer to first HOB in the list. + + @return The pointer to the HOB list. + +**/ +VOID * +EFIAPI +PrePeiGetHobList ( + VOID + ) +{ + EFI_RISCV_FIRMWARE_CONTEXT *FirmwareContext; + + FirmwareContext = NULL; + GetFirmwareContextPointer (&FirmwareContext); + + if (FirmwareContext == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __FUNCTION__)); + return NULL; + } + + return (VOID *)FirmwareContext->PrePiHobList; +} + +/** + Updates the pointer to the HOB list. + + @param HobList Hob list pointer to store + +**/ +EFI_STATUS +EFIAPI +PrePeiSetHobList ( + IN VOID *HobList + ) +{ + EFI_RISCV_FIRMWARE_CONTEXT *FirmwareContext; + + FirmwareContext = NULL; + GetFirmwareContextPointer (&FirmwareContext); + + if (FirmwareContext == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __FUNCTION__)); + return EFI_NOT_READY; + } + + FirmwareContext->PrePiHobList = HobList; + return EFI_SUCCESS; +} -- 2.38.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#99239): https://edk2.groups.io/g/devel/message/99239 Mute This Topic: https://groups.io/mt/96593515/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-