diff options
author | Nikolai Artemiev <nartemiev@google.com> | 2021-10-21 01:35:13 +1100 |
---|---|---|
committer | Anastasia Klimchuk <aklm@chromium.org> | 2022-03-01 04:12:19 +0000 |
commit | 9fc100f54953dc74603678fc42e74d9b99e61ff0 (patch) | |
tree | abfee6a62c3ad028187e36f97796d099c944a104 /flashchips.c | |
parent | cff87a8488597b08c8b0ffb7037ed44f840a156b (diff) | |
download | flashrom-9fc100f54953dc74603678fc42e74d9b99e61ff0.tar.gz flashrom-9fc100f54953dc74603678fc42e74d9b99e61ff0.tar.bz2 flashrom-9fc100f54953dc74603678fc42e74d9b99e61ff0.zip |
flashchips,writeprotect_ranges: add range decoding function
Allow chips to specify functions that map status register bits to
protection ranges. These are used to enumerate available ranges and
determine the protection state of chips. The patch also adds a range
decoding function for the example chips. Many other chips can also be
handled by it, though some will require different functions (e.g.
MX25L6406 and related chips).
Another approach that has been tried in cros flashrom is maintaining
tables of range data, but it quickly becomes error prone and hard to
validate.
Using a function to interpret the ranges allows compact encoding with
most chips and is flexible enough to allow chips with less predictable
ranges to be handled as well.
BUG=b:195381327,b:153800563
BRANCH=none
TEST=dumped range tables, checked against datasheets
Change-Id: Id163ed80938a946a502ed116e48e8236e36eb203
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58480
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'flashchips.c')
-rw-r--r-- | flashchips.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/flashchips.c b/flashchips.c index e12c8fceb..acb7718cc 100644 --- a/flashchips.c +++ b/flashchips.c @@ -6354,6 +6354,7 @@ const struct flashchip flashchips[] = { .sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */ .cmp = {STATUS2, 6, RW}, }, + .decode_range = decode_range_spi25, }, { @@ -6760,6 +6761,7 @@ const struct flashchip flashchips[] = { .bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}, {STATUS1, 5, RW}}, .tb = {STATUS1, 6, RW}, }, + .decode_range = decode_range_spi25, }, { @@ -6808,6 +6810,7 @@ const struct flashchip flashchips[] = { .sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */ .cmp = {STATUS2, 6, RW}, }, + .decode_range = decode_range_spi25, }, { |