[flashrom] [PATCH 2/8] ichspi: disable writes when locked or read-only regions are detected

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Sat Aug 20 12:39:42 CEST 2011


Until we are able to unlock regions or at least understand better what
consequences writing single regions have, disable writing completely
whenever a non-writeable region is detected.

NB: the registers might not always reflect the real access status.
http://www.flashrom.org/pipermail/flashrom/2011-April/006309.html
(this is the sole such report i can remember)
---
Might not be the best location to do this, but currently i don't recognize a better
one. The warnings are repeated for each non-writeable region. We could
surpress it by checking if programmer_may_write is already 0 before printing.
the output on my thinkpad is:
[…]
Proceeding anyway because user specified laptop=force_I_want_a_brick
Found chipset "Intel QS57". Enabling flash write... WARNING: SPI Configuration Lockdown activated.
WARNING: Flash Descriptor region is read-only. Disabling writes.
WARNING: Management Engine region is locked. Disabling writes.
OK.
This chipset supports the following protocols: FWH, SPI.
Found Winbond flash chip "W25X64" (8192 kB, SPI) at physical address 0xff800000.
[…]

verbose output is:
[…]
0x54: 0x00000000 (FREG0: Flash Descriptor)
0x00000000-0x00000fff is read-only
WARNING: Flash Descriptor region is read-only. Disabling writes.
0x58: 0x07ff0500 (FREG1: BIOS)
0x00500000-0x007fffff is read-write
0x5C: 0x04ff0003 (FREG2: Management Engine)
0x00003000-0x004fffff is locked
WARNING: Management Engine region is locked. Disabling writes.
0x60: 0x00020001 (FREG3: Gigabit Ethernet)
0x00001000-0x00002fff is read-write
0x64: 0x00000fff (FREG4: Platform Data)
Platform Data region is unused.
[…]

i think that is ok.

Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
---
 ichspi.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/ichspi.c b/ichspi.c
index 09af2b3..343a0af 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1168,6 +1168,15 @@ static void do_ich9_spi_frap(uint32_t frap, int i)
 
 	msg_pdbg("0x%08x-0x%08x is %s\n", base, (limit | 0x0fff),
 		 access_names[rwperms]);
+	if (rwperms <= 0x1) {
+		msg_pinfo("WARNING: %s region is %s. Disabling writes.\n",
+			  region_names[i], access_names[rwperms]);
+		/* FIXME: This needs some refinement when we know how unlocking
+		 * of region works.
+		 */
+		programmer_may_write = 0;
+	}
+
 }
 
 static const struct spi_programmer spi_programmer_ich7 = {
-- 
1.7.1





More information about the flashrom mailing list