Interrupt Sharing
A well-known ``feature'' of the PC is its inability to attach different devices to the same interrupt line. However, Linux 2.0 broke the spell. Even though my ISA hardware manual--a Linux-unaware book--says that ``at most one device'' can be attached to an IRQ line, the electrical signals don’t have these restrictions unless the device hardware is unfriendly by design. The problem is with the software.
Linux software support for sharing was developed for PCI devices, but it works with ISA boards as well. Needless to say, non-PC platforms and buses support interrupt sharing too.
In order to develop a driver that can manage a shared interrupt line, there are some details that need to be considered. As discussed below, some of the features described in this chapter are not available for devices using interrupt sharing. Whenever possible, it’s better to support sharing because it presents fewer problems for the final user.
Installing a Shared Handler
Shared interrupts are installed through request_irq just like owned ones, but there are two differences:
The
SA_SHIRQbit must be specified in theflagsargument when requesting the interrupt.The
dev_idargument must be unique. Any pointer into the module’s address space will do, butdev_iddefinitely cannot be set toNULL.
The kernel keeps a list of shared handlers associated with the
interrupt, and dev_id
differentiates between them, like a driver’s signature. If two
drivers were to register NULL as their signature ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access