David Hendricks has uploaded this change for review. ( https://review.coreboot.org/20570
Change subject: ichspi: Check if region is included before disabling writes ......................................................................
ichspi: Check if region is included before disabling writes
If the user only includes regions to write which are not restricted, then they should not need to specify ich_spi_force=yes.
Change-Id: I8d5156954b88dbb3058194ab3f351aaf88ea6d8f Signed-off-by: David Hendricks dhendricks@fb.com --- M ichspi.c 1 file changed, 25 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/70/20570/1
diff --git a/ichspi.c b/ichspi.c index f26a7c0..6f1faae 100644 --- a/ichspi.c +++ b/ichspi.c @@ -32,6 +32,7 @@ #include "hwaccess.h" #include "spi.h" #include "ich_descriptors.h" +#include "layout.h"
/* Sunrise Point */
@@ -1817,8 +1818,30 @@ msg_pdbg("BRRA 0x%02x\n", ICH_BRRA(tmp));
/* Handle FREGx and FRAP registers */ - for (i = 0; i < num_freg; i++) - ich_spi_rw_restricted |= ich9_handle_frap(tmp, i); + for (i = 0; i < num_freg; i++) { + int offset; + uint32_t freg, base, limit; + + offset = ICH9_REG_FREG0 + i * 4; + freg = mmio_readl(ich_spibar + offset); + base = ICH_FREG_BASE(freg); + limit = ICH_FREG_LIMIT(freg); + + if (range_is_included(base, limit)) { + int is_locked = ich9_handle_frap(tmp, i); + + msg_pspew("Region %07x:%07x is included and ", base, limit); + if (is_locked) { + msg_pspew("locked.\n"); + ich_spi_rw_restricted = 1; + } else { + msg_pspew("not locked.\n"); + } + } else { + msg_pspew("Region %07x:%07x is not included, ignoring " + "access permission.\n", base, limit); + } + } if (ich_spi_rw_restricted) msg_pwarn("Not all flash regions are freely accessible by flashrom. This is " "most likely\ndue to an active ME. Please see "