Subversion Repositories Kolibri OS

Rev

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

Rev 2434 Rev 2439
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2008. 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: 2434 $
8
$Revision: 2439 $
9
 
9
 
10
 
10
 
Line 430... Line 430...
430
        shr     eax, 8
430
        shr     eax, 8
431
        and     eax, 0x0f
431
        and     eax, 0x0f
432
        ret
432
        ret
433
endp
433
endp
Line -... Line 434...
-
 
434
 
-
 
435
iglobal
-
 
436
align 4
-
 
437
acpi_lapic_base   dd 0xfee00000   ; default local apic base
-
 
438
endg
434
 
439
 
435
uglobal
440
uglobal
436
align 4
441
align 4
437
acpi_rsdp         rd 1
442
acpi_rsdp         rd 1
438
acpi_rsdt         rd 1
443
acpi_rsdt         rd 1
Line 441... Line 446...
441
acpi_dev_data     rd 1
446
acpi_dev_data     rd 1
442
acpi_dev_size     rd 1
447
acpi_dev_size     rd 1
Line 443... Line 448...
443
 
448
 
444
acpi_rsdt_base    rd 1
449
acpi_rsdt_base    rd 1
445
acpi_madt_base    rd 1
-
 
446
acpi_lapic_base   rd 1
450
acpi_madt_base    rd 1
-
 
451
acpi_ioapic_base  rd 1
-
 
452
 
-
 
453
cpu_count         rd 1
447
acpi_ioapic_base  rd 1
454
smpt              rd 16
Line 448... Line 455...
448
endg
455
endg
449
 
456
 
450
ACPI_HI_RSDP_WINDOW_START  equ 0x000E0000
457
ACPI_HI_RSDP_WINDOW_START  equ 0x000E0000
Line 491... Line 498...
491
        push    esi
498
        push    esi
Line 492... Line 499...
492
 
499
 
493
        lea     ebx, [ecx+36]
500
        lea     ebx, [ecx+36]
494
        mov     esi, [ecx+4]
501
        mov     esi, [ecx+4]
-
 
502
        add     esi, ecx
495
        add     esi, ecx
503
align 4
496
.next:
504
.next:
497
        mov     eax, [ebx]
505
        mov     eax, [ebx]
498
        cmp     [eax], edx
506
        cmp     [eax], edx
Line 511... Line 519...
511
        mov     eax, [ebx]
519
        mov     eax, [ebx]
512
        pop     esi
520
        pop     esi
513
        pop     ebx
521
        pop     ebx
514
        ret
522
        ret
Line 515... Line -...
515
 
-
 
516
 
523
 
-
 
524
align 4
-
 
525
madt_find:
-
 
526
 
Line -... Line 527...
-
 
527
 
-
 
528
 
-
 
529
 
-
 
530
 
-
 
531
        ret
517
align 4
532
 
Line 518... Line 533...
518
 
533
align 4
519
check_acpi:
534
check_acpi:
520
 
535
 
Line 527... Line 542...
527
        mov     [acpi_rsdt_base-OS_BASE], ecx
542
        mov     [acpi_rsdt_base-OS_BASE], ecx
528
        call    rsdt_find
543
        call    rsdt_find
529
        test    eax, eax
544
        test    eax, eax
530
        jz      .done
545
        jz      .done
Line -... Line 546...
-
 
546
 
-
 
547
        xchg bx, bx
531
 
548
 
532
        mov     [acpi_madt_base-OS_BASE], eax
549
        mov     [acpi_madt_base-OS_BASE], eax
533
        mov     ecx, [eax+36]
550
        mov     ecx, [eax+36]
Line -... Line 551...
-
 
551
        mov     [acpi_lapic_base-OS_BASE], ecx
-
 
552
 
-
 
553
        mov     edi, smpt-OS_BASE
-
 
554
        mov     ebx, [ecx+0x20]
-
 
555
        shr     ebx, 24              ; read APIC ID
-
 
556
 
-
 
557
        mov     [edi], ebx           ; bootstrap always first
-
 
558
        inc     [cpu_count]
534
        mov     [acpi_lapic_base-OS_BASE], ecx
559
        add     edi, 4
535
 
560
 
536
        lea     edx, [eax+44]
561
        lea     edx, [eax+44]
537
        mov     ecx, [eax+4]
562
        mov     ecx, [eax+4]
538
        add     ecx, eax
563
        add     ecx, eax
539
.check:
564
.check:
540
        mov     eax, [edx]
565
        mov     eax, [edx]
-
 
566
        cmp     al, 0
-
 
567
        jne     .io_apic
-
 
568
 
-
 
569
        shr     eax, 24              ; get APIC ID
-
 
570
        cmp     eax, ebx             ; skip self
-
 
571
        je      .next
-
 
572
 
-
 
573
        test    [edx+4], byte 1      ; is enabled ?
-
 
574
        jz      .next
-
 
575
 
Line -... Line 576...
-
 
576
        cmp     [cpu_count-OS_BASE], 16
-
 
577
        jae     .next
541
        cmp     al, 1
578
 
-
 
579
        stosd                        ; store APIC ID
542
        je      .ioapic
580
        inc     [cpu_count-OS_BASE]
543
 
581
.next:
544
.next:
582
        mov     eax, [edx]
545
        movzx   eax, ah
583
        movzx   eax, ah
546
        add     edx, eax
584
        add     edx, eax
547
        cmp     edx, ecx
585
        cmp     edx, ecx
-
 
586
        jb      .check
548
        jb      .check
587
.done:
-
 
588
        ret
-
 
589
 
-
 
590
.io_apic:
549
.done:
591
        cmp     al, 1
550
        ret
592
        jne     .next
551
.ioapic:
593