先介紹PCI configuration的兩個欄位Interrupt Line (0x3C) / Interrupt Pin (0x3D)
# Interrupt Line (0x3C)
# Interrupt Line (0x3C)
a. 這個configuration space register欄位的值是看Bios IRQ routing到哪個 IRQ number後Bios填進去的,系統或device driver可能會使用到, 只是現在的系統很少在用PIC了。(PCI device因為只有定義四個interrupt pin, 因此通常會IRQ sharing)
b. 另外一種方法是透過int 1A, GET_IRQ_ROUTING_EXPANSIONS, 來得到routing的位置 (PCI firmware spec有提到但是沒試過)
a. 一個8259有八個IRQ, 佔用兩個IO address, 使用前需要透過ICW register初始化,也就是設定IRQ所對應的Interrupt vector等等
b. 用法通常都是兩個8259A串接, IRQ2: slave 8259; IRQ14/IRQ15: Master/Slave IDE; IRQ1: Keyboard; IRQ12: PS2 mouse
c. Master/Slave 8259 address=> Master: 0x20/0x21, Slave: 0xA0/0xA1
d. IR0優先權最高再來是IR1,..以此類推
e. 一般設定為非AEOI,所以事情處理完需要透過OCW2(IO address 0x20 or 0xA0)發送EOI清掉ISR
mov al, 20h
out 20h, al
f. OCW1(IO address 0x21 or 0xA1) 為IMR用來Mask 中斷,每個bit代表一個IRQ number
g. x86 IRQ所對應的interrupt vector:
Default Hardware Interrupt Layout (from http://wiki.osdev.org/Interrupts)
Master 8259:
Some interrupts mapped by the 8259 by default overlap with some of the processor's exception handlers. These can be remapped via the 8259's IO ports.
Slave 8259:
g. x86 IRQ所對應的interrupt vector:
Default Hardware Interrupt Layout (from http://wiki.osdev.org/Interrupts)
Master 8259:
Some interrupts mapped by the 8259 by default overlap with some of the processor's exception handlers. These can be remapped via the 8259's IO ports.
| IVT Offset | INT # | IRQ # | Description
+------------+-------+-------+------------------------------
| 0x0020 | 0x08 | 0 | PIT
| 0x0024 | 0x09 | 1 | Keyboard
| 0x0028 | 0x0A | 2 | 8259A slave controller
| 0x002C | 0x0B | 3 | COM2 / COM4
| 0x0030 | 0x0C | 4 | COM1 / COM3
| 0x0034 | 0x0D | 5 | LPT2
| 0x0038 | 0x0E | 6 | Floppy controller
| 0x003C | 0x0F | 7 | LPT1
Slave 8259:
| IVT Offset | INT # | IRQ # | Description
+------------+-------+-------+------------------------------
| 0x01C0 | 0x70 | 8 | RTC
| 0x01C4 | 0x71 | 9 | Unassigned
| 0x01C8 | 0x72 | 10 | Unassigned
| 0x01CC | 0x73 | 11 | Unassigned
| 0x01D0 | 0x74 | 12 | Mouse controller
| 0x01D4 | 0x75 | 13 | Math coprocessor
| 0x01D8 | 0x76 | 14 | Hard disk controller 1
| 0x01DC | 0x77 | 15 | Hard disk controller 2
沒有留言:
張貼留言