mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 14:33: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:

committed by
Anastasia Klimchuk

parent
39b1890773
commit
af76e44752
@ -221,8 +221,6 @@ int flashrom_flash_probe(struct flashrom_flashctx **const flashctx,
|
||||
int i, ret = 2;
|
||||
struct flashrom_flashctx second_flashctx = { 0, };
|
||||
|
||||
chip_to_probe = chip_name; /* chip_to_probe is global in flashrom.c */
|
||||
|
||||
*flashctx = malloc(sizeof(**flashctx));
|
||||
if (!*flashctx)
|
||||
return 1;
|
||||
@ -230,10 +228,10 @@ int flashrom_flash_probe(struct flashrom_flashctx **const flashctx,
|
||||
|
||||
for (i = 0; i < registered_master_count; ++i) {
|
||||
int flash_idx = -1;
|
||||
if (!ret || (flash_idx = probe_flash(®istered_masters[i], 0, *flashctx, 0)) != -1) {
|
||||
if (!ret || (flash_idx = probe_flash(®istered_masters[i], 0, *flashctx, 0, chip_name)) != -1) {
|
||||
ret = 0;
|
||||
/* We found one chip, now check that there is no second match. */
|
||||
if (probe_flash(®istered_masters[i], flash_idx + 1, &second_flashctx, 0) != -1) {
|
||||
if (probe_flash(®istered_masters[i], flash_idx + 1, &second_flashctx, 0, chip_name) != -1) {
|
||||
flashrom_layout_release(second_flashctx.default_layout);
|
||||
free(second_flashctx.chip);
|
||||
ret = 3;
|
||||
|
Reference in New Issue
Block a user