diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-10-09 16:57:48 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-10-09 16:57:48 +0000 |
commit | d77b3f516b36f537c0e4c5626461f1b82f01f860 (patch) | |
tree | f9f93edfb18f866c5fa3b96ae3694f1cbc90d26c /sys/dev/i2c | |
parent | e4143a86bd8fff8512eeb151a0a7751b7410f172 (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')
-rw-r--r-- | sys/dev/i2c/i2c.c | 13 | ||||
-rw-r--r-- | sys/dev/i2c/i2c_scan.c | 19 |
2 files changed, 17 insertions, 15 deletions
diff --git a/sys/dev/i2c/i2c.c b/sys/dev/i2c/i2c.c index be0a8dc710f..3db9c350972 100644 --- a/sys/dev/i2c/i2c.c +++ b/sys/dev/i2c/i2c.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i2c.c,v 1.14 2006/02/26 20:24:46 deraadt Exp $ */ +/* $OpenBSD: i2c.c,v 1.15 2007/10/09 16:57:47 deraadt Exp $ */ /* $NetBSD: i2c.c,v 1.1 2003/09/30 00:35:31 thorpej Exp $ */ /* @@ -48,8 +48,6 @@ #define IICCF_ADDR 0 #define IICCF_SIZE 1 -#include "ipmi.h" - struct iic_softc { struct device sc_dev; i2c_tag_t sc_tag; @@ -130,15 +128,6 @@ iic_attach(struct device *parent, struct device *self, void *aux) sc->sc_tag = iba->iba_tag; -#if NIPMI > 0 - extern int ipmi_enabled; - - if (ipmi_enabled) { - printf(": disabled to avoid ipmi0 interactions\n"); - return; - } -#endif - printf("\n"); /* 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++) { |