According to the ACPI spec, The FADT (Fixed ACPI Description Table) table contains a field that reports the SCI interrupt number to OS. The field is defined as below:
I dumped the FADT table on an Intel x86 platform and see the SCI interrupt is associated with the number 9
:
But according to the Intel Manual, 0-31
are reserved vectors for IA architecturally defined interrupts. Specifically, the 9
is defined as:
So, according to the note 2, the 9
is not generated after I386 processor. So I guess that's why 9 can be salvaged for SCI. This can be seen as a x86-specific implementation of the ACPI spec.
Am I right on this?
Seems I misunderstand something here. Will update later.
The IRQ is an abbreviation of Interrupt ReQuest. It represents the identity a source of external event that needs processor's attention. On 8259 system, once the processor got interrupted, it will ask the 8259 PIC for the address (read vector) of the handler through the INTA bar signal. So in this scenario, the identity (the IRQ number) of the event is not so critical in finding the handler routine. But in other scenarios, the OS will need to know the identity (IRQ number) of the event and use that to look up for the address/vector of the handler routine.
The first 9 in the FADT is a System Vector/ACPI GSI number/ACPI Plug and Play IRQ number. Kind of like the name of a 8259 pin, which represents the identify of the event.
The second 9 in the Intel Manual is a interrupt vector, which is the index into a vector table to get the final address of the handler routine, which represents an interrupt handler.
It is the mapping/translation from an IRQ number to an interrupt vector that associate an external event with an interrupt handler.
BTW, a very good tutorial video on 8259.
Throughout the ACPI specifications every notification event that uses the interrupting mechanism gets associated with a Global System Interrupt (GSI).
GSIs are briefly described in section 5.2.13 Global System Interrupts of the 6.1 ACPI specifications linked previously1.
Global System Interrupts can be thought of as ACPI Plug and Play IRQ numbers.
They are used to virtualize interrupts in tables and in ASL methods that perform resource allocation of interrupts.
The specifications use the term system vector to denote the number of the GSI.
For example, the GSI number 9 has system vector number 9.
This is admittedly confusing as the term "vector" can be mistaken for the term "vector" in "interrupt vector" as used in Intel manuals.
To understand GSIs one must have a minimum understanding or IRQs.
The two standard interrupt controllers on an x86 system are
The 8259A PIC [datasheet] [OSDev wiki]
There are always two PICs, at standard IO addresses, each with eight input pins (IR 0-7).
One PIC is the master and handles IRQ 0-7.
The other is the slave and handles IRQ 8-15, its output goes to IR2 of the master2.
The IO APIC [datasheet] [OSDev wiki].
Do not confuse the IO APIC with the LAPIC.
There can be one or multiple IO APICs, all memory mapped at variable (but usually fixed) addresses, each with a variable number of input pins INTINx.
Usually, one of the IO APIC is wired and configured to emulate the PICs, INTIN0-15 are mapped to IRQ0-15 but this is not a requirement.
Message signalled interrupts[OSDev forum thread]
This is not an interrupt controller (hence it doesn't add up in the count) but it's worth mentioning.
The PIC was the first generation controller, the IO APIC the second and MSIs are the third.
They are implemented as writes to specific memory addresses and as such require no controller.
On an x86 system, a PCI(e) device is configured to do a write into the LAPIC dedicated area3.
The interrupt controllers are configured, along with the LAPIC, to map an IRQ number into a vector number.
The standard configuration for the PIC is
IRQ 0-7 -> INT 08h - 0fh
IRQ 8-15 -> INT 70h - 77h
Note that mapping the first IRQs at base 08h was a mistake by IBM (Intel marked the first 32 interrupt vectors as reserved).
Once one knows the IRQ number it is easy to get the INT number, the OS generally can easily make a table for that purpose since it is well known (or can be known with the ACPI tables) how the interrupt controllers are connected to the CPUs.
Associating an IRQ to a device (a process known as interrupt routeing) is very complex because it requires a knowledge of how devices are connected, the ACPI specifications use GSIs to simplify this aspect.
In the end, GSIs (or in ACPI words, system vectors) must be mapped to IRQs, this is done in one-to-one fashion when in PIC mode or by assigning a GSI base (system vector base) to each IO APIC - thereby assigning it all the GSIs from the base to the number of pins minus one.
With all this in mind, we can finally understand the description of the SCI_INT
field:
System vector the SCI interrupt is wired to in 8259 mode. On systems that do not contain the 8259, this field contains the Global System interrupt number of the SCI interrupt.
The text is imprecise in my opinion, Global System interrupt number is just another name for system vector and thus the whole text reduces to "System vector for the SCI interrupt".
The SCI, being a system vector number, it has the nature of a GSI so the number 9 you found is the IRQ 94. By default, IRQ 9 is the INT 71h but any OS that use ACPI surely has remapped the IRQs to a different base and had surely avoided any conflict with the processor exceptions.
Long story short, the number 9 is not an interrupt vector but a system vector (as defined by ACPI).
GSI <----> IRQ <----> INT
System vector Interrupt vector
1the latest at the moment of writing.
2 which is configured as it, the 8259A was designed with chaining in mind.
3 which is shared among all LAPIC but can be remapped, especially for non-SMP systems to avoid crossing a QPI link.
4 Not strictly true as we know, in APIC mode the GSI 9 can be handled by an IO APIC that doesn't handle ISA IRQs.