summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2008-09-03 23:10:05 +0000
committerPeter Stuge <peter@stuge.se>2008-09-03 23:10:05 +0000
commit483b8f0c0d55a4dd13e3624214b18e523c688df7 (patch)
tree6b36d75859e9179323501722c38db049f812fd7a
parent8d74c1b05a4865385b5a4c955dca7543cfb9768a (diff)
downloadast2050-flashrom-483b8f0c0d55a4dd13e3624214b18e523c688df7.zip
ast2050-flashrom-483b8f0c0d55a4dd13e3624214b18e523c688df7.tar.gz
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. Corresponding to flashrom svn r313 and coreboot v2 svn r3562. Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Stefan Reinauer <stepan@coresystems.de>
-rw-r--r--flashrom.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/flashrom.c b/flashrom.c
index 03a8eeb..a6d6e91 100644
--- a/flashrom.c
+++ b/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);
}
OpenPOWER on IntegriCloud