Subversion Repositories Kolibri OS

Rev

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