summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2005-12-13 02:31:46 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2005-12-13 02:31:46 +0000
commit5683571cc4899d549f1ef435095f7a5cd23f47f9 (patch)
treefda33a7318269dedb46cdbbbddb3a172eb005af8 /sys/arch
parent2cb3b3cc2c95f3193d800d0d2948aef08789cb5c (diff)
the status field for power supplies is different to the rest of the
sensors. as a result i wasnt being shown that i have a failed power supply. power supplies now show up like this: hw.sensors.14=esm0, Power Supply 1, OK, raw, 65359 hw.sensors.15=esm0, Power Supply 2, OK, raw, 65359 hw.sensors.16=esm0, Power Supply 3, CRITICAL, raw, 65347 anyone got a spare 2500 power supply they want to send to me? ok deraadt@ marco@ jordan@ VS: ----------------------------------------------------------------------
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/esm.c23
-rw-r--r--sys/arch/i386/i386/esmreg.h35
2 files changed, 49 insertions, 9 deletions
diff --git a/sys/arch/i386/i386/esm.c b/sys/arch/i386/i386/esm.c
index c23dc6f2d48..a9d4a4d5307 100644
--- a/sys/arch/i386/i386/esm.c
+++ b/sys/arch/i386/i386/esm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: esm.c,v 1.26 2005/12/01 00:19:14 deraadt Exp $ */
+/* $OpenBSD: esm.c,v 1.27 2005/12/13 02:31:45 dlg Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -391,6 +391,15 @@ esm_refresh(void *arg)
es->es_sensor->status = SENSOR_S_OK;
break;
+ case ESM_S_PWRSUP:
+ if (val->v_status & ESM2_VS_PSU_FAIL) {
+ es->es_sensor->status = SENSOR_S_CRIT;
+ break;
+ }
+
+ es->es_sensor->status = SENSOR_S_OK;
+ break;
+
default:
break;
}
@@ -780,8 +789,16 @@ esm_make_sensors(struct esm_softc *sc, struct esm_devmap *devmap,
DEVNAME(sc), devmap->index, i, sensor_map[i].name,
val->v_reading, val->v_status, val->v_checksum);
- if ((val->v_status & ESM2_VS_VALID) != ESM2_VS_VALID)
- continue;
+ switch (sensor_map[i].type) {
+ case ESM_S_PWRSUP:
+ if (!(val->v_status & ESM2_VS_PSU_INST))
+ continue;
+ break;
+ default:
+ if (!(val->v_status & ESM2_VS_VALID))
+ continue;
+ break;
+ }
es = malloc(sizeof(struct esm_sensor), M_DEVBUF, M_NOWAIT);
if (es == NULL)
diff --git a/sys/arch/i386/i386/esmreg.h b/sys/arch/i386/i386/esmreg.h
index 3aee53b9fbf..1aded68e2e7 100644
--- a/sys/arch/i386/i386/esmreg.h
+++ b/sys/arch/i386/i386/esmreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: esmreg.h,v 1.9 2005/11/30 11:46:57 dlg Exp $ */
+/* $OpenBSD: esmreg.h,v 1.10 2005/12/13 02:31:45 dlg Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -212,11 +212,34 @@ struct esm_smb_resp {
#define resp_thr _._thr
} __packed;
-#define ESM2_VS_VALID 0x07
-#define ESM2_VS_SLOT 0x04
-
-#define isValidSensor(state) (((state) & ESM_STATE_MASK) == ESM_VALID_SENSOR)
-#define isValidSlot(state) (((state) & ESM_VALID_SLOT) == ESM_VALID_SLOT)
+/* esm_smb_resp_val drive values */
+#define ESM2_V_DRV_EMPTY 1
+#define ESM2_V_DRV_READY 2
+#define ESM2_V_DRV_POWERUP 3
+#define ESM2_V_DRV_ONLINE 4
+#define ESM2_V_DRV_IDLE 5
+#define ESM2_V_DRV_ACTIVE 6
+#define ESM2_V_DRV_REBUILD 7
+#define ESM2_V_DRV_POWERDOWN 8
+#define ESM2_V_DRV_FAIL 9
+#define ESM2_V_DRV_PFAIL 10
+
+/* esm_smb_resp_val powersupply values */
+#define ESM2_V_PSU_ID(x) ((x)>>8 & 0xff)
+#define ESM2_V_PSU_AC (1<<0)
+#define ESM2_V_PSU_SW (1<<1)
+#define ESM2_V_PSU_OK (1<<2)
+#define ESM2_V_PSU_ON (1<<3)
+#define ESM2_V_PSU_FFAN (1<<4)
+#define ESM2_V_PSU_OTMP (1<<5)
+
+/* esm_smb_resp_val status */
+#define ESM2_VS_VALID (1<<2)
+/* the powersupplies have a special status field */
+#define ESM2_VS_PSU_INST (1<<0)
+#define ESM2_VS_PSU_PSON (1<<1)
+#define ESM2_VS_PSU_FAIL (1<<2)
+#define ESM2_VS_PSU_PSDB (1<<3)
enum esm_dev_type {
ESM2_DEV_ESM2 = 1,