Irq Assignments

On By In 1

This article needs to be updated. In particular: No PCs have been built with 8259s in at least ten years. APIC systems are not commonly limited to 24 IRQs. Etc.. Please update this article to reflect recent events or newly available information.(December 2017)

In a computer, an interrupt request (or IRQ) is a hardware signal sent to the processor that temporarily stops a running program and allows a special program, an interrupt handler, to run instead. Hardware interrupts are used to handle events such as receiving data from a modem or network card, key presses, or mouse movements.

Interrupt lines are often identified by an index with the format of IRQ followed by a number. For example, on the Intel 8259 family of PICs there are eight interrupt inputs commonly referred to as IRQ0 through IRQ7. In x86 based computer systems that use two of these PICs, the combined set of lines are referred to as IRQ0 through IRQ15. Technically these lines are named IR0 through IR7, and the lines on the ISA bus to which they were historically attached are named IRQ0 through IRQ15.

Newer x86 systems integrate an Advanced Programmable Interrupt Controller (APIC) that conforms to the Intel APIC Architecture. These APICs support a programming interface for up to 255 physical hardware IRQ lines per APIC, with a typical system implementing support for only around 24 total hardware lines.

Overview[edit]

When working with personal computer hardware, installing and removing devices, the system relies on interrupt requests. There are default settings that are configured in the system BIOS and recognized by the operating system. These default settings can be altered by advanced users. Modern plug and play technology has not only reduced the need for concern for these settings, but has also virtually eliminated manual configuration.

x86 IRQs[edit]

Typically, on systems using the Intel 8259, 16 IRQs are used. IRQs 0 to 7 are managed by one Intel 8259 PIC, and IRQs 8 to 15 by a second Intel 8259 PIC. The first PIC, the master, is the only one that directly signals the CPU. The second PIC, the slave, instead signals to the master on its IRQ 2 line, and the master passes the signal on to the CPU. There are therefore only 15 interrupt request lines available for hardware.

On newer systems using the Intel APIC Architecture, typically there are 24 IRQs available, and the extra 8 IRQs are used to route PCI interrupts, avoiding conflict between dynamically configured PCI interrupts and statically configured ISA interrupts. On early APIC systems with only 16 IRQs or with only Intel 8259 interrupt controllers, PCI interrupt lines were routed to the 16 IRQs using a PIR integrated into the southbridge.

The easiest way of viewing this information on Microsoft Windows is to use Device Manager or System Information (msinfo32.exe). On Linux, IRQ mappings can be viewed by executing or using the utility.

Master PIC[edit]

  • IRQ 0 – system timer (cannot be changed)
  • IRQ 1 – keyboardcontroller (cannot be changed)
  • IRQ 2 – cascaded signals from IRQs 8–15 (any devices configured to use IRQ 2 will actually be using IRQ 9)
  • IRQ 3 – serial portcontroller for serial port 2 (shared with serial port 4, if present)
  • IRQ 4 – serial port controller for serial port 1 (shared with serial port 3, if present)
  • IRQ 5 – parallel port 2 and 3  or  sound card
  • IRQ 6 – floppy diskcontroller
  • IRQ 7 – parallel port 1. It is used for printers or for any parallel port if a printer is not present. It can also be potentially be shared with a secondary sound card with careful management of the port.

Slave PIC[edit]

  • IRQ 8 – real-time clock (RTC)
  • IRQ 9 – Advanced Configuration and Power Interface (ACPI) system control interrupt on Intel chipsets.[1] Other chipset manufacturers might use another interrupt for this purpose, or make it available for the use of peripherals (any devices configured to use IRQ 2 will actually be using IRQ 9)
  • IRQ 10 – The Interrupt is left open for the use of peripherals (open interrupt/available, SCSI or NIC)
  • IRQ 11 – The Interrupt is left open for the use of peripherals (open interrupt/available, SCSI or NIC)
  • IRQ 12 – mouse on PS/2 connector
  • IRQ 13 – CPU co-processor  or  integrated floating point unit  or  inter-processor interrupt (use depends on OS)
  • IRQ 14 – primary ATA channel (ATA interface usually serves hard disk drives and CD drives)
  • IRQ 15 – secondary ATA channel

Conflicts[edit]

In early IBM-compatible personal computers, an IRQ conflict is a once common hardware error, received when two devices were trying to use the same interrupt request (or IRQ) to signal an interrupt to the Programmable Interrupt Controller (PIC). The PIC expects interrupt requests from only one device per line, thus more than one device sending IRQ signals along the same line will generally cause an IRQ conflict that can freeze a computer.

For example, if a modemexpansion card is added into a system and assigned to IRQ4, which is traditionally assigned to the serial port 1, it will likely cause an IRQ conflict. Initially, IRQ 7 was a common choice for the use of a sound card, but later IRQ 5 was used when it was found that IRQ 7 would interfere with the printer port (LPT1). The serial ports are frequently disabled to free an IRQ line for another device. IRQ 2/9 is the traditional interrupt line for an MPU-401 MIDI port, but this conflicts with the ACPI system control interrupt (SCI is hardwired to IRQ9 on Intel chipsets);[1] this means ISA MPU-401 cards with a hardwired IRQ 2/9, and MPU-401 device drivers with a hardcoded IRQ 2/9, cannot be used in interrupt-driven mode on a system with ACPI enabled.

In some rare conditions, two devices could share the same IRQ as long as they were not used simultaneously. To solve this problem, the later PCI bus specification allows for IRQ sharing, with the additional support for Message Signaled Interrupts (MSI) in its later revisions. PCI Express does not have physical interrupt lines at all, and uses MSI exclusively.

See also[edit]

References[edit]

Further reading[edit]

  • Gilluwe, Frank van. The Undocumented PC, Second Edition, Addison-Wesley Developers Press, 1997. ISBN 0-201-47950-8
  • Shanley, Tom. ISA System Architecture, Third Edition, Addison-Wesley Publishing Company, 1995. ISBN 0-201-40996-8
  • Solari, Edward. PCI & PCI-X Hardware and Software Architecture & Design, Sixth Edition, Research Tech Inc., 2004. ISBN 0-9760865-0-6

External links[edit]

Interrupts

All computers do one thing very well…they follow instructions. Each instruction has a length and an address. The instruction pointer contains the address of the next instruction to be executed, and as soon as it has begun execution, the IP is incremented by the length of that instruction, thereby pointing to the next one, and so on. Some instructions can modify this address, and are called ‘branch’ instructions because they cause the computer to branch to a different piece of the program. This sequence of events will occur until something comes along that causes the computer to break away – which is called an ‘interrupt’.

The architecture of the computer will determine the type and number of interrupts that are recognized. Interrupts essentially cause the computer to save off the current instruction pointer (and associated flags, registers, etc.) and replace it with another address that will execute a completely different program. That program might be another ‘task’ (which is how multi-tasking is performed), might be an operating system routine (such as a DOS or BIOS interrupt), might be some recovery or termination code (such as a system error routine to dump addresses), or might be some routine that interfaces with a piece of hardware. In addition, interrupts can be classed as ‘maskable’ (can be ignored) or ‘non-maskable’ (must be acted upon immediately). It is possible that a maskable interrupt could be pre-empted by another interrupt if it is not acted upon quickly enough.

The Interrupt Vector Table

The interrupt table is a list of addresses which contain the information about which routine gets executed when that interrupt has been recognized, and is officially known as the Interrupt Vector Table. There is a special set of signal lines to the CPU which signal when an interrupt has been requested. The CPU checks the opcode and type, determines whether it should honor the interrupt immediately (or wait for a more convenient time), and then locates the address of the routine to be executed if it determines that the interrupt should be taken. The address is basically the interrupt number multiplied by 4. This is because each address is 4-bytes long, and the vector table begins at address ‘0’. The table is 256 entries long, or 1024 bytes (0400 in hex).

When the system is first initialized (boot up), the Interrupt Vector Table is initialized. Many of these routines are pre-defined by the architecture of the machine, but a few are reserved, and therefore can be used by hardware and software manufacturers. These ‘user defined’ interrupts are loaded immediately after the nucleus or kernel is loaded, and before any application level programs are loaded. For this reason, any device or software requiring an interrupt cannot be made active without rebooting the machine and initializing it’s interrupt address.

IRQs

When people speak of IRQs, they are referring to hardware interrupt requests. In the IBM PC there are 16 such interrupts defined, which are all maskable interrupts named IRQ0 through IRQ15. These interrupts reside at entries 8 through 15, and 112 through 119. If these numbers were translated to hex (08h – 0Fh and 70h – 77h), they would yield the interrupt type code, and multiplying by 4 would give the actual location in memory of the address of the corresponding routine to execute.

Some hardware IRQs are pre-determined, such as the system timer (IRQ0), Keyboard controller (IRQ1), floppy controller (IRQ6), real-time clock (IRQ8) and Math Co-processor (IRQ13). Most others are ‘user’ determined, either via hardware (with jumpers), through software (such as installable drivers) with firmware (Plug’N Play devices). The IRQs that are usually available for add-on devices are IRQ 5, 7, 9, 10, 11 and 12. Today, the generally accepted IRQ assignments are: modem (IRQ5), printer (IRQ7), Sound Card (IRQ9/IRQ10), Video Card (IRQ11) and PS/2 mouse (IRQ12). While not written in stone, IRQ3 and IRQ4 are usually reserved for serial ports, while IRQ14 and IRQ15 are used for the IDE controllers (primary and secondary).

For the most part IRQs cannot be shared. The only exception to this is where two devices can use the exact same interrupt routine (such as serial devices), and do not have to operate at the same time. If this rule is violated, either one (or both) devices will not work, the machine will lock up, or in the most extreme situation the system will not even complete the boot up routines.

Assigning IRQs

As it turns out, Plug’N Play is one of the most frustrating issues we have encountered in hardware configuration. The intention was to have the hardware and the operating system ‘negotiate’ for an available IRQ. The theory was that most people did not understand IRQs, and so the more intelligent engineers would handle this difficult situation ‘under the covers’. Well, it hasn’t quite worked out that way. Most PnP devices no longer have jumpers to override the ‘firmware’ IRQ assignments, and the PnP operating systems (like Win95), don’t use configurable drivers. The result is multiple devices trying to use the same IRQ – especially sound cards and modems. Fortunately, there are still several ways to assign IRQs for yourself.

The best method for manually assigning IRQs (if available) is through the BIOS. Many of the more recent BIOS programs have a menu selection which allows you to avoid any Plug’N Play assignments for specific IRQs. They will typically have a list of all 16 IRQs, with the default setting as ‘No/ICU’, which means that it is *not* reserved, and can be assigned by the Interrupt Controller Utility. The other option is ‘Legacy ISA’, which means that the system is to reserve this IRQ for use by non-PnP (or Legacy) devices.

Windows95 also allows the re-assignment of IRQs through the Device Manager. By opening the Control Panel and selecting the System icon, you will be presented with a screen with a Device Manager tab on the top. When you select this tab, you will be presented with a list of all the defined device types (such as ‘display controller’, ‘sound cards’, ‘modems’, etc.), with the highest level device being labeled ‘Computer’. If you highlight this device, and click on ‘Properties’, you will be presented with a list of every IRQ that is currently in use – including any duplicates. If you see a ‘!’ (exclamation point) next to any IRQ number, this means that either the IRQ is in use by another device, or the Win95 driver which assigns this IRQ has not been loaded properly.

Next to each of the other device types will usually be a ‘+’, which means there are devices defined under this type. If you click on the ‘+’, these devices will be displayed. By highlighting the device you wish to view/configure, and clicking on the ‘Properties’ button, you will be presented with another screen. Usually there will be a ‘Resources’ tab, that will show the IRQ and port address for the device (port addresses will be discussed in a future article). Some devices will let you highlight the IRQ number and change it, while others will not. If the check box labeled ‘manually configure’ is not grayed out, you can check it, and then change the IRQ number that way. Beware, however, that using this method may hamper the automatic configuration of any new PnP devices you install. If that box is grayed out, you cannot change the IRQ through Win95 and must use the BIOS method described above.

Once you have made these changes, you will need to reboot the machine so that the correct addresses can be loaded, and the device can be made available to the system. Occasionally you will need to perform this routine several times before you get everything configured properly. Sometimes, however, the mix of hardware simply will not allow everything to be installed together. When this happens, your only choices are to do without one (or more) of the components, or use some ‘IRQ saving’ techninques (which usually means buying different hardware, unfortunately).

Saving IRQs

There are a few things that can be done to reduce the number of IRQs that are required. If you don’t need both on board serial ports, you can disable one or both of them and free up IRQ3 and/or IRQ4. On the other hand, you might attach an external modem and utilize COM2, making IRQ5 available for another device. By the same token, you might use a PS/2 mouse connector (if available for your motherboard), and free up COM1 for attaching a scanner or other external serial device.

A little more expensive solution is to plug in a SCSI adapter, and connect SCSI devices, such as hard drives and scanners. If you disable the onboard IDE controllers, you can then use IRQ14 and IRQ15 for something else. Since SCSI controllers can attach up to 15 devices, yet only take one IRQ, you have much more device ‘real estate’ available to you. One final option that may soon be more widely available is the use of USB devices, which may include keyboards, mice and other low-throughput devices.

Summary

With a little understanding of how IRQs work, and some judicious use of the techniques mentioned here, you should be able to overcome just about any IRQ problems you may encounter. Until the architecture of the PC is completely revamped (which means scrapping our current operating systems, hardware, etc. – so don’t hold your breath), we will be stuck with the limited number of IRQs currently available. It is possible that a few more might be squeezed out of the architecture, but not very likely. The most probable long term solution will be the development of fast serial devices on Firewire (IEEE 1394) connections, such as hard drives, tape drives, monitors, scanners, modems, etc.


Be the first to discuss this article!

0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *