If a chip is not on the RDID generic vendor list nor on the REMS
specific ID list, flashrom will claim that no chip is there. Handle
these cases gracefully. flashrom will ignore generic matches if a
specific chip was found, so this will have no impact on supported chips,
but help a lot for a first quick analysis by the user or developer. The
only drawback is that unknown chips may be recognized multiple times
until they are added to flashchips.[ch].
Signed-off-by: Carl-Daniel Hailfinger <c-…
[View More]d.hailfinger.devel.2006(a)gmx.net>
Index: flashrom-spi_totally_generic_probe/flashchips.c
===================================================================
--- flashrom-spi_totally_generic_probe/flashchips.c (Revision 664)
+++ flashrom-spi_totally_generic_probe/flashchips.c (Arbeitskopie)
@@ -3167,5 +3167,32 @@
.read = NULL,
},
+ {
+ .vendor = "Generic",
+ .name = "unknown SPI chip (RDID)",
+ .bustype = CHIP_BUSTYPE_SPI,
+ .manufacture_id = GENERIC_MANUF_ID,
+ .model_id = GENERIC_DEVICE_ID,
+ .total_size = 0,
+ .page_size = 256,
+ .tested = TEST_BAD_PREW,
+ .probe = probe_spi_rdid,
+ .erase = NULL,
+ .write = NULL,
+ },
+ {
+ .vendor = "Generic",
+ .name = "unknown SPI chip (REMS)",
+ .bustype = CHIP_BUSTYPE_SPI,
+ .manufacture_id = GENERIC_MANUF_ID,
+ .model_id = GENERIC_DEVICE_ID,
+ .total_size = 0,
+ .page_size = 256,
+ .tested = TEST_BAD_PREW,
+ .probe = probe_spi_rems,
+ .erase = NULL,
+ .write = NULL,
+ },
+
{ NULL }
};
Index: flashrom-spi_totally_generic_probe/flashchips.h
===================================================================
--- flashrom-spi_totally_generic_probe/flashchips.h (Revision 664)
+++ flashrom-spi_totally_generic_probe/flashchips.h (Arbeitskopie)
@@ -34,6 +34,7 @@
* SPI parts have 16-bit device IDs if they support RDID.
*/
+#define GENERIC_MANUF_ID 0xffff /* Check if there is a vendor ID */
#define GENERIC_DEVICE_ID 0xffff /* Only match the vendor ID */
#define ALLIANCE_ID 0x52 /* Alliance Semiconductor */
Index: flashrom-spi_totally_generic_probe/spi.c
===================================================================
--- flashrom-spi_totally_generic_probe/spi.c (Revision 664)
+++ flashrom-spi_totally_generic_probe/spi.c (Arbeitskopie)
@@ -274,6 +274,11 @@
GENERIC_DEVICE_ID == flash->model_id)
return 1;
+ /* Test if there is any vendor ID. */
+ if (GENERIC_MANUF_ID == flash->manufacture_id &&
+ id1 != 0xff)
+ return 1;
+
return 0;
}
@@ -329,6 +334,11 @@
GENERIC_DEVICE_ID == flash->model_id)
return 1;
+ /* Test if there is any vendor ID. */
+ if (GENERIC_MANUF_ID == flash->manufacture_id &&
+ id1 != 0xff)
+ return 1;
+
return 0;
}
--
http://www.hailfinger.org/
[View Less]
see attached patch. patch is too small to be copyrightable...
ciao
Joerg
--
Joerg Mayer <jmayer(a)loplof.de>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.
Author: hailfinger
Date: 2009-10-31 02:53:09 +0100 (Sat, 31 Oct 2009)
New Revision: 755
Modified:
trunk/chipset_enable.c
trunk/flash.h
trunk/flashrom.c
Log:
Add infrastructure to check and report to the user the maximum supported
decode size for chipsets and tested mainboards.
The rationale is to warn users when they, for example, try to flash
a 512KB parallel flash chip but their chipset only supports 256KB,
or they try to flash 512KB and the chipset _does_ theoretically
support …
[View More]512KB but their special board doesn't wire all address lines
and thus supports only 256 KB ROM chips at maximum.
This has cost Uwe hours of debugging on some board already, until he
figured out what was going on. We should try warn our users where
possible about this.
The chipset and the chip may have more than one bus in common (e.g.
SB600 and Pm49* can both speak LPC+FWH) and on SB600/SB7x0/SB8x0 there
are different limits for LPC and FWH. The only way to tell the user
about the exact circumstances is to spew error messages per bus.
The code will issue a warning during probe (which does fail for some
chips if the size is too big) and abort before the first real
read/write/erase action. If no action is specified, the warning is
printed anyway.
That way, a user can find out why probe might not have worked, and will
be stopped before he/she gets incorrect results.
Add a bitcount function to the infrastructure.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Acked-by: Uwe Hermann <uwe(a)hermann-uwe.de>
Modified: trunk/chipset_enable.c
===================================================================
--- trunk/chipset_enable.c 2009-10-30 21:12:39 UTC (rev 754)
+++ trunk/chipset_enable.c 2009-10-31 01:53:09 UTC (rev 755)
@@ -42,6 +42,17 @@
enum chipbustype buses_supported = CHIP_BUSTYPE_NONSPI;
+/**
+ * Programmers supporting multiple buses can have differing size limits on
+ * each bus. Store the limits for each bus in a common struct.
+ */
+struct decode_sizes max_rom_decode = {
+ .parallel = 0xffffffff,
+ .lpc = 0xffffffff,
+ .fwh = 0xffffffff,
+ .spi = 0xffffffff
+};
+
extern int ichspi_lock;
static int enable_flash_ali_m1533(struct pci_dev *dev, const char *name)
Modified: trunk/flash.h
===================================================================
--- trunk/flash.h 2009-10-30 21:12:39 UTC (rev 754)
+++ trunk/flash.h 2009-10-31 01:53:09 UTC (rev 755)
@@ -352,9 +352,17 @@
void sio_mask(uint16_t port, uint8_t reg, uint8_t data, uint8_t mask);
int board_flash_enable(const char *vendor, const char *part);
+struct decode_sizes {
+ uint32_t parallel;
+ uint32_t lpc;
+ uint32_t fwh;
+ uint32_t spi;
+};
+
/* chipset_enable.c */
extern enum chipbustype buses_supported;
int chipset_flash_enable(void);
+extern struct decode_sizes max_rom_decode;
extern unsigned long flashbase;
Modified: trunk/flashrom.c
===================================================================
--- trunk/flashrom.c 2009-10-30 21:12:39 UTC (rev 754)
+++ trunk/flashrom.c 2009-10-31 01:53:09 UTC (rev 755)
@@ -299,6 +299,15 @@
return (a > b) ? a : b;
}
+int bitcount(unsigned long a)
+{
+ int i = 0;
+ for (; a != 0; a >>= 1)
+ if (a & 1)
+ i++;
+ return i;
+}
+
char *strcat_realloc(char *dest, const char *src)
{
dest = realloc(dest, strlen(dest) + strlen(src) + 1);
@@ -398,10 +407,60 @@
return ret;
}
+int check_max_decode(enum chipbustype buses, uint32_t size)
+{
+ int limitexceeded = 0;
+ if ((buses & CHIP_BUSTYPE_PARALLEL) &&
+ (max_rom_decode.parallel < size)) {
+ limitexceeded++;
+ printf_debug("Chip size %u kB is bigger than supported "
+ "size %u kB of chipset/board/programmer "
+ "for %s interface, "
+ "probe/read/erase/write may fail. ", size / 1024,
+ max_rom_decode.parallel / 1024, "Parallel");
+ }
+ if ((buses & CHIP_BUSTYPE_LPC) && (max_rom_decode.lpc < size)) {
+ limitexceeded++;
+ printf_debug("Chip size %u kB is bigger than supported "
+ "size %u kB of chipset/board/programmer "
+ "for %s interface, "
+ "probe/read/erase/write may fail. ", size / 1024,
+ max_rom_decode.lpc / 1024, "LPC");
+ }
+ if ((buses & CHIP_BUSTYPE_FWH) && (max_rom_decode.fwh < size)) {
+ limitexceeded++;
+ printf_debug("Chip size %u kB is bigger than supported "
+ "size %u kB of chipset/board/programmer "
+ "for %s interface, "
+ "probe/read/erase/write may fail. ", size / 1024,
+ max_rom_decode.fwh / 1024, "FWH");
+ }
+ if ((buses & CHIP_BUSTYPE_SPI) && (max_rom_decode.spi < size)) {
+ limitexceeded++;
+ printf_debug("Chip size %u kB is bigger than supported "
+ "size %u kB of chipset/board/programmer "
+ "for %s interface, "
+ "probe/read/erase/write may fail. ", size / 1024,
+ max_rom_decode.spi / 1024, "SPI");
+ }
+ if (!limitexceeded)
+ return 0;
+ /* Sometimes chip and programmer have more than one bus in common,
+ * and the limit is not exceeded on all buses. Tell the user.
+ */
+ if (bitcount(buses) > limitexceeded)
+ printf_debug("There is at least one common chip/programmer "
+ "interface which can support a chip of this size. "
+ "You can try --force at your own risk.\n");
+ return 1;
+}
+
struct flashchip *probe_flash(struct flashchip *first_flash, int force)
{
struct flashchip *flash;
- unsigned long base = 0, size;
+ unsigned long base = 0;
+ uint32_t size;
+ enum chipbustype buses_common;
char *tmp;
for (flash = first_flash; flash && flash->name; flash++) {
@@ -413,7 +472,8 @@
printf_debug("failed! flashrom has no probe function for this flash chip.\n");
continue;
}
- if (!(buses_supported & flash->bustype)) {
+ buses_common = buses_supported & flash->bustype;
+ if (!buses_common) {
tmp = flashbuses_to_text(buses_supported);
printf_debug("skipped. Host bus type %s ", tmp);
free(tmp);
@@ -424,6 +484,7 @@
}
size = flash->total_size * 1024;
+ check_max_decode(buses_common, size);
base = flashbase ? flashbase : (0xffffffff - size + 1);
flash->virtual_memory = (chipaddr)programmer_map_flash_region("flash chip", base, size);
@@ -956,6 +1017,15 @@
"mainboard you tested. Thanks for your help!\n===\n");
}
+ size = flash->total_size * 1024;
+ if (check_max_decode((buses_supported & flash->bustype), size) &&
+ (!force)) {
+ fprintf(stderr, "Chip is too big for this programmer "
+ "(-V gives details). Use --force to override.\n");
+ programmer_shutdown();
+ return 1;
+ }
+
if (!(read_it | write_it | verify_it | erase_it)) {
printf("No operations were specified.\n");
// FIXME: flash writes stay enabled!
@@ -974,7 +1044,6 @@
if (write_it && !dont_verify_it)
verify_it = 1;
- size = flash->total_size * 1024;
buf = (uint8_t *) calloc(size, sizeof(char));
if (erase_it) {
[View Less]
Good evening
i installed fedora 11 in my laptop Intel pentium III coppermine
i'd like to flash the bios using flashrom
the objectif is ( i hope) to fix a display problem - stripes on the
screen, especially when i move the mouse.
i tried to fix the problem with Xorg.conf and system-config-display
withoot any success. Some people drived me in the french fedora forum.
They invite my to join the flashrom IRC chat.
for your information here a report when i launch flashrom with a terminal.
…
[View More]flashrom v0.9.1-r710
No coreboot table found.
Found chipset "Intel PIIX4/4E/4M", enabling flash write... OK.
This chipset supports the following protocols: Non-SPI.
Calibrating delay loop... OK.
No EEPROM/flash device found.
If you know which flash chip you have, and if this version of flashrom
supports a similar flash chip, you can try to force read your chip. Run:
flashrom -f -r -c similar_supported_flash_chip filename
Note: flashrom can never write when the flash chip isn't found
automatically.
i will stay connect on #flashrom as much as I can.
Thank you for your help
hope to hear from you soon
regards
guillaume de bamako
[View Less]
See patch.
I'm thankful for better suggestions to track which chipsets and
especially boards can decode how much.
For boards we need to autodetect them (not possible for all boards
unfortunately). For those with board-enables we could reuse that
table and enhance/add board-enables, whether that's a good idea
is another issue.
For boards that cannot be autodetected we should at least have a table
of the max. supported ROM chip size, which can be printed in
"flashrom -L" and in the wiki.
Uwe.…
[View More]
--
http://www.hermann-uwe.de | http://www.holsham-traders.dehttp://www.crazy-hacks.org | http://www.unmaintained-free-software.org
[View Less]