summaryrefslogtreecommitdiff
path: root/util/flashrom/jedec.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/flashrom/jedec.c')
-rw-r--r--util/flashrom/jedec.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/util/flashrom/jedec.c b/util/flashrom/jedec.c
index 958875194a..e818294f0e 100644
--- a/util/flashrom/jedec.c
+++ b/util/flashrom/jedec.c
@@ -27,6 +27,14 @@
#define MAX_REFLASH_TRIES 0x10
+/* Check one byte for odd parity */
+uint8_t oddparity(uint8_t val)
+{
+ val = (val ^ (val >> 4)) & 0xf;
+ val = (val ^ (val >> 2)) & 0x3;
+ return (val ^ (val >> 1)) & 0x1;
+}
+
void toggle_ready_jedec(volatile uint8_t *dst)
{
unsigned int i = 0;
@@ -123,7 +131,10 @@ int probe_jedec(struct flashchip *flash)
*(volatile uint8_t *)(bios + 0x5555) = 0xF0;
myusec_delay(40);
- printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, largeid1, largeid2);
+ printf_debug("%s: id1 0x%x, id2 0x%x", __FUNCTION__, largeid1, largeid2);
+ if (!oddparity(id1))
+ printf_debug(", id1 parity violation");
+ printf_debug("\n");
if (largeid1 == flash->manufacture_id && largeid2 == flash->model_id)
return 1;