1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 11:17:43 +00:00

Kernel: Simplify interrupt management

The IRQController object is RefCounted, and is shared between the
InterruptManagement class & IRQ handlers' classes.

IRQHandler, SharedIRQHandler & SpuriousInterruptHandler classes
use a responsible IRQ controller directly instead of calling
InterruptManagement for disable(), enable() or eoi().

Also, the initialization process of InterruptManagement is
simplified, so it doesn't rely on an ACPI parser to be initialized.
This commit is contained in:
Liav A 2020-02-28 22:33:41 +02:00 committed by Andreas Kling
parent f96cf250f9
commit 6f914ed0a4
9 changed files with 80 additions and 128 deletions

View file

@ -62,12 +62,13 @@ bool SharedIRQHandler::eoi()
#ifdef INTERRUPT_DEBUG
dbg() << "EOI IRQ " << interrupt_number();
#endif
InterruptManagement::the().eoi(interrupt_number());
m_responsible_irq_controller->eoi(interrupt_number());
return true;
}
SharedIRQHandler::SharedIRQHandler(u8 irq)
: GenericInterruptHandler(irq)
, m_responsible_irq_controller(InterruptManagement::the().get_responsible_irq_controller(irq))
{
#ifdef INTERRUPT_DEBUG
kprintf("Shared Interrupt Handler registered @ %d\n", m_interrupt_number);
@ -114,7 +115,7 @@ void SharedIRQHandler::enable_interrupt_vector()
if (m_enabled)
return;
m_enabled = true;
InterruptManagement::the().enable(interrupt_number());
m_responsible_irq_controller->enable(interrupt_number());
}
void SharedIRQHandler::disable_interrupt_vector()
@ -122,7 +123,7 @@ void SharedIRQHandler::disable_interrupt_vector()
if (!m_enabled)
return;
m_enabled = false;
InterruptManagement::the().disable(interrupt_number());
m_responsible_irq_controller->disable(interrupt_number());
}
}