From fc2493fd9f42d76d38fefbc56e5e7c993a492a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Tue, 19 Nov 2024 13:05:47 +0100 Subject: [PATCH] refactor(apic): simplify I/O APIC config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- src/arch/x86_64/kernel/apic.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/arch/x86_64/kernel/apic.rs b/src/arch/x86_64/kernel/apic.rs index 0f94cc7d2e..ec93320915 100644 --- a/src/arch/x86_64/kernel/apic.rs +++ b/src/arch/x86_64/kernel/apic.rs @@ -544,13 +544,9 @@ fn init_ioapic() { // now lets turn everything else on for i in 0..max_entry { - if i != 2 { - ioapic_set_interrupt(i, 0 /*apic_processors[boot_processor]->id*/, true); - } else { - // now, we don't longer need the IOAPIC timer and turn it off - info!("Disable IOAPIC timer"); - ioapic_set_interrupt(2, 0 /*apic_processors[boot_processor]->id*/, false); - } + // now, we don't longer need the IOAPIC timer and turn it off + let enabled = i != 2; + ioapic_set_interrupt(i, 0, enabled); } } @@ -561,6 +557,7 @@ fn ioapic_set_interrupt(irq: u8, apicid: u8, enabled: bool) { let ioredirect_upper = u32::from(apicid) << 24; let mut ioredirect_lower = u32::from(0x20 + irq); if !enabled { + debug!("Disabling irq {irq}"); ioredirect_lower |= 1 << 16; }