summaryrefslogtreecommitdiffstats
path: root/spi.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2008-05-14 12:03:06 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2008-05-14 12:03:06 +0000
commitb5ad9196af122455aedcabea05ca4436be18fcee (patch)
tree96e3402473e7630b467b7befe97e0a03ecdc21f4 /spi.c
parent7e692090cba49fa425518ae1d1d5ba6925dfbfe8 (diff)
downloadflashrom-b5ad9196af122455aedcabea05ca4436be18fcee.zip
flashrom-b5ad9196af122455aedcabea05ca4436be18fcee.tar.gz
Check the JEDEC vendor ID for correct parity
Flash chips which can be detected by JEDEC probe routines all have vendor IDs with correct parity. Use a parity check as additional hint whether a vendor ID makes sense. Note: Device IDs have no parity requirements whatsoever. Corresponding to flashrom svn r231 and coreboot v2 svn r3308. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Peter Stuge <peter@stuge.se>
Diffstat (limited to 'spi.c')
-rw-r--r--spi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/spi.c b/spi.c
index 5cfc052..786d555 100644
--- a/spi.c
+++ b/spi.c
@@ -71,8 +71,12 @@ int probe_spi(struct flashchip *flash)
uint32_t manuf_id;
uint32_t model_id;
if (!spi_rdid(readarr)) {
+ if (!oddparity(readarr[0]))
+ printf_debug("RDID byte 0 parity violation.\n");
/* Check if this is a continuation vendor ID */
if (readarr[0] == 0x7f) {
+ if (!oddparity(readarr[1]))
+ printf_debug("RDID byte 1 parity violation.\n");
manuf_id = (readarr[0] << 8) | readarr[1];
model_id = readarr[2];
} else {
OpenPOWER on IntegriCloud