Interrupts
Interrupt request channels, or hardware interrupts, are used by various hardware devices to signal the motherboard that a request must be fulfilled. This procedure is the same as a student raising his hand to indicate that he needs attention. These interrupt channels are represented by wires on the motherboard and in the slot connectors.
When a particular interrupt is invoked, a special routine takes over the system, which first saves all the CPU register contents in a stack and then directs the system to the interrupt vector table. This vector table contains a list of memory addresses that correspond to the interrupt channels. Depending on which interrupt was invoked, the program corresponding to that channel is run.
The pointers in the vector table point to the address of whatever software driver is used to service the card that generated the interrupt. For a network card, for example, the vector might point to the address of the network drivers that have been loaded to operate the card; for a hard disk controller, the vector might point to the BIOS code that operates the controller.
After the particular software routine finishes performing whatever function the card needed, the interrupt-control software returns the stack contents to the CPU registers, and the system then resumes whatever it was doing before the interrupt occurred.
Through the use of interrupts, your system can respond to external events in a timely fashion. Each time a serial port presents a byte to your system, an interrupt is generated to ensure that the system reads that byte before another comes in.
Keep in mind that in some cases a port device—in particular, a modem with a 16550 or higher UART chip—might incorporate a byte buffer that allows multiple characters to be stored before an interrupt is generated.
Hardware interrupts are generally prioritized by their numbers; with some exceptions, the highest-priority interrupts have the lowest numbers. Higher-priority interrupts take precedence over lower-priority interrupts by interrupting them. As a result, several interrupts can occur in your system concurrently, with each interrupt nesting within another.
If you overload the system—in this case, by running out of stack resources (too many interrupts were generated too quickly)—an internal stack overflow error occurs and your system halts. The message usually appears as Internal stack overflow - system halted at a DOS prompt.
If you experience this type of system error and run DOS, you can compensate for it by using the STACKS parameter in your CONFIG.SYS file to increase the available stack resources. Most people will not see this error in Windows 9x/Me or Windows NT/2000/XP.
The ISA bus uses edge-triggered interrupt sensing, in which an interrupt is sensed by a changing signal sent on a particular wire located in the slot connector. A different wire corresponds to each possible hardware interrupt.
Because the motherboard can't recognize which slot contains the card that used an interrupt line and therefore generated the interrupt, confusion results if more than one card is set to use a particular interrupt. Each interrupt, therefore, is usually designated for a single hardware device. Most of the time, interrupts can't be shared.
Originally, IBM developed ways to share interrupts on the ISA bus, but few devices followed the necessary rules to make this a reality. The PCI bus inherently allows interrupt sharing; in fact, virtually all PCI cards are set to PCI interrupt A and share that interrupt on the PCI bus.
The real problem is that there are technically two sets of hardware interrupts in the system: PCI interrupts and ISA interrupts. For PCI cards to work in a PC, the PCI interrupts are first mapped to ISA interrupts, which are then configured as non-shareable.
Therefore, in many cases you must assign a nonconflicting interrupt for each card, even PCI cards. The conflict between assigning ISA IRQs for PCI interrupts caused many configuration problems for early users of PCI motherboards and continued to cause problems even after the development of Windows 95 and its Plug and Play technology.
The solution to the interrupt sharing problem for PCI cards was something called PCI IRQ Steering, which is supported in the more recent operating systems (starting with Windows 95 OSR 2.x) and BIOS.
PCI IRQ Steering allows a plug-and-play operating system such as Windows to dynamically map or "steer" PCI cards (which almost all use PCI INTA#) to standard PC interrupts and allows several PCI cards to be mapped to the same interrupt.
Hardware interrupts are sometimes referred to as maskable interrupts, which means the interrupts can be masked or turned off for a short time while the CPU is used for other critical operations. It is up to the system BIOS and programs to manage interrupts properly and efficiently for the best system performance.
Because interrupts usually can't be shared in an ISA bus system, you often run into conflicts and can even run out of interrupts when you are adding boards to a system. If two boards use the same IRQ to signal the system, the resulting conflict prevents either board from operating properly.
8-Bit ISA Bus Interrupts
The PC and XT (the systems based on the 8-bit 8086 CPU) provide for eight different external hardware interrupts. Table 1 shows the typical uses for these interrupts, which are numbered 0–7.
IRQ | Function | Bus Slot |
---|---|---|
0 | System Timer | No |
1 | Keyboard Controller | No |
2 | Available | Yes (8-bit) |
3 | Serial Port 2 (COM2:) | Yes (8-bit) |
4 | Serial Port 1 (COM1:) | Yes (8-bit) |
5 | Hard Disk Controller | Yes (8-bit) |
6 | Floppy Disk Controller | Yes (8-bit) |
7 | Parallel Port 1 (LPT1:) | Yes (8-bit) |
If you have a system that has one of the original 8-bit ISA buses, you will find that the IRQ resources provided by the system present a severe limitation. Installing several devices that need the services of system IRQs in a PC/XT-type system can be a study in frustration because the only way to resolve the interrupt-shortage problem is to remove the adapter board that you need the least.
16-Bit ISA, EISA, and MCA Bus Interrupts
The introduction of the AT, based on the 286 processor, was accompanied by an increase in the number of external hardware interrupts the bus would support.
The number of interrupts was doubled to 16 by using two Intel 8259 interrupt controllers, piping the interrupts generated by the second one through the unused IRQ 2 in the first controller. This arrangement effectively makes only 15 IRQ assignments available, and IRQ 2 effectively became inaccessible.
By routing all the interrupts from the second IRQ controller through IRQ 2 on the first, all these new interrupts are assigned a nested priority level between IRQ 1 and IRQ 3. Thus, IRQ 15 ends up having a higher priority than IRQ 3. Figure 1 shows how the two 8259 chips were wired to create the cascade through IRQ 2 on the first chip.
To prevent problems with boards set to use IRQ 2, the AT system designers routed one of the new interrupts (IRQ 9) to fill the slot position left open after removing IRQ 2. This means that any card you install in a modern system that claims to use IRQ 2 is really using IRQ 9 instead.
Table 2 shows the typical uses for interrupts in the 16-bit ISA and 32-bit PCI/AGP buses and lists them in priority order from highest to lowest. The obsolete EISA and MCA buses used a similar IRQ map.
IRQ | Standard Function | Bus Slot | Card Type | Recommended Use |
---|---|---|---|---|
0 | System Timer | No | — | — |
1 | Keyboard Controller | No | — | — |
2 | 2nd IRQ Controller Cascade | No | — | — |
8 | Real-Time Clock | No | — | — |
9 | Avail. (as IRQ2 or IRQ9) | Yes | 8/16-bit | Network Card |
10 | Available | Yes | 16-bit | USB |
11 | Available | Yes | 16-bit | SCSI Host Adapter |
12 | Mouse Port/Available | Yes | 16-bit | Mouse Port |
13 | Math Coprocessor | No | — | — |
14 | Primary IDE | Yes | 16-bit | Primary IDE (hard disks) |
15 | Secondary IDE | Yes | 16-bit | 2nd IDE (CD-ROM/Tape) |
3 | Serial 2 (COM2:) | Yes | 8/16-bit | COM2:/Internal Modem |
4 | Serial 1 (COM1:) | Yes | 8/16-bit | COM1: |
5 | Sound/Parallel 2 (LPT2:) | Yes | 8/16-bit | Sound Card |
6 | Floppy Controller | Yes | 8/16-bit | Floppy Controller |
7 | Parallel 1 (LPT1:) | Yes | 8/16-bit | LPT1: |
Notice that interrupts 0, 1, 2, 8, and 13 are not on the bus connectors and are not accessible to adapter cards. Interrupts 8, 10, 11, 12, 13, 14, and 15 are from the second interrupt controller and are accessible only by boards that use the 16-bit extension connector because this is where these wires are located.
IRQ 9 is rewired to the 8-bit slot connector in place of IRQ 2, so IRQ 9 replaces IRQ 2 and, therefore, is available to 8-bit cards, which treat it as though it were IRQ 2.
The extra IRQ lines in a 16-bit ISA system are of little help unless the adapter boards you plan to use enable you to configure them for one of the unused IRQs.
Some devices are hard-wired so that they can use only a particular IRQ. If you have a device that already uses that IRQ, you must resolve the conflict before installing the second adapter. If neither adapter enables you to reconfigure its IRQ use, chances are that you can't use the two devices in the same system.