diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2013-10-09 09:40:02 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2013-10-09 09:40:02 +0000 |
commit | e999601c3ca3ad9e4079ac07bdb6fa2c5862be20 (patch) | |
tree | 89d46d7293fa8fee464189f2b005d4c9eebd1703 | |
parent | 09031ac62e58cfacdc7e5781a0626dcd9a0b906e (diff) |
Include the 'state of health' field in the bbu ok sensor value.
The dell perc 6/i sets this to zero (meaning bad) when it
decides the battery doesn't have enough capacity for it to
allow write back mode, but doesn't set any of the other flags
to tell us why.
ok dlg@, tested by sthen@
-rw-r--r-- | sys/dev/ic/mfi.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index 9019cc40288..b62130a3aef 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.146 2013/05/18 08:39:47 jmc Exp $ */ +/* $OpenBSD: mfi.c,v 1.147 2013/10/09 09:40:01 jmatthew Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -2050,6 +2050,7 @@ mfi_bbu(struct mfi_softc *sc) struct mfi_bbu_status bbu; u_int32_t status; u_int32_t mask; + u_int32_t soh_bad; int i; if (mfi_mgmt(sc, MR_DCMD_BBU_GET_STATUS, MFI_DATA_IN, @@ -2068,9 +2069,11 @@ mfi_bbu(struct mfi_softc *sc) switch (bbu.battery_type) { case MFI_BBU_TYPE_IBBU: mask = MFI_BBU_STATE_BAD_IBBU; + soh_bad = 0; break; case MFI_BBU_TYPE_BBU: mask = MFI_BBU_STATE_BAD_BBU; + soh_bad = (bbu.detail.bbu.is_SOH_good == 0); break; case MFI_BBU_TYPE_NONE: @@ -2090,8 +2093,9 @@ mfi_bbu(struct mfi_softc *sc) status = letoh32(bbu.fw_status); - sc->sc_bbu[0].value = (status & mask) ? 0 : 1; - sc->sc_bbu[0].status = (status & mask) ? SENSOR_S_CRIT : SENSOR_S_OK; + sc->sc_bbu[0].value = ((status & mask) || soh_bad) ? 0 : 1; + sc->sc_bbu[0].status = ((status & mask) || soh_bad) ? SENSOR_S_CRIT : + SENSOR_S_OK; sc->sc_bbu[1].value = letoh16(bbu.voltage) * 1000; sc->sc_bbu[2].value = (int16_t)letoh16(bbu.current) * 1000; |