summaryrefslogtreecommitdiff
path: root/sys/dev/i2c/i2c_scan.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2007-10-18 11:03:10 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2007-10-18 11:03:10 +0000
commit1c8f120dc9df0f7bdf0427418018e8d6a688f3ac (patch)
tree493bce4b53af2f80989e09804d8805a17c229560 /sys/dev/i2c/i2c_scan.c
parent25835069fa09a6851aa4658d033c5047452b25bb (diff)
Check to see if the SPD EEPROM size looks sane (ie < 32K)
when trying to decide if we have found an SPD EEPROM. ok deraadt@
Diffstat (limited to 'sys/dev/i2c/i2c_scan.c')
-rw-r--r--sys/dev/i2c/i2c_scan.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/i2c/i2c_scan.c b/sys/dev/i2c/i2c_scan.c
index cea55cd62e1..59173813c22 100644
--- a/sys/dev/i2c/i2c_scan.c
+++ b/sys/dev/i2c/i2c_scan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i2c_scan.c,v 1.104 2007/10/17 17:29:54 deraadt Exp $ */
+/* $OpenBSD: i2c_scan.c,v 1.105 2007/10/18 11:03:09 jsg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt <deraadt@openbsd.org>
@@ -904,7 +904,10 @@ iic_probe_eeprom(struct device *self, struct i2cbus_attach_args *iba,
int reg, csum = 0;
char *name = NULL;
- /* only check SPD memory EEPROMs for now */
+ /* SPD EEPROMs should only set lower nibble for size (ie <= 32K) */
+ if ((iicprobe(0x01) & 0xf0) != 0)
+ return (name);
+
for (reg = 0; reg < 0x3f; reg++)
csum += iicprobe(reg);