forked from KolibriOS/kolibrios
GMon: simple precautions against division-by-zero error
git-svn-id: svn://kolibrios.org@2429 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ba28bfb5a8
commit
d955a6bf75
@ -4,13 +4,13 @@
|
||||
; All Right Reserved
|
||||
|
||||
; Integrated Technology Express
|
||||
; Chip Temp Volt Fan ISA SMBus
|
||||
; it8705 3 8+1* 3 + +
|
||||
; it8712 3 8+1* 3 + +
|
||||
; Chip Temp Volt Fan ISA SMBus
|
||||
; it8705 3 8+1* 3 + +
|
||||
; it8712 3 8+1* 3 + +
|
||||
|
||||
; SiS
|
||||
; Chip Temp Volt Fan ISA SMBus
|
||||
; sis950 3 8+1* 3 + +
|
||||
; Chip Temp Volt Fan ISA SMBus
|
||||
; sis950 3 8+1* 3 + +
|
||||
;
|
||||
; * - VBAT
|
||||
|
||||
@ -20,7 +20,7 @@ IT87_FANDIV equ 0x0B
|
||||
it8705 db 'IT8705F/SiS 950', 0
|
||||
it8712 db 'IT8712F', 0
|
||||
it8716 db 'IT8716F', 0
|
||||
ite_unk db 'Unknown ITE', 0
|
||||
ite_unk db 'Unknown ITE', 0
|
||||
|
||||
ite_coeff: dd 0.016 ; Vcore
|
||||
dd 0.016 ; Vin0
|
||||
@ -41,7 +41,7 @@ it87_init:
|
||||
call ReservePorts
|
||||
jc .no_io
|
||||
|
||||
mov eax, 0x55550187 ; ïåðåõîä â MB PnP Mode
|
||||
mov eax, 0x55550187 ; ïåðåõîä â MB PnP Mode
|
||||
out 0x2e, al
|
||||
shr eax, 8
|
||||
out 0x2e, al
|
||||
@ -87,30 +87,30 @@ it87_init:
|
||||
clc
|
||||
ret
|
||||
|
||||
.no_io: stc
|
||||
.no_io: stc
|
||||
ret
|
||||
|
||||
; cmp byte[acc_type], 2 ; Only ISA and SMBus
|
||||
; jae it87_no
|
||||
; cmp byte[acc_type], 2 ; Only ISA and SMBus
|
||||
; jae it87_no
|
||||
;;--- Ïðîâåðÿåì IT87* --------
|
||||
; mov al, IT87_REGCHIP
|
||||
; call [IO_Read]
|
||||
; cmp al, IT87_CHIPID
|
||||
; jne it87_no ; ýòî íå it87 !!!
|
||||
; mov al, IT87_REGCHIP
|
||||
; call [IO_Read]
|
||||
; cmp al, IT87_CHIPID
|
||||
; jne it87_no ; ýòî íå it87 !!!
|
||||
;;-~- not tested ~-~-
|
||||
; mov al, 0x21 ; --- óçíà¸ì èäåíòèôèêàòîð ÷èïà --
|
||||
; call [IO_Read]
|
||||
; mov edx, it8705
|
||||
; cmp al, 0x05
|
||||
; je @f
|
||||
; mov edx, it8712
|
||||
; cmp al, 0x12
|
||||
; je @f
|
||||
; mov edx, it8716
|
||||
; cmp al, 0x16
|
||||
; je @f
|
||||
; mov edx, ite_unk
|
||||
; @@: mov [hwm_chip_name], edx
|
||||
; mov al, 0x21 ; --- óçíà¸ì èäåíòèôèêàòîð ÷èïà --
|
||||
; call [IO_Read]
|
||||
; mov edx, it8705
|
||||
; cmp al, 0x05
|
||||
; je @f
|
||||
; mov edx, it8712
|
||||
; cmp al, 0x12
|
||||
; je @f
|
||||
; mov edx, it8716
|
||||
; cmp al, 0x16
|
||||
; je @f
|
||||
; mov edx, ite_unk
|
||||
; @@: mov [hwm_chip_name], edx
|
||||
;;-~-~-~-~-~-~-~-~-~-
|
||||
; clc
|
||||
; ret
|
||||
@ -167,6 +167,8 @@ it87_get_fan_speed:
|
||||
pop ecx
|
||||
mov eax, 1350000
|
||||
xor edx, edx
|
||||
test ebx, ebx
|
||||
jz @f
|
||||
div ebx
|
||||
mov [hwm_rpms + 4 * ecx], eax
|
||||
inc ecx
|
||||
@ -180,17 +182,17 @@ it87_get_fan_speed:
|
||||
;
|
||||
; Volt = A * read_val + B
|
||||
;
|
||||
; A, B
|
||||
; A, B
|
||||
; --- 0 ---
|
||||
; dd 0.01565, 0.0 ; VIN0 (Index = 0x20)
|
||||
; dd 0.016, 0.0 ; VIN1 (Index = 0x21)
|
||||
; dd 0.016, 0.0 ; VIN2 (Index = 0x22)
|
||||
; dd 0.0, 0.0 ; VIN3 (Index = 0x23)
|
||||
; dd 0.0608, 0.0 ; VIN4 (Index = 0x24)
|
||||
; dd 0.0, 0.0 ; VIN5 (Index = 0x25)
|
||||
; dd 0.0, 0.0 ; VIN6 (Index = 0x26)
|
||||
; dd 0.08224, -22.104 ; VIN7 (Index = 0x27)
|
||||
; dd 0.016, 0.0 ; VBAT (Index = 0x28)
|
||||
; dd 0.01565, 0.0 ; VIN0 (Index = 0x20)
|
||||
; dd 0.016, 0.0 ; VIN1 (Index = 0x21)
|
||||
; dd 0.016, 0.0 ; VIN2 (Index = 0x22)
|
||||
; dd 0.0, 0.0 ; VIN3 (Index = 0x23)
|
||||
; dd 0.0608, 0.0 ; VIN4 (Index = 0x24)
|
||||
; dd 0.0, 0.0 ; VIN5 (Index = 0x25)
|
||||
; dd 0.0, 0.0 ; VIN6 (Index = 0x26)
|
||||
; dd 0.08224, -22.104 ; VIN7 (Index = 0x27)
|
||||
; dd 0.016, 0.0 ; VBAT (Index = 0x28)
|
||||
|
||||
; --- 1 ---
|
||||
; dd 0.01614, 0.0
|
||||
|
@ -1,38 +1,38 @@
|
||||
;
|
||||
; Ghost Monitor - утилита (стресс) тестирования и мониторинга системы
|
||||
; Ghost Monitor - ã⨫¨â (áâà¥áá) â¥áâ¨à®¢ ¨ï ¨ ¬®¨â®à¨£ á¨á⥬ë
|
||||
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
|
||||
; All Right Reserved
|
||||
|
||||
;
|
||||
; Библиотека для чипов WinBond
|
||||
; <EFBFBD>¨¡«¨®â¥ª ¤«ï 稯®¢ WinBond
|
||||
;
|
||||
;
|
||||
; Дописать получение инфы с других датчиков
|
||||
; W83627DHG мониторинг аналогичен W83627EHF, дописать учёт DIV_B2
|
||||
; + 16.03.06 Исправлена ошибка в wb_get_cpu_temper с десятых градуса (было 30.5 30.0 31.5 ...)
|
||||
; „®¯¨á âì ¯®«ã票¥ ¨äë á ¤àã£¨å ¤ â稪®¢
|
||||
; W83627DHG ¬®¨â®à¨£ «®£¨ç¥ W83627EHF, ¤®¯¨á âì ãçñâ DIV_B2
|
||||
; + 16.03.06 ˆá¯à ¢«¥ ®è¨¡ª ¢ wb_get_cpu_temper á ¤¥áïâëå £à ¤ãá (¡ë«® 30.5 30.0 31.5 ...)
|
||||
;
|
||||
;
|
||||
; О маркировке (?) : H - H/W Monitor, G - Pb-free package, T - ACPI, S - Smart Card Reader Interface
|
||||
; Ž ¬ ન஢ª¥ (?) : H - H/W Monitor, G - Pb-free package, T - ACPI, S - Smart Card Reader Interface
|
||||
; D - SuperIO supporting Intel* PECI* & SST* interfaces, U - UART
|
||||
;
|
||||
; | Chip name | ID Vin Fanin PWM Temp ISA SMBus
|
||||
msg_wb27HF: db 'W83627HF', 0 ; 0x20|0x21 9 3 2 3 + +
|
||||
msg_wb27THF: db 'W83627THF', 0 ; 0x90|0x91 7 3 3 3 + +
|
||||
msg_wb37THF: db 'W83637THF', 0 ; 0x80 7 3 3 3 + +
|
||||
msg_wb97HF: db 'W83697HF', 0 ; 0x60|0x61 8 2 2 2 + -
|
||||
; | Chip name | ID Vin Fanin PWM Temp ISA SMBus
|
||||
msg_wb27HF: db 'W83627HF', 0 ; 0x20|0x21 9 3 2 3 + +
|
||||
msg_wb27THF: db 'W83627THF', 0 ; 0x90|0x91 7 3 3 3 + +
|
||||
msg_wb37THF: db 'W83637THF', 0 ; 0x80 7 3 3 3 + +
|
||||
msg_wb97HF: db 'W83697HF', 0 ; 0x60|0x61 8 2 2 2 + -
|
||||
msg_wb27THFA: db 'W83627THF-A', 0 ; 0x1A
|
||||
|
||||
msg_w83627DHG: db 'W83627DHG', 0 ; 0xC1 ? 5 ? 3 + +
|
||||
msg_w83627EHF: db 'W83627EHF', 0 ; 0x88 10 5 3 3 + +
|
||||
msg_w83627EHG: db 'W83627EHG', 0 ; 0xA1 10 5 3 3 + +
|
||||
msg_w83627DHG: db 'W83627DHG', 0 ; 0xC1 ? 5 ? 3 + +
|
||||
msg_w83627EHF: db 'W83627EHF', 0 ; 0x88 10 5 3 3 + +
|
||||
msg_w83627EHG: db 'W83627EHG', 0 ; 0xA1 10 5 3 3 + +
|
||||
|
||||
|
||||
; db 'W83781D', 0 ; 0x10|0x11 7 3 3 + +
|
||||
; db 'W83782D', 0 ; 0x30 9 3 3 + +
|
||||
; db 'AS99127F', 0 ; 0x31 7 3 3 - +
|
||||
; db 'W83783S', 0 ; 0x40|0x41 5-6 3 1-2 - +
|
||||
; db 'W83791D', 0 ; 0x70|0x71 10 5 3 - +
|
||||
msg_wbunk: db 'Unknown Winbond', 0 ; other, non zero ;-)
|
||||
; db 'W83781D', 0 ; 0x10|0x11 7 3 3 + +
|
||||
; db 'W83782D', 0 ; 0x30 9 3 3 + +
|
||||
; db 'AS99127F', 0 ; 0x31 7 3 3 - +
|
||||
; db 'W83783S', 0 ; 0x40|0x41 5-6 3 1-2 - +
|
||||
; db 'W83791D', 0 ; 0x70|0x71 10 5 3 - +
|
||||
msg_wbunk: db 'Unknown Winbond', 0 ; other, non zero ;-)
|
||||
|
||||
uglobal
|
||||
wb_fans_num db 0
|
||||
@ -40,7 +40,7 @@ endg
|
||||
|
||||
;-----------------------------------
|
||||
wb_init:
|
||||
; Проверка наличия и инициализация
|
||||
; <EFBFBD>஢¥àª «¨ç¨ï ¨ ¨¨æ¨ «¨§ æ¨ï
|
||||
; OUT - CF = 1 - error
|
||||
cmp byte[acc_type], 2 ; Only ISA and SMBus
|
||||
jae wb_no
|
||||
@ -57,9 +57,9 @@ wb_init:
|
||||
mov al, 0x4f
|
||||
call [IO_Read]
|
||||
cmp ax, 0xa35c
|
||||
jne wb_no ; это не Winbond !!!
|
||||
jne wb_no ; íâ® ¥ Winbond !!!
|
||||
|
||||
; --- узнаём идентификатор чипа --
|
||||
; --- 㧠ñ¬ ¨¤¥â¨ä¨ª â®à 稯 --
|
||||
mov al, 0x58
|
||||
call [IO_Read]
|
||||
and al, 0xFE ; 0x20 = 0x21, 0x60 = 0x61, etc
|
||||
@ -111,13 +111,13 @@ wb_getparam:
|
||||
;-----------------------------------
|
||||
wb_get_temp:
|
||||
; temp 1
|
||||
mov al, 0x4e ; Выбираем bank 1
|
||||
mov al, 0x4e ; ‚ë¡¨à ¥¬ bank 1
|
||||
mov bl, 1
|
||||
call [IO_Write]
|
||||
mov al, 0x50 ; Получаем старший байт температуры (градусы)
|
||||
mov al, 0x50 ; <EFBFBD>®«ãç ¥¬ áâ à訩 ¡ ©â ⥬¯¥à âãàë (£à ¤ãáë)
|
||||
call [IO_Read]
|
||||
mov [hwm_temps], al
|
||||
mov al, 0x51 ; Получаем младший байт температуры (x.5`C)
|
||||
mov al, 0x51 ; <EFBFBD>®«ãç ¥¬ ¬« ¤è¨© ¡ ©â ⥬¯¥à âãàë (x.5`C)
|
||||
call [IO_Read]
|
||||
cmp al, 0 ; if al == 0 then x.0, else x.5
|
||||
je @f
|
||||
@ -125,28 +125,28 @@ wb_get_temp:
|
||||
@@: mov [hwm_temps + 1], al
|
||||
|
||||
; temp 2 (3 SYSTIN)
|
||||
mov al, 0x4e ; Выбираем bank 0
|
||||
mov al, 0x4e ; ‚ë¡¨à ¥¬ bank 0
|
||||
xor bl, bl
|
||||
call [IO_Write]
|
||||
mov al, 0x27 ; Получаем старший байт температуры (градусы)
|
||||
mov al, 0x27 ; <EFBFBD>®«ãç ¥¬ áâ à訩 ¡ ©â ⥬¯¥à âãàë (£à ¤ãáë)
|
||||
call [IO_Read]
|
||||
mov [hwm_temps + 2], al
|
||||
|
||||
; temp 3 (VTIN)
|
||||
mov al, 0x4e ; Выбираем bank 2
|
||||
mov al, 0x4e ; ‚ë¡¨à ¥¬ bank 2
|
||||
mov bl, 2
|
||||
call [IO_Write]
|
||||
mov al, 0x50 ; Получаем старший байт температуры (градусы)
|
||||
mov al, 0x50 ; <EFBFBD>®«ãç ¥¬ áâ à訩 ¡ ©â ⥬¯¥à âãàë (£à ¤ãáë)
|
||||
call [IO_Read]
|
||||
mov [hwm_temps + 4], al
|
||||
mov al, 0x51 ; Получаем младший байт температуры (x.5`C)
|
||||
mov al, 0x51 ; <EFBFBD>®«ãç ¥¬ ¬« ¤è¨© ¡ ©â ⥬¯¥à âãàë (x.5`C)
|
||||
call [IO_Read]
|
||||
cmp al, 0 ; if al == 0 then x.0, else x.5
|
||||
je @f
|
||||
mov al, 5
|
||||
@@: mov [hwm_temps + 5], al
|
||||
|
||||
; Проверка температуры, датчики с 127.5`C не используются
|
||||
; <EFBFBD>஢¥àª ⥬¯¥à âãàë, ¤ â稪¨ á 127.5`C ¥ ¨á¯®«ì§ãîâáï
|
||||
mov ecx, 3
|
||||
mov esi, hwm_temps
|
||||
wb_check_temp:
|
||||
@ -166,7 +166,7 @@ wb_get_fan_speed:
|
||||
shr al, 4
|
||||
mov ebx, 1
|
||||
mov cl, al
|
||||
shl ebx, cl ; <- div1
|
||||
shl ebx, cl ; <- div1
|
||||
xor eax, eax
|
||||
mov al, 0x28
|
||||
call [IO_Read]
|
||||
@ -178,6 +178,8 @@ wb_get_fan_speed:
|
||||
mov ebx, eax
|
||||
mov eax, 1350000
|
||||
xor edx, edx
|
||||
test ebx, ebx
|
||||
jz .div0
|
||||
div ebx
|
||||
mov [hwm_rpms], eax
|
||||
|
||||
@ -186,18 +188,21 @@ wb_get_fan_speed:
|
||||
shr al, 6
|
||||
mov ebx, 1
|
||||
mov cl, al
|
||||
shl ebx, cl ; <- div2
|
||||
shl ebx, cl ; <- div2
|
||||
xor eax, eax
|
||||
mov al, 0x29
|
||||
call [IO_Read]
|
||||
cmp al, 255
|
||||
jne @f
|
||||
xor eax, eax
|
||||
.div0:
|
||||
ret
|
||||
@@: mul ebx
|
||||
mov ebx, eax
|
||||
mov eax, 1350000
|
||||
xor edx, edx
|
||||
test ebx, ebx
|
||||
jz .div0
|
||||
div ebx
|
||||
mov [hwm_rpms + 4], eax
|
||||
|
||||
@ -206,7 +211,7 @@ wb_get_fan_speed:
|
||||
shr al, 6
|
||||
mov ebx, 1
|
||||
mov cl, al
|
||||
shl ebx, cl ; <- div3
|
||||
shl ebx, cl ; <- div3
|
||||
xor eax, eax
|
||||
mov al, 0x2A
|
||||
call [IO_Read]
|
||||
@ -218,6 +223,8 @@ wb_get_fan_speed:
|
||||
mov ebx, eax
|
||||
mov eax, 1350000
|
||||
xor edx, edx
|
||||
test ebx, ebx
|
||||
jz .div0
|
||||
div ebx
|
||||
mov [hwm_rpms + 8], eax
|
||||
|
||||
@ -229,7 +236,7 @@ wb_get_fan_speed:
|
||||
and al, 3
|
||||
mov ebx, 1
|
||||
mov cl, al
|
||||
shl ebx, cl ; <- div4, дописать учёт DIV_B2
|
||||
shl ebx, cl ; <- div4, ¤®¯¨á âì ãçñâ DIV_B2
|
||||
xor eax, eax
|
||||
mov al, 0x3F
|
||||
call [IO_Read]
|
||||
@ -241,6 +248,8 @@ wb_get_fan_speed:
|
||||
mov ebx, eax
|
||||
mov eax, 1350000
|
||||
xor edx, edx
|
||||
test ebx, ebx
|
||||
jz .div0
|
||||
div ebx
|
||||
mov [hwm_rpms + 12], eax
|
||||
|
||||
@ -250,9 +259,9 @@ wb_get_fan_speed:
|
||||
and al, 3
|
||||
mov ebx, 1
|
||||
mov cl, al
|
||||
shl ebx, cl ; <- div5, дописать учёт DIV_B2
|
||||
shl ebx, cl ; <- div5, ¤®¯¨á âì ãçñâ DIV_B2
|
||||
xor eax, eax
|
||||
mov al, 0x4e ; Выбираем bank 5
|
||||
mov al, 0x4e ; ‚ë¡¨à ¥¬ bank 5
|
||||
mov bl, 5
|
||||
call [IO_Write]
|
||||
mov al, 0x53
|
||||
@ -265,6 +274,8 @@ wb_get_fan_speed:
|
||||
mov ebx, eax
|
||||
mov eax, 1350000
|
||||
xor edx, edx
|
||||
test ebx, ebx
|
||||
jz .wb_f_e
|
||||
div ebx
|
||||
mov [hwm_rpms + 16], eax
|
||||
|
||||
@ -272,7 +283,7 @@ wb_get_fan_speed:
|
||||
ret
|
||||
;-----------------------------------
|
||||
wb_get_volt:
|
||||
;mov edi, wb_coeff ; <-- possible differences for miscellaneous chip
|
||||
;mov edi, wb_coeff ; <-- possible differences for miscellaneous chip
|
||||
mov esi, hwm_voltages
|
||||
xor ecx, ecx
|
||||
@@: mov eax, ecx
|
||||
|
Loading…
Reference in New Issue
Block a user