OvmfPkg/RiscVVirt: Add VirtNorFlashPlatformLib library

Qemu NOR flash driver needs this library. Add this
library for RISC-V leveraged from SbsaQemu.

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:59:36 +05:30 committed by mergify[bot]
parent c126e3588d
commit 6d5ae344cd
2 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,40 @@
/** @file
Copyright (c) 2019, Linaro Ltd. All rights reserved
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Base.h>
#include <PiDxe.h>
#include <Library/VirtNorFlashPlatformLib.h>
#define QEMU_NOR_BLOCK_SIZE SIZE_256KB
EFI_STATUS
VirtNorFlashPlatformInitialization (
VOID
)
{
return EFI_SUCCESS;
}
VIRT_NOR_FLASH_DESCRIPTION mNorFlashDevice =
{
FixedPcdGet32 (PcdOvmfFdBaseAddress),
FixedPcdGet64 (PcdFlashNvStorageVariableBase),
FixedPcdGet32 (PcdOvmfFirmwareFdSize),
QEMU_NOR_BLOCK_SIZE
};
EFI_STATUS
VirtNorFlashPlatformGetDevices (
OUT VIRT_NOR_FLASH_DESCRIPTION **NorFlashDescriptions,
OUT UINT32 *Count
)
{
*NorFlashDescriptions = &mNorFlashDevice;
*Count = 1;
return EFI_SUCCESS;
}

View File

@ -0,0 +1,30 @@
#/** @file
#
# Component description file for VirtNorFlashStaticLib module
#
# Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = VirtNorFlashStaticLib
FILE_GUID = 064742F1-E531-4D7D-A154-22315889CC23
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = VirtNorFlashPlatformLib
[Sources.common]
VirtNorFlashStaticLib.c
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
OvmfPkg/OvmfPkg.dec
[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase