summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-11-20 01:12:45 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-11-20 01:12:45 +0000
commitaedc04631a248216b3b0e081df0e586428c28cbe (patch)
treebf814fbd7d2cccd943299f00e2ef5277b16e36ae
parentc83c474dd8c5333d052ad944a9f8f267d997eaa7 (diff)
downloadflashrom-aedc04631a248216b3b0e081df0e586428c28cbe.tar.gz
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-d.hailfinger.devel.2006@gmx.net> Acked-by: Marc Jones <marcj303@gmail.com> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@767 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--flashchips.c27
-rw-r--r--flashchips.h1
-rw-r--r--spi.c10
3 files changed, 38 insertions, 0 deletions
diff --git a/flashchips.c b/flashchips.c
index 65eb7f0..e97786f 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -3340,5 +3340,32 @@ struct flashchip flashchips[] = {
.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 }
};
diff --git a/flashchips.h b/flashchips.h
index 81ce250..95277e6 100644
--- a/flashchips.h
+++ b/flashchips.h
@@ -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 */
diff --git a/spi.c b/spi.c
index 48be29a..29c202c 100644
--- a/spi.c
+++ b/spi.c
@@ -281,6 +281,11 @@ static int probe_spi_rdid_generic(struct flashchip *flash, int bytes)
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;
}
@@ -340,6 +345,11 @@ int probe_spi_rems(struct flashchip *flash)
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;
}