From 12aa5d9acfdf989717e904a8832e4cc4dd7faca2 Mon Sep 17 00:00:00 2001 From: Peter Stuge Date: Wed, 3 Sep 2008 23:10:05 +0000 Subject: flashrom: Only find "unknown .. SPI chip" if no other chip was found This removes the false positive matches we've been seeing, and also removes the true positive match in case there is more than one flash chip and the 2nd or 3rd are unknown - but I think that case is uncommon enough to warrant the improvement in the common case. Use flashrom -frc forced read if you have the uncommon case, and/or please add the flash chip to the flashchips array. Signed-off-by: Peter Stuge Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3562 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/flashrom/flashrom.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/flashrom/flashrom.c b/util/flashrom/flashrom.c index 03a8eeb651..a6d6e9148c 100644 --- a/util/flashrom/flashrom.c +++ b/util/flashrom/flashrom.c @@ -99,12 +99,13 @@ int map_flash_registers(struct flashchip *flash) return 0; } -struct flashchip *probe_flash(struct flashchip *flash, int force) +struct flashchip *probe_flash(struct flashchip *first_flash, int force) { volatile uint8_t *bios; + struct flashchip *flash; unsigned long flash_baseaddr = 0, size; - for (; flash && flash->name; flash++) { + for (flash = first_flash; flash && flash->name; flash++) { if (chip_to_probe && strcmp(flash->name, chip_to_probe) != 0) continue; printf_debug("Probing for %s %s, %d KB: ", @@ -150,9 +151,13 @@ struct flashchip *probe_flash(struct flashchip *flash, int force) if (force) break; - if (flash->probe(flash) == 1) + if (flash->probe(flash) != 1) + goto notfound; + + if (first_flash == flashchips || flash->model_id != GENERIC_DEVICE_ID) break; +notfound: munmap((void *)bios, size); } -- cgit v1.2.3