summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-02-10 04:20:05 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-02-10 04:20:05 +0000
commit6127b7e571fb6532c7e05f41d532f695494a4560 (patch)
tree7bf47fb9fab2df35972b161ea794cc3e070034b3 /sys
parent4f47e6da100680ee216e99c396b5c7467b18490c (diff)
hook the amp sensors up properly. normalise their values and check the
thresholds.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/esm.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/arch/i386/i386/esm.c b/sys/arch/i386/i386/esm.c
index f542516e846..d60c87bc6ae 100644
--- a/sys/arch/i386/i386/esm.c
+++ b/sys/arch/i386/i386/esm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: esm.c,v 1.35 2006/02/10 02:55:23 dlg Exp $ */
+/* $OpenBSD: esm.c,v 1.36 2006/02/10 04:20:04 dlg Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -156,6 +156,7 @@ int esm_smb_cmd(struct esm_softc *, struct esm_smb_req *,
int64_t esm_val2temp(u_int16_t);
int64_t esm_val2volts(u_int16_t);
+int64_t esm_val2amps(u_int16_t);
/* Determine if this is a Dell server */
@@ -375,6 +376,9 @@ esm_refresh(void *arg)
es->es_sensor->value = esm_val2volts(val->v_reading) *
es->es_arg;
break;
+ case ESM_S_AMPS:
+ es->es_sensor->value = esm_val2amps(val->v_reading);
+ break;
case ESM_S_DRIVES:
for (i = 0; i < nsensors; i++) {
es->es_sensor[i].value =
@@ -396,6 +400,7 @@ esm_refresh(void *arg)
case ESM_S_TEMP:
case ESM_S_FANRPM:
case ESM_S_VOLTS:
+ case ESM_S_AMPS:
if (val->v_reading >= es->es_thresholds.th_hi_crit ||
val->v_reading <= es->es_thresholds.th_lo_crit) {
es->es_sensor->status = SENSOR_S_CRIT;
@@ -895,6 +900,7 @@ esm_make_sensors(struct esm_softc *sc, struct esm_devmap *devmap,
/* FALLTHROUGH */
case ESM_S_TEMP:
case ESM_S_FANRPM:
+ case ESM_S_AMPS:
if (esm_thresholds(sc, devmap, es) != 0) {
free(es, M_DEVBUF);
continue;
@@ -1074,3 +1080,9 @@ esm_val2volts(u_int16_t value)
{
return ((int64_t)value * 1000);
}
+
+int64_t
+esm_val2amps(u_int16_t value)
+{
+ return ((int64_t)value * 100000);
+}