Subversion Repositories Kolibri OS

Rev

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