1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:27:34 +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

@ -40,6 +40,8 @@
namespace Kernel {
class ISAInterruptOverrideMetadata;
class InterruptManagement {
public:
static InterruptManagement& the();
@ -48,32 +50,17 @@ public:
virtual void switch_to_pic_mode();
virtual void switch_to_ioapic_mode();
RefPtr<IRQController> get_responsible_irq_controller(u8 interrupt_vector);
void enable(u8 interrupt_vector);
void disable(u8 interrupt_vector);
void eoi(u8 interrupt_vector);
void enumerate_interrupt_handlers(Function<void(GenericInterruptHandler&)>);
IRQController& get_interrupt_controller(int index);
protected:
explicit InterruptManagement(bool create_default_controller);
FixedArray<OwnPtr<IRQController>> m_interrupt_controllers { 1 };
};
class ISAInterruptOverrideMetadata;
class AdvancedInterruptManagement : public InterruptManagement {
friend class IOAPIC;
public:
static void initialize(PhysicalAddress madt);
virtual void switch_to_ioapic_mode() override;
virtual void switch_to_pic_mode() override;
private:
explicit AdvancedInterruptManagement(PhysicalAddress madt);
void locate_ioapics(PhysicalAddress madt);
void locate_isa_interrupt_overrides(PhysicalAddress madt);
InterruptManagement();
PhysicalAddress search_for_madt();
void locate_apic_data();
void locate_pci_interrupt_overrides();
FixedArray<RefPtr<IRQController>> m_interrupt_controllers { 1 };
Vector<RefPtr<ISAInterruptOverrideMetadata>> m_isa_interrupt_overrides;
Vector<RefPtr<PCIInterruptOverrideMetadata>> m_pci_interrupt_overrides;
PhysicalAddress m_madt;