Subversion Repositories Kolibri OS

Rev

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

Rev 2129 Rev 2218
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: 2129 $
8
$Revision: 2218 $
9
 
9
 
10
 
10
 
Line 429... Line 429...
429
           shr eax, 8
429
           shr eax, 8
430
           and eax, 0x0f
430
           and eax, 0x0f
431
           ret
431
           ret
432
endp
432
endp
Line -... Line 433...
-
 
433
 
-
 
434
uglobal
-
 
435
align 4
-
 
436
acpi_rsdp         rd 1
-
 
437
acpi_rsdt         rd 1
-
 
438
acpi_madt         rd 1
-
 
439
 
-
 
440
acpi_rsdt_base    rd 1
-
 
441
acpi_madt_base    rd 1
-
 
442
acpi_lapic_base   rd 1
-
 
443
acpi_ioapic_base  rd 1
-
 
444
endg
-
 
445
 
-
 
446
ACPI_HI_RSDP_WINDOW_START  equ 0x000E0000
-
 
447
ACPI_HI_RSDP_WINDOW_END    equ 0x00100000
-
 
448
ACPI_RSDP_CHECKSUM_LENGTH  equ 20
-
 
449
ACPI_MADT_SIGN             equ 0x43495041
-
 
450
 
-
 
451
 
-
 
452
acpi_locate:
-
 
453
        push ebx
-
 
454
        mov ebx, ACPI_HI_RSDP_WINDOW_START
-
 
455
.check:
-
 
456
        cmp [ebx], dword 0x20445352
-
 
457
        jne .next
-
 
458
        cmp [ebx+4], dword 0x20525450
-
 
459
        jne .next
-
 
460
 
-
 
461
        mov edx, ebx
-
 
462
        mov ecx, ACPI_RSDP_CHECKSUM_LENGTH
-
 
463
        xor eax, eax
-
 
464
.sum:
-
 
465
        add al, [edx]
-
 
466
        inc edx
-
 
467
        loop .sum
-
 
468
 
-
 
469
        test al, al
-
 
470
        jnz .next
-
 
471
 
-
 
472
        mov eax, ebx
-
 
473
        pop ebx
-
 
474
        ret
-
 
475
.next:
-
 
476
        add ebx, 16
-
 
477
        cmp ebx, ACPI_HI_RSDP_WINDOW_END
Line -... Line 478...
-
 
478
        jb .check
-
 
479
 
-
 
480
        pop ebx
-
 
481
        xor eax, eax
-
 
482
        ret
-
 
483
 
-
 
484
align 4
-
 
485
rsdt_find:           ;ecx= rsdt edx= SIG
-
 
486
        push ebx
-
 
487
        push esi
-
 
488
 
-
 
489
        lea ebx, [ecx+36]
-
 
490
        mov esi, [ecx+4]
-
 
491
        add esi, ecx
-
 
492
.next:
-
 
493
        mov eax, [ebx]
-
 
494
        cmp [eax], edx
-
 
495
        je .done
-
 
496
 
-
 
497
        add ebx, 4
-
 
498
        cmp ebx, esi
-
 
499
        jb .next
-
 
500
 
-
 
501
        xor eax, eax
-
 
502
        pop esi
-
 
503
        pop ebx
-
 
504
        ret
-
 
505
 
-
 
506
.done:
-
 
507
        mov eax, [ebx]
-
 
508
        pop esi
-
 
509
        pop ebx
-
 
510
        ret
-
 
511
 
-
 
512
 
-
 
513
align 4
-
 
514
 
-
 
515
check_acpi:
-
 
516
 
-
 
517
        call acpi_locate
-
 
518
        test eax, eax
-
 
519
        jz .done
-
 
520
 
-
 
521
        mov ecx, [eax+16]
-
 
522
        mov edx, ACPI_MADT_SIGN
-
 
523
        mov [acpi_rsdt_base-OS_BASE], ecx
-
 
524
        call rsdt_find
-
 
525
        test eax, eax
-
 
526
        jz .done
-
 
527
 
-
 
528
        mov [acpi_madt_base-OS_BASE], eax
-
 
529
        mov ecx, [eax+36]
-
 
530
        mov [acpi_lapic_base-OS_BASE], ecx
-
 
531
 
-
 
532
        lea edx, [eax+44]
-
 
533
        mov ecx, [eax+4]
-
 
534
        add ecx, eax
-
 
535
.check:
-
 
536
        mov eax, [edx]
-
 
537
        cmp al, 1
-
 
538
        je .ioapic
-
 
539
 
-
 
540
.next:
-
 
541
        movzx eax, ah
-
 
542
        add edx, eax
-
 
543
        cmp edx, ecx
-
 
544
        jb .check
-
 
545
.done:
-
 
546
        ret
-
 
547
.ioapic:
-
 
548
        mov eax, [edx+4]