summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2017-08-19 17:04:21 +0200
committerNico Huber <nico.h@gmx.de>2017-08-21 21:21:47 +0000
commitaa91d5c16858cb400cc61e8a759838f645e3f314 (patch)
tree163b27954a680ea02f945ee383f8dbc7c1cc03c8
parenta1bccd88c3c8c0041795b96faef2cb4179bfbd7c (diff)
downloadflashrom-aa91d5c16858cb400cc61e8a759838f645e3f314.tar.gz
flashrom-aa91d5c16858cb400cc61e8a759838f645e3f314.tar.bz2
flashrom-aa91d5c16858cb400cc61e8a759838f645e3f314.zip
ichspi: "Fix" access permission reporting for regions > 7
Can't find bits that tell us the actual permissions in charge. So report them as unknown. Change-Id: Ib73f95e0348f5c6d89988e3ea3529af0ec3b23a6 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/21106 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
-rw-r--r--ichspi.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/ichspi.c b/ichspi.c
index 5f3e39470..9ee8044ad 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1543,6 +1543,7 @@ static int ich9_handle_frap(uint32_t frap, int i)
static const char *const access_names[4] = {
"locked", "read-only", "write-only", "read-write"
};
+ const int rwperms_unknown = ARRAY_SIZE(access_names);
static const char *const region_names[5] = {
"Flash Descriptor", "BIOS", "Management Engine",
"Gigabit Ethernet", "Platform Data"
@@ -1550,11 +1551,21 @@ static int ich9_handle_frap(uint32_t frap, int i)
const char *const region_name = i < ARRAY_SIZE(region_names) ? region_names[i] : "unknown";
uint32_t base, limit;
- int rwperms = (((ICH_BRWA(frap) >> i) & 1) << 1) |
- (((ICH_BRRA(frap) >> i) & 1) << 0);
+ int rwperms;
int offset = ICH9_REG_FREG0 + i * 4;
uint32_t freg = mmio_readl(ich_spibar + offset);
+ if (i < 8) {
+ rwperms = (((ICH_BRWA(frap) >> i) & 1) << 1) |
+ (((ICH_BRRA(frap) >> i) & 1) << 0);
+ } else {
+ /* Datasheets don't define any access bits for regions > 7. We
+ can't rely on the actual descriptor settings either as there
+ are several overrides for them (those by other masters are
+ not even readable by us, *shrug*). */
+ rwperms = rwperms_unknown;
+ }
+
base = ICH_FREG_BASE(freg);
limit = ICH_FREG_LIMIT(freg);
if (base > limit || (freg == 0 && i > 0)) {
@@ -1569,6 +1580,11 @@ static int ich9_handle_frap(uint32_t frap, int i)
region_name, base, limit, access_names[rwperms]);
return 0;
}
+ if (rwperms == rwperms_unknown) {
+ msg_pdbg("FREG%i: %s region (0x%08x-0x%08x) has unknown permissions.\n",
+ i, region_name, base, limit);
+ return 0;
+ }
msg_pwarn("FREG%i: Warning: %s region (0x%08x-0x%08x) is %s.\n", i,
region_name, base, limit, access_names[rwperms]);