|
PatchworkOS
321f6ec
A non-POSIX operating system.
|
Input / Output Advanced Programmable Interrupt Controller. More...
Input / Output Advanced Programmable Interrupt Controller.
The IO APICs are used to route external interrupts to a CPUs local APIC. Each IO APIC handles a range of Global System Interrupts (GSIs) or in PatchworkOS terms, physical IRQs, which it receives from external devices such as a keyboard. The IO APIC then routes these physical IRQs to a local APIC using that local APICs ID, that local APIC then triggers the interrupt on its CPU.
So, for example, say we have two IO APICs, 0 and 1, where IO APIC 0 handles physical IRQs 0-23 and IO APIC 1 handles physical IRQs 24-47. Then lets say we want to route physical IRQ 1 to CPU 4. In this case, we would use IO APIC 0 to route physical IRQ 1 to the local APIC ID of CPU 4, lets say this ID is 5. The IO APIC would then send the interrupt to the local APIC with ID 5, which would then trigger the interrupt on CPU 4.
The range that each IO APIC handles is defined as the range [globalSystemInterruptBase, globalSystemInterruptBase + maxRedirs), where globalSystemInterruptBase is defined in the ACPI MADT table and maxRedirs is read from the IO APICs version register.
Data Structures | |
| struct | ioapic_version_t |
| IO APIC Version Structure. More... | |
| struct | ioapic_redirect_entry_t |
| IO APIC Redirection Entry Structure. More... | |
Typedefs | |
| typedef uint32_t | ioapic_gsi_t |
| IO APIC Global System Interrupt type. | |
Enumerations | |
| enum | ioapic_mmio_register_t { IOAPIC_MMIO_REG_SELECT = 0x00 , IOAPIC_MMIO_REG_DATA = 0x10 } |
| IO APIC Memory Mapped Registers. More... | |
| enum | ioapic_register_t { IOAPIC_REG_IDENTIFICATION = 0x00 , IOAPIC_REG_VERSION = 0x01 , IOAPIC_REG_ARBITRATION = 0x02 , IOAPIC_REG_REDIRECTION_BASE = 0x10 } |
| IO APIC Registers. More... | |
| enum | ioapic_delivery_mode_t { IOAPIC_DELIVERY_NORMAL = 0 , IOAPIC_DELIVERY_LOW_PRIO = 1 , IOAPIC_DELIVERY_SMI = 2 , IOAPIC_DELIVERY_NMI = 4 , IOAPIC_DELIVERY_INIT = 5 , IOAPIC_DELIVERY_EXTERNAL = 7 } |
| IO APIC Delivery Modes. More... | |
| enum | ioapic_destination_mode_t { IOAPIC_DESTINATION_PHYSICAL = 0 , IOAPIC_DESTINATION_LOGICAL = 1 } |
| IO APIC Destination Modes. More... | |
| enum | ioapic_trigger_mode_t { IOAPIC_TRIGGER_EDGE = 0 , IOAPIC_TRIGGER_LEVEL = 1 } |
| IO APIC Trigger Modes. More... | |
| enum | ioapic_polarity_t { IOAPIC_POLARITY_HIGH = 0 , IOAPIC_POLARITY_LOW = 1 } |
| IO APIC Polarity Modes. More... | |
Functions | |
| uint64_t | ioapic_all_init (void) |
| Initialize all IO APICs found in the MADT. | |
| typedef uint32_t ioapic_gsi_t |
| enum ioapic_register_t |
| enum ioapic_polarity_t |