[flashrom] [PATCH] Don't show address for dediprog & Co
Mathias Krause
mathias.krause at secunet.com
Mon Jan 17 09:22:04 CET 2011
On 14.01.2011 20:10, Stefan Reinauer wrote:
> * Stefan Reinauer <reinauer at google.com> [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 <reinauer at google.com>
>
> 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 <mathias.krause at secunet.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: location.diff
Type: text/x-patch
Size: 1092 bytes
Desc: not available
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20110117/3521802c/attachment.diff>
More information about the flashrom
mailing list