OvmfPkg/VirtNorFlashDxe: clone ArmPlatformPkg's NOR flash driver

QEMU's mach-virt is loosely based on ARM Versatile Express, and inherits
its NOR flash driver, which is now being used on other QEMU emulated
architectures as well.

In order to permit ourselves the freedom to optimize this driver for
use under KVM emulation, let's clone it into OvmfPkg, so we have a
version we can hack without the risk of regressing bare metal platforms.

The cloned version is mostly identical to the original, but it depends
on the newly added VirtNorFlashPlatformLib library class instead of the
original one from ArmPlatformPkg. Beyond that, only cosmetic changes
related to #include order etc were made.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
This commit is contained in:
Ard Biesheuvel
2022-10-24 16:41:43 +02:00
committed by mergify[bot]
parent 16bf588b60
commit c1ff81f799
6 changed files with 2891 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
#/** @file
#
# Component description file for NorFlashDxe module
#
# Copyright (c) 2011 - 2021, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#**/
[Defines]
INF_VERSION = 1.29
BASE_NAME = VirtNorFlashDxe
FILE_GUID = e452cabd-5fe1-4d97-8161-e80ed6a409a8
MODULE_TYPE = DXE_RUNTIME_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = NorFlashInitialise
[Sources.common]
VirtNorFlash.c
VirtNorFlash.h
VirtNorFlashBlockIoDxe.c
VirtNorFlashDxe.c
VirtNorFlashFvb.c
[Packages]
ArmPlatformPkg/ArmPlatformPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
OvmfPkg/OvmfPkg.dec
[LibraryClasses]
BaseLib
DebugLib
DxeServicesTableLib
HobLib
IoLib
UefiBootServicesTableLib
UefiDriverEntryPoint
UefiLib
UefiRuntimeLib
VirtNorFlashPlatformLib
[Guids]
gEdkiiNvVarStoreFormattedGuid ## PRODUCES ## PROTOCOL
gEfiAuthenticatedVariableGuid
gEfiEventVirtualAddressChangeGuid
gEfiSystemNvDataFvGuid
gEfiVariableGuid
[Protocols]
gEfiBlockIoProtocolGuid
gEfiDevicePathProtocolGuid
gEfiDiskIoProtocolGuid
gEfiFirmwareVolumeBlockProtocolGuid
[Pcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked
[Depex]
gEfiCpuArchProtocolGuid