The SPI NOR flash drivers which base on ArmPlatformPkg's NorFlashDxe usually make use of static declarations of the flash instances with their type and parameters. As a result it implies hardcoding the exact way of flash handling, not to mention the code does not look very nice. Much better solution would be obtaining the flash ID and hence its description in runtime. JEDEC compliant SPI NOR devices allow to obtain their IDs with READ_ID command (0x9f), which should return the vendor ID byte, followed by 2 to 4 following device ID bytes. Use this capability for implementing a NorFlashInfoLib that gives an access to the NOR flash description data, such as name, page size, sector (block) size and others, of more than 50 different models. The new library user should pass an output array from issuing READ_ID command to the NorFlashGetInfo () routine - if the match is found, an allocated (optionally for RT) pool with the flash description copy will be returned. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas <mw@semihalf.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
35 lines
1.0 KiB
INI
35 lines
1.0 KiB
INI
/** @file
|
|
*
|
|
* Copyright (c) 2017 Marvell International Ltd.
|
|
*
|
|
* This program and the accompanying materials
|
|
* are licensed and made available under the terms and conditions of the BSD License
|
|
* which accompanies this distribution. The full text of the license may be found at
|
|
* http://opensource.org/licenses/bsd-license.php
|
|
*
|
|
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
*
|
|
**/
|
|
|
|
[Defines]
|
|
INF_VERSION = 0x00010019
|
|
BASE_NAME = NorFlashInfoLib
|
|
FILE_GUID = 6b639c7e-9b53-4e9f-89a3-2e711729709c
|
|
MODULE_TYPE = DXE_DRIVER
|
|
VERSION_STRING = 1.0
|
|
LIBRARY_CLASS = NorFlashInfoLib|DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION
|
|
|
|
[Sources]
|
|
NorFlashInfoLib.c
|
|
|
|
[Packages]
|
|
EmbeddedPkg/EmbeddedPkg.dec
|
|
MdePkg/MdePkg.dec
|
|
|
|
[LibraryClasses]
|
|
BaseLib
|
|
DebugLib
|
|
DxeServicesLib
|
|
MemoryAllocationLib
|