Kernel: Create an interface for conversion between IRQs and interrupts

This commit is contained in:
Liav A 2020-03-08 02:34:46 +02:00 committed by Andreas Kling
parent c2c0e9fb04
commit 4cc96a7aa9
Notes: sideshowbarker 2024-07-19 08:09:29 +09:00
2 changed files with 21 additions and 7 deletions

View file

@ -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_vector;
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 mapped_interrupt_vector;
}
RefPtr<IRQController> InterruptManagement::get_responsible_irq_controller(u8 interrupt_vector)

View file

@ -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);