On 14.01.2011 20:10, Stefan Reinauer wrote:
> * Stefan Reinauer <[email protected]> [110113 01:43]:
> 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.
Sounds like a good idea. Albeit adding a new function that recalculates
size and base seems unnecessary. By inlining the code the static char
array can be avoided, too. See attached modification of the patch.
Otherwise: Acked-by: Mathias Krause <[email protected]>
Index: flashrom.c
===================================================================
--- flashrom.c (Revision 1250)
+++ flashrom.c (Arbeitskopie)
@@ -1127,6 +1127,7 @@
{
struct flashchip *flash;
unsigned long base = 0;
+ char location[64];
uint32_t size;
enum chipbustype buses_common;
char *tmp;
@@ -1178,10 +1179,16 @@
if (!flash || !flash->name)
return NULL;
- msg_cinfo("%s chip \"%s %s\" (%d KB, %s) at physical address 0x%lx.\n",
+ if (programmer_table[programmer].map_flash_region == physmap) {
+ snprintf(location, sizeof(location), "at physical address 0x%lx", base);
+ } else {
+ snprintf(location, sizeof(location), "on %s", programmer_table[programmer].name);
+ }
+
+ 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), location);
/* 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