Subversion Repositories Kolibri OS

Rev

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

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