summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2017-03-29 16:44:33 +0200
committerNico Huber <nico.h@gmx.de>2017-07-28 12:24:06 +0000
commit0bb3f7142aecdf883cc28bd9b771bdba3da5d7d9 (patch)
tree1bd56eecff210a628c148c836e2dfce13ebfd5f8
parentd54e4f467753a247552bfb629f007f8931b0caa7 (diff)
downloadflashrom-0bb3f7142aecdf883cc28bd9b771bdba3da5d7d9.tar.gz
flashrom-0bb3f7142aecdf883cc28bd9b771bdba3da5d7d9.tar.bz2
flashrom-0bb3f7142aecdf883cc28bd9b771bdba3da5d7d9.zip
ich_descriptors: Draw +0xfff into ICH_FREG_LIMIT()
The condition `base > limit` is still valid since `base` is always at least 4096 greater than `limit` in this case. Change-Id: I11ac0a50b3f32f47879e7cfb7a26068cd0572ede Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/19046 Reviewed-by: David Hendricks <david.hendricks@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--ich_descriptors.c4
-rw-r--r--ich_descriptors.h2
-rw-r--r--ichspi.c8
-rw-r--r--util/ich_descriptors_tool/ich_descriptors_tool.c1
4 files changed, 6 insertions, 9 deletions
diff --git a/ich_descriptors.c b/ich_descriptors.c
index 1fc8835ea..3e53ec9d6 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -246,7 +246,7 @@ static void pprint_freg(const struct ich_desc_region *reg, uint32_t i)
if (base > limit)
msg_pdbg2("is unused.\n");
else
- msg_pdbg2("0x%08x - 0x%08x\n", base, limit | 0x0fff);
+ msg_pdbg2("0x%08x - 0x%08x\n", base, limit);
}
void prettyprint_ich_descriptor_region(const struct ich_descriptors *desc)
@@ -952,7 +952,7 @@ int layout_from_ich_descriptors(struct ich_layout *const layout, const void *con
size_t i, j;
for (i = 0, j = 0; i < min(desc.content.NR + 1, ARRAY_SIZE(regions)); ++i) {
const chipoff_t base = ICH_FREG_BASE(desc.region.FLREGs[i]);
- const chipoff_t limit = ICH_FREG_LIMIT(desc.region.FLREGs[i]) + 0xfff;
+ const chipoff_t limit = ICH_FREG_LIMIT(desc.region.FLREGs[i]);
if (limit <= base)
continue;
layout->entries[j].start = base;
diff --git a/ich_descriptors.h b/ich_descriptors.h
index 831341a64..ec85e0c43 100644
--- a/ich_descriptors.h
+++ b/ich_descriptors.h
@@ -63,7 +63,7 @@
/* 24-31: reserved */
#define ICH_FREG_BASE(flreg) (((flreg) << 12) & 0x01fff000)
-#define ICH_FREG_LIMIT(flreg) (((flreg) >> 4) & 0x01fff000)
+#define ICH_FREG_LIMIT(flreg) ((((flreg) >> 4) & 0x01fff000) | 0x00000fff)
void prettyprint_ich_reg_vscc(uint32_t reg_val, int verbosity, bool print_vcl);
diff --git a/ichspi.c b/ichspi.c
index ecf0c4212..5f3e39470 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1566,14 +1566,12 @@ static int ich9_handle_frap(uint32_t frap, int i)
msg_pdbg("0x%02X: 0x%08x ", offset, freg);
if (rwperms == 0x3) {
msg_pdbg("FREG%i: %s region (0x%08x-0x%08x) is %s.\n", i,
- region_name, base, (limit | 0x0fff),
- access_names[rwperms]);
+ region_name, base, limit, access_names[rwperms]);
return 0;
}
msg_pwarn("FREG%i: Warning: %s region (0x%08x-0x%08x) is %s.\n", i,
- region_name, base, (limit | 0x0fff),
- access_names[rwperms]);
+ region_name, base, limit, access_names[rwperms]);
return 1;
}
@@ -1608,7 +1606,7 @@ static int ich9_handle_pr(const size_t reg_pr0, int i)
msg_pdbg("0x%02X: 0x%08x ", off, pr);
msg_pwarn("%sPR%u: Warning: 0x%08x-0x%08x is %s.\n", prefix, i, ICH_FREG_BASE(pr),
- ICH_FREG_LIMIT(pr) | 0x0fff, access_names[rwperms]);
+ ICH_FREG_LIMIT(pr), access_names[rwperms]);
return 1;
}
diff --git a/util/ich_descriptors_tool/ich_descriptors_tool.c b/util/ich_descriptors_tool/ich_descriptors_tool.c
index 250abf003..7dfa5c07e 100644
--- a/util/ich_descriptors_tool/ich_descriptors_tool.c
+++ b/util/ich_descriptors_tool/ich_descriptors_tool.c
@@ -58,7 +58,6 @@ static void dump_file(const char *prefix, const uint32_t *dump, unsigned int len
return;
}
- limit = limit | 0x0fff;
file_len = limit + 1 - base;
if (base + file_len > len) {
printf("The %s region is spanning 0x%08x-0x%08x, but it is "