Rev 5363 | Rev 5791 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5363 | Rev 5787 | ||
---|---|---|---|
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: 5363 $ |
8 | $Revision: 5787 $ |
9 | 9 | ||
10 | 10 | ||
Line 433... | Line 433... | ||
433 | acpi_fadt_base rd 1 |
433 | acpi_fadt_base rd 1 |
434 | acpi_dsdt_base rd 1 |
434 | acpi_dsdt_base rd 1 |
435 | acpi_dsdt_size rd 1 |
435 | acpi_dsdt_size rd 1 |
436 | acpi_madt_base rd 1 |
436 | acpi_madt_base rd 1 |
437 | acpi_ioapic_base rd 1 |
437 | acpi_ioapic_base rd 1 |
- | 438 | acpi_hpet_base rd 1 |
|
- | 439 | hpet_base rd 1 |
|
- | 440 | hpet_period rd 1 |
|
- | 441 | hpet_timers rd 1 |
|
Line 438... | Line 442... | ||
438 | 442 | ||
439 | cpu_count rd 1 |
443 | cpu_count rd 1 |
440 | smpt rd 16 |
444 | smpt rd 16 |
Line 441... | Line 445... | ||
441 | endg |
445 | endg |
442 | 446 | ||
443 | ACPI_HI_RSDP_WINDOW_START equ 0x000E0000 |
447 | ACPI_HI_RSDP_WINDOW_START equ 0x000E0000 |
- | 448 | ACPI_HI_RSDP_WINDOW_END equ 0x00100000 |
|
- | 449 | ACPI_RSDP_CHECKSUM_LENGTH equ 20 |
|
444 | ACPI_HI_RSDP_WINDOW_END equ 0x00100000 |
450 | |
445 | ACPI_RSDP_CHECKSUM_LENGTH equ 20 |
451 | ACPI_HPET_SIGN equ 0x54455048 |
Line 446... | Line 452... | ||
446 | ACPI_MADT_SIGN equ 0x43495041 |
452 | ACPI_MADT_SIGN equ 0x43495041 |
Line 514... | Line 520... | ||
514 | call acpi_locate |
520 | call acpi_locate |
515 | test eax, eax |
521 | test eax, eax |
516 | jz .done |
522 | jz .done |
Line 517... | Line 523... | ||
517 | 523 | ||
518 | mov ecx, [eax+16] |
524 | mov ecx, [eax+16] |
519 | mov edx, 0x50434146 |
525 | mov edx, ACPI_FADT_SIGN |
520 | mov [acpi_rsdt_base-OS_BASE], ecx |
526 | mov [acpi_rsdt_base-OS_BASE], ecx |
521 | call rsdt_find |
527 | call rsdt_find |
522 | mov [acpi_fadt_base-OS_BASE], eax |
528 | mov [acpi_fadt_base-OS_BASE], eax |
523 | test eax, eax |
529 | test eax, eax |
Line 524... | Line 530... | ||
524 | jz @f |
530 | jz @f |
525 | 531 | ||
526 | mov eax, [eax+40] |
532 | mov eax, [eax+40] |
527 | mov [acpi_dsdt_base-OS_BASE], eax |
533 | mov [acpi_dsdt_base-OS_BASE], eax |
- | 534 | mov eax, [eax+4] |
|
- | 535 | mov [acpi_dsdt_size-OS_BASE], eax |
|
- | 536 | @@: |
|
- | 537 | mov edx, ACPI_HPET_SIGN |
|
- | 538 | mov ecx, [acpi_rsdt_base-OS_BASE] |
|
- | 539 | call rsdt_find |
|
Line -... | Line 540... | ||
- | 540 | test eax, eax |
|
- | 541 | jz @F |
|
- | 542 | ||
528 | mov eax, [eax+4] |
543 | mov [acpi_hpet_base-OS_BASE], eax |
529 | mov [acpi_dsdt_size-OS_BASE], eax |
544 | mov eax, [eax+44] |
530 | 545 | mov [hpet_base-OS_BASE], eax |
|
531 | @@: |
546 | @@: |
532 | mov edx, ACPI_MADT_SIGN |
547 | mov edx, ACPI_MADT_SIGN |
Line 581... | Line 596... | ||
581 | jne .next |
596 | jne .next |
Line 582... | Line 597... | ||
582 | 597 | ||
583 | mov eax, [edx+4] |
598 | mov eax, [edx+4] |
584 | mov [acpi_ioapic_base-OS_BASE], eax |
599 | mov [acpi_ioapic_base-OS_BASE], eax |
- | 600 | jmp .next |
|
- | 601 | ||
- | 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 |
|
- | 609 | HPET_TN_ENABLE equ 0x0004 |
|
- | 610 | HPET_TN_FSB equ 0x4000 |
|
- | 611 | ||
- | 612 | align 4 |
|
- | 613 | init_hpet: |
|
- | 614 | mov ebx, [hpet_base-OS_BASE] |
|
- | 615 | test ebx, ebx |
|
- | 616 | jz @F |
|
- | 617 | ||
- | 618 | mov eax, [ebx] |
|
- | 619 | and ah, 0x1F |
|
- | 620 | inc ah |
|
- | 621 | movzx eax, ah |
|
- | 622 | mov [hpet_timers-OS_BASE], eax |
|
- | 623 | mov ecx, eax |
|
- | 624 | ||
- | 625 | mov eax, [ebx+HPET_PERIOD] |
|
- | 626 | mov edx, 0x431BDE83 |
|
- | 627 | mul edx |
|
- | 628 | shr edx, 18 |
|
- | 629 | mov [hpet_period-OS_BASE], edx |
|
- | 630 | ||
- | 631 | mov esi, [ebx+HPET_CFG] |
|
- | 632 | and esi, not HPET_CFG_ENABLE |
|
- | 633 | mov [ebx+HPET_CFG], esi ;stop main counter |
|
- | 634 | ||
- | 635 | lea edx, [ebx+HPET_T0_CFG] |
|
- | 636 | @@: |
|
- | 637 | jcxz @F |
|
- | 638 | mov eax, [edx] |
|
- | 639 | and eax, not (HPET_TN_ENABLE+HPET_TN_LEVEL+HPET_TN_FSB) |
|
- | 640 | mov [edx], eax |
|
- | 641 | add edx, 0x20 |
|
- | 642 | dec ecx |
|
- | 643 | jmp @B |
|
- | 644 | @@: |
|
- | 645 | mov [ebx+HPET_COUNTER], ecx ;reset main counter |
|
- | 646 | mov [ebx+HPET_COUNTER+4], ecx |
|
- | 647 | ||
- | 648 | or esi, HPET_CFG_ENABLE |
|
- | 649 | mov [ebx+HPET_CFG], esi ;and start again |
|
- | 650 | @@: |
|
- | 651 | ret |
|
- | 652 | ||
- | 653 | ||
- | 654 |