Reputation:
As far as i know there are 255 virtual IRQ's in Windows system (chipset only allows 16 physical) and they all usually use physical IRQ 11.In Linux systems there is also a notion of virtual IRQ's.
So, I'm interested how does this mapping implented?Sourse code samples from Linux kernel or just algorithm will be appreciated.
Upvotes: 3
Views: 2004
Reputation: 15746
The exact implementation of interrupt handling will vary between architectures and platforms. This answer predominantly addresses Linux as source is available. For Linux at least, there is a generic IRQ handling layer against which drivers are written so that the drivers can be compatible between architectures, independent of the underlying interrupt architecture.
Modern platforms may have multiple interrupt controllers, so its the platform specific code which handles the mapping of an IRQ number requested with request_irq()
to a specific interrupt controller.
Take for example the mach-pxa
architecture on Linux for PXAxxx base platforms. The platform irq.c file contains two struct irq_chip
references indicating two different interrupt controllers. When pxa_init_irq()
is called, it assigns a virtual interrupt number to a specific interrupt controller. The platform code ensures that unique interrupt numbers are assigned to every possible interrupt source.
There are quite a few details which are too detailed to post here, so I'd suggest getting a copy of the Linux source and digging in. If you're looking for the mappings, look specifically in the different arch
directories.
If you do a make htmldocs
from the top level, you'll get a Documentation/DocBook/index.html
which you can peruse. Look at the genericirq
section for some more details.
Additionally, the Linux Device Drivers, Corbet, Rubini, Kroah-Hartman book is an excellent source of information.
Upvotes: 5