Rev 251 | 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 | |||
223 | Ghost | 6 | ; ABIT uGuru |
7 | ; |
||
8 | ; Chip Temp Volt Fan ISA SMBus LPC |
||
9 | ; W83L950D(?) 3 11 5 - - + |
||
10 | |||
11 | |||
12 | ; uGuru ports |
||
13 | UGURU_CMD_PORT equ 0x0e0 |
||
14 | UGURU_DATA_PORT equ 0x0e4 |
||
15 | ; temp sensors |
||
16 | UGURU_CPUTEMP equ 0x2100 |
||
17 | UGURU_SYSTEMP equ 0x2101 |
||
18 | UGURU_PWMTEMP equ 0x210f |
||
19 | ; fans. These are placed at bank 2 |
||
20 | SENS_CPUFAN equ 0x2600 |
||
21 | SENS_NBFAN equ 0x2601 |
||
22 | SENS_SYSFAN equ 0x2602 |
||
23 | SENS_AUXFAN1 equ 0x2603 |
||
24 | SENS_AUXFAN2 equ 0x2604 |
||
25 | ; Voltage sensors |
||
26 | SENS_VCORE equ 0x2103 ; 3.49V max |
||
27 | SENS_DDRVDD equ 0x2104 ; 3.49V max |
||
28 | SENS_DDRVTT equ 0x210A ; 3.49V max |
||
29 | SENS_NBVDD equ 0x2108 ; 3.49V max |
||
30 | SENS_SBVDD equ 0x210E ; 3.49V max |
||
31 | SENS_HTV equ 0x2102 ; 3.49V max |
||
32 | SENS_AGP equ 0x2109 ; 3.49V max |
||
33 | SENS_5V equ 0x2106 ; 6.25V max |
||
34 | SENS_3V3 equ 0x2105 ; 4.36V max |
||
35 | SENS_5VSB equ 0x210B ; 6.25V max |
||
36 | SENS_3VDUAL equ 0x210D ; 4.36V max |
||
37 | ; Voltage ADC multipliers |
||
38 | MLTP_3V49 equ 0.0136862745098039 |
||
39 | MLTP_4V36 equ 0.0170980392156863 |
||
40 | MLTP_6V25 equ 0.0245098039215686 |
||
41 | |||
42 | |||
43 | v_addr: dw SENS_VCORE, SENS_DDRVDD, SENS_DDRVTT, SENS_NBVDD, SENS_SBVDD |
||
44 | dw SENS_HTV, SENS_AGP, SENS_5V, SENS_3V3, SENS_5VSB, SENS_3VDUAL |
||
45 | |||
46 | v_mult: dd MLTP_3V49, MLTP_3V49, MLTP_3V49, MLTP_3V49, MLTP_3V49, MLTP_3V49 |
||
47 | dd MLTP_3V49, MLTP_6V25, MLTP_4V36, MLTP_6V25, MLTP_4V36 |
||
48 | |||
49 | |||
50 | msg_uguru: db 10, 'ABIT uGuru' |
||
51 | |||
52 | ;----------------------------------- |
||
53 | uGuru_init: |
||
54 | ; Проверка наличия и инициализация |
||
55 | ; OUT - CF = 1 - error |
||
241 | Ghost | 56 | cmp byte[acc_type], 2 ; Special IO interface |
223 | Ghost | 57 | jne .uGuru_no |
58 | pusha |
||
59 | mov ecx, UGURU_CMD_PORT |
||
60 | mov edx, UGURU_DATA_PORT |
||
61 | call ReservePorts |
||
251 | Ghost | 62 | jc .no_lpc |
223 | Ghost | 63 | in al, UGURU_CMD_PORT |
64 | test al, al |
||
65 | jz @f |
||
66 | cmp al, 0xac |
||
67 | jne .bad_sig |
||
68 | @@: in al, UGURU_DATA_PORT |
||
69 | test al, al |
||
70 | jz @f |
||
71 | cmp al, 8 |
||
72 | jne .bad_sig |
||
73 | @@: mov [hwm_chip_name], msg_uguru |
||
74 | popa |
||
75 | clc |
||
76 | ret |
||
77 | .bad_sig: |
||
78 | ; popa ; |
||
79 | ; clc ; <- uncomment this three line, if you certain that you |
||
80 | ; ret ; have ABIT uGuru but he is not defined |
||
81 | .no_lpc: |
||
82 | mov ecx, UGURU_CMD_PORT |
||
83 | mov edx, UGURU_DATA_PORT |
||
84 | call FreePorts |
||
85 | popa |
||
86 | .uGuru_no: |
||
87 | stc |
||
88 | ret |
||
89 | ;----------------------------------- |
||
90 | uGuru_getparam: |
||
91 | ; Temperature |
||
92 | mov ax, UGURU_CPUTEMP |
||
93 | call uGuru_ReadSensor |
||
94 | mov [hwm_temps + 0], al |
||
95 | mov ax, UGURU_SYSTEMP |
||
96 | call uGuru_ReadSensor |
||
97 | mov [hwm_temps + 1], al |
||
98 | mov ax, UGURU_PWMTEMP |
||
99 | call uGuru_ReadSensor |
||
100 | mov [hwm_temps + 2], al |
||
101 | ; Fan speed |
||
102 | mov ax, SENS_CPUFAN |
||
103 | call uGuru_ReadSensor |
||
104 | mov dl, 60 |
||
105 | mul dl |
||
106 | mov word[hwm_rpms + 0 ], ax |
||
107 | mov ax, SENS_NBFAN |
||
108 | call uGuru_ReadSensor |
||
109 | mov dl, 60 |
||
110 | mul dl |
||
111 | mov word[hwm_rpms + 4 ], ax |
||
112 | mov ax, SENS_SYSFAN |
||
113 | call uGuru_ReadSensor |
||
114 | mov dl, 60 |
||
115 | mul dl |
||
116 | mov word[hwm_rpms + 8 ], ax |
||
117 | mov ax, SENS_AUXFAN1 |
||
118 | call uGuru_ReadSensor |
||
119 | mov dl, 60 |
||
120 | mul dl |
||
121 | mov word[hwm_rpms + 12], ax |
||
122 | mov ax, SENS_AUXFAN2 |
||
123 | call uGuru_ReadSensor |
||
124 | mov dl, 60 |
||
125 | mul dl |
||
126 | mov word[hwm_rpms + 16], ax |
||
127 | ; voltages |
||
128 | cld ; Paranoia |
||
129 | xor ecx, ecx |
||
130 | mov esi, v_addr |
||
131 | @@: push ecx |
||
132 | lodsw |
||
133 | call uGuru_ReadSensor |
||
134 | movzx eax, al |
||
135 | fld dword[v_mult + ecx * 4] |
||
136 | push eax |
||
137 | fild dword [esp] |
||
138 | fmulp st1, st0 |
||
139 | fstp dword [hwm_voltages + ecx * 4] |
||
140 | pop eax |
||
141 | pop ecx |
||
142 | inc ecx |
||
143 | cmp ecx, 11 ; <-- количество датчиков (ADC Vin) |
||
144 | jne @b |
||
145 | |||
146 | ret |
||
147 | ;----------------------------------- |
||
148 | uGuru_ReadSensor: |
||
149 | ; Read a sensor |
||
150 | ; In : ax - sensorID |
||
151 | ; Out : al - result |
||
152 | mov ebx, eax ; Ask to read from uGuru |
||
153 | shr eax, 8 |
||
154 | out UGURU_DATA_PORT, al |
||
155 | mov ecx, 1000 ; I guess this is to se if uGuru is ready to take a command |
||
156 | .is_ready: |
||
157 | in al, UGURU_DATA_PORT |
||
158 | dec ecx |
||
159 | jnz @f |
||
160 | xor al, al |
||
161 | ret |
||
162 | @@: cmp al, 8 |
||
163 | jne .is_ready |
||
164 | mov al, bl ; Whitch sensor to read? |
||
165 | out UGURU_CMD_PORT, al |
||
166 | mov ecx, 1000 ; Wait until uGuru is ready to be read |
||
167 | .is_ready2: |
||
168 | in al, UGURU_DATA_PORT |
||
169 | dec ecx |
||
170 | jnz @f |
||
171 | xor al, al |
||
172 | ret |
||
173 | @@: cmp al, 1 |
||
174 | jne .is_ready2 |
||
175 | in al, UGURU_CMD_PORT ; Read the sensor |
||
176 | push eax |
||
177 | call uGuru_Ready ; Put the chip in ready state |
||
178 | pop eax ; Return the result of the sensor |
||
179 | ret |
||
180 | ;----------------------------------- |
||
181 | uGuru_Ready: |
||
182 | ; Put uGuru in ready state. uGuru will hold 0x08 at Data port and 0xAC at Command port after this. |
||
183 | ; Out : CF = 1 - error |
||
184 | ; Wait until uGuru is in ready-state |
||
185 | ; The loop shouldn't be needed to execut more then one time |
||
186 | mov edx, 1000 |
||
187 | .nxt: in al, UGURU_DATA_PORT |
||
188 | cmp al, 8 |
||
189 | je .ok |
||
190 | xor al, al ; after 0x00 is written to Data port |
||
191 | out UGURU_DATA_PORT, al |
||
192 | mov ecx, 1000 ; Wait until 0x09 is read at Data port |
||
193 | .is_ready: |
||
194 | in al, UGURU_DATA_PORT |
||
195 | dec ecx |
||
196 | jnz @f |
||
197 | stc |
||
198 | ret |
||
199 | @@: cmp al, 9 |
||
200 | jne .is_ready |
||
201 | mov ecx, 1000 ; Wait until 0xAC is read at Cmd port |
||
202 | .is_ready2: |
||
203 | in al, UGURU_CMD_PORT |
||
204 | dec ecx |
||
205 | jnz @f |
||
206 | stc |
||
207 | ret |
||
208 | @@: cmp al, 0xAC |
||
209 | jne .is_ready2 |
||
210 | dec edx ; Prevent a lockup |
||
211 | jnz .nxt |
||
212 | stc |
||
213 | ret |
||
214 | .ok: clc |
||
215 | ret-->-> |
||
216 |