1 /* $NetBSD: ugvar.h,v 1.3 2007/11/16 08:00:15 xtraeme Exp $ */ 2 3 /* 4 * Copyright (c) 2007 Mihai Chelaru <kefren@netbsd.ro> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. The name of the author may not be used to endorse or promote products 13 * derived from this software without specific prior written permission. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28 #ifndef _UGVAR_H_ 29 #define _UGVAR_H_ 30 31 struct ug_softc { 32 struct device sc_dev; 33 34 bus_space_tag_t sc_iot; 35 bus_space_handle_t sc_ioh; 36 37 struct sysmon_envsys *sc_sme; 38 envsys_data_t sc_sensor[UG_MAX_SENSORS]; 39 uint8_t version; 40 void *mbsens; 41 }; 42 43 struct ug2_sensor_info { 44 const char *name; 45 int port; 46 int type; 47 int multiplier; 48 int divisor; 49 int offset; 50 }; 51 52 struct ug2_motherboard_info { 53 uint16_t id; 54 const char *name; 55 struct ug2_sensor_info sensors[UG2_MAX_NO_SENSORS + 1]; 56 }; 57 58 /* driver internal functions */ 59 int ug_reset(struct ug_softc *); 60 uint8_t ug_read(struct ug_softc *, unsigned short); 61 int ug_waitfor(struct ug_softc *, uint16_t, uint8_t); 62 void ug_setup_sensors(struct ug_softc *); 63 void ug2_attach(struct ug_softc *); 64 int ug2_wait_ready(struct ug_softc *); 65 int ug2_wait_readable(struct ug_softc *); 66 int ug2_sync(struct ug_softc *); 67 int ug2_read(struct ug_softc *, uint8_t, uint8_t, uint8_t, uint8_t*); 68 69 /* Envsys */ 70 void ug_refresh(struct sysmon_envsys *, envsys_data_t *); 71 void ug2_refresh(struct sysmon_envsys *, envsys_data_t *); 72 73 #endif /* _UGVAR_H_ */ 74