Subversion Repositories Kolibri OS

Rev

Rev 518 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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