Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / sys / dev / powermng / it / itvar.h
1 /*
2  * Copyright (c) 2003 Julien Bordet <zejames@greyhats.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  * 
25  * $OpenBSD: itvar.h,v 1.4 2007/03/22 16:55:31 deraadt Exp $
26  * $DragonFly: src/sys/dev/powermng/it/itvar.h,v 1.1 2007/10/02 13:37:38 hasso Exp $
27  */
28
29 #ifndef _DEV_ISA_ITVAR_H
30 #define _DEV_ISA_ITVAR_H
31
32 #define IT_NUM_SENSORS  15
33
34 /* chip ids */
35 #define IT_ID_IT87      0x90
36
37 /* ctl registers */
38
39 #define ITC_ADDR        0x05
40 #define ITC_DATA        0x06
41
42 /* data registers */
43
44 #define ITD_CONFIG      0x00
45 #define ITD_ISR1        0x01
46 #define ITD_ISR2        0x02
47 #define ITD_ISR3        0x03
48 #define ITD_SMI1        0x04
49 #define ITD_SMI2        0x05
50 #define ITD_SMI3        0x06
51 #define ITD_IMR1        0x07
52 #define ITD_IMR2        0x08
53 #define ITD_IMR3        0x09
54 #define ITD_VID         0x0a
55 #define ITD_FAN         0x0b
56
57 #define ITD_FANMINBASE  0x10
58 #define ITD_FANENABLE   0x13
59
60 #define ITD_SENSORFANBASE       0x0d    /* Fan from 0x0d to 0x0f */
61 #define ITD_SENSORVOLTBASE      0x20    /* Fan from 0x20 to 0x28 */
62 #define ITD_SENSORTEMPBASE      0x29    /* Fan from 0x29 to 0x2b */
63
64 #define ITD_VOLTMAXBASE 0x30
65 #define ITD_VOLTMINBASE 0x31
66
67 #define ITD_TEMPMAXBASE 0x40
68 #define ITD_TEMPMINBASE 0x41
69
70 #define ITD_SBUSADDR    0x48
71 #define ITD_VOLTENABLE  0x50
72 #define ITD_TEMPENABLE  0x51
73
74 #define ITD_CHIPID      0x58
75
76 #define IT_VREF         (4096) /* Vref = 4.096 V */
77
78 struct it_softc {
79         struct device *sc_dev;
80
81         struct resource *sc_iores;
82         int sc_iorid;
83         bus_space_tag_t sc_iot;
84         bus_space_handle_t sc_ioh;
85
86         struct ksensor sensors[IT_NUM_SENSORS];
87         struct ksensordev sensordev;
88         u_int numsensors;
89         void (*refresh_sensor_data)(struct it_softc *);
90
91         u_int8_t (*it_readreg)(struct it_softc *, int);
92         void (*it_writereg)(struct it_softc *, int, int);
93 };
94
95 #endif