diff options
author | Edward O'Callaghan <quasisec@google.com> | 2022-08-25 23:11:56 +1000 |
---|---|---|
committer | Anastasia Klimchuk <aklm@chromium.org> | 2022-11-06 23:30:33 +0000 |
commit | af76e447527da609965dff5726696b59d6873d6e (patch) | |
tree | a6153ef63056d4501cec684410a28314a4aea7e5 /w29ee011.c | |
parent | 39b189077379a6cdd99e5ae20452fa685b94500e (diff) | |
download | flashrom-af76e447527da609965dff5726696b59d6873d6e.tar.gz flashrom-af76e447527da609965dff5726696b59d6873d6e.tar.bz2 flashrom-af76e447527da609965dff5726696b59d6873d6e.zip |
flashrom.c: Make 'chip_to_probe' a param to probe_flash()
Apart from the very bespoke case of 'probe_w29ee011()'
the override 'chip_to_probe' name is a nature parameter
to 'probe_flash()'. However we can deal with w29ee011
by providing a probe specific validation function to
check if the chip can indeed be overriden.
TEST=`./flashrom -p internal --flash-name`.
Change-Id: Ifcdace07ea2135d83dea92cfa5c6bec8d7ddf05d
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67091
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'w29ee011.c')
-rw-r--r-- | w29ee011.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/w29ee011.c b/w29ee011.c index 62d7a0f70..234b865c8 100644 --- a/w29ee011.c +++ b/w29ee011.c @@ -15,9 +15,24 @@ */ #include <string.h> +#include <stdbool.h> + #include "flash.h" #include "chipdrivers.h" +bool w29ee011_can_override(const char *const chip_name, const char *const override_chip) +{ + if (!override_chip || strcmp(override_chip, chip_name)) { + msg_cdbg("Old Winbond W29* probe method disabled because " + "the probing sequence puts the AMIC A49LF040A in " + "a funky state. Use 'flashrom -c %s' if you " + "have a board with such a chip.\n", chip_name); + return false; + } + + return true; +} + /* According to the Winbond W29EE011, W29EE012, W29C010M, W29C011A * datasheets this is the only valid probe function for those chips. */ @@ -26,14 +41,6 @@ int probe_w29ee011(struct flashctx *flash) chipaddr bios = flash->virtual_memory; uint8_t id1, id2; - if (!chip_to_probe || strcmp(chip_to_probe, flash->chip->name)) { - msg_cdbg("Old Winbond W29* probe method disabled because " - "the probing sequence puts the AMIC A49LF040A in " - "a funky state. Use 'flashrom -c %s' if you " - "have a board with such a chip.\n", flash->chip->name); - return 0; - } - /* Issue JEDEC Product ID Entry command */ chip_writeb(flash, 0xAA, bios + 0x5555); programmer_delay(flash, 10); |