最初,每个设备都有自己的私有 IRQ。做为示例,注意,在清单 5 中,IRQ5 通常用于声卡 或者 第二个并行端口(打印机)。如果两个都要使用,那么不得不去寻找一个能够配置的卡(通常是通过硬件跳线设置)来使用另一个 IRQ,比如 IRQ15。
目前的 PCI 设备是共享 IRQ 的,所以,当某个设备中断 CPU 时,会有一个中断处理程序检查它并判断那个中断是否为它所用的中断,如果不是,则将它传递给链中的下一个处理程序。清单 4 和 5 并没有向我们展示这种共享。在后面的教程中我们将会学习 grep 命令,不过,现在我们可以使用它来过滤 dmesg 命令的输出,来查看关于 IRQ 的引导消息,如清单 6 所示。在此突出显示了共享的中断。
清单 6. 引导过程中发现的中断
[ian@lyrebird ian]$ dmesg | grep -i irq
PCI: Discovered primary peer bus 01 [IRQ]
PCI: Using IRQ router PIIX [8086/24c0] at 00:1f.0
PCI: Found IRQ 5 for device 00:1f.1
PCI: Sharing IRQ 5 with 00:1d.2
Serial driver version 5.05c (2001-07-08) with MANY_PORTS MULTIPORT
SHARE_IRQ SERIAL_PCI ISAPNP enabled
ttyS0 at 0x03f8 (irq = 4) is a 16550A
ttyS1 at 0x02f8 (irq = 3) is a 16550A
PCI: Found IRQ 5 for device 00:1f.1
PCI: Sharing IRQ 5 with 00:1d.2
ICH4: not 100% native mode: will probe irqs later
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
PCI: Found IRQ 11 for device 00:1d.0
PCI: Sharing IRQ 11 with 00:02.0
usb-uhci.c: USB UHCI at I/O 0x1800, IRQ 11
PCI: Found IRQ 10 for device 00:1d.1
usb-uhci.c: USB UHCI at I/O 0x1820, IRQ 10
PCI: Found IRQ 5 for device 00:1d.2
PCI: Sharing IRQ 5 with 00:1f.1
usb-uhci.c: USB UHCI at I/O 0x1840, IRQ 5
PCI: Found IRQ 9 for device 00:1d.7
ehci-hcd 00:1d.7: irq 9, pci mem f885d000
parport0: irq 7 detected
PCI: Found IRQ 9 for device 02:08.0
PCI: Found IRQ 9 for device 02:08.0
parport0: irq 7 detected
PCI: Found IRQ 11 for device 00:02.0
PCI: Sharing IRQ 11 with 00:1d.0
PCI: Found IRQ 9 for device 00:1f.5
PCI: Sharing IRQ 9 with 00:1f.3
i810: Intel ICH4 found at IO 0x18c0 and 0x1c00, MEM 0xc0080c00 and
0xc0080800, IRQ 9