OvmfPkg/RiscVVirt: Add PrePiHobListPointerLib library

Add the PrePiHobListPointerLib required for RISC-V Qemu Virt machine
since it follows PEIless design.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
Sunil V L 2023-01-28 20:56:15 +05:30 committed by mergify[bot]
parent d78df93863
commit 6720b8e46f
2 changed files with 88 additions and 0 deletions

View File

@ -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;
}

View File

@ -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