From 02f1fd767af032ed112356dd8b5457e95c6ad57f Mon Sep 17 00:00:00 2001 From: Sughosh Ganu Date: Thu, 25 Jun 2020 16:30:12 +0100 Subject: NorFlashPlatformLib: Add platform specific nor flash library Add a platform specific library for passing information on the nor flash device on the platform. This includes the number of devices, their size and base address. Signed-off-by: Sughosh Ganu --- .../QemuVirt/Library/NorFlashLib/NorFlashLib.c | 47 ++++++++++++++++++++++ .../QemuVirt/Library/NorFlashLib/NorFlashLib.inf | 28 +++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 Platform/QemuVirt/Library/NorFlashLib/NorFlashLib.c create mode 100644 Platform/QemuVirt/Library/NorFlashLib/NorFlashLib.inf diff --git a/Platform/QemuVirt/Library/NorFlashLib/NorFlashLib.c b/Platform/QemuVirt/Library/NorFlashLib/NorFlashLib.c new file mode 100644 index 00000000..a04b771d --- /dev/null +++ b/Platform/QemuVirt/Library/NorFlashLib/NorFlashLib.c @@ -0,0 +1,47 @@ +/** @file + + Copyright (c) 2018, ARM Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + + **/ + +#include +#include +#include +#include +#include + +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { + { +// 0x403c5000, + // 0x403c5000, + 0x40419000, + 0x40419000, + SIZE_256KB * 40, + SIZE_256KB, + }, +}; + +EFI_STATUS +NorFlashPlatformInitialization ( + VOID + ) +{ + return EFI_SUCCESS; +} + +EFI_STATUS +NorFlashPlatformGetDevices ( + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices, + OUT UINT32 *Count + ) +{ + if ((NorFlashDevices == NULL) || (Count == NULL)) { + return EFI_INVALID_PARAMETER; + } + + *NorFlashDevices = mNorFlashDevices; + *Count = ARRAY_SIZE (mNorFlashDevices); + return EFI_SUCCESS; +} diff --git a/Platform/QemuVirt/Library/NorFlashLib/NorFlashLib.inf b/Platform/QemuVirt/Library/NorFlashLib/NorFlashLib.inf new file mode 100644 index 00000000..057870ee --- /dev/null +++ b/Platform/QemuVirt/Library/NorFlashLib/NorFlashLib.inf @@ -0,0 +1,28 @@ +#/** @file +# +# Copyright (c) 2018, ARM Ltd. All rights reserved. + +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = NorFlashQemuLib + FILE_GUID = 3f021755-6d74-4065-9ee4-98225267b36e + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = NorFlashPlatformLib + +[Sources.common] + NorFlashLib.c + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Platform/ARM/SgiPkg/SgiPlatform.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib -- cgit v1.2.3