diff options
author | Sughosh Ganu <sughosh.ganu@linaro.org> | 2020-06-25 16:30:12 +0100 |
---|---|---|
committer | Jose Marinho <jose.marinho@arm.com> | 2021-05-10 18:27:20 +0100 |
commit | 02f1fd767af032ed112356dd8b5457e95c6ad57f (patch) | |
tree | c22e3a34b5afe9fe6801193639bd53af2984dbd0 | |
parent | 2548b0d4dfd289aa4f73824c57c8f99c84ae0225 (diff) |
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 <sughosh.ganu@linaro.org>
-rw-r--r-- | Platform/QemuVirt/Library/NorFlashLib/NorFlashLib.c | 47 | ||||
-rw-r--r-- | Platform/QemuVirt/Library/NorFlashLib/NorFlashLib.inf | 28 |
2 files changed, 75 insertions, 0 deletions
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 <PiDxe.h> +#include <Library/DebugLib.h> +#include <Library/IoLib.h> +#include <Library/NorFlashPlatformLib.h> +#include <SgiPlatform.h> + +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 |