From f86be46c989499562b0b9ab9cd194e16dbc5bb36 Mon Sep 17 00:00:00 2001 From: Liav A Date: Sun, 8 Mar 2020 12:47:33 +0200 Subject: Kernel: Abstract IRQ controller handling from Interrupt handlers Now we don't send raw numbers, but we let the IRQController object to figure out the correct IRQ number. This helps in a situation when we have 2 or more IOAPICs, so if IOAPIC 1 is assigned for IRQs 0-23 and IOAPIC 2 is assigned for IRQs 24-47, if an IRQHandler of IRQ 25 invokes disable() for example, it will call his responsible IRQController (IOAPIC 2), and the IRQController will subtract the IRQ number with his assigned offset, and the result is that the second redirection entry in IOAPIC 2 will be masked. --- Kernel/Interrupts/IRQController.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Kernel/Interrupts/IRQController.h') diff --git a/Kernel/Interrupts/IRQController.h b/Kernel/Interrupts/IRQController.h index f27c5bd0f9..2a99df4ab4 100644 --- a/Kernel/Interrupts/IRQController.h +++ b/Kernel/Interrupts/IRQController.h @@ -41,14 +41,16 @@ class IRQController : public RefCounted { public: virtual ~IRQController() {} - virtual void enable(u8 number) = 0; - virtual void disable(u8 number) = 0; + virtual void enable(const GenericInterruptHandler&) = 0; + virtual void disable(const GenericInterruptHandler&) = 0; virtual void hard_disable() { m_hard_disabled = true; } virtual bool is_vector_enabled(u8 number) const = 0; bool is_enabled() const { return m_enabled && !m_hard_disabled; } bool is_hard_disabled() const { return m_hard_disabled; } - virtual void eoi(u8 number) const = 0; - virtual u32 get_gsi_base() const = 0; + virtual void eoi(const GenericInterruptHandler&) const = 0; + virtual void spurious_eoi(const GenericInterruptHandler&) const = 0; + virtual size_t interrupt_vectors_count() const = 0; + virtual u32 gsi_base() const = 0; virtual u16 get_isr() const = 0; virtual u16 get_irr() const = 0; virtual const char* model() const = 0; -- cgit v1.2.3