Subversion Repositories Kolibri OS

Rev

Rev 500 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
313 Ghost 1
;
2
; Ghost Monitor - утилита (стресс) тестирования и мониторинга системы
3
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
4
; All Right Reserved
5
 
205 heavyiron 6
; Integrated Technology Express
223 Ghost 7
;	Chip	Temp	Volt	Fan   ISA   SMBus
500 Ghost 8
;	it8705	 3	 8+1*	 3     +      +
9
;	it8712	 3	 8+1*	 3     +      +
205 heavyiron 10
 
11
; SiS
223 Ghost 12
;	Chip	Temp	Volt	Fan   ISA   SMBus
500 Ghost 13
;	sis950	 3	 8+1*	 3     +      +
14
;
15
; * - VBAT
205 heavyiron 16
 
17
IT87_REGCHIP	equ	0x58
18
IT87_CHIPID	equ	0x90
19
IT87_FANDIV	equ	0x0B
500 Ghost 20
it8705		db	'IT8705F/SiS 950', 0
21
it8712		db	'IT8712F', 0
22
it8716		db	'IT8716F', 0
23
ite_unk		db	'Unknown ITE', 0
205 heavyiron 24
 
25
ite_coeff:	dd 0.016		; Vcore
26
		dd 0.016		; Vin0
27
		dd 0.016		; Vin1 (+3.3V)
28
		dd 0.02688		; AVcc (+5V)
29
		dd 0.0608		; Vin2 (+12V)
30
		dd -0.055632		; -12V
31
		dd -0.02408		; -5V
32
;-----------------------------------
33
it87_init:
34
; Проверка наличия и инициализация
35
; OUT - CF = 1 - error
223 Ghost 36
	cmp	byte[acc_type], 2	; Only ISA and SMBus
243 Ghost 37
	jae	.no_io
38
 
39
	mov	ecx, 0x2e
40
	mov	edx, 0x2f
41
	call	ReservePorts
250 Ghost 42
	jc	.no_io
243 Ghost 43
 
44
	mov	eax, 0x55550187		; переход в MB PnP Mode
45
	out	0x2e, al
46
	shr	eax, 8
47
	out	0x2e, al
48
	shr	eax, 8
49
	out	0x2e, al
50
	shr	eax, 8
51
	out	0x2e, al
52
 
53
	mov	al, 0x20
54
	out	0x2e, al
55
	in	al, 0x2f		; al = 0x87
56
	push	eax
57
 
58
	mov	al, 0x21
59
	out	0x2e, al
60
	in	al, 0x2f		; al = model
61
	push	eax
62
 
63
	mov	al, 0x02		; выход из режима
64
	out	0x2E, al
65
	out	0x2F, al
66
 
67
	mov	ecx, 0x2e
68
	mov	edx, 0x2f
69
	call	FreePorts
70
 
71
	pop	eax
72
	pop	ebx
73
	cmp	bl, 0x87
74
	jne	.no_io
75
 
223 Ghost 76
	mov	edx, it8705
77
	cmp	al, 0x05
78
	je	@f
79
	mov	edx, it8712
80
	cmp	al, 0x12
81
	je	@f
82
	mov	edx, it8716
83
	cmp	al, 0x16
84
	je	@f
85
	mov	edx, ite_unk
86
@@:	mov	[hwm_chip_name], edx
205 heavyiron 87
	clc
243 Ghost 88
	ret
89
 
90
.no_io:	stc
205 heavyiron 91
	ret
243 Ghost 92
 
93
	; cmp	byte[acc_type], 2	; Only ISA and SMBus
94
	; jae	it87_no
95
	;;--- Проверяем IT87* --------
96
	; mov	al, IT87_REGCHIP
97
	; call	[IO_Read]
98
	; cmp	al, IT87_CHIPID
99
	; jne	it87_no		; это не it87 !!!
100
	;;-~- not tested ~-~-
101
	; mov	al, 0x21	; --- узнаём идентификатор чипа --
102
	; call	[IO_Read]
103
	; mov	edx, it8705
104
	; cmp	al, 0x05
105
	; je	@f
106
	; mov	edx, it8712
107
	; cmp	al, 0x12
108
	; je	@f
109
	; mov	edx, it8716
110
	; cmp	al, 0x16
111
	; je	@f
112
	; mov	edx, ite_unk
113
; @@:	mov	[hwm_chip_name], edx
114
	;;-~-~-~-~-~-~-~-~-~-
115
	; clc
116
	; ret
117
; it87_no:stc
118
	; ret
500 Ghost 119
 
205 heavyiron 120
;-----------------------------------
223 Ghost 121
it87_getparam:
122
	call	it87_get_temp
123
	call	it87_get_fan_speed
124
	mov	edi, ite_coeff
125
	call	wb_get_volt
126
	ret
127
;-----------------------------------
205 heavyiron 128
it87_get_temp:
129
	xor	ecx, ecx
223 Ghost 130
	mov	esi, hwm_temps
131
@@:	mov	eax, ecx
205 heavyiron 132
	add	al, 0x29
223 Ghost 133
	call	[IO_Read]
205 heavyiron 134
	mov	[esi + ecx * 2], al
135
	inc	ecx
136
	cmp	ecx, 3
137
	jb	@b
138
	ret
139
;-----------------------------------
140
it87_fan_div	db	1, 1, 1
141
it87_get_fan_speed:
142
; читаем делители
143
	mov	al, IT87_FANDIV
223 Ghost 144
	call	[IO_Read]
145
 
205 heavyiron 146
	mov	ah, al
147
	and	al, 0x07
148
	mov	[it87_fan_div], al
149
	shr	ah, 3
150
	and	ah, 0x07
151
	mov	[it87_fan_div + 1], ah
223 Ghost 152
 
205 heavyiron 153
	xor	ecx, ecx
223 Ghost 154
@@:	mov	al, 0x0D
205 heavyiron 155
	add	al, cl
223 Ghost 156
	call	[IO_Read]
518 Ghost 157
 
158
	test	al, al
159
	jz	@f
160
	cmp	al, 0xff
161
	je	@f
223 Ghost 162
 
205 heavyiron 163
	movzx	ebx, al
164
	push	ecx
165
	mov	cl, [it87_fan_div + ecx]
166
	shl	ebx, cl
167
	pop	ecx
168
	mov	eax, 1350000
169
	xor	edx, edx
170
	div	ebx
223 Ghost 171
	mov	[hwm_rpms + 4 * ecx], eax
205 heavyiron 172
	inc	ecx
173
	cmp	ecx, 3
174
	jb	@b
518 Ghost 175
@@:
205 heavyiron 176
	ret
177
;--------------------------------------------------------------------------
243 Ghost 178
;
179
; Presets for IT8712
180
;
181
; Volt = A * read_val + B
182
;
183
;	A, B
184
; --- 0 ---
500 Ghost 185
; dd 0.01565, 0.0		; VIN0 (Index = 0x20)
186
; dd 0.016, 0.0			; VIN1 (Index = 0x21)
187
; dd 0.016, 0.0			; VIN2 (Index = 0x22)
188
; dd 0.0, 0.0			; VIN3 (Index = 0x23)
189
; dd 0.0608, 0.0		; VIN4 (Index = 0x24)
190
; dd 0.0, 0.0			; VIN5 (Index = 0x25)
191
; dd 0.0, 0.0			; VIN6 (Index = 0x26)
192
; dd 0.08224, -22.104		; VIN7 (Index = 0x27)
193
; dd 0.016, 0.0			; VBAT (Index = 0x28)
243 Ghost 194
 
195
; --- 1 ---
196
; dd 0.01614, 0.0
197
; dd 0.01614, 0.0
198
; dd 0.01614, 0.0
199
; dd 0.01614, 0.0
200
; dd 0.062946, 0.0
201
; dd 0.0, 0.0
202
; dd 0.0, 0.0
203
; dd 0.016, 0.0
204
; dd 0.016, 0.0
205
 
206
; --- 2 ---
207
; dd 0.016, 0.0
208
; dd 0.016, 0.0
209
; dd 0.016, 0.0
210
; dd 0.062946, 0.0
211
; dd 0.016, 0.0
212
; dd 0.01614, 0.0
213
; dd 0.0, 0.0
214
; dd 0.016, 0.0
215
; dd 0.016, 0.0
216
 
217
; --- 3 ---
218
; dd 0.016, 0.0
219
; dd 0.016, 0.0
220
; dd 0.016, 0.0
221
; dd 0.027, 0.0
222
; dd 0.06564, 0.0
223
; dd 0.084, -17.408
224
; dd 0.0512, -9.0112
225
; dd 0.016, 0.0
226
; dd 0.016, 0.0
227
 
228
; --- 4 ---
229
; dd 0.01653, 0.0
230
; dd 0.016, 0.0
231
; dd 0.016, 0.0
232
; dd 0.02684, 0.0
233
; dd 0.06398, 0.0
234
; dd 0.0, 0.0
235
; dd 0.0, 0.0
236
; dd 0.016, 0.0
237
; dd 0.016, 0.0
238
 
239
; --- 5 ---
240
; dd 0.016, 0.0
241
; dd 0.016, 0.0
242
; dd 0.016, 0.0
243
; dd 0.027, 0.0
244
; dd 0.06369, 0.0
245
; dd 0.082285714288, -16.9691428598999
246
; dd 0.016, 0.0
247
; dd 0.016, 0.0
248
; dd 0.016, 0.0
249
 
250
; --- 6 ---
251
; dd 0.01565, 0.0
252
; dd 0.06564, 0.0
253
; dd 0.016, 0.0
254
; dd 0.016, 0.0
255
; dd 0.02688, 0.0
256
; dd 0.016, 0.0
257
; dd 0.016, 0.0
258
; dd 0.016, 0.0
259
; dd 0.016, 0.0
260
 
261
; --- 7 ---
262
; dd 0.016, 0.0
263
; dd 0.016, 0.0
264
; dd 0.016, 0.0
265
; dd 0.027, 0.0
266
; dd 0.06369, 0.0
267
; dd 0.082285714288, -16.9691428598999
268
; dd 0.016, 0.0
269
; dd 0.016, 0.0
270
; dd 0.016, 0.0
271
 
272
; --- 8 ---
273
; dd 0.01653, 0.0
274
; dd 0.016, 0.0
275
; dd 0.016, 0.0
276
; dd 0.0265, 0.0
277
; dd 0.06398, 0.0
278
; dd 0.0, 0.0
279
; dd 0.0, 0.0
280
; dd 0.016, 0.0
281
; dd 0.016, 0.0
282
 
283
; --- 9 ---
284
; dd 0.016, 0.0
285
; dd 0.01565, 0.0
286
; dd 0.016, 0.0
287
; dd 0.0265, 0.0
288
; dd 0.06398, 0.0
289
; dd 0.09152, -20.592
290
; dd 0.03728, -8.388
291
; dd 0.016, 0.0
292
; dd 0.016, 0.0
293
 
294
; --- 10 ---
295
; dd 0.016, 0.0
296
; dd 0.016, 0.0
297
; dd 0.016, 0.0
298
; dd 0.0265, 0.0
299
; dd 0.06398, 0.0
300
; dd 0.016, 0.0
301
; dd 0.0512, -9.0112
302
; dd 0.0, 0.0
303
; dd 0.0, 0.0
304
 
305
; --- 11 ---
306
; dd 0.016, 0.0
307
; dd 0.0, 0.0
308
; dd 0.016, 0.0
309
; dd 0.016, 0.0
310
; dd 0.06564, 0.0
311
; dd 0.0, 0.0
312
; dd 0.0, 0.0
313
; dd 0.0, 0.0
314
; dd 0.0, 0.0