summaryrefslogtreecommitdiff
path: root/sys/dev/i2c/i2c_scan.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-10-09 16:57:48 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-10-09 16:57:48 +0000
commitd77b3f516b36f537c0e4c5626461f1b82f01f860 (patch)
treef9f93edfb18f866c5fa3b96ae3694f1cbc90d26c /sys/dev/i2c/i2c_scan.c
parente4143a86bd8fff8512eeb151a0a7751b7410f172 (diff)
we have been knocking out i2c when ipmi exists on a machine (because
there are ipmi bmc's that apparently violate i2c bus master locking). but those problems bite us only for sensors which we re-scan every few seconds, and then we hit the ipmi bmc's races. for non-sensor devices (like spdmem) it is probably ok to look once. let's try that method for a while and see if anyone sees breakage.
Diffstat (limited to 'sys/dev/i2c/i2c_scan.c')
-rw-r--r--sys/dev/i2c/i2c_scan.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sys/dev/i2c/i2c_scan.c b/sys/dev/i2c/i2c_scan.c
index 8ca6428feb2..3571ea4c933 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.101 2007/10/07 14:26:41 deraadt Exp $ */
+/* $OpenBSD: i2c_scan.c,v 1.102 2007/10/09 16:57:47 deraadt Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt <deraadt@openbsd.org>
@@ -20,6 +20,8 @@
* I2C bus scanning.
*/
+#include "ipmi.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
@@ -62,12 +64,14 @@ struct iicprobelist probe_addrs_eeprom[] = {
char *iic_probe_sensor(struct device *, struct i2cbus_attach_args *, u_int8_t);
char *iic_probe_eeprom(struct device *, struct i2cbus_attach_args *, u_int8_t);
+#define PFLAG_SENSOR 1
static struct {
struct iicprobelist *pl;
char *(*probe)(struct device *, struct i2cbus_attach_args *, u_int8_t);
+ int flags;
} probes[] = {
- { probe_addrs_sensor, iic_probe_sensor },
- { probe_addrs_eeprom, iic_probe_eeprom },
+ { probe_addrs_sensor, iic_probe_sensor, PFLAG_SENSOR },
+ { probe_addrs_eeprom, iic_probe_eeprom, 0 },
{ NULL, NULL }
};
@@ -902,6 +906,15 @@ iic_scan(struct device *self, struct i2cbus_attach_args *iba)
bzero(ignore_addrs, sizeof(ignore_addrs));
for (i = 0; probes[i].probe; i++) {
+#if NIPMI > 0
+ extern int ipmi_enabled;
+
+ if ((probes[i].flags & PFLAG_SENSOR) && ipmi_enabled) {
+ printf("%s: skipping sensors to avoid ipmi0 interactions\n",
+ self->dv_xname);
+ continue;
+ }
+#endif
pl = probes[i].pl;
for (j = 0; pl[j].start && pl[j].end; j++) {
for (addr = pl[j].start; addr <= pl[j].end; addr++) {