Commit Graph

3206 Commits

Author SHA1 Message Date
Maciej Pijanowski 24c75c11a7 Docuemntation/W25Q64.W.md: add WP test report
Change-Id: I41f9561d2318162d5129f59c0f0d7964d110313e
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2024-02-14 13:29:59 +01:00
Maciej Pijanowski b3876115ae Docuemntation/chips.md: add missing references
Change-Id: I961e86053897164515e72ac20eebe7a46046b382
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2024-02-14 13:29:59 +01:00
Maciej Pijanowski 4487fb7219 Docuemntation/MX25L6436E.md: add WP test reults
Change-Id: Iffe0cc369251852874586745d04c7ce6b90dc87d
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2024-02-14 13:29:59 +01:00
Maciej Pijanowski 16a8ada65e Documentation/MX25L6406E.md: add WP test report
Change-Id: Iebef0e9d558dda75b469f467658e7f49e6e00224
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2024-02-14 13:29:58 +01:00
Maciej Pijanowski 94083d0380 Documentation/chips.md: add test results table
Change-Id: I5c5811994b5bebeefd5be683208de8984ba281a3
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2024-02-14 13:29:58 +01:00
Maciej Pijanowski 10ea2acaaa MX25L3206E: add WP test report
Change-Id: I0f5a8f760660eae77e97c8b1a5c7dcf3dc6ba61d
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2024-02-14 13:29:54 +01:00
Sergii Dmytruk d09a6c6143 Add list of chips for which we intend to have WP
Change-Id: Ifcd6cffa22dffd05241515fc30e0f550f89b5b16
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-09-28 17:43:13 +02:00
Sergii Dmytruk 500a854804 Documentation/heads-and-wp.md: add
Change-Id: I5848ea57ec389f2830e92d972ce6fe6c38737509
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-09-28 17:43:13 +02:00
Sergii Dmytruk 42e2cda9c6 Add --skip-wp-area CLI parameter
Change-Id: I73c9a1a1e348820cc438f347a5e09f348e397fe6
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-09-28 17:43:13 +02:00
Sergii Dmytruk c9c08f7c4c Add FLASHROM_FLAG_SKIP_WP_AREA flag
Used to control skipping of write-protected part of a chip.

Change-Id: Icdc56cb1876aab8f8229cd1a485aa297d8b7b1e9
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-09-28 17:43:13 +02:00
Sergii Dmytruk ef147f5f57 flashrom.c: automatically exclude write-protected area from write/erase
Change-Id: I971a07d9d8b16f5c0ead9a9b6de1efe0b69288c9
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-09-28 17:43:13 +02:00
Sergii Dmytruk 074322ea2b Documentation/bootblock-protection.md: add
Change-Id: Iaad1014fad5a60e78bef55c5f3aceaed782b66d6
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-09-21 17:40:25 +02:00
Sergii Dmytruk 9c3ba8dd5d flashchips.c: enable WP for to 7 entries of MX chips
These weren't split:
 * MX25L3206E/MX25L3208E
 * MX25L6405
 * MX25L6405D
 * MX25L6406E/MX25L6408E

MX25L6436E/MX25L6445E/MX25L6465E/MX25L6473E/MX25L6473F was split into:
 * MX25L6436E/MX25L6445E/MX25L6465E
   - security register
   - WPS
 * MX25L6473E
   - security register
   - OTP TB bit in CONFIG1/STATUS2 (0x15 opcode)
   - WPS
 * MX25L6473F
   - NO security register
   - OTP TB bit in CONFIG1/STATUS2 (0x15 opcode)
   - NO WPS

Change-Id: Ib3db9d39ffacd3e9e44de92c6cfb6c3ecc8615bd
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-08-17 19:27:27 +03:00
Sergii Dmytruk 14012f4288 flashchips.c: enable WP for MT25QL512, N25Q0{32,64}..{1,3}E
Change-Id: Ib0f3cb9516cea7bb678842a358a82099221e1ed9
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-08-17 18:31:53 +03:00
Sergii Dmytruk 42a16ce688 flashchips.c: enable WP for W25Q32.V, W25Q32.W and W25Q32JW...M
Split chips:
 * W25Q32.V -> W25Q32BV/W25Q32CV/W25Q32DV, W25Q32FV and W25Q32JV
 * W25Q32.W -> W25Q32BW/W25Q32CW/W25Q32DW, W25Q32FW and W25Q32JW...Q

Change-Id: Id259c27dfa6c681bbadc73b3bd7559ad6a5865f4
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-08-17 18:31:53 +03:00
Sergii Dmytruk 4695736ced flashchips.c: enable WP for EN25QH32 and EN25QH64
Split chips:
 * EN25QH32 -> EN25QH32 and EN25QH32B
 * EN25QH64 -> EN25QH64 and EN25QH64A

Unlike older revisions both newly added EN25QH32B and EN25QH64A support
half block (32KiB) erase operation via 0x52 opcode.

Change-Id: I759f0119346235ce0bddc78cde9c461495990c25
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-08-17 18:31:53 +03:00
Sergii Dmytruk c88325e0dd writeprotect_ranges.c: add more range functions
Not all chips follow the same pattern. There are differences in how CMP
bit is treated or in block size used.

Change-Id: Ied7b27be2ee2426af8f473432e2b01a290de2365
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-08-17 18:31:53 +03:00
Sergii Dmytruk 1f1a1e1bd5 spi25_statusreg: support reading/writing "configuration registers"
Sometimes it's only a matter of naming and these behave exactly like
SR2/SR3 (Spansion S25FL256L and S25FL128L), but in case of Macronix
MX25L6473E and MX25L6473F configuration register is read via a separate
RDCR command, but written as if it's SR2 using WRSR_EXT2.

Change-Id: I45f9afcc31f1928ef6263a749596380082963de4
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-08-17 18:31:53 +03:00
Sergii Dmytruk 0bc33ef923 spi25_statusreg: support reading/writing security register
Not to be confused with "secure registers" of OTP.

Security register is a dedicated status register for security-related
bits. You don't write its value directly, issuing special write commands
with no data set separate OTP bits to 1 automatically (WRSCUR, WPSEL
commands). No WREN is necessary, but at least some datasheets indicate
BUSY state after those write commands.

Unlike cases where OTP bit is part of SR and can only be written while
in OTP mode, security register can only be written outside of the mode.

The register is found in at least these chips by Macronix:
 * MX25L6436E
 * MX25L6445E
 * MX25L6465E
 * MX25L6473E

Change-Id: Iae1753ca4cb051127a5bcbeba7f064053adb8dae
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-08-17 18:31:53 +03:00
Sergii Dmytruk 40ee3b3614 writeprotect: refuse to work with chip if OTP WPS == 1
Perform the check right in read_wp_bits() as it's used by various WP
operations and also because its results won't make sense if WPS bit is
on and can't be changed.

Change-Id: I143186066a1d3af89809b7135886cb8b0d038085
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-08-17 18:29:10 +03:00
Sergii Dmytruk e423a6be4d writeprotect: skip unnecessary writes
* Don't write register because of RO and OTP bits.
* Skip the write of RW bits if register state wouldn't change by it.

Change-Id: I81d2d3fc0a103ee00ced78838d77fe33a9d3056a
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-08-14 16:51:46 +03:00
Felix Singer 1392a08c50 tests/realtek_mst_i2c_spi.c: Fix macro closing comment
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: I7b130c58305f4a8b2afbfdb7dcead9d6535d98af
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66509
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Thomas Heijligen <src@posteo.de>
2022-08-10 23:53:56 +00:00
Anastasia Klimchuk e18a528c6b tests: Test allow_brick is required for i2c programmers init
Add tests for i2c programmers that assert that initialisation fails
when allow_brick parameter is not provided.

Example of logs from test run:

[ RUN      ] parade_lspcon_no_allow_brick_test_success
Testing init error path for programmer=parade_lspcon with params: bus=254 ...
... init failed with error code -1 as expected
[       OK ] parade_lspcon_no_allow_brick_test_success

BUG=b:181803212
TEST=ninja test

Change-Id: I382f563016502f3342131d5f9c0de41dc665b03a
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66508
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Thomas Heijligen <src@posteo.de>
2022-08-10 23:53:11 +00:00
Anastasia Klimchuk 4adfd99d78 tests: Add function to test programmer init error paths
New function tests an error path for programmer initialisation,
and expects programmer init to fail with given error code.

BUG=b:181803212
TEST=ninja test

Change-Id: Icc59396e604d74442852b4bbd575440df3347c3f
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66507
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Thomas Heijligen <src@posteo.de>
2022-08-10 23:53:00 +00:00
Alexander Goncharov 02f43e89ba atahpt: restore flash access state explicitly
Instead of using reversible write (rpci_write_long) that relies on
global state, do it manually. Save original PCI config space
register contents to programmer's structure during initialization
and restore it in programmer's shutdown.

TOPIC=reduce_global_pci_state
TEST=builds

Change-Id: I9996bb4d71801034e66ba0c233846e19fa29224d
Signed-off-by: Alexander Goncharov <chat@joursoir.net>
Ticket: https://ticket.coreboot.org/issues/389
Reviewed-on: https://review.coreboot.org/c/flashrom/+/65386
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Thomas Heijligen <src@posteo.de>
2022-08-09 23:19:15 +00:00