Line data Source code
1 : /* $OpenBSD: uguru.c,v 1.5 2015/03/14 03:38:47 jsg Exp $ */
2 :
3 : /*
4 : * Copyright (c) 2010 Mikko Tolmunen <oskari@sefirosu.org>
5 : *
6 : * Permission to use, copy, modify, and distribute this software for any
7 : * purpose with or without fee is hereby granted, provided that the above
8 : * copyright notice and this permission notice appear in all copies.
9 : *
10 : * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 : * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 : * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 : * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 : * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 : * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 : * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 : */
18 :
19 : #include <sys/param.h>
20 : #include <sys/systm.h>
21 : #include <sys/device.h>
22 : #include <sys/sensors.h>
23 :
24 : #include <machine/bus.h>
25 :
26 : #include <dev/isa/isavar.h>
27 :
28 : #ifdef UGURU_DEBUG
29 : int uguru_dbg = 0;
30 : #define DPRINTF(lvl, fmt...) \
31 : if (uguru_dbg >= lvl) \
32 : printf(fmt);
33 : #else
34 : #define DPRINTF(lvl, fmt...)
35 : #endif
36 :
37 : #define UGURU_READ(iot, ioh, reg) \
38 : bus_space_read_1((iot), (ioh), (reg))
39 : #define UGURU_WRITE(iot, ioh, reg, val) \
40 : bus_space_write_1((iot), (ioh), (reg), (val))
41 :
42 : #define UGURU_DATA 0x00 /* configuration data register */
43 : #define UGURU_INDEX 0x04 /* configuration index register */
44 : #define UGURU_IOSIZE 0x08
45 :
46 : #define UGURU_DUMMY 0x00 /* dummy zero bit */
47 : #define UGURU_ITM_DATA 0x21 /* temp/volt readings */
48 : #define UGURU_ITM_CTRL 0x22 /* temp/volt settings */
49 : #define UGURU_FAN_DATA 0x26 /* fan readings */
50 : #define UGURU_FAN_CTRL 0x27 /* fan settings */
51 : #define UGURU_PRODID 0x44 /* product ID */
52 :
53 : #define UGURU_VENDID_ABIT 0x147b /* ABIT */
54 : #define UGURU_DEVID1 0x2003 /* AC2003 */
55 : #define UGURU_DEVID2 0x2005 /* AC2005 */
56 :
57 : #define ABIT_SYSID_KV01 0x0301
58 : #define ABIT_SYSID_AI01 0x0302
59 : #define ABIT_SYSID_AN01 0x0303
60 : #define ABIT_SYSID_AA01 0x0304
61 : #define ABIT_SYSID_AG01 0x0305
62 : #define ABIT_SYSID_AV01 0x0306
63 : #define ABIT_SYSID_KVP1 0x0307
64 : #define ABIT_SYSID_AS01 0x0308
65 : #define ABIT_SYSID_AX01 0x0309
66 : #define ABIT_SYSID_M401 0x030a
67 : #define ABIT_SYSID_AN02 0x030b
68 : #define ABIT_SYSID_AU01 0x050c
69 : #define ABIT_SYSID_AW01 0x050d
70 : #define ABIT_SYSID_AL01 0x050e
71 : #define ABIT_SYSID_BL01 0x050f
72 : #define ABIT_SYSID_NI01 0x0510
73 : #define ABIT_SYSID_AT01 0x0511
74 : #define ABIT_SYSID_AN03 0x0512
75 : #define ABIT_SYSID_AW02 0x0513
76 : #define ABIT_SYSID_AB01 0x0514
77 : #define ABIT_SYSID_AN04 0x0515
78 : #define ABIT_SYSID_AW03 0x0516
79 : #define ABIT_SYSID_AT02 0x0517
80 : #define ABIT_SYSID_AB02 0x0518
81 : #define ABIT_SYSID_IN01 0x0519
82 : #define ABIT_SYSID_IP01 0x051a
83 : #define ABIT_SYSID_IX01 0x051b
84 : #define ABIT_SYSID_IX02 0x051c
85 :
86 : #define UGURU_INTERVAL 5
87 : #define UGURU_MAX_SENSORS 27
88 :
89 : #define RFACT_NONE 13700
90 : #define RFACT_NONE2 10000
91 : #define RFACT(x, y) (RFACT_NONE * ((x) + (y)) / (y))
92 : #define RFACT2(x, y) (RFACT_NONE2 * ((x) + (y)) / (y))
93 :
94 : struct uguru_softc {
95 : struct device sc_dev;
96 :
97 : bus_space_tag_t sc_iot;
98 : bus_space_handle_t sc_ioh;
99 :
100 : struct ksensor sc_sensors[UGURU_MAX_SENSORS];
101 : struct ksensordev sc_sensordev;
102 : int sc_numsensors;
103 : struct uguru_sensor *uguru_sensors;
104 : struct {
105 : uint8_t reading;
106 : /* uint8_t flags; */
107 : uint8_t lower;
108 : uint8_t upper;
109 : } cs;
110 : int (*read)(struct uguru_softc *, int);
111 : };
112 :
113 : struct uguru_sensor {
114 : char *desc;
115 : enum sensor_type type;
116 : void (*refresh)(struct uguru_softc *, int);
117 : uint8_t reg;
118 : int rfact;
119 : };
120 :
121 : void uguru_refresh_temp(struct uguru_softc *, int);
122 : void uguru_refresh_volt(struct uguru_softc *, int);
123 : void uguru_refresh_fan(struct uguru_softc *, int);
124 :
125 : #define UGURU_R_TEMP uguru_refresh_temp
126 : #define UGURU_R_VOLT uguru_refresh_volt
127 : #define UGURU_R_FAN uguru_refresh_fan
128 :
129 : struct uguru_sensor abitkv_sensors[] = {
130 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 },
131 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 },
132 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x0f },
133 :
134 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE },
135 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT(100, 402) },
136 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT(442, 560) },
137 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT(2800, 887) },
138 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT(442, 560) },
139 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE },
140 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT_NONE },
141 :
142 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x00 },
143 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x01 },
144 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x02 },
145 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x03 },
146 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x04 },
147 :
148 : { NULL }
149 : };
150 :
151 : struct uguru_sensor abitaa_sensors[] = {
152 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 },
153 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 },
154 : { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x0f },
155 : { "PWM2", SENSOR_TEMP, UGURU_R_TEMP, 0x0c },
156 :
157 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE },
158 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT(100, 402) },
159 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT(442, 560) },
160 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT(2800, 888) },
161 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT(442, 560) },
162 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE },
163 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT_NONE },
164 : { "FSBVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0e, RFACT_NONE },
165 : { "NB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE },
166 : { "NB +2.5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT_NONE },
167 :
168 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x00 },
169 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x01 },
170 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x02 },
171 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x03 },
172 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x04 },
173 :
174 : { NULL }
175 : };
176 :
177 : struct uguru_sensor abitav_sensors[] = {
178 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 },
179 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 },
180 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x0f },
181 :
182 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE },
183 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT(100, 402) },
184 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT(442, 560) },
185 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT(442, 560) },
186 : { "+3.3VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0d, RFACT(100, 402) },
187 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE },
188 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT_NONE },
189 : { "NB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT_NONE },
190 : { "SB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0e, RFACT_NONE },
191 : { "HTV", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE },
192 : { "AGP", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT_NONE },
193 :
194 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x00 },
195 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x01 },
196 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x02 },
197 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x03 },
198 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x04 },
199 :
200 : { NULL }
201 : };
202 :
203 : struct uguru_sensor abitas_sensors[] = {
204 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 },
205 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 },
206 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x0f },
207 :
208 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE },
209 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT(100, 402) },
210 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT(442, 560) },
211 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT(2800, 884) },
212 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT(442, 560) },
213 : { "+3.3VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0d, RFACT(100, 402) },
214 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE },
215 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT_NONE },
216 : { "FSBVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0e, RFACT_NONE },
217 : { "NB/AGP", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE },
218 : { "GMCH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT_NONE },
219 :
220 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x00 },
221 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x01 },
222 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x02 },
223 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x03 },
224 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x04 },
225 :
226 : { NULL }
227 : };
228 :
229 : struct uguru_sensor abitax_sensors[] = {
230 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 },
231 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 },
232 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x0f },
233 :
234 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE },
235 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT(100, 402) },
236 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT(442, 560) },
237 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0d, RFACT(2800, 888) },
238 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT(442, 560) },
239 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE },
240 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT_NONE },
241 : { "NB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT_NONE },
242 : { "SB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0e, RFACT_NONE },
243 : { "HTV", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE },
244 :
245 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x00 },
246 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x01 },
247 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x02 },
248 : { "AUX", SENSOR_FANRPM, UGURU_R_FAN, 0x03 },
249 :
250 : { NULL }
251 : };
252 :
253 : struct uguru_sensor abitm4_sensors[] = {
254 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 },
255 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 },
256 : { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x02 },
257 : { "PWM2", SENSOR_TEMP, UGURU_R_TEMP, 0x03 },
258 : { "PWM3", SENSOR_TEMP, UGURU_R_TEMP, 0x04 },
259 : { "PWM4", SENSOR_TEMP, UGURU_R_TEMP, 0x05 },
260 :
261 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT_NONE },
262 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x13, RFACT(100, 402) },
263 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x12, RFACT(442, 560) },
264 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x11, RFACT(2800, 884) },
265 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x10, RFACT(442, 560) },
266 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT_NONE },
267 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT_NONE },
268 : { "FSBVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0d, RFACT_NONE },
269 : { "NB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT_NONE },
270 : { "NB +2.5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0c, RFACT_NONE },
271 :
272 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x00 },
273 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x01 },
274 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x02 },
275 : { "OTES1", SENSOR_FANRPM, UGURU_R_FAN, 0x03 },
276 : { "OTES2", SENSOR_FANRPM, UGURU_R_FAN, 0x04 },
277 :
278 : { NULL }
279 : };
280 :
281 : struct uguru_sensor abitan_sensors[] = {
282 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 },
283 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 },
284 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x0f },
285 :
286 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE },
287 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT(100, 402) },
288 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT(442, 560) },
289 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0d, RFACT(2800, 844) },
290 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT(442, 560) },
291 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE },
292 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT_NONE },
293 : { "CPUVDDA", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0e, RFACT_NONE },
294 : { "HTV", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE },
295 : { "MCP", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT_NONE },
296 : { "MCP SB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT_NONE },
297 :
298 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x00 },
299 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x01 },
300 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x02 },
301 : { "AUX", SENSOR_FANRPM, UGURU_R_FAN, 0x05 },
302 : { "OTES1", SENSOR_FANRPM, UGURU_R_FAN, 0x04 },
303 : { "OTES2", SENSOR_FANRPM, UGURU_R_FAN, 0x03 },
304 :
305 : { NULL }
306 : };
307 :
308 : struct uguru_sensor abital_sensors[] = {
309 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
310 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 },
311 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
312 :
313 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x00, RFACT_NONE2 },
314 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
315 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
316 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT2(50, 10) },
317 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
318 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
319 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x01, RFACT_NONE2 },
320 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE2 },
321 : { "CPUVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
322 : { "MCH/PCIE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
323 : { "MCH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT2(34, 34) },
324 : { "ICH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT_NONE2 },
325 :
326 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
327 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
328 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
329 : { "AUX", SENSOR_FANRPM, UGURU_R_FAN, 0x23 },
330 :
331 : { NULL }
332 : };
333 :
334 : struct uguru_sensor abitaw_sensors[] = {
335 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
336 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 },
337 : { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
338 : { "PWM2", SENSOR_TEMP, UGURU_R_TEMP, 0x1b },
339 : { "PWM3", SENSOR_TEMP, UGURU_R_TEMP, 0x1c },
340 : { "PWM4", SENSOR_TEMP, UGURU_R_TEMP, 0x1d },
341 :
342 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x00, RFACT_NONE2 },
343 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
344 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
345 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT2(50, 10) },
346 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
347 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
348 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x01, RFACT_NONE2 },
349 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE2 },
350 : { "CPUVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
351 : { "MCH/PCIE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
352 : { "MCH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT2(34, 34) },
353 : { "ICH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT_NONE2 },
354 :
355 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
356 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
357 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
358 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x23 },
359 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x24 },
360 : { "AUX3", SENSOR_FANRPM, UGURU_R_FAN, 0x25 },
361 : { "AUX4", SENSOR_FANRPM, UGURU_R_FAN, 0x26 },
362 : { "AUX5", SENSOR_FANRPM, UGURU_R_FAN, 0x27 },
363 :
364 : { NULL }
365 : };
366 :
367 : struct uguru_sensor abitni_sensors[] = {
368 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
369 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 },
370 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
371 :
372 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x00, RFACT_NONE2 },
373 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
374 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
375 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT2(50, 10) },
376 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
377 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
378 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x01, RFACT_NONE2 },
379 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE2 },
380 : { "CPUVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
381 : { "NB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
382 : { "SB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT_NONE2 },
383 :
384 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
385 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
386 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
387 : { "AUX", SENSOR_FANRPM, UGURU_R_FAN, 0x23 },
388 : { "OTES1", SENSOR_FANRPM, UGURU_R_FAN, 0x24 },
389 : { "OTES2", SENSOR_FANRPM, UGURU_R_FAN, 0x25 },
390 :
391 : { NULL }
392 : };
393 :
394 : struct uguru_sensor abitat_sensors[] = {
395 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
396 : { "NB", SENSOR_TEMP, UGURU_R_TEMP, 0x19 },
397 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
398 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1b },
399 :
400 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x00, RFACT_NONE2 },
401 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
402 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
403 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT2(50, 10) },
404 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
405 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
406 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x01, RFACT2(34, 34) },
407 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE2 },
408 : { "CPUVDDA", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT2(34, 34) },
409 : { "PCIE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0c, RFACT_NONE2 },
410 : { "HTV", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
411 : { "NB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0d, RFACT_NONE2 },
412 : { "NB +1.8V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
413 : { "NB +1.8V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT_NONE2 },
414 :
415 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
416 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
417 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
418 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x23 },
419 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x24 },
420 : { "AUX3", SENSOR_FANRPM, UGURU_R_FAN, 0x25 },
421 :
422 : { NULL }
423 : };
424 :
425 : struct uguru_sensor abitan2_sensors[] = {
426 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
427 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 },
428 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
429 :
430 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x00, RFACT_NONE2 },
431 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
432 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
433 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT2(50, 10) },
434 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
435 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
436 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x01, RFACT2(34, 34) },
437 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE2 },
438 : { "CPUVDDA", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT2(34, 34) },
439 : { "HTV", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
440 : { "NB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
441 : { "SB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT_NONE2 },
442 :
443 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
444 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
445 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
446 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x24 },
447 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x25 },
448 :
449 : { NULL }
450 : };
451 :
452 : struct uguru_sensor abitab_sensors[] = {
453 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
454 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 },
455 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
456 :
457 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x00, RFACT_NONE2 },
458 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
459 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
460 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT2(50, 10) },
461 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
462 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
463 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x01, RFACT_NONE2 },
464 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE2 },
465 : { "CPUVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
466 : { "ICHIO", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT_NONE2 },
467 : { "ICH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT_NONE2 },
468 : { "MCH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
469 :
470 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
471 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
472 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
473 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x23 },
474 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x24 },
475 : { "AUX3", SENSOR_FANRPM, UGURU_R_FAN, 0x25 },
476 :
477 : { NULL }
478 : };
479 :
480 : struct uguru_sensor abitan3_sensors[] = {
481 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
482 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 },
483 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
484 :
485 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x00, RFACT_NONE2 },
486 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
487 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
488 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT2(50, 10) },
489 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
490 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
491 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x01, RFACT2(34, 34) },
492 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE2 },
493 : { "CPUVDDA", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT2(34, 34) },
494 : { "HTV", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
495 : { "NB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
496 : { "NB/PCIE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0e, RFACT_NONE2 },
497 : { "SB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT_NONE2 },
498 :
499 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
500 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
501 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
502 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x23 },
503 : { "AUX3", SENSOR_FANRPM, UGURU_R_FAN, 0x24 },
504 : { "AUX4", SENSOR_FANRPM, UGURU_R_FAN, 0x25 },
505 :
506 : { NULL }
507 : };
508 :
509 : struct uguru_sensor abitaw2_sensors[] = {
510 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
511 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 },
512 : { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
513 : { "PWM2", SENSOR_TEMP, UGURU_R_TEMP, 0x1b },
514 : { "PWM3", SENSOR_TEMP, UGURU_R_TEMP, 0x1c },
515 : { "PWM4", SENSOR_TEMP, UGURU_R_TEMP, 0x1d },
516 :
517 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x00, RFACT_NONE2 },
518 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
519 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
520 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT2(50, 10) },
521 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
522 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
523 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x01, RFACT2(34, 34) },
524 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE2 },
525 : { "CPUVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
526 : { "MCH/PCIE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
527 : { "MCH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT2(34, 34) },
528 : { "ICH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT_NONE2 },
529 :
530 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
531 : { "NB", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
532 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
533 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x23 },
534 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x24 },
535 : { "AUX3", SENSOR_FANRPM, UGURU_R_FAN, 0x25 },
536 : { "OTES1", SENSOR_FANRPM, UGURU_R_FAN, 0x26 },
537 : { "OTES2", SENSOR_FANRPM, UGURU_R_FAN, 0x27 },
538 :
539 : { NULL }
540 : };
541 :
542 : struct uguru_sensor abitat2_sensors[] = {
543 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
544 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
545 : { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1b },
546 :
547 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x00, RFACT_NONE2 },
548 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
549 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
550 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT2(50, 10) },
551 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
552 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
553 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x01, RFACT2(34, 34) },
554 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE2 },
555 : { "CPUVDDA", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT2(34, 34) },
556 : { "PCIE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0c, RFACT_NONE2 },
557 : { "HTV", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
558 : { "NB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0d, RFACT_NONE2 },
559 : { "NB +1.8V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
560 : { "SB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT_NONE2 },
561 :
562 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
563 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
564 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x23 },
565 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x24 },
566 : { "AUX3", SENSOR_FANRPM, UGURU_R_FAN, 0x25 },
567 : { "AUX4", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
568 :
569 : { NULL }
570 : };
571 :
572 : struct uguru_sensor abitab2_sensors[] = {
573 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
574 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 },
575 : { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
576 : { "PWM2", SENSOR_TEMP, UGURU_R_TEMP, 0x1b },
577 : { "PWM3", SENSOR_TEMP, UGURU_R_TEMP, 0x1c },
578 : { "PWM4", SENSOR_TEMP, UGURU_R_TEMP, 0x1d },
579 : { "PWM5", SENSOR_TEMP, UGURU_R_TEMP, 0x1e },
580 :
581 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x00, RFACT_NONE2 },
582 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
583 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
584 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT2(50, 10) },
585 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
586 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
587 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x01, RFACT2(34, 34) },
588 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x02, RFACT_NONE2 },
589 : { "CPUVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
590 : { "ICHIO", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT_NONE2 },
591 : { "ICH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT_NONE2 },
592 : { "MCH", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
593 :
594 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
595 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
596 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
597 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x23 },
598 : { "AUX3", SENSOR_FANRPM, UGURU_R_FAN, 0x24 },
599 : { "AUX4", SENSOR_FANRPM, UGURU_R_FAN, 0x25 },
600 :
601 : { NULL }
602 : };
603 :
604 : struct uguru_sensor abitin_sensors[] = {
605 : { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 },
606 : { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 },
607 : { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x1a },
608 : { "PWM2", SENSOR_TEMP, UGURU_R_TEMP, 0x1b },
609 : { "PWM3", SENSOR_TEMP, UGURU_R_TEMP, 0x1c },
610 : { "PWM4", SENSOR_TEMP, UGURU_R_TEMP, 0x1d },
611 : { "PWM5", SENSOR_TEMP, UGURU_R_TEMP, 0x1e },
612 :
613 : { "VCORE", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x07, RFACT_NONE2 },
614 : { "+3.3V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0a, RFACT2(34, 34) },
615 : { "+5V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x09, RFACT2(120, 60) },
616 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0c, RFACT2(50, 10) },
617 : { "+12V", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x08, RFACT2(50, 10) },
618 : { "+5VSB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0b, RFACT2(120, 60) },
619 : { "DDR", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0d, RFACT2(34, 34) },
620 : { "DDRVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x0e, RFACT_NONE2 },
621 : { "CPUVTT", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x03, RFACT_NONE2 },
622 : { "HTV", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x05, RFACT_NONE2 },
623 : { "NB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x04, RFACT_NONE2 },
624 : { "SB", SENSOR_VOLTS_DC, UGURU_R_VOLT, 0x06, RFACT_NONE2 },
625 :
626 : { "CPU", SENSOR_FANRPM, UGURU_R_FAN, 0x20 },
627 : { "SYS", SENSOR_FANRPM, UGURU_R_FAN, 0x22 },
628 : { "AUX1", SENSOR_FANRPM, UGURU_R_FAN, 0x21 },
629 : { "AUX2", SENSOR_FANRPM, UGURU_R_FAN, 0x23 },
630 : { "AUX3", SENSOR_FANRPM, UGURU_R_FAN, 0x24 },
631 : { "AUX4", SENSOR_FANRPM, UGURU_R_FAN, 0x25 },
632 :
633 : { NULL }
634 : };
635 :
636 : int uguru_match(struct device *, void *, void *);
637 : void uguru_attach(struct device *, struct device *, void *);
638 : void uguru_refresh(void *);
639 : int uguru_read_sensor(struct uguru_softc *, int);
640 : int uguru_ac5_read_sensor(struct uguru_softc *, int);
641 : int uguru_ac5_read(bus_space_tag_t, bus_space_handle_t,
642 : uint16_t, void *, int);
643 : int uguru_write_multi(bus_space_tag_t, bus_space_handle_t,
644 : uint8_t, void *, int);
645 : int uguru_read_multi(bus_space_tag_t, bus_space_handle_t, void *, int);
646 :
647 : struct cfdriver uguru_cd = {
648 : NULL, "uguru", DV_DULL
649 : };
650 :
651 : struct cfattach uguru_ca = {
652 : sizeof(struct uguru_softc), uguru_match, uguru_attach
653 : };
654 :
655 : int
656 0 : uguru_match(struct device *parent, void *match, void *aux)
657 : {
658 0 : struct isa_attach_args *ia = aux;
659 : bus_space_tag_t iot;
660 0 : bus_space_handle_t ioh;
661 0 : uint8_t data[9];
662 : uint16_t vendid, devid;
663 : int ret = 0;
664 :
665 0 : iot = ia->ia_iot;
666 0 : if (bus_space_map(iot, ia->ipa_io[0].base, UGURU_IOSIZE, 0, &ioh)) {
667 : DPRINTF(0, ": can't map i/o space\n");
668 0 : return 0;
669 : }
670 :
671 0 : UGURU_WRITE(iot, ioh, UGURU_INDEX, UGURU_PRODID);
672 0 : if (!uguru_read_multi(iot, ioh, &data, sizeof(data)) ||
673 0 : !uguru_ac5_read(iot, ioh, 0x0904, &data, sizeof(data))) {
674 0 : vendid = data[0] << 8 | data[1];
675 0 : devid = data[2] << 8 | data[3];
676 :
677 0 : if (vendid == UGURU_VENDID_ABIT &&
678 0 : (devid == UGURU_DEVID1 ||
679 0 : devid == UGURU_DEVID2)) {
680 0 : ia->ipa_nio = 1;
681 0 : ia->ipa_io[0].length = UGURU_IOSIZE;
682 0 : ia->ipa_nmem = 0;
683 0 : ia->ipa_nirq = 0;
684 0 : ia->ipa_ndrq = 0;
685 : ret = 1;
686 0 : }
687 : }
688 0 : bus_space_unmap(iot, ioh, UGURU_IOSIZE);
689 0 : return (ret);
690 0 : }
691 :
692 : void
693 0 : uguru_attach(struct device *parent, struct device *self, void *aux)
694 : {
695 0 : struct uguru_softc *sc = (void *)self;
696 0 : struct isa_attach_args *ia = aux;
697 : struct uguru_sensor *sensors;
698 0 : uint8_t data[9];
699 : uint16_t vendid, devid, sysid;
700 : int i;
701 :
702 0 : sc->sc_iot = ia->ia_iot;
703 0 : if (bus_space_map(sc->sc_iot, ia->ipa_io[0].base,
704 0 : UGURU_IOSIZE, 0, &sc->sc_ioh)) {
705 0 : printf(": can't map i/o space\n");
706 0 : return;
707 : }
708 :
709 0 : UGURU_WRITE(sc->sc_iot, sc->sc_ioh, UGURU_INDEX, UGURU_PRODID);
710 0 : if (!uguru_read_multi(sc->sc_iot, sc->sc_ioh, &data, sizeof(data))) {
711 0 : sc->read = uguru_read_sensor;
712 0 : goto done;
713 : }
714 :
715 : /* AC2005 product ID */
716 0 : if (!uguru_ac5_read(sc->sc_iot, sc->sc_ioh,
717 : 0x0904, &data, sizeof(data))) {
718 0 : sc->read = uguru_ac5_read_sensor;
719 0 : goto done;
720 : }
721 :
722 0 : printf("\n");
723 0 : return;
724 :
725 : done:
726 : DPRINTF(5, ": %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x",
727 : data[0], data[1], data[2], data[3], data[4],
728 : data[5], data[6], data[7], data[8]);
729 :
730 0 : vendid = data[0] << 8 | data[1];
731 0 : devid = data[2] << 8 | data[3];
732 0 : sysid = data[3] << 8 | data[7];
733 :
734 0 : if (vendid != UGURU_VENDID_ABIT ||
735 0 : (devid != UGURU_DEVID1 &&
736 0 : devid != UGURU_DEVID2)) {
737 0 : printf(": attach failed\n");
738 0 : return;
739 : }
740 0 : printf(": AC%x", devid);
741 :
742 0 : switch(sysid) {
743 : case ABIT_SYSID_KV01:
744 : case ABIT_SYSID_AI01:
745 : case ABIT_SYSID_AN01:
746 0 : printf(" KV1");
747 : sensors = abitkv_sensors;
748 0 : break;
749 : case ABIT_SYSID_AA01:
750 : case ABIT_SYSID_AG01:
751 0 : printf(" AA1");
752 : sensors = abitaa_sensors;
753 0 : break;
754 : case ABIT_SYSID_AV01:
755 : case ABIT_SYSID_KVP1:
756 0 : printf(" AV1");
757 : sensors = abitav_sensors;
758 0 : break;
759 : case ABIT_SYSID_AS01:
760 0 : printf(" AS1");
761 : sensors = abitas_sensors;
762 0 : break;
763 : case ABIT_SYSID_AX01:
764 0 : printf(" AX1");
765 : sensors = abitax_sensors;
766 0 : break;
767 : case ABIT_SYSID_M401:
768 0 : printf(" M41");
769 : sensors = abitm4_sensors;
770 0 : break;
771 : case ABIT_SYSID_AN02:
772 0 : printf(" AN1");
773 : sensors = abitan_sensors;
774 0 : break;
775 : case ABIT_SYSID_AU01:
776 : case ABIT_SYSID_AL01:
777 : case ABIT_SYSID_BL01:
778 0 : printf(" AL1");
779 : sensors = abital_sensors;
780 0 : break;
781 : case ABIT_SYSID_AW01:
782 : case ABIT_SYSID_AW02:
783 0 : printf(" AW1");
784 : sensors = abitaw_sensors;
785 0 : break;
786 : case ABIT_SYSID_NI01:
787 0 : printf(" NI1");
788 : sensors = abitni_sensors;
789 0 : break;
790 : case ABIT_SYSID_AT01:
791 0 : printf(" AT1");
792 : sensors = abitat_sensors;
793 0 : break;
794 : case ABIT_SYSID_AN03:
795 0 : printf(" AN2");
796 : sensors = abitan2_sensors;
797 0 : break;
798 : case ABIT_SYSID_AB01:
799 0 : printf(" AB1");
800 : sensors = abitab_sensors;
801 0 : break;
802 : case ABIT_SYSID_AN04:
803 0 : printf(" AN3");
804 : sensors = abitan3_sensors;
805 0 : break;
806 : case ABIT_SYSID_AW03:
807 0 : printf(" AW2");
808 : sensors = abitaw2_sensors;
809 0 : break;
810 : case ABIT_SYSID_AT02:
811 0 : printf(" AT2");
812 : sensors = abitat2_sensors;
813 0 : break;
814 : case ABIT_SYSID_AB02:
815 : case ABIT_SYSID_IP01:
816 : case ABIT_SYSID_IX01:
817 : case ABIT_SYSID_IX02:
818 0 : printf(" AB2");
819 : sensors = abitab2_sensors;
820 0 : break;
821 : case ABIT_SYSID_IN01:
822 0 : printf(" IN1");
823 : sensors = abitin_sensors;
824 0 : break;
825 : default:
826 0 : printf(" unknown system (ID 0x%.4x)\n", sysid);
827 0 : return;
828 : }
829 0 : printf("\n");
830 :
831 0 : strlcpy(sc->sc_sensordev.xname,
832 0 : sc->sc_dev.dv_xname,
833 : sizeof(sc->sc_sensordev.xname));
834 :
835 0 : for (i = 0; sensors[i].desc != NULL; i++) {
836 0 : strlcpy(sc->sc_sensors[i].desc,
837 : sensors[i].desc, sizeof(sc->sc_sensors[i].desc));
838 0 : sc->sc_sensors[i].type = sensors[i].type;
839 0 : sensor_attach(&sc->sc_sensordev, &sc->sc_sensors[i]);
840 0 : sc->sc_numsensors++;
841 : }
842 0 : sc->uguru_sensors = sensors;
843 :
844 0 : if (sensor_task_register(sc, uguru_refresh, UGURU_INTERVAL) == NULL) {
845 0 : printf("%s: unable to register update task\n",
846 : sc->sc_sensordev.xname);
847 0 : return;
848 : }
849 0 : sensordev_install(&sc->sc_sensordev);
850 0 : }
851 :
852 : void
853 0 : uguru_refresh(void *arg)
854 : {
855 0 : struct uguru_softc *sc = (struct uguru_softc *)arg;
856 : int i;
857 :
858 0 : for (i = 0; i < sc->sc_numsensors; i++)
859 0 : sc->uguru_sensors[i].refresh(sc, i);
860 0 : }
861 :
862 : void
863 0 : uguru_refresh_temp(struct uguru_softc *sc, int n)
864 : {
865 0 : struct ksensor *sensor = &sc->sc_sensors[n];
866 : int status = SENSOR_S_OK;
867 : int ret;
868 :
869 0 : ret = sc->read(sc, n);
870 0 : if (sc->cs.reading == 0x00) {
871 0 : sensor->flags |= SENSOR_FINVALID;
872 0 : sensor->value = 0;
873 0 : return;
874 : }
875 0 : sensor->flags &= ~SENSOR_FINVALID;
876 0 : sensor->value = sc->cs.reading * 1000000 + 273150000;
877 :
878 0 : if (ret)
879 0 : status = SENSOR_S_UNSPEC;
880 : else {
881 0 : if (sc->cs.reading >= sc->cs.lower)
882 0 : status = SENSOR_S_WARN;
883 0 : if (sc->cs.reading >= sc->cs.upper)
884 0 : status = SENSOR_S_CRIT;
885 : }
886 0 : sensor->status = status;
887 0 : }
888 :
889 : void
890 0 : uguru_refresh_volt(struct uguru_softc *sc, int n)
891 : {
892 : int status = SENSOR_S_OK;
893 :
894 0 : if (sc->read(sc, n))
895 0 : status = SENSOR_S_UNSPEC;
896 : else
897 0 : if (sc->cs.reading <= sc->cs.lower ||
898 0 : sc->cs.reading >= sc->cs.upper)
899 0 : status = SENSOR_S_CRIT;
900 :
901 0 : sc->sc_sensors[n].value =
902 0 : sc->cs.reading * sc->uguru_sensors[n].rfact;
903 0 : sc->sc_sensors[n].status = status;
904 0 : }
905 :
906 : void
907 0 : uguru_refresh_fan(struct uguru_softc *sc, int n)
908 : {
909 0 : struct ksensor *sensor = &sc->sc_sensors[n];
910 : int ret;
911 :
912 0 : ret = sc->read(sc, n);
913 0 : if (sc->cs.reading == 0x00) {
914 0 : sensor->flags |= SENSOR_FINVALID;
915 0 : sensor->value = 0;
916 0 : return;
917 : }
918 0 : sensor->flags &= ~SENSOR_FINVALID;
919 0 : sensor->value = sc->cs.reading * 60;
920 :
921 0 : if (ret)
922 0 : sensor->status = SENSOR_S_UNSPEC;
923 : else
924 0 : if (sc->cs.reading <= sc->cs.lower)
925 0 : sensor->status = SENSOR_S_CRIT;
926 : else
927 0 : sensor->status = SENSOR_S_OK;
928 0 : }
929 :
930 : int
931 0 : uguru_read_sensor(struct uguru_softc *sc, int n)
932 : {
933 0 : struct ksensor *sensor = &sc->sc_sensors[n];
934 0 : bus_space_tag_t iot = sc->sc_iot;
935 0 : bus_space_handle_t ioh = sc->sc_ioh;
936 0 : uint8_t reg = sc->uguru_sensors[n].reg;
937 0 : uint8_t idx, data[3];
938 0 : uint8_t val = 0x00;
939 : int count, ret = 0;
940 :
941 0 : if (sensor->type == SENSOR_FANRPM)
942 0 : idx = UGURU_FAN_DATA;
943 : else
944 : idx = UGURU_ITM_DATA;
945 :
946 : /* sensor value */
947 0 : if (uguru_write_multi(iot, ioh, idx, ®, sizeof(reg)) ||
948 0 : uguru_read_multi(iot, ioh, &val, sizeof(val)))
949 0 : ++ret;
950 :
951 : /* sensor status */
952 0 : bzero(&data, sizeof(data));
953 0 : count = sensor->type == SENSOR_FANRPM ? 2 : 3;
954 :
955 0 : if (uguru_write_multi(iot, ioh, idx + 1, ®, sizeof(reg)) ||
956 0 : uguru_read_multi(iot, ioh, &data, count))
957 0 : ++ret;
958 :
959 : /* fill in current sensor structure */
960 0 : sc->cs.reading = val;
961 : /* sc->cs.flags = data[0]; */
962 0 : sc->cs.lower = data[1];
963 0 : sc->cs.upper = data[2];
964 :
965 : DPRINTF(50, "0x%.2x: 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x\n",
966 : idx, reg, val, data[0], data[1], data[2]);
967 :
968 0 : return (ret);
969 0 : }
970 :
971 : int
972 0 : uguru_ac5_read_sensor(struct uguru_softc *sc, int n)
973 : {
974 : uint16_t reg;
975 0 : uint8_t val = 0x00;
976 : int ret = 1;
977 :
978 0 : reg = sc->uguru_sensors[n].reg | 0x0880;
979 0 : if (uguru_ac5_read(sc->sc_iot, sc->sc_ioh, reg, &val, sizeof(val)))
980 0 : ++ret;
981 :
982 0 : sc->cs.reading = val;
983 0 : return (ret);
984 0 : }
985 :
986 : int
987 0 : uguru_ac5_read(bus_space_tag_t iot, bus_space_handle_t ioh,
988 : uint16_t reg, void *data, int count)
989 : {
990 0 : uint8_t buf[3];
991 :
992 0 : buf[0] = reg >> 8;
993 0 : buf[1] = reg & 0xff;
994 0 : buf[2] = count;
995 :
996 0 : if (!uguru_write_multi(iot, ioh, 0x1a, &buf, sizeof(buf)) &&
997 0 : !uguru_read_multi(iot, ioh, data, count))
998 0 : return 0;
999 :
1000 : DPRINTF(0, "uguru_ac5_read: timeout 0x%.2x 0x%.2x 0x%.2x\n",
1001 : buf[0], buf[1], buf[2]);
1002 :
1003 0 : return 1;
1004 0 : }
1005 :
1006 : int
1007 0 : uguru_write_multi(bus_space_tag_t iot, bus_space_handle_t ioh,
1008 : uint8_t idx, void *data, int count)
1009 : {
1010 : uint8_t *inbuf = data;
1011 : int i, ntries;
1012 :
1013 0 : UGURU_WRITE(iot, ioh, UGURU_INDEX, idx);
1014 :
1015 0 : for (i = 0; i < count; ++i) {
1016 : /*
1017 : * wait for non-busy status before write
1018 : * to the data port.
1019 : */
1020 : ntries = 0;
1021 0 : while (UGURU_READ(iot, ioh, UGURU_INDEX) >> 1 & 1) {
1022 0 : if (++ntries > 65)
1023 : goto timeout;
1024 0 : DELAY(5);
1025 : }
1026 : /* dummy read to flush the internal buffer */
1027 0 : if (i == 0)
1028 0 : UGURU_READ(iot, ioh, UGURU_DATA);
1029 :
1030 0 : UGURU_WRITE(iot, ioh, UGURU_DATA, *inbuf++);
1031 : }
1032 0 : return 0;
1033 :
1034 : timeout:
1035 : DPRINTF(0, "uguru_write_multi: timeout 0x%.2x\n", idx);
1036 0 : return 1;
1037 0 : }
1038 :
1039 : int
1040 0 : uguru_read_multi(bus_space_tag_t iot, bus_space_handle_t ioh,
1041 : void *data, int count)
1042 : {
1043 : uint8_t *outbuf = data;
1044 : int i, ntries;
1045 :
1046 0 : for (i = 0; i < count; ++i) {
1047 : /*
1048 : * wait for valid status before read
1049 : * from the data port.
1050 : */
1051 : ntries = 0;
1052 0 : while (!(UGURU_READ(iot, ioh, UGURU_INDEX) & 1)) {
1053 0 : if (++ntries > 40) {
1054 : DPRINTF(0, "uguru_read_multi: timeout\n");
1055 0 : return 1;
1056 : }
1057 0 : DELAY(35);
1058 : }
1059 0 : *outbuf++ = UGURU_READ(iot, ioh, UGURU_DATA);
1060 : }
1061 0 : return 0;
1062 0 : }
|