diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2006-07-28 20:46:13 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2006-07-28 20:46:13 +0000 |
commit | e646117c074b1adcf0fba93a06659050d3008003 (patch) | |
tree | 9b277a45f0a8619185c289691efa52231cb1e031 | |
parent | ada49c0e14c7ffadf8df314ab60a3a0ccc577a9d (diff) |
Only read 1 sensor at a time instead of all of them. This should help
systems that have a burst of activity every 10 seconds.
Also lower the polling frequency from 10 to 5 seconds.
ok jordan@
-rw-r--r-- | sys/dev/ipmi.c | 32 | ||||
-rw-r--r-- | sys/dev/ipmivar.h | 4 |
2 files changed, 25 insertions, 11 deletions
diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c index ad0d0f9eb7a..4379474c8ef 100644 --- a/sys/dev/ipmi.c +++ b/sys/dev/ipmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipmi.c,v 1.43 2006/07/28 20:41:02 jordan Exp $ */ +/* $OpenBSD: ipmi.c,v 1.44 2006/07/28 20:46:12 marco Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave @@ -62,7 +62,7 @@ int ipmi_dbg = 0; int ipmi_poll = 1; int ipmi_enabled = 0; -#define SENSOR_REFRESH_RATE (10 * hz) +#define SENSOR_REFRESH_RATE (5 * hz) #define SMBIOS_TYPE_IPMI 0x26 @@ -311,13 +311,14 @@ bmc_io_wait_cold(struct ipmi_softc *sc, int offset, u_int8_t mask, u_int8_t value, const char *lbl) { volatile u_int8_t v; - int count = 100000; /* == 5s XXX can be shorter */ + int count = 5000000; /* == 5s XXX can be shorter */ while (count--) { v = bmc_read(sc, offset); if ((v & mask) == value) return v; - delay(50); + + delay(1); } printf("%s: bmc_io_wait_cold fails : *v=%.2x m=%.2x b=%.2x %s\n", @@ -870,7 +871,8 @@ void ipmi_smbios_probe(struct smbios_ipmi *pipmi, struct ipmi_attach_args *ia) { - dbg_printf(1, "%02x %02x %02x %02x %08llx %02x %02x\n", + dbg_printf(1, "ipmi_smbios_probe: %02x %02x %02x %02x %08llx %02x " + "%02x\n", pipmi->smipmi_if_type, pipmi->smipmi_if_rev, pipmi->smipmi_i2c_address, @@ -1048,6 +1050,7 @@ ipmi_recvcmd(struct ipmi_softc *sc, int maxlen, int *rxlen, void *data) if ((rc = buf[IPMI_MSG_CCODE]) != 0) dbg_printf(1, "ipmi_recvmsg: nfln=%.2x cmd=%.2x err=%.2x\n", buf[IPMI_MSG_NFLN], buf[IPMI_MSG_CMD], buf[IPMI_MSG_CCODE]); + dbg_printf(50, "ipmi_recvcmd: nfln=%.2x cmd=%.2x err=%.2x len=%.2x\n", buf[IPMI_MSG_NFLN], buf[IPMI_MSG_CMD], buf[IPMI_MSG_CCODE], *rxlen); @@ -1517,15 +1520,20 @@ ipmi_intr(void *arg) void ipmi_refresh_sensors(struct ipmi_softc *sc) { - struct ipmi_sensor *psensor = NULL; if (!ipmi_poll) return; - SLIST_FOREACH(psensor, &ipmi_sensor_list, list) - if (read_sensor(sc, psensor)) - printf("%s: error reading: %s\n", DEVNAME(sc), - psensor->i_sensor.desc); + if (SLIST_EMPTY(&ipmi_sensor_list)) + return; + + sc->current_sensor = SLIST_NEXT(sc->current_sensor, list); + if (sc->current_sensor == NULL) + sc->current_sensor = SLIST_FIRST(&ipmi_sensor_list); + + if (read_sensor(sc, sc->current_sensor)) + printf("%s: error reading: %s\n", DEVNAME(sc), + sc->current_sensor->i_sensor.desc); } int @@ -1682,6 +1690,10 @@ ipmi_attach(struct device *parent, struct device *self, void *aux) if (get_sdr(sc, rec, &rec)) break; + /* initialize sensor list for thread */ + if (!SLIST_EMPTY(&ipmi_sensor_list)) + sc->current_sensor = SLIST_FIRST(&ipmi_sensor_list); + /* Setup threads */ kthread_create_deferred(ipmi_create_thread, sc); diff --git a/sys/dev/ipmivar.h b/sys/dev/ipmivar.h index 196df24dc6a..7644f25ed4f 100644 --- a/sys/dev/ipmivar.h +++ b/sys/dev/ipmivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ipmivar.h,v 1.15 2006/05/21 20:55:26 alek Exp $ */ +/* $OpenBSD: ipmivar.h,v 1.16 2006/07/28 20:46:12 marco Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave @@ -101,6 +101,8 @@ struct ipmi_softc { struct rwlock sc_lock; struct ipmi_bmc_args *sc_iowait_args; + + struct ipmi_sensor *current_sensor; }; struct ipmi_thread { |