Evil twins are chips with identical IDs and different/incompatible characteristics (e.g. eraseblock layout, write strategy or size). Annotate them so flashrom can tell the user that it's not a matter of simply picking one of the chips in a list of multiple chips found.
This patch only touches the AMIC A25L40PT and A25L40PU. I'm fairly sure there are more evil twins, but those two were touched recently.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-evil_twin/flash.h =================================================================== --- flashrom-evil_twin/flash.h (Revision 1096) +++ flashrom-evil_twin/flash.h (Arbeitskopie) @@ -180,6 +180,14 @@ #define FEATURE_ADDR_2AA (1 << 2) #define FEATURE_ADDR_AAA (2 << 2) #define FEATURE_ADDR_SHIFTED (1 << 5) +/* Evil twins are chips with the same ID and different erase/write + * characteristics. The second macro discards its arguments for now and allows + * human readable annotation while at the same time providing a zero cost + * simplified machine readable annotation. The first macro is there to check + * quickly if the chip has any evil twins. + */ +#define FEATURE_EVIL_TWIN (1 << 6) +#define FEATURE_EVIL_TWIN_OF(a,b) (1 << 6)
struct flashchip { const char *vendor; Index: flashrom-evil_twin/flashchips.c =================================================================== --- flashrom-evil_twin/flashchips.c (Revision 1096) +++ flashrom-evil_twin/flashchips.c (Arbeitskopie) @@ -1372,6 +1372,7 @@ .model_id = AMIC_A25L40PT, .total_size = 512, .page_size = 256, + .feature_bits = FEATURE_EVIL_TWIN_OF("AMIC", "A25L40PU"), .tested = TEST_OK_PRW, .probe = probe_spi_rdid4, .probe_timing = TIMING_ZERO, @@ -1404,6 +1405,7 @@ .model_id = AMIC_A25L40PU, .total_size = 512, .page_size = 256, + .feature_bits = FEATURE_EVIL_TWIN_OF("AMIC", "A25L40PT"), .tested = TEST_OK_PRW, .probe = probe_spi_rdid4, .probe_timing = TIMING_ZERO, Index: flashrom-evil_twin/cli_classic.c =================================================================== --- flashrom-evil_twin/cli_classic.c (Revision 1096) +++ flashrom-evil_twin/cli_classic.c (Arbeitskopie) @@ -399,7 +399,8 @@ if (flashes[1]) { printf("Multiple flash chips were detected:"); for (i = 0; i < ARRAY_SIZE(flashes) && flashes[i]; i++) - printf(" %s", flashes[i]->name); + printf("%s %s%s", i ? "," : "", flashes[i]->name, + flashes[i]->feature_bits & FEATURE_EVIL_TWIN ? " (evil twin)" : ""); printf("\nPlease specify which chip to use with the -c <chipname> option.\n"); programmer_shutdown(); exit(1);
On Thu, 2010-07-22 at 14:54 +0200, Carl-Daniel Hailfinger wrote:
Evil twins are chips with identical IDs and different/incompatible characteristics (e.g. eraseblock layout, write strategy or size). Annotate them so flashrom can tell the user that it's not a matter of simply picking one of the chips in a list of multiple chips found.
This patch only touches the AMIC A25L40PT and A25L40PU. I'm fairly sure there are more evil twins, but those two were touched recently.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
I should point out that the A25L40PT and A25L40PU got erase-tested by Rudolf Marek while we were trying to figure out if they were really evil twins. My patch added the erase-tested bit, but I think you took this out.
Dan
On 22.07.2010 15:43, Daniel Lenski wrote:
On Thu, 2010-07-22 at 14:54 +0200, Carl-Daniel Hailfinger wrote:
Evil twins are chips with identical IDs and different/incompatible characteristics (e.g. eraseblock layout, write strategy or size). Annotate them so flashrom can tell the user that it's not a matter of simply picking one of the chips in a list of multiple chips found.
This patch only touches the AMIC A25L40PT and A25L40PU. I'm fairly sure there are more evil twins, but those two were touched recently.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
I should point out that the A25L40PT and A25L40PU got erase-tested by Rudolf Marek while we were trying to figure out if they were really evil twins. My patch added the erase-tested bit, but I think you took this out.
Yes, sorry for not mentioning this in the commit mail. Right now we only check if at least one erase function worked. There is no way (except editing the source code) to test all erase functions for a given chip. This will change once [PATCH] Move implicit erase out of chip drivers, clean up is committed and we have partial write.
Regards, Carl-Daniel