* Stefan Reinauer <[email protected]> [110113 01:43]:
> See patch.

> Don't print the local memory flash chip address on programmers that don't
> actually map the flash chip into local memory (like the dediprog) because
> the value does not make sense there.

updated patch, shows the programmer name if there is no physical address
to show:

flashrom v0.9.3-r1250 on Linux 2.6.35 (x86_64), built with libpci 3.1.7, GCC 
4.5.1, little endian
flashrom is free software, get the source code at http://www.flashrom.org

Calibrating delay loop... OK.
Found chip "Winbond W25Q32" (4096 KB, SPI) on dediprog.
Erasing and writing flash chip... Done.
Verifying flash... VERIFIED.          



Don't print the local memory flash chip address on programmers that don't
actually map the flash chip into local memory (like the dediprog) because
the value does not make sense there.

Signed-off-by: Stefan Reinauer <[email protected]>

Index: flashrom.c
===================================================================
--- flashrom.c	(revision 1250)
+++ flashrom.c	(working copy)
@@ -604,6 +604,24 @@
 	programmer_table[programmer].delay(usecs);
 }
 
+char *programmer_extension_to_text(struct flashchip *flash)
+{
+	static char extension[64];
+	memset(extension, 0, 64);
+
+	if (programmer_table[programmer].map_flash_region == physmap) {
+		unsigned long base;
+		uint32_t size;
+		size = flash->total_size * 1024;
+		base = flashbase ? flashbase : (0xffffffff - size + 1);
+		snprintf(extension, sizeof(extension), " at physical address 0x%lx", base);
+	} else {
+		snprintf(extension, sizeof(extension), " on %s",
+				programmer_table[programmer].name);
+	}
+	return extension;
+}
+
 void map_flash_registers(struct flashchip *flash)
 {
 	size_t size = flash->total_size * 1024;
@@ -1178,10 +1196,11 @@
 	if (!flash || !flash->name)
 		return NULL;
 
-	msg_cinfo("%s chip \"%s %s\" (%d KB, %s) at physical address 0x%lx.\n",
+	msg_cinfo("%s chip \"%s %s\" (%d KB, %s)%s.\n",
 	       force ? "Assuming" : "Found",
 	       flash->vendor, flash->name, flash->total_size,
-	       flashbuses_to_text(flash->bustype), base);
+	       flashbuses_to_text(flash->bustype),
+	       programmer_extension_to_text(flash));
 
 	/* Flash registers will not be mapped if the chip was forced. Lock info
 	 * may be stored in registers, so avoid lock info printing.
_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to