summaryrefslogtreecommitdiff
path: root/Kernel/Interrupts
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2020-03-08 02:34:46 +0200
committerAndreas Kling <kling@serenityos.org>2020-03-24 16:15:33 +0100
commit4cc96a7aa91cf94155924a7915cf33cd578aab59 (patch)
tree8587aa61ac31ddcdd9faf92e02a2deab73ec33ff /Kernel/Interrupts
parentc2c0e9fb04184d7f82d00455a4c75807e6c4a3c2 (diff)
downloadserenity-4cc96a7aa91cf94155924a7915cf33cd578aab59.zip
Kernel: Create an interface for conversion between IRQs and interrupts
Diffstat (limited to 'Kernel/Interrupts')
-rw-r--r--Kernel/Interrupts/InterruptManagement.cpp22
-rw-r--r--Kernel/Interrupts/InterruptManagement.h6
2 files changed, 21 insertions, 7 deletions
diff --git a/Kernel/Interrupts/InterruptManagement.cpp b/Kernel/Interrupts/InterruptManagement.cpp
index 154a1a9ce4..eb539b3de0 100644
--- a/Kernel/Interrupts/InterruptManagement.cpp
+++ b/Kernel/Interrupts/InterruptManagement.cpp
@@ -81,19 +81,31 @@ Vector<RefPtr<ISAInterruptOverrideMetadata>> InterruptManagement::isa_overrides(
return m_isa_interrupt_overrides;
}
-u8 InterruptManagement::acquire_mapped_interrupt_number(u8 number)
+u8 InterruptManagement::acquire_mapped_interrupt_number(u8 original_irq)
{
if (!InterruptManagement::initialized()) {
// This is necessary, because we install UnhandledInterruptHandlers before we actually initialize the Interrupt Management object...
- return number;
+ return original_irq;
}
- return InterruptManagement::the().get_mapped_vector_number(number);
+ return InterruptManagement::the().get_mapped_interrupt_vector(original_irq);
}
-u8 InterruptManagement::get_mapped_vector_number(u8 original_vector)
+u8 InterruptManagement::acquire_irq_number(u8 mapped_interrupt_vector)
+{
+ ASSERT(InterruptManagement::initialized());
+ return InterruptManagement::the().get_irq_vector(mapped_interrupt_vector);
+}
+
+u8 InterruptManagement::get_mapped_interrupt_vector(u8 original_irq)
+{
+ // FIXME: For SMP configuration (with IOAPICs) use a better routing scheme to make redirections more efficient.
+ return original_irq;
+}
+
+u8 InterruptManagement::get_irq_vector(u8 mapped_interrupt_vector)
{
// FIXME: For SMP configuration (with IOAPICs) use a better routing scheme to make redirections more efficient.
- return original_vector;
+ return mapped_interrupt_vector;
}
RefPtr<IRQController> InterruptManagement::get_responsible_irq_controller(u8 interrupt_vector)
diff --git a/Kernel/Interrupts/InterruptManagement.h b/Kernel/Interrupts/InterruptManagement.h
index 2f6815795a..3e3d82fd12 100644
--- a/Kernel/Interrupts/InterruptManagement.h
+++ b/Kernel/Interrupts/InterruptManagement.h
@@ -47,7 +47,8 @@ public:
static InterruptManagement& the();
static void initialize();
static bool initialized();
- static u8 acquire_mapped_interrupt_number(u8);
+ static u8 acquire_mapped_interrupt_number(u8 original_irq);
+ static u8 acquire_irq_number(u8 mapped_interrupt_vector);
virtual void switch_to_pic_mode();
virtual void switch_to_ioapic_mode();
@@ -57,7 +58,8 @@ public:
Vector<RefPtr<ISAInterruptOverrideMetadata>> isa_overrides();
- u8 get_mapped_vector_number(u8 original_vector);
+ u8 get_mapped_interrupt_vector(u8 original_irq);
+ u8 get_irq_vector(u8 mapped_interrupt_vector);
void enumerate_interrupt_handlers(Function<void(GenericInterruptHandler&)>);
IRQController& get_interrupt_controller(int index);