96 LOG_ERR(
"no MADT table found\n");
112 LOG_ERR(
"failed to map io apic\n");
118 LOG_INFO(
"found I/O APIC globalSystemInterruptBase=0x%02x maxRedirs=0x%02x\n",
131 LOG_ERR(
"failed to register io apic irq chip\n");
#define assert(expression)
uint64_t irq_chip_register(irq_chip_t *chip, irq_phys_t start, irq_phys_t end, void *private)
Register an IRQ chip for a range of physical IRQs.
@ IRQ_TRIGGER_EDGE
If set, the IRQ is edge triggered. Otherwise, level triggered.
@ IRQ_POLARITY_LOW
If set, the IRQ is active low. Otherwise, active high.
static cpuid_t cpu_get_id_unsafe(void)
Gets the current CPU ID.
#define LOG_ERR(format,...)
#define LOG_INFO(format,...)
#define PML_LOWER_TO_HIGHER(addr)
Converts an address from the lower half to the higher half.
void * vmm_map(space_t *space, void *virtAddr, void *physAddr, uint64_t length, pml_flags_t flags, space_callback_func_t func, void *private)
Maps physical memory to virtual memory in a given address space.
#define PAGE_SIZE
The size of a memory page in bytes.
#define NULL
Pointer error value.
#define ERR
Integer error value.
sdt_header_t * acpi_tables_lookup(const char *signature, uint64_t minSize, uint64_t n)
Lookup the n'th table matching the signature.
#define MADT_FOR_EACH(madt, ic)
Iterate over all MADT interrupt controllers.
#define MADT_SIGNATURE
MADT table signature.
#define INTERRUPT_CONTROLLER_IO_APIC
ioapic_register_t
IO APIC Registers.
uint32_t ioapic_gsi_t
IO APIC Global System Interrupt type.
uint64_t ioapic_all_init(void)
Initialize all IO APICs found in the MADT.
@ IOAPIC_REG_REDIRECTION_BASE
@ IOAPIC_DESTINATION_PHYSICAL
lapic_t * lapic_get(uint32_t cpuId)
Get the lapic data for the specified CPU.
void lapic_write(uint32_t reg, uint32_t value)
Write to a local apic register.
static irq_chip_t ioApicChip
static void ioapic_disable(irq_t *irq)
static ioapic_version_t ioapic_version_read(ioapic_t *ioapic)
static void ioapic_redirect_write(ioapic_t *ioapic, ioapic_gsi_t gsi, ioapic_redirect_entry_t entry)
static void ioapic_eoi(irq_t *irq)
static uint32_t ioapic_read(ioapic_t *ioapic, ioapic_register_t reg)
static uint64_t ioapic_enable(irq_t *irq)
static void ioapic_write(ioapic_t *ioapic, ioapic_register_t reg, uint32_t value)
__UINTPTR_TYPE__ uintptr_t
uint32_t globalSystemInterruptBase
interrupt_controller_header_t header
IO APIC Version Structure.
Multiple APIC Description Table.
IO APIC Redirection Entry Structure.
struct ioapic_redirect_entry_t::PACKED raw
#define WRITE_32(address, value)