1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 06:23:18 +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

@ -35,7 +35,6 @@
#include "chipdrivers.h"
const char flashrom_version[] = FLASHROM_VERSION;
const char *chip_to_probe = NULL;
static const struct programmer_entry *programmer = NULL;
@ -824,7 +823,7 @@ static probe_func_t *lookup_probe_func_ptr(const struct flashchip *chip)
return NULL;
}
int probe_flash(struct registered_master *mst, int startchip, struct flashctx *flash, int force)
int probe_flash(struct registered_master *mst, int startchip, struct flashctx *flash, int force, const char *const chip_to_probe)
{
const struct flashchip *chip;
enum chipbustype buses_common;
@ -864,6 +863,10 @@ int probe_flash(struct registered_master *mst, int startchip, struct flashctx *f
if (force)
break;
if (probe_func == &probe_w29ee011)
if (!w29ee011_can_override(flash->chip->name, chip_to_probe))
goto notfound;
if (probe_func(flash) != 1)
goto notfound;