aboutsummaryrefslogtreecommitdiffstats
path: root/sfdp.c
Commit message (Collapse)AuthorAgeFilesLines
* SFDP: make mandatory table length check work with newer SFDP revisionsMichael Niewöhner2022-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The JEDEC SFDP specification JESD216A (1.5) adds five new DWORDs to the Basic Flash Parameter Table. Later versions of the spec add even more fields. This increases the table being read from 36 bytes to currently 64 bytes and makes flashrom bail out for any SFDP version >= 1.5 due to a static table length check. This was discovered on a GigaDevice GD25B127DSIGR from 2021 with SFDP revision 1.6, while another flash of the same model from 2020 with SFDP revision 1.0 was detected fine by flashrom. GD25B127DSIGR - 2020 version: Probing for Unknown SFDP-capable chip, 0 kB: SFDP revision = 1.0 SFDP number of parameter headers is 2 (NPH = 1). SFDP parameter table header 0/1: ID 0x00, version 1.0 Length 36 B, Parameter Table Pointer 0x000030 GD25B127DSIGR - 2021 version: Probing for Unknown SFDP-capable chip, 0 kB: SFDP revision = 1.6 SFDP number of parameter headers is 2 (NPH = 1). SFDP parameter table header 0/1: ID 0x00, version 1.6 Length 64 B, Parameter Table Pointer 0x000030 ... Length of the mandatory JEDEC SFDP parameter table is wrong (64 B), skipping it. The specification says that changes of the minor SFDP revision will maintain compatibility. Thus, simply check for the minimal required table length, which is 16 bytes for legacy Intel pre-SFDP and 36 bytes for SFDP. Change-Id: Id84cde4ebc805d68e2984e8041fbc48d7ceebe34 Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/60055 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* sfdp: drop redundant check of the mandatory table sizeMichael Niewöhner2022-01-261-4/+0
| | | | | | | | Change-Id: I464856612a6d21c682f1d9ad5110fa11a0a276c2 Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/61379 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* treewide: Drop most cases of `sizeof(struct ...)`Angel Pons2021-06-091-1/+1
| | | | | | | | | | | | | | | | Spelling out the struct type name hurts readability and introduces opportunities for bugs to happen when the pointer variable type is changed but the corresponding sizeof is (are) not. TEST=`make CONFIG_EVERYTHING=yes CONFIG_JLINK_SPI=no VERSION=none -j` with and without this patch; the flashrom executable does not change. Change-Id: Icc0b60ca6ef9f5ece6ed2a0e03600bb6ccd7dcc6 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55266 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* Remove trailing whitespaceElyes HAOUAS2019-03-041-1/+1
| | | | | | | | | Change-Id: I1ff9418bcf150558ce7c97fafa3a68e5fa59f11e Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/31227 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* Remove address from GPLv2 headersElyes HAOUAS2018-04-241-4/+0
| | | | | | | | Change-Id: I7bfc339673cbf5ee2d2ff7564c4db04ca088d0a4 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/25381 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* Make struct flashchip a field in struct flashctx instead of a complete copyCarl-Daniel Hailfinger2012-08-251-16/+16
| | | | | | | | | | | | All the driver conversion work and cleanup has been done by Stefan. flashrom.c and cli_classic.c are a joint work of Stefan and Carl-Daniel. Corresponding to flashrom svn r1579. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* Tag all EWSR chips correctlySteven Zakulec2012-05-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All SPI chips without a WRSR feature bit set were evaluated except the Sanyo LF25FW203A for which no datasheet is available. The following list includes all SPI-capable chips that still have no WRSR feature bit set: - AT26DF041 - AT45CS1282 - AT45DB011D - AT45DB021D - AT45DB041D - AT45DB081D - AT45DB161D - AT45DB321C - AT45DB321D - AT45DB642D All of them have no write function set and can be therefore ignored for now. Apart from those the generic chips are also not tagged. The opaque flash interface should not be affected. The SFDP dummy chip is changed to explicitly set EWSR if it can't deduce it dynamically. The vendor detecting generic chips can't write anyway. Corresponding to flashrom svn r1527. Signed-off-by: Steven Zakulec <spzakulec@gmail.com> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
* SFDP: Fetch parameter table in a more portable wayCarl-Daniel Hailfinger2012-02-241-7/+16
| | | | | | | | | | | | | SFDP parameter table reads expect a dummy byte between written data (opcode+address) and read data on the SPI bus. Read that dummy byte instead of writing it to be compatible with all programmer drivers. Reduce SFDP parameter table read chunk size from 8 to 2 to handle programmers with small readcount limits. Corresponding to flashrom svn r1506. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
* Fix SFDP probingStefan Tauner2012-02-221-26/+39
| | | | | | | | | | | | | | | | | | | | | | Sfdp_add_uniform_eraser checks for existing erasers. Due to a bug it looked for eraser slots that have no erase functions set instead of those that have one set. Postpone adding an erase function for the special 4k block erase opcode until we know the flash chip size and add an additional check to sfdp_add_uniform_eraser. Fix the output of the parameter table contents. This patch fixes the index used to retrieve the eraser types, which was off one double word. Refine some messages and add a few further debugging prints. Corresponding to flashrom svn r1505. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* Add support for SFDP (JESD216)Stefan Tauner2012-02-171-0/+370
Similar to modules using the opaque programmer framework (e.g. ICH Hardware Sequencing) this uses a template struct flashchip element in flashchips.c with a special probe function that fills the obtained values into that struct. This allows yet unknown SPI chips to be supported (read, erase, write) almost as if it was already added to flashchips.c. Documentation used: http://www.jedec.org/standards-documents/docs/jesd216 (2011-04) W25Q32BV data sheet Revision F (2011-04-01) EN25QH16 data sheet Revision F (2011-06-01) MX25L6436E data sheet Revision 1.8 (2011-12-26) Tested-by: David Hendricks <dhendrix@google.com> on W25Q64CV + dediprog Tested-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> on a 2010 MX25L6436E with preliminary (i.e. incorrect) SFDP implementation + serprog Thanks also to Michael Karcher for his comments and preliminary review! Corresponding to flashrom svn r1500. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>