Subversion Repositories Kolibri OS

Rev

Rev 518 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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