Subversion Repositories Kolibri OS

Rev

Rev 5645 | Rev 6242 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5645 Rev 5984
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 5645 $
8
$Revision: 5984 $
9
 
9
 
10
 
10
 
Line 437... Line 437...
437
acpi_ioapic_base  rd 1
437
acpi_ioapic_base  rd 1
438
acpi_hpet_base    rd 1
438
acpi_hpet_base    rd 1
439
hpet_base         rd 1
439
hpet_base         rd 1
440
hpet_period       rd 1
440
hpet_period       rd 1
441
hpet_timers       rd 1
441
hpet_timers       rd 1
442
 
-
 
-
 
442
hpet_tsc_start    rd 2
443
cpu_count         rd 1
443
cpu_count         rd 1
444
smpt              rd 16
444
smpt              rd 16
445
endg
445
endg
Line 446... Line 446...
446
 
446
 
Line 597... Line 597...
597
 
597
 
598
        mov     eax, [edx+4]
598
        mov     eax, [edx+4]
599
        mov     [acpi_ioapic_base-OS_BASE], eax
599
        mov     [acpi_ioapic_base-OS_BASE], eax
Line 600... Line 600...
600
        jmp     .next
600
        jmp     .next
601
 
601
 
602
HPET_PERIOD             equ 0x004
602
HPET_PERIOD             equ 0x0004
-
 
603
HPET_CFG_ENABLE         equ 0x0001
-
 
604
HPET_CFG                equ 0x0010
-
 
605
HPET_COUNTER            equ 0x00f0
-
 
606
HPET_T0_CFG             equ 0x0100
-
 
607
 
-
 
608
HPET_TN_LEVEL           equ 0x0002
Line 603... Line 609...
603
HPET_CFG_ENABLE         equ     1
609
HPET_TN_ENABLE          equ 0x0004
604
HPET_CFG                equ 0x010
610
HPET_TN_FSB             equ 0x4000
605
 
611
 
606
align 4
612
align 4
607
init_hpet:
613
init_hpet:
Line 608... Line 614...
608
        mov     ebx, [hpet_base-OS_BASE]
614
        mov     ebx, [hpet_base-OS_BASE]
609
        test    ebx, ebx
615
        test    ebx, ebx
610
        jz      @F
616
        jz      .done
611
 
617
 
612
        mov     eax, [ebx]
618
        mov     eax, [ebx]
-
 
619
        and     ah, 0x1F
Line 613... Line 620...
613
        and     ah, 0x1F
620
        inc     ah
614
        inc     ah
621
        movzx   eax, ah
615
        movzx   eax, ah
622
        mov     [hpet_timers-OS_BASE], eax
616
        mov     [hpet_timers-OS_BASE], eax
623
        mov     ecx, eax
-
 
624
 
-
 
625
        mov     eax, [ebx+HPET_PERIOD]
617
 
626
        xor     edx, edx
618
        mov     eax, [ebx+HPET_PERIOD]
627
        shld    edx, eax, 10
619
        mov     edx, 0x431BDE83
628
        shl     eax, 10
620
        mul     edx
629
        mov     esi, 1000000
621
        shr     edx, 18
630
        div     esi
622
        mov     [hpet_period-OS_BASE], edx
-
 
623
 
-
 
624
        mov     eax, [ebx+HPET_CFG]
-
 
625
        and     eax, not HPET_CFG_ENABLE
-
 
Line 626... Line 631...
626
        mov     [ebx+HPET_CFG], eax     ;stop main counter
631
        mov     [hpet_period-OS_BASE], eax
-
 
632
 
-
 
633
        mov     esi, [ebx+HPET_CFG]
-
 
634
        and     esi, not HPET_CFG_ENABLE
-
 
635
        mov     [ebx+HPET_CFG], esi             ;stop main counter
627
 
636
 
-
 
637
        lea     edx, [ebx+HPET_T0_CFG]
-
 
638
@@:
-
 
639
        jcxz    @F
628
        xor     ecx, ecx
640
        mov     eax, [edx]
-
 
641
        and     eax, not (HPET_TN_ENABLE+HPET_TN_LEVEL+HPET_TN_FSB)
-
 
642
        mov     [edx], eax
-
 
643
        add     edx, 0x20
-
 
644
        dec     ecx
-
 
645
        jmp     @B
-
 
646
@@:
-
 
647
        mov     [ebx+HPET_COUNTER], ecx         ;reset main counter
-
 
648
        mov     [ebx+HPET_COUNTER+4], ecx
-
 
649
 
-
 
650
        or      esi, HPET_CFG_ENABLE
-
 
651
        mov     [ebx+HPET_CFG], esi             ;and start again
629
        mov     [ebx+0xF0], ecx         ;reset counter
652