1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 22:43:17 +02:00

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>
This commit is contained in:
Edward O'Callaghan
2022-08-25 23:11:56 +10:00
committed by Anastasia Klimchuk
parent 39b1890773
commit af76e44752
6 changed files with 27 additions and 18 deletions

View File

@ -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);