Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Initial implementation of ibmhawk(4) driver for sensors behi...
details: https://anonhg.NetBSD.org/src/rev/c79225a0afd3
branches: trunk
changeset: 762041:c79225a0afd3
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Feb 14 08:50:38 2011 +0000
description:
Initial implementation of ibmhawk(4) driver for sensors behind the IBM Hawk
on-board Integrated Systems Management Processor found on some eServers.
Tested on an IBM eServer x335.
diffstat:
distrib/sets/lists/man/mi | 5 +-
share/man/man4/Makefile | 4 +-
share/man/man4/ibmhawk.4 | 58 ++++++
sys/arch/amd64/conf/GENERIC | 7 +-
sys/arch/i386/conf/ALL | 7 +-
sys/arch/i386/conf/GENERIC | 7 +-
sys/dev/i2c/files.i2c | 7 +-
sys/dev/i2c/ibmhawk.c | 386 ++++++++++++++++++++++++++++++++++++++++++++
sys/dev/i2c/ibmhawkreg.h | 86 +++++++++
sys/dev/i2c/ibmhawkvar.h | 51 +++++
10 files changed, 608 insertions(+), 10 deletions(-)
diffs (truncated from 750 to 300 lines):
diff -r e32e46d90f98 -r c79225a0afd3 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Mon Feb 14 06:21:29 2011 +0000
+++ b/distrib/sets/lists/man/mi Mon Feb 14 08:50:38 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1287 2011/02/10 14:04:30 rmind Exp $
+# $NetBSD: mi,v 1.1288 2011/02/14 08:50:38 hannken Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -1130,6 +1130,7 @@
./usr/share/man/cat4/i4btrc.0 man-obsolete obsolete
./usr/share/man/cat4/i915drm.0 man-sys-catman .cat
./usr/share/man/cat4/iavc.0 man-sys-catman .cat
+./usr/share/man/cat4/ibmhawk.0 man-sys-catman .cat
./usr/share/man/cat4/ichlpcib.0 man-obsolete obsolete
./usr/share/man/cat4/ichsmb.0 man-sys-catman .cat
./usr/share/man/cat4/icmp.0 man-sys-catman .cat
@@ -3860,6 +3861,7 @@
./usr/share/man/html4/i386/vesafb.html man-obsolete obsolete
./usr/share/man/html4/i915drm.html man-sys-htmlman html
./usr/share/man/html4/iavc.html man-sys-htmlman html
+./usr/share/man/html4/ibmhawk.html man-sys-htmlman html
./usr/share/man/html4/ichlpcib.html man-obsolete obsolete
./usr/share/man/html4/ichsmb.html man-sys-htmlman html
./usr/share/man/html4/icmp.html man-sys-htmlman html
@@ -6425,6 +6427,7 @@
./usr/share/man/man4/i4btrc.4 man-obsolete obsolete
./usr/share/man/man4/i915drm.4 man-sys-man .man
./usr/share/man/man4/iavc.4 man-sys-man .man
+./usr/share/man/man4/ibmhawk.4 man-sys-man .man
./usr/share/man/man4/ichlpcib.4 man-obsolete obsolete
./usr/share/man/man4/ichsmb.4 man-sys-man .man
./usr/share/man/man4/icmp.4 man-sys-man .man
diff -r e32e46d90f98 -r c79225a0afd3 share/man/man4/Makefile
--- a/share/man/man4/Makefile Mon Feb 14 06:21:29 2011 +0000
+++ b/share/man/man4/Makefile Mon Feb 14 08:50:38 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.549 2011/02/09 15:31:30 tsutsui Exp $
+# $NetBSD: Makefile,v 1.550 2011/02/14 08:50:39 hannken Exp $
# @(#)Makefile 8.1 (Berkeley) 6/18/93
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -28,7 +28,7 @@
gcscaudio.4 gem.4 genfb.4 gentbi.4 geodeide.4 \
glxtphy.4 gpib.4 gpio.4 gpiolock.4 gpiosim.4 gre.4 gphyter.4 gsip.4 \
hdaudio.4 hifn.4 hme.4 hpqlb.4 hptide.4 \
- ichsmb.4 icmp.4 icp.4 icsphy.4 iee.4 ieee80211.4 \
+ ibmhawk.4 ichsmb.4 icmp.4 icp.4 icsphy.4 iee.4 ieee80211.4 \
ifmedia.4 igphy.4 igsfb.4 iha.4 ihphy.4 iic.4 inet.4 ikphy.4 inphy.4 \
intersil7170.4 \
ioasic.4 ioat.4 iop.4 iophy.4 iopsp.4 ip.4 ipkdb.4 ipmi.4 ipw.4 \
diff -r e32e46d90f98 -r c79225a0afd3 share/man/man4/ibmhawk.4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/ibmhawk.4 Mon Feb 14 08:50:38 2011 +0000
@@ -0,0 +1,58 @@
+.\" $NetBSD: ibmhawk.4,v 1.1 2011/02/14 08:50:39 hannken Exp $
+.\"
+.\" Copyright (c) 2011 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Juergen Hannken-Illjes.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd February 14, 2011
+.Dt IBMHAWK 4
+.Os
+.Sh NAME
+.Nm ibmhawk
+.Nd IBM Hawk Integrated Systems Management Processor
+.Sh SYNOPSUS
+.Cd "ibmhawk0 at iic?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the temperature, voltage and
+fan sensors present on IBM eServers equipped with an on-board
+Hawk Integrated Systems Management Processor.
+.Pp
+The
+.Nm
+driver reports these sensors through the
+.Xr envsys 4
+API.
+.Sh SEE ALSO
+.Xr envsys 4 ,
+.Xr envstat 8 ,
+.Xr powerd 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 6.0 .
diff -r e32e46d90f98 -r c79225a0afd3 sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC Mon Feb 14 06:21:29 2011 +0000
+++ b/sys/arch/amd64/conf/GENERIC Mon Feb 14 08:50:38 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.303 2011/02/13 04:21:23 jym Exp $
+# $NetBSD: GENERIC,v 1.304 2011/02/14 08:50:39 hannken Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.303 $"
+#ident "GENERIC-$Revision: 1.304 $"
maxusers 64 # estimated number of users
@@ -428,6 +428,9 @@
#wbsio* at isa? port 0x2e
#wbsio* at isa? port 0x4e
+# IBM Hawk Integrated Systems Management Processor
+#ibmhawk0 at iic? addr 0x37
+
# LM7[89] and compatible hardware monitors
# Use flags to select temp sensor type (see lm(4) man page for details)
#lm0 at isa? port 0x290 flags 0x0 # other common ports: 0x280, 0x310
diff -r e32e46d90f98 -r c79225a0afd3 sys/arch/i386/conf/ALL
--- a/sys/arch/i386/conf/ALL Mon Feb 14 06:21:29 2011 +0000
+++ b/sys/arch/i386/conf/ALL Mon Feb 14 08:50:38 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.286 2011/02/11 01:59:56 jmcneill Exp $
+# $NetBSD: ALL,v 1.287 2011/02/14 08:50:39 hannken Exp $
# From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
#
# ALL machine description file
@@ -17,7 +17,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "ALL-$Revision: 1.286 $"
+#ident "ALL-$Revision: 1.287 $"
maxusers 64 # estimated number of users
@@ -708,6 +708,9 @@
dbcool* at iic? addr 0x2D # Tyan S2881
dbcool* at iic? addr 0x2E # Tyan S2882-D
+# IBM Hawk Integrated Systems Management Processor
+ibmhawk0 at iic? addr 0x37
+
# LM7[89] and compatible hardware monitors
# Use flags to select temp sensor type (see lm(4) man page for details)
lm0 at iic? addr 0x2e flags 0x0
diff -r e32e46d90f98 -r c79225a0afd3 sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC Mon Feb 14 06:21:29 2011 +0000
+++ b/sys/arch/i386/conf/GENERIC Mon Feb 14 08:50:38 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1013 2011/02/13 04:37:21 jym Exp $
+# $NetBSD: GENERIC,v 1.1014 2011/02/14 08:50:39 hannken Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.1013 $"
+#ident "GENERIC-$Revision: 1.1014 $"
maxusers 64 # estimated number of users
@@ -678,6 +678,9 @@
#wbsio* at isa? port 0x2e
#wbsio* at isa? port 0x4e
+# IBM Hawk Integrated Systems Management Processor
+#ibmhawk0 at iic? addr 0x37
+
# LM7[89] and compatible hardware monitors
# Use flags to select temp sensor type (see lm(4) man page for details)
#lm0 at isa? port 0x290 flags 0x0 # other common: 0x280, 0x310
diff -r e32e46d90f98 -r c79225a0afd3 sys/dev/i2c/files.i2c
--- a/sys/dev/i2c/files.i2c Mon Feb 14 06:21:29 2011 +0000
+++ b/sys/dev/i2c/files.i2c Mon Feb 14 08:50:38 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.i2c,v 1.32 2011/01/21 19:11:47 jakllsch Exp $
+# $NetBSD: files.i2c,v 1.33 2011/02/14 08:50:39 hannken Exp $
defflag opt_i2cbus.h I2C_SCAN
define i2cbus { }
@@ -145,3 +145,8 @@
device g760a: sysmon_envsys
attach g760a at iic
file dev/i2c/g760a.c g760a
+
+# IBM Hawk Integrated Systems Management Processor
+device ibmhawk: sysmon_envsys
+attach ibmhawk at iic
+file dev/i2c/ibmhawk.c ibmhawk
diff -r e32e46d90f98 -r c79225a0afd3 sys/dev/i2c/ibmhawk.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/i2c/ibmhawk.c Mon Feb 14 08:50:38 2011 +0000
@@ -0,0 +1,386 @@
+/* $NetBSD: ibmhawk.c,v 1.1 2011/02/14 08:50:39 hannken Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Juergen Hannken-Illjes.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/systm.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/bswap.h>
+
+#include <dev/sysmon/sysmonvar.h>
+#include <dev/i2c/i2cvar.h>
+#include <dev/i2c/ibmhawkreg.h>
+#include <dev/i2c/ibmhawkvar.h>
+
+#if !defined(IBMHAWK_DEBUG) /* Set to 2 for verbose debug. */
+#if defined(DEBUG)
+#define IBMHAWK_DEBUG 1
+#else
+#define IBMHAWK_DEBUG 0
+#endif
+#endif
+
+/*
+ * Known sensors.
+ */
+static struct ibmhawk_sensordesc {
+ const char *desc;
+ uint32_t units;
+ int offset;
+} ibmhawk_sensors[] = {
+ { "Ambient temperature", ENVSYS_STEMP, IBMHAWK_T_AMBIENT },
+ { "CPU 1 temperature", ENVSYS_STEMP, IBMHAWK_T_CPU },
+ { "CPU 2 temperature", ENVSYS_STEMP, IBMHAWK_T_CPU+1 },
+ { "12 Voltage sensor", ENVSYS_SVOLTS_DC, IBMHAWK_V_VOLTAGE },
+ { "5 Voltage sensor", ENVSYS_SVOLTS_DC, IBMHAWK_V_VOLTAGE+1 },
+ { "3.3 Voltage sensor", ENVSYS_SVOLTS_DC, IBMHAWK_V_VOLTAGE+2 },
+ { "2.5 Voltage sensor", ENVSYS_SVOLTS_DC, IBMHAWK_V_VOLTAGE+3 },
+ { "1.5 Voltage sensor", ENVSYS_SVOLTS_DC, IBMHAWK_V_VOLTAGE+4 },
+ { "1.25 Voltage sensor", ENVSYS_SVOLTS_DC, IBMHAWK_V_VOLTAGE+5 },
+ { "VRM 1", ENVSYS_SVOLTS_DC, IBMHAWK_V_VOLTAGE+6 },
+ { "Fan 1", ENVSYS_SFANRPM, IBMHAWK_F_FAN },
+ { "Fan 2", ENVSYS_SFANRPM, IBMHAWK_F_FAN+1 },
+ { "Fan 3", ENVSYS_SFANRPM, IBMHAWK_F_FAN+2 },
+ { "Fan 4", ENVSYS_SFANRPM, IBMHAWK_F_FAN+3 },
+ { "Fan 5", ENVSYS_SFANRPM, IBMHAWK_F_FAN+4 },
+ { "Fan 6", ENVSYS_SFANRPM, IBMHAWK_F_FAN+5 },
+};
+static const int ibmhawk_num_sensors =
+ (sizeof(ibmhawk_sensors)/sizeof(ibmhawk_sensors[0]));
+
+static int ibmhawk_match(device_t, cfdata_t, void *);
+static void ibmhawk_attach(device_t, device_t, void *);
+static int ibmhawk_detach(device_t, int);
Home |
Main Index |
Thread Index |
Old Index