]> git.proxmox.com Git - mirror_edk2.git/commit
EmbeddedPkg: Implement NorFlashInfoLib
authorMarcin Wojtas <mw@semihalf.com>
Fri, 3 Nov 2017 17:55:17 +0000 (18:55 +0100)
committerLeif Lindholm <leif.lindholm@linaro.org>
Tue, 7 Nov 2017 15:26:41 +0000 (15:26 +0000)
commit7046610163d3dd0f6b410ae0b3a564917db4ed0a
tree8b16ed490aee68012fe13d41708348dabbee82f8
parent62ba0febf517138a01c7a5f6d221ce6a2e4c28b6
EmbeddedPkg: Implement NorFlashInfoLib

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>
EmbeddedPkg/EmbeddedPkg.dec
EmbeddedPkg/Include/Library/NorFlashInfoLib.h [new file with mode: 0644]
EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.c [new file with mode: 0644]
EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf [new file with mode: 0644]