Skip to content

Commit fc2493f

Browse files
committed
refactor(apic): simplify I/O APIC config
Signed-off-by: Martin Kröning <[email protected]>
1 parent 73379fc commit fc2493f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/arch/x86_64/kernel/apic.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,9 @@ fn init_ioapic() {
544544

545545
// now lets turn everything else on
546546
for i in 0..max_entry {
547-
if i != 2 {
548-
ioapic_set_interrupt(i, 0 /*apic_processors[boot_processor]->id*/, true);
549-
} else {
550-
// now, we don't longer need the IOAPIC timer and turn it off
551-
info!("Disable IOAPIC timer");
552-
ioapic_set_interrupt(2, 0 /*apic_processors[boot_processor]->id*/, false);
553-
}
547+
// now, we don't longer need the IOAPIC timer and turn it off
548+
let enabled = i != 2;
549+
ioapic_set_interrupt(i, 0, enabled);
554550
}
555551
}
556552

@@ -561,6 +557,7 @@ fn ioapic_set_interrupt(irq: u8, apicid: u8, enabled: bool) {
561557
let ioredirect_upper = u32::from(apicid) << 24;
562558
let mut ioredirect_lower = u32::from(0x20 + irq);
563559
if !enabled {
560+
debug!("Disabling irq {irq}");
564561
ioredirect_lower |= 1 << 16;
565562
}
566563

0 commit comments

Comments
 (0)