Skip to content

Commit

Permalink
refactor(apic): simplify I/O APIC config
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Nov 19, 2024
1 parent 73379fc commit fc2493f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/arch/x86_64/kernel/apic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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;
}

Expand Down

0 comments on commit fc2493f

Please sign in to comment.