[coreboot] r3562 - trunk/util/flashrom

svn at coreboot.org svn at coreboot.org
Thu Sep 4 01:10:06 CEST 2008


Author: stuge
Date: 2008-09-04 01:10:05 +0200 (Thu, 04 Sep 2008)
New Revision: 3562

Modified:
   trunk/util/flashrom/flashrom.c
Log:
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 <peter at stuge.se>
Acked-by: Stefan Reinauer <stepan at coresystems.de>


Modified: trunk/util/flashrom/flashrom.c
===================================================================
--- trunk/util/flashrom/flashrom.c	2008-09-03 19:59:44 UTC (rev 3561)
+++ trunk/util/flashrom/flashrom.c	2008-09-03 23:10:05 UTC (rev 3562)
@@ -99,12 +99,13 @@
 	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 @@
 		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);
 	}
 





More information about the coreboot mailing list