1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:58:12 +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

@ -45,12 +45,13 @@ bool SpuriousInterruptHandler::eoi()
{
// FIXME: Actually check if IRQ7 or IRQ15 are spurious, and if not, call EOI with the correct interrupt number.
if (interrupt_number() == 15)
InterruptManagement::the().eoi(7);
m_responsible_irq_controller->eoi(7);
return false;
}
SpuriousInterruptHandler::SpuriousInterruptHandler(u8 irq)
: GenericInterruptHandler(irq)
, m_responsible_irq_controller(InterruptManagement::the().get_responsible_irq_controller(irq))
{
}
@ -69,7 +70,7 @@ void SpuriousInterruptHandler::enable_interrupt_vector()
if (m_enabled)
return;
m_enabled = true;
InterruptManagement::the().enable(interrupt_number());
m_responsible_irq_controller->enable(interrupt_number());
}
void SpuriousInterruptHandler::disable_interrupt_vector()
@ -77,7 +78,7 @@ void SpuriousInterruptHandler::disable_interrupt_vector()
if (!m_enabled)
return;
m_enabled = false;
InterruptManagement::the().disable(interrupt_number());
m_responsible_irq_controller->disable(interrupt_number());
}
}