Rev 2219 | Rev 2434 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2219 | Rev 2229 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2011. 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 | - | ||
Line 8... | Line 7... | ||
8 | IRQ_RESERVED = 24 ; 16 or 24 |
7 | |
9 | 8 | ||
10 | iglobal |
9 | iglobal |
Line 52... | Line 51... | ||
52 | cmp [acpi_lapic_base], 0 |
51 | cmp [acpi_lapic_base], 0 |
53 | jz .no_apic |
52 | jz .no_apic |
Line 54... | Line 53... | ||
54 | 53 | ||
55 | stdcall load_file, dev_data_path |
54 | stdcall load_file, dev_data_path |
56 | test eax, eax |
- | |
57 | mov [acpi_dev_data], eax |
55 | test eax, eax |
Line -... | Line 56... | ||
- | 56 | jz .no_apic |
|
- | 57 | ||
- | 58 | mov [acpi_dev_data], eax |
|
58 | jz .no_apic |
59 | mov [acpi_dev_size], ebx |
Line 59... | Line 60... | ||
59 | 60 | ||
60 | call IRQ_mask_all |
61 | call IRQ_mask_all |
61 | 62 | ||
Line 110... | Line 111... | ||
110 | mov al, 0x70 |
111 | mov al, 0x70 |
111 | out 0x22, al |
112 | out 0x22, al |
112 | mov al, 1 |
113 | mov al, 1 |
113 | out 0x23, al |
114 | out 0x23, al |
Line -... | Line 115... | ||
- | 115 | ||
114 | 116 | call pci_irq_fixup |
|
Line 115... | Line -... | ||
115 | .no_apic: |
- | |
116 | - | ||
117 | ;init handlers table |
- | |
118 | - | ||
119 | mov ecx, IRQ_RESERVED |
- | |
120 | mov edi, irqh_tab |
- | |
121 | @@: |
- | |
122 | mov eax, edi |
- | |
123 | stosd |
- | |
124 | stosd |
- | |
125 | loop @B |
- | |
126 | - | ||
127 | mov ecx, 47 |
- | |
128 | mov eax, irqh_pool+IRQH.sizeof |
- | |
129 | mov [next_irqh], irqh_pool |
- | |
130 | @@: |
- | |
131 | mov [eax-IRQH.sizeof], eax |
- | |
132 | add eax, IRQH.sizeof |
- | |
133 | loop @B |
- | |
134 | - | ||
135 | mov [eax-IRQH.sizeof], dword 0 |
117 | .no_apic: |
Line 136... | Line 118... | ||
136 | 118 | ||
137 | ret |
119 | ret |
138 | 120 | ||
Line 428... | Line 410... | ||
428 | .fail: |
410 | .fail: |
429 | pop ebp |
411 | pop ebp |
430 | ret |
412 | ret><><<> |
Line 431... | Line -... | ||
431 | - | ||
432 | - | ||
433 | ; IRQ_TYPE_DISABLE equ 0 |
- | |
434 | ; IRQ_TYPE_PIC equ 1 |
- | |
435 | ; IRQ_TYPE_APIC equ 2 |
- | |
436 | - | ||
437 | ; uglobal |
- | |
438 | ; irq_type_to_set rd 1 |
- | |
439 | ; irq_types rd IRQ_RESERVE |
- | |
440 | ; endg |
- | |
441 | - | ||
442 | ; ----------------------------------------- |
- | |
443 | ; End Of Interrupt |
- | |
444 | ; al - IRQ number |
- | |
445 | ; align 16 |
- | |
446 | ; IRQ_EOI: |
- | |
447 | ; movzx eax, al |
- | |
448 | ; cmp dword[irq_types + eax * 4], IRQ_TYPE_APIC |
- | |
449 | ; jne @f |
- | |
450 | ; mov eax, [LAPIC_BASE] |
- | |
451 | ; mov dword [eax + APIC_EOI], 0 ; EOI |
- | |
452 | ; ret |
- | |
453 | ; @@: |
- | |
454 | ; cmp al, 8 |
- | |
455 | ; mov al, 0x20 |
- | |
456 | ; jb @f |
- | |
457 | ; out 0xa0, al |
- | |
458 | ; @@: out 0x20, al |
- | |
459 | ; ret |
- | |
460 | - | ||
461 | ; align 4 |
- | |
462 | ; proc enable_irq stdcall, irq_line:dword |
- | |
463 | ; cmp dword[irq_type_to_set], IRQ_TYPE_APIC |
- | |
464 | ; jne @f |
- | |
465 | ; stdcall APIC_enable_irq, [irq_line] |
- | |
466 | ; ret |
- | |
467 | ; @@: stdcall PIC_enable_irq, [irq_line] |
- | |
468 | ; ret |
- | |
469 | ; endp |
- | |
470 | - | ||
471 | ; align 4 |
- | |
472 | ; proc disable_irq stdcall, irq_line:dword |
- | |
473 | ; push eax |
- | |
474 | ; mov eax, [irq_line] |
- | |
475 | ; cmp dword[irq_types + eax * 4], IRQ_TYPE_APIC |
- | |
476 | ; jne @f |
- | |
477 | ; stdcall APIC_disable_irq, eax |
- | |
478 | ; pop eax |
- | |
479 | ; ret |
- | |
480 | ; @@: stdcall PIC_disable_irq, eax |
- | |
481 | ; pop eax |
- | |
482 | ; ret |
- | |
483 | ; endp |
- | |
484 | - | ||
485 | ; align 4 |
- | |
486 | ; proc PIC_enable_irq stdcall, irq_line:dword |
- | |
487 | ; pusha |
- | |
488 | ; mov ebx, [irq_line] |
- | |
489 | ; mov eax, [irq_types + ebx * 4] |
- | |
490 | ; cmp eax, IRQ_TYPE_DISABLE |
- | |
491 | ; je @f |
- | |
492 | ; cmp eax, IRQ_TYPE_PIC |
- | |
493 | ; je @f |
- | |
494 | ; stdcall disable_irq, ebx |
- | |
495 | ; @@: mov dword[irq_types + ebx * 4], IRQ_TYPE_PIC |
- | |
496 | ; mov edx, 0x21 |
- | |
497 | ; cmp ebx, 8 |
- | |
498 | ; jb @F |
- | |
499 | ; mov edx, 0xA1 |
- | |
500 | ; sub ebx,8 |
- | |
501 | ; @@: in al,dx |
- | |
502 | ; btr eax, ebx |
- | |
503 | ; out dx, al |
- | |
504 | ; popa |
- | |
505 | ; ret |
- | |
506 | ; endp |
- | |
507 | - | ||
508 | ; align 4 |
- | |
509 | ; proc PIC_disable_irq stdcall, irq_line:dword |
- | |
510 | ; pusha |
- | |
511 | ; mov ebx, [irq_line] |
- | |
512 | ; mov dword[irq_types + ebx * 4], IRQ_TYPE_DISABLE |
- | |
513 | ; mov edx, 0x21 |
- | |
514 | ; cmp ebx, 8 |
- | |
515 | ; jb @F |
- | |
516 | ; mov edx, 0xA1 |
- | |
517 | ; sub ebx,8 |
- | |
518 | ; @@: in al,dx |
- | |
519 | ; bts eax, ebx |
- | |
520 | ; out dx, al |
- | |
521 | ; popa |
- | |
522 | ; ret |
- | |
523 | ; endp |
- | |
524 | - | ||
525 | ; align 4 |
- | |
526 | ; proc APIC_enable_irq stdcall, irq_line:dword |
- | |
527 | ; pusha |
- | |
528 | ; mov ebx, [irq_line] |
- | |
529 | ; mov eax, [irq_types + ebx * 4] |
- | |
530 | ; cmp eax, IRQ_TYPE_DISABLE |
- | |
531 | ; je @f |
- | |
532 | ; cmp eax, IRQ_TYPE_APIC |
- | |
533 | ; je @f |
- | |
534 | ; stdcall disable_irq, ebx |
- | |
535 | ; @@: mov dword[irq_types + ebx * 4], IRQ_TYPE_APIC |
- | |
536 | ; shl ebx, 1 |
- | |
537 | ; add ebx, 0x10 |
- | |
538 | ; mov eax, ebx |
- | |
539 | ; call IOAPIC_read |
- | |
540 | ; and eax, 0xfffeffff ; bit 16 |
- | |
541 | ; xchg eax, ebx |
- | |
542 | ; call IOAPIC_write |
- | |
543 | ; popa |
- | |
544 | ; ret |
- | |
545 | ; endp |
- | |
546 | - | ||
547 | ; align 4 |
- | |
548 | ; proc APIC_disable_irq stdcall, irq_line:dword |
- | |
549 | ; pusha |
- | |
550 | ; mov ebx, [irq_line] |
- | |
551 | ; mov dword[irq_types + ebx * 4], IRQ_TYPE_DISABLE |
- | |
552 | ; shl ebx, 1 |
- | |
553 | ; add ebx, 0x10 |
- | |
554 | ; mov eax, ebx |
- | |
555 | ; call IOAPIC_read |
- | |
556 | ; or eax, 0x10000 |
- | |
557 | ; xchg eax, ebx |
- | |
558 | ; call IOAPIC_write |
- | |
559 | ; popa |
- | |
560 | ; ret |
- | |
561 | ; endp><><<> |
- |