diff options
author | Michael Knudsen <mk@cvs.openbsd.org> | 2009-01-23 20:32:23 +0000 |
---|---|---|
committer | Michael Knudsen <mk@cvs.openbsd.org> | 2009-01-23 20:32:23 +0000 |
commit | ae81bb0fd5d1986ac1ba851c49f86e7aa323b4bc (patch) | |
tree | b1e322ca532cf8bf3b163745d9721e284290fbf2 /sys | |
parent | 6d54d03573c96c5e760fb506855c9a967178e0b6 (diff) |
Add schsio(4), a driver for SMSC SCH311x LPC Super I/O ICs providing
environment sensors. These are found at least on VIA Epia SN18000G
boards.
Not enabled at 0x162e and 0x164e because probing these may not be
safe according to kettenis (guess where my schsio is).
Much help from kettenis. Input from const and fgs.
ok kettenis
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/conf/GENERIC | 7 | ||||
-rw-r--r-- | sys/arch/i386/conf/GENERIC | 7 | ||||
-rw-r--r-- | sys/dev/isa/files.isa | 7 | ||||
-rw-r--r-- | sys/dev/isa/sch311x.c | 467 |
4 files changed, 485 insertions, 3 deletions
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index 0678609356b..eb63ca9a462 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.255 2009/01/18 04:41:26 kevlo Exp $ +# $OpenBSD: GENERIC,v 1.256 2009/01/23 20:32:22 mk Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -78,6 +78,11 @@ it* at isa? port 0x2e # ITE IT8705F, IT8712F, IT8716F, IT8718F, it* at isa? port 0x4e # IT8726F and SiS SiS950 monitors and # watchdog timer +schsio* at isa? port 0x2e # SMSC SCH311x Super I/O +schsio* at isa? port 0x4e +#schsio* at isa? port 0x162e +#schsio* at isa? port 0x164e + viaenv* at pci? # VIA VT82C686A hardware monitor #viasio* at isa? port 0x2e flags 0x0000 # VIA VT1211 LPC Super I/O #viasio* at isa? port 0x4e flags 0x0000 diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index 70e83754990..b8d960bc75b 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.649 2009/01/18 04:41:26 kevlo Exp $ +# $OpenBSD: GENERIC,v 1.650 2009/01/23 20:32:22 mk Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -131,6 +131,11 @@ it* at isa? port 0x2e # ITE IT8705F, IT8712F, IT8716F, it* at isa? port 0x4e # IT8718F, IT8726F and SiS SiS950 # monitors and watchdog timer +schsio* at isa? port 0x2e # SMSC SCH311x Super I/O +schsio* at isa? port 0x4e +#schsio* at isa? port 0x162e +#schsio* at isa? port 0x164e + viaenv* at pci? # VIA VT82C686A hardware monitor viasio* at isa? port 0x2e flags 0x0000 # VIA VT1211 LPC Super I/O viasio* at isa? port 0x4e flags 0x0000 diff --git a/sys/dev/isa/files.isa b/sys/dev/isa/files.isa index e9051b11971..1489c93ac09 100644 --- a/sys/dev/isa/files.isa +++ b/sys/dev/isa/files.isa @@ -1,4 +1,4 @@ -# $OpenBSD: files.isa,v 1.104 2008/04/23 13:28:59 jsg Exp $ +# $OpenBSD: files.isa,v 1.105 2009/01/23 20:32:22 mk Exp $ # $NetBSD: files.isa,v 1.21 1996/05/16 03:45:55 mycroft Exp $ # # Config file and device description for machine-independent ISA code. @@ -337,6 +337,11 @@ device wbsio {} attach wbsio at isa file dev/isa/wbsio.c wbsio +# SMSC SCH311x Super I/O +device schsio {} +attach schsio at isa +file dev/isa/sch311x.c schsio + # National Semiconductor LM78/79/81 and compatible hardware monitors attach lm at isa with lm_isa attach lm at wbsio with lm_wbsio diff --git a/sys/dev/isa/sch311x.c b/sys/dev/isa/sch311x.c new file mode 100644 index 00000000000..d288f94803c --- /dev/null +++ b/sys/dev/isa/sch311x.c @@ -0,0 +1,467 @@ +/* $OpenBSD: sch311x.c,v 1.1 2009/01/23 20:32:22 mk Exp $ */ +/* + * Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org> + * Copyright (c) 2009 Michael Knudsen <mk@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * SMSC SCH3112, SCH3114, and SCH3116 LPC Super I/O driver. + */ + +#include <sys/param.h> +#include <sys/device.h> +#include <sys/kernel.h> +#include <sys/systm.h> +#include <sys/types.h> +#include <sys/sensors.h> + +#include <machine/bus.h> + +#include <dev/isa/isareg.h> +#include <dev/isa/isavar.h> + +/* Device identifiers */ +#define SCHSIO_ID_SCH3112 0x7c +#define SCHSIO_ID_SCH3114 0x7d +#define SCHSIO_ID_SCH3116 0x7f + +#define SCHSIO_IOSIZE 0x02 +#define SCHSIO_PORT_CONFIG 0x00 + +/* These are used in configuration mode */ +#define SCHSIO_PORT_INDEX 0x00 +#define SCHSIO_PORT_DATA 0x01 + +#define SCHSIO_CONFIG_ENTER 0x55 +#define SCHSIO_CONFIG_LEAVE 0xaa + +/* Register definitions */ +#define SCHSIO_IDX_LDEVSEL 0x07 /* Logical device select */ +#define SCHSIO_IDX_DEVICE 0x20 /* Device ID */ +#define SCHSIO_IDX_REV 0x21 /* Device revision */ + +#define SCHSIO_IDX_BASE_HI 0x60 /* Configuration base address */ +#define SCHSIO_IDX_BASE_LO 0x61 + +/* Logical devices */ +#define SCHSIO_LDEV_RUNTIME 0x0a /* holds wdog and sensors */ + + +/* Hardware monitor */ +#define SCHSIO_HWM_INTERVAL 5 /* seconds */ + +/* Register access */ +#define SCHSIO_HWM_IOSIZE 0x02 +#define SCHSIO_HWM_OFFSET 0x70 +#define SCHSIO_HWM_INDEX 0x00 +#define SCHSIO_HWM_DATA 0x01 + +/* Sensor definitions */ +/* Voltage */ +#define SCHSIO_HWM_VOLT1 0x20 +#define SCHSIO_HWM_VOLT2 0x21 +#define SCHSIO_HWM_VOLT3 0x22 +#define SCHSIO_HWM_VOLT4 0x23 +#define SCHSIO_HWM_VOLT5 0x24 +#define SCHSIO_HWM_VOLT6 0x99 +#define SCHSIO_HWM_VOLT7 0x9a + +/* Temperature */ +#define SCHSIO_HWM_TEMP1 0x26 +#define SCHSIO_HWM_TEMP2 0x25 +#define SCHSIO_HWM_TEMP3 0x27 + +/* Fan speed */ +#define SCHSIO_HWM_TACH1_L 0x28 +#define SCHSIO_HWM_TACH1_U 0x29 +#define SCHSIO_HWM_TACH2_L 0x2a +#define SCHSIO_HWM_TACH2_U 0x2b +#define SCHSIO_HWM_TACH3_L 0x2c +#define SCHSIO_HWM_TACH3_U 0x2d + +/* 11111 = 90kHz * 10^9 */ +#define SCHSIO_FAN_RPM(x) (1000000000 / ((x) * 11111) * 60) + +#define SCHSIO_CONV_VOLT1 66400 +#define SCHSIO_CONV_VOLT2 20000 +#define SCHSIO_CONV_VOLT3 43800 +#define SCHSIO_CONV_VOLT4 66400 +#define SCHSIO_CONV_VOLT5 160000 +#define SCHSIO_CONV_VOLT6 43800 +#define SCHSIO_CONV_VOLT7 43800 +#define SCHSIO_VOLT_MUV(x, k) (1000000 * (x) / 2560000 * (k)) + +#define SCHSIO_TEMP_MUK(x) (((x) + 273) * 1000000) + +#define SCHSIO_SENSORS 13 + +#define SCHSIO_SENSOR_FAN1 0 +#define SCHSIO_SENSOR_FAN2 1 +#define SCHSIO_SENSOR_FAN3 2 + +#define SCHSIO_SENSOR_VOLT1 3 +#define SCHSIO_SENSOR_VOLT2 4 +#define SCHSIO_SENSOR_VOLT3 5 +#define SCHSIO_SENSOR_VOLT4 6 +#define SCHSIO_SENSOR_VOLT5 7 +#define SCHSIO_SENSOR_VOLT6 8 +#define SCHSIO_SENSOR_VOLT7 9 + +#define SCHSIO_SENSOR_TEMP1 10 +#define SCHSIO_SENSOR_TEMP2 11 +#define SCHSIO_SENSOR_TEMP3 12 + + +#ifdef SCHSIO_DEBUG +#define DPRINTF(x) printf x +#else +#define DPRINTF(x) +#endif + +#define DEVNAME(x) ((x)->sc_dev.dv_xname) + +struct schsio_softc { + struct device sc_dev; + + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + + bus_space_handle_t sc_hwm_ioh; + + struct ksensordev sc_sensordev; + struct ksensor sc_sensor[SCHSIO_SENSORS]; +}; + +int schsio_probe(struct device *, void *, void *); +void schsio_attach(struct device *, struct device *, void *); +int schsio_print(void *, const char *); + +static __inline void schsio_config_enable(bus_space_tag_t iot, + bus_space_handle_t ioh); +static __inline void schsio_config_disable(bus_space_tag_t iot, + bus_space_handle_t ioh); + +u_int8_t schsio_config_read(bus_space_tag_t iot, bus_space_handle_t ioh, + int reg); +void schsio_config_write(bus_space_tag_t iot, + bus_space_handle_t ioh, int reg, u_int8_t val); + +/* HWM prototypes */ +void schsio_hwm_init(struct schsio_softc *sc); +void schsio_hwm_update(void *arg); + +u_int8_t schsio_hwm_read(struct schsio_softc *sc, int reg); + + +struct cfattach schsio_ca = { + sizeof(struct schsio_softc), + schsio_probe, + schsio_attach +}; + +struct cfdriver schsio_cd = { + NULL, "schsio", DV_DULL +}; + +static __inline void +schsio_config_enable(bus_space_tag_t iot, bus_space_handle_t ioh) +{ + bus_space_write_1(iot, ioh, SCHSIO_PORT_CONFIG, SCHSIO_CONFIG_ENTER); +} + +static __inline void +schsio_config_disable(bus_space_tag_t iot, bus_space_handle_t ioh) +{ + bus_space_write_1(iot, ioh, SCHSIO_PORT_CONFIG, SCHSIO_CONFIG_LEAVE); +} + +u_int8_t +schsio_config_read(bus_space_tag_t iot, bus_space_handle_t ioh, int reg) +{ + bus_space_write_1(iot, ioh, SCHSIO_PORT_INDEX, reg); + return (bus_space_read_1(iot, ioh, SCHSIO_PORT_DATA)); +} + +void +schsio_config_write(bus_space_tag_t iot, bus_space_handle_t ioh, int reg, + u_int8_t val) +{ + bus_space_write_1(iot, ioh, SCHSIO_PORT_INDEX, reg); + bus_space_write_1(iot, ioh, SCHSIO_PORT_DATA, val); +} + +int +schsio_probe(struct device *parent, void *match, void *aux) +{ + struct isa_attach_args *ia = aux; + bus_space_tag_t iot; + bus_space_handle_t ioh; + u_int8_t reg; + + /* Match by device ID */ + iot = ia->ia_iot; + if (bus_space_map(iot, ia->ipa_io[0].base, SCHSIO_IOSIZE, 0, &ioh)) + return (0); + + schsio_config_enable(iot, ioh); + reg = schsio_config_read(iot, ioh, SCHSIO_IDX_DEVICE); + schsio_config_disable(iot, ioh); + + bus_space_unmap(iot, ia->ipa_io[0].base, SCHSIO_IOSIZE); + + switch (reg) { + case SCHSIO_ID_SCH3112: + case SCHSIO_ID_SCH3114: + case SCHSIO_ID_SCH3116: + ia->ipa_nio = 1; + ia->ipa_io[0].length = SCHSIO_IOSIZE; + ia->ipa_nmem = 0; + ia->ipa_nirq = 0; + ia->ipa_ndrq = 0; + + return (1); + break; + } + + return (0); +} + +void +schsio_attach(struct device *parent, struct device *self, void *aux) +{ + struct schsio_softc *sc = (void *)self; + struct isa_attach_args *ia = aux; + u_int8_t reg; + + /* Map ISA I/O space */ + sc->sc_iot = ia->ia_iot; + if (bus_space_map(sc->sc_iot, ia->ipa_io[0].base, + SCHSIO_IOSIZE, 0, &sc->sc_ioh)) { + printf(": can't map I/O space\n"); + return; + } + + /* Enter configuration mode */ + schsio_config_enable(sc->sc_iot, sc->sc_ioh); + + /* Read device ID */ + reg = schsio_config_read(sc->sc_iot, sc->sc_ioh, SCHSIO_IDX_DEVICE); + switch (reg) { + case SCHSIO_ID_SCH3112: + printf(": SCH3112"); + break; + case SCHSIO_ID_SCH3114: + printf(": SCH3114"); + break; + case SCHSIO_ID_SCH3116: + printf(": SCH3116"); + break; + } + + /* Read device revision */ + reg = schsio_config_read(sc->sc_iot, sc->sc_ioh, SCHSIO_IDX_REV); + printf(" rev 0x%02x", reg); + + schsio_hwm_init(sc); + + printf("\n"); + + /* Escape from configuration mode */ + schsio_config_disable(sc->sc_iot, sc->sc_ioh); + +} + +void +schsio_hwm_init(struct schsio_softc *sc) +{ + int i; + u_int16_t iobase; + u_int8_t reg0, reg1; + + /* Select runtime registers logical device */ + schsio_config_write(sc->sc_iot, sc->sc_ioh, SCHSIO_IDX_LDEVSEL, + SCHSIO_LDEV_RUNTIME); + + reg0 = schsio_config_read(sc->sc_iot, sc->sc_ioh, + SCHSIO_IDX_BASE_HI); + reg1 = schsio_config_read(sc->sc_iot, sc->sc_ioh, + SCHSIO_IDX_BASE_LO); + iobase = ((reg0 << 8) | reg1) + SCHSIO_HWM_OFFSET; + + + if (bus_space_map(sc->sc_iot, iobase, + SCHSIO_HWM_IOSIZE, 0, &sc->sc_hwm_ioh)) { + printf(": can't map I/O space\n"); + return; + } + + /* Set up sensors */ + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_FAN1].desc, "", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_FAN1].desc)); + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_FAN2].desc, "", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_FAN2].desc)); + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_FAN3].desc, "", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_FAN3].desc)); + for (i = SCHSIO_SENSOR_FAN1; i < SCHSIO_SENSOR_FAN3 + 1; i++) { + sc->sc_sensor[i].type = SENSOR_FANRPM; + sc->sc_sensor[i].flags = SENSOR_FINVALID; + sc->sc_sensor[i].status = SENSOR_S_OK; + sc->sc_sensor[i].value = 0; + } + + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_VOLT1].desc, "+2.5V", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_VOLT1].desc)); + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_VOLT2].desc, "+1.5V (Vccp)", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_VOLT2].desc)); + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_VOLT3].desc, "+3.3V (VCC)", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_VOLT3].desc)); + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_VOLT4].desc, "+5V", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_VOLT4].desc)); + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_VOLT5].desc, "+12V", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_VOLT5].desc)); + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_VOLT6].desc, "+3.3V (VTR)", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_VOLT6].desc)); + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_VOLT7].desc, "+3V (Vbat)", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_VOLT7].desc)); + for (i = SCHSIO_SENSOR_VOLT1; i < SCHSIO_SENSOR_VOLT7 + 1; i++) { + sc->sc_sensor[i].type = SENSOR_VOLTS_DC; + sc->sc_sensor[i].flags = SENSOR_FINVALID; + sc->sc_sensor[i].status = SENSOR_S_OK; + sc->sc_sensor[i].value = 0; + } + + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_TEMP1].desc, "Internal", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_TEMP1].desc)); + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_TEMP2].desc, "Remote", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_TEMP2].desc)); + strlcpy(sc->sc_sensor[SCHSIO_SENSOR_TEMP3].desc, "Remote", + sizeof(sc->sc_sensor[SCHSIO_SENSOR_TEMP3].desc)); + for (i = SCHSIO_SENSOR_TEMP1; i < SCHSIO_SENSOR_TEMP3 + 1; i++) { + sc->sc_sensor[i].type = SENSOR_TEMP; + sc->sc_sensor[i].flags = SENSOR_FINVALID; + sc->sc_sensor[i].status = SENSOR_S_OK; + sc->sc_sensor[i].value = 0; + } + + strlcpy(sc->sc_sensordev.xname, DEVNAME(sc), + sizeof(sc->sc_sensordev.xname)); + + for (i = 0; i < SCHSIO_SENSORS; i++) + sensor_attach(&sc->sc_sensordev, &sc->sc_sensor[i]); + + sensordev_install(&sc->sc_sensordev); + + sensor_task_register(sc, schsio_hwm_update, SCHSIO_HWM_INTERVAL); +} + +void +schsio_hwm_update(void *arg) +{ + struct schsio_softc *sc; + u_int16_t tach; + int8_t temp; + u_int8_t volt; + u_int8_t reg0, reg1; + + sc = (struct schsio_softc *)arg; + + schsio_config_enable(sc->sc_iot, sc->sc_ioh); + + /* Select logical device a */ + schsio_config_write(sc->sc_iot, sc->sc_ioh, SCHSIO_IDX_LDEVSEL, + SCHSIO_LDEV_RUNTIME); + + reg0 = schsio_hwm_read(sc, SCHSIO_HWM_TACH1_L); + reg1 = schsio_hwm_read(sc, SCHSIO_HWM_TACH1_U); + tach = (reg1 << 8) | reg0; + sc->sc_sensor[SCHSIO_SENSOR_FAN1].value = SCHSIO_FAN_RPM(tach); + sc->sc_sensor[SCHSIO_SENSOR_FAN1].flags = + (tach == 0xffff) ? SENSOR_FINVALID : 0; + + reg0 = schsio_hwm_read(sc, SCHSIO_HWM_TACH2_L); + reg1 = schsio_hwm_read(sc, SCHSIO_HWM_TACH2_U); + tach = (reg1 << 8) | reg0; + sc->sc_sensor[SCHSIO_SENSOR_FAN2].value = SCHSIO_FAN_RPM(tach); + sc->sc_sensor[SCHSIO_SENSOR_FAN2].flags = + (tach == 0xffff) ? SENSOR_FINVALID : 0; + + reg0 = schsio_hwm_read(sc, SCHSIO_HWM_TACH3_L); + reg1 = schsio_hwm_read(sc, SCHSIO_HWM_TACH3_U); + tach = (reg1 << 8) | reg0; + sc->sc_sensor[SCHSIO_SENSOR_FAN3].value = SCHSIO_FAN_RPM(tach); + sc->sc_sensor[SCHSIO_SENSOR_FAN3].flags = + (tach == 0xffff) ? SENSOR_FINVALID : 0; + + volt = schsio_hwm_read(sc, SCHSIO_HWM_VOLT1); + sc->sc_sensor[SCHSIO_SENSOR_VOLT1].value = + SCHSIO_VOLT_MUV(volt, SCHSIO_CONV_VOLT1); + sc->sc_sensor[SCHSIO_SENSOR_VOLT1].flags = 0; + + volt = schsio_hwm_read(sc, SCHSIO_HWM_VOLT2); + sc->sc_sensor[SCHSIO_SENSOR_VOLT2].value = + SCHSIO_VOLT_MUV(volt, SCHSIO_CONV_VOLT2); + sc->sc_sensor[SCHSIO_SENSOR_VOLT2].flags = 0; + + volt = schsio_hwm_read(sc, SCHSIO_HWM_VOLT3); + sc->sc_sensor[SCHSIO_SENSOR_VOLT3].value = + SCHSIO_VOLT_MUV(volt, SCHSIO_CONV_VOLT3); + sc->sc_sensor[SCHSIO_SENSOR_VOLT3].flags = 0; + + volt = schsio_hwm_read(sc, SCHSIO_HWM_VOLT4); + sc->sc_sensor[SCHSIO_SENSOR_VOLT4].value = + SCHSIO_VOLT_MUV(volt, SCHSIO_CONV_VOLT4); + sc->sc_sensor[SCHSIO_SENSOR_VOLT4].flags = 0; + + volt = schsio_hwm_read(sc, SCHSIO_HWM_VOLT5); + sc->sc_sensor[SCHSIO_SENSOR_VOLT5].value = + SCHSIO_VOLT_MUV(volt, SCHSIO_CONV_VOLT5); + sc->sc_sensor[SCHSIO_SENSOR_VOLT5].flags = 0; + + volt = schsio_hwm_read(sc, SCHSIO_HWM_VOLT6); + sc->sc_sensor[SCHSIO_SENSOR_VOLT6].value = + SCHSIO_VOLT_MUV(volt, SCHSIO_CONV_VOLT6); + sc->sc_sensor[SCHSIO_SENSOR_VOLT6].flags = 0; + + volt = schsio_hwm_read(sc, SCHSIO_HWM_VOLT7); + sc->sc_sensor[SCHSIO_SENSOR_VOLT7].value = + SCHSIO_VOLT_MUV(volt, SCHSIO_CONV_VOLT7); + sc->sc_sensor[SCHSIO_SENSOR_VOLT7].flags = 0; + + temp = schsio_hwm_read(sc, SCHSIO_HWM_TEMP1); + sc->sc_sensor[SCHSIO_SENSOR_TEMP1].value = SCHSIO_TEMP_MUK(temp); + sc->sc_sensor[SCHSIO_SENSOR_TEMP1].flags = + ((uint8_t)temp == 0x80) ? SENSOR_FINVALID : 0; + + temp = schsio_hwm_read(sc, SCHSIO_HWM_TEMP2); + sc->sc_sensor[SCHSIO_SENSOR_TEMP2].value = SCHSIO_TEMP_MUK(temp); + sc->sc_sensor[SCHSIO_SENSOR_TEMP2].flags = + ((uint8_t)temp == 0x80) ? SENSOR_FINVALID : 0; + + temp = schsio_hwm_read(sc, SCHSIO_HWM_TEMP3); + sc->sc_sensor[SCHSIO_SENSOR_TEMP3].value = SCHSIO_TEMP_MUK(temp); + sc->sc_sensor[SCHSIO_SENSOR_TEMP3].flags = + ((uint8_t)temp == 0x80) ? SENSOR_FINVALID : 0; + + schsio_config_disable(sc->sc_iot, sc->sc_ioh); + +} + +u_int8_t +schsio_hwm_read(struct schsio_softc *sc, int reg) +{ + bus_space_write_1(sc->sc_iot, sc->sc_hwm_ioh, SCHSIO_HWM_INDEX, reg); + return (bus_space_read_1(sc->sc_iot, sc->sc_hwm_ioh, SCHSIO_HWM_DATA)); +} + |