Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64 Remove the envctrl driver, it is superseede...



details:   https://anonhg.NetBSD.org/src/rev/7687d83257a5
branches:  trunk
changeset: 752511:7687d83257a5
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Feb 28 11:49:44 2010 +0000

description:
Remove the envctrl driver, it is superseeded by the more general pcfiic @
ebus. Add the SB1000/SB2000 fan controll driver (tda). From OpenBSD.
Move config files over to direct configuration of i2c devices.

diffstat:

 sys/arch/sparc64/conf/GENERIC          |   19 +-
 sys/arch/sparc64/conf/SCHIZO           |    7 +-
 sys/arch/sparc64/conf/files.sparc64    |   16 +-
 sys/arch/sparc64/dev/envctrl.c         |  643 ---------------------------------
 sys/arch/sparc64/dev/envctrlreg.h      |   90 ----
 sys/arch/sparc64/dev/pcf8591_envctrl.c |  255 +++++++++++++
 sys/arch/sparc64/dev/pcfiic_ebus.c     |  222 +++++++++++
 sys/arch/sparc64/dev/tda.c             |  228 +++++++++++
 8 files changed, 730 insertions(+), 750 deletions(-)

diffs (truncated from 1558 to 300 lines):

diff -r f97afad35594 -r 7687d83257a5 sys/arch/sparc64/conf/GENERIC
--- a/sys/arch/sparc64/conf/GENERIC     Sun Feb 28 11:47:28 2010 +0000
+++ b/sys/arch/sparc64/conf/GENERIC     Sun Feb 28 11:49:44 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.117 2010/02/13 08:54:58 mrg Exp $
+# $NetBSD: GENERIC,v 1.118 2010/02/28 11:49:44 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.117 $"
+#ident                 "GENERIC-$Revision: 1.118 $"
 
 maxusers       64
 
@@ -906,17 +906,20 @@
 #### Other device configuration
 
 psm*           at ebus?                # Ultrabook IIi microcontroller
-envctrl*       at ebus?                # Ultra E450 environmental monitoring
+pcfiic*                at ebus?                # various environmental monitoring
+iic*           at pcfiic?
 lom*           at ebus?                # LOMlite lights out management
 
 # Netra X1 / T1 style environmental monitoring
 alipm*         at pci?
 iic*           at alipm?
-spdmem*                at iic? addr 0x54
-spdmem*                at iic? addr 0x55
-spdmem*                at iic? addr 0x56
-spdmem*                at iic? addr 0x57
-admtemp*       at iic? addr 0x18
+
+# I2C devices
+spdmem*                at iic? addr?
+admtemp*       at iic? addr?
+ecadc*         at iic? addr?   # envctrl/envctrltwo on E250/E450
+lmtemp*                at iic? addr?
+tda*           at iic? addr?   # fan controll on SB1000/2000
 
 ### Other pseudo-devices
 
diff -r f97afad35594 -r 7687d83257a5 sys/arch/sparc64/conf/SCHIZO
--- a/sys/arch/sparc64/conf/SCHIZO      Sun Feb 28 11:47:28 2010 +0000
+++ b/sys/arch/sparc64/conf/SCHIZO      Sun Feb 28 11:49:44 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: SCHIZO,v 1.6 2010/02/13 22:24:09 mrg Exp $
+# $NetBSD: SCHIZO,v 1.7 2010/02/28 11:49:44 martin Exp $
 #
 # GENERIC with schizo support enabled, with the annoying schizo interupt
 # option
@@ -7,7 +7,7 @@
 include        "arch/sparc64/conf/GENERIC.MP"
 #include       "arch/sparc64/conf/GENERIC"
 
-#ident         "SCHIZO.$Revision: 1.6 $"
+#ident         "SCHIZO.$Revision: 1.7 $"
 
 options        CHEETAH
 
@@ -20,6 +20,3 @@
 
 # this crashes when attaching.
 #no machfb
-
-# this matches when it isn't present. ugh.
-no admtemp
diff -r f97afad35594 -r 7687d83257a5 sys/arch/sparc64/conf/files.sparc64
--- a/sys/arch/sparc64/conf/files.sparc64       Sun Feb 28 11:47:28 2010 +0000
+++ b/sys/arch/sparc64/conf/files.sparc64       Sun Feb 28 11:49:44 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sparc64,v 1.124 2010/02/22 22:28:58 mrg Exp $
+#      $NetBSD: files.sparc64,v 1.125 2010/02/28 11:49:44 martin Exp $
 
 # @(#)files.sparc64    8.1 (Berkeley) 7/19/93
 # sparc64-specific configuration info
@@ -68,9 +68,17 @@
 attach power at sbus, ebus
 file   arch/sparc64/dev/power.c                power
 
-device envctrl: sysmon_envsys, pcf8584, i2cbus
-attach envctrl at ebus
-file   arch/sparc64/dev/envctrl.c      envctrl
+device tda
+attach tda at iic
+file   arch/sparc64/dev/tda.c                  tda
+
+device pcfiic: sysmon_envsys, pcf8584, i2cbus
+attach pcfiic at ebus
+file   arch/sparc64/dev/pcfiic_ebus.c  pcfiic
+
+device ecadc
+attach ecadc at iic
+file   arch/sparc64/dev/pcf8591_envctrl.c
 
 device lom: sysmon_envsys, sysmon_wdog
 attach lom at ebus
diff -r f97afad35594 -r 7687d83257a5 sys/arch/sparc64/dev/envctrl.c
--- a/sys/arch/sparc64/dev/envctrl.c    Sun Feb 28 11:47:28 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,643 +0,0 @@
-/*     $NetBSD: envctrl.c,v 1.11 2008/04/28 20:23:36 martin Exp $ */
-
-/*-
- * Copyright (c) 2007 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Tobias Nygren.
- *
- * 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.
- */
-
-/*
- * SUNW,envctrl Sun Ultra Enterprise 450 environmental monitoring driver
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: envctrl.c,v 1.11 2008/04/28 20:23:36 martin Exp $");
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/kthread.h>
-#include <sys/condvar.h>
-#include <sys/mutex.h>
-#include <sys/envsys.h>
-
-#include <machine/autoconf.h>
-#include <machine/promlib.h>
-
-#include <dev/ebus/ebusreg.h>
-#include <dev/ebus/ebusvar.h>
-#include <dev/i2c/i2cvar.h>
-#include <sparc64/dev/envctrlreg.h>
-#include <dev/sysmon/sysmonvar.h>
-
-#include <dev/i2c/pcf8583reg.h>        /* for WDT */
-#include <dev/ic/pcf8584var.h>
-
-static int envctrlmatch(device_t, cfdata_t, void *);
-static void envctrlattach(device_t, device_t, void *);
-
-struct envctrl_softc {
-       device_t sc_dev;
-       bus_space_tag_t sc_iot;
-       bus_space_handle_t sc_ioh;
-
-       struct pcf8584_handle sc_pcfiic;
-
-       lwp_t *sc_thread;
-       kcondvar_t sc_sleepcond;
-       kmutex_t sc_sleepmtx;
-
-       struct sysmon_envsys *sc_sme;
-       envsys_data_t sc_sensor[13];
-       uint8_t sc_keyswitch;
-       uint8_t sc_fanstate;
-       uint8_t sc_ps_state[3];
-       int sc_ps_temp_factors[256];
-       int sc_cpu_temp_factors[256];
-       uint8_t sc_ps_fan_speeds[112];
-       uint8_t sc_cpu_fan_speeds[112];
-};
-
-CFATTACH_DECL_NEW(envctrl, sizeof(struct envctrl_softc),
-    envctrlmatch, envctrlattach, NULL, NULL);
-
-static void envctrl_thread(void *);
-static void envctrl_sleep(struct envctrl_softc *, int);
-static int envctrl_write_1(struct envctrl_softc *, int, uint8_t);
-static int envctrl_write_2(struct envctrl_softc *, int, uint8_t, uint8_t);
-static int envctrl_read(struct envctrl_softc *, int, uint8_t *, int);
-static int envctrl_get_cputemp(struct envctrl_softc *, uint8_t);
-static int envctrl_get_pstemp(struct envctrl_softc *, uint8_t);
-static int envctrl_get_ambtemp(struct envctrl_softc *);
-static int envctrl_set_fanvoltage(struct envctrl_softc *, uint8_t, uint8_t);
-static uint8_t envctrl_cputemp_to_voltage(struct envctrl_softc *, int);
-static uint8_t envctrl_pstemp_to_voltage(struct envctrl_softc *, int);
-static void envctrl_init_components(struct envctrl_softc *);
-static int envctrl_init_tables(struct envctrl_softc *, int);
-static void envctrl_update_sensors(struct envctrl_softc *);
-static void envctrl_interpolate_ob_table(int *, uint8_t *);
-
-static int
-envctrlmatch(device_t parent, cfdata_t cf, void *aux)
-{
-       struct ebus_attach_args *ea = aux;
-
-       return (strcmp("SUNW,envctrl", ea->ea_name) == 0);
-}
-
-static void
-envctrlattach(device_t parent, device_t self, void *aux)
-{
-       struct envctrl_softc *sc = device_private(self);
-       struct ebus_attach_args *ea = aux;
-       bus_addr_t devaddr;
-       int i, error;
-
-       sc->sc_dev = self;
-       sc->sc_iot = ea->ea_bustag;
-       devaddr = EBUS_ADDR_FROM_REG(&ea->ea_reg[0]);
-       if (bus_space_map(sc->sc_iot, devaddr, ea->ea_reg[0].size,
-               0, &sc->sc_ioh) != 0) {
-               aprint_error(": unable to map device registers\n");
-               return;
-       }
-       if (envctrl_init_tables(sc, ea->ea_node) != 0) {
-               aprint_error(": unable to initialize tables\n");
-               return;
-       }
-       /*
-        * initialize envctrl bus
-        */
-       sc->sc_pcfiic.ha_parent = self;
-       sc->sc_pcfiic.ha_iot = sc->sc_iot;
-       sc->sc_pcfiic.ha_ioh = sc->sc_ioh;
-       pcf8584_init(&sc->sc_pcfiic);
-
-       if (envctrl_write_1(sc, ENVCTRL_FANFAIL_ADDR, 0xFF)) {
-               aprint_error(": i2c probe failed\n");
-               return;
-       }
-       aprint_normal("\n%s: Ultra Enterprise 450 environmental monitoring\n",
-           device_xname(self));
-
-       envctrl_init_components(sc);
-
-       /*
-        * fill envsys sensor structures
-        */
-       sc->sc_sme = sysmon_envsys_create();
-
-       for (i = 0; i < 8; i++)
-               sc->sc_sensor[i].units = ENVSYS_STEMP;
-
-       for (i = 0; i < 4; i++)
-               sprintf(sc->sc_sensor[i].desc, "CPU%i", i);
-
-       for (i = 4; i < 7; i++)
-               sprintf(sc->sc_sensor[i].desc, "PS%i", i - 4);
-
-       for (i = 8; i < 10; i++)
-               sc->sc_sensor[i].units = ENVSYS_SVOLTS_DC;
-
-       for (i = 10; i < 12; i++) {
-               sc->sc_sensor[i].units = ENVSYS_INTEGER;
-               sc->sc_sensor[i].flags = ENVSYS_FMONNOTSUPP;
-       }
-
-       sprintf(sc->sc_sensor[7].desc, "ambient");
-       sprintf(sc->sc_sensor[8].desc, "cpufan voltage");
-       sprintf(sc->sc_sensor[9].desc, "psfan voltage");
-       sprintf(sc->sc_sensor[10].desc, "ps failed");
-       sprintf(sc->sc_sensor[11].desc, "fans failed");
-
-       for (i = 0; i < 12; i++) {
-               if (sysmon_envsys_sensor_attach(sc->sc_sme,
-                                               &sc->sc_sensor[i])) {
-                       sysmon_envsys_destroy(sc->sc_sme);
-                       return;
-               }
-       }
-
-       sc->sc_sme->sme_name = device_xname(self);
-       sc->sc_sme->sme_flags = SME_DISABLE_REFRESH;
-
-       if (sysmon_envsys_register(sc->sc_sme)) {
-               aprint_error("%s: unable to register with sysmon\n",
-                   device_xname(self));
-               sysmon_envsys_destroy(sc->sc_sme);
-               return;
-       }
-
-       envctrl_update_sensors(sc);
-



Home | Main Index | Thread Index | Old Index