Files
Mohammed Anees d2ef1fdb62 bsps/i386: Refactor LAPIC code into apic.c module
Move Local APIC initialization, IPI, and utility functions out of
smp-imps.c into a file bsps/i386/shared/irq/apic.c for lapic driver.
This decouples the LAPIC driver from the MPS table parsing code.

- Add apic.c with lapic_initialize(), lapic_enable(), lapic_send_ipi(),
  lapic_clear_errors(), lapic_reset_and_start_ap(), and lapic_reset_ap()
- Extend apic.h with LAPIC register offset macros, inline helpers
  lapic_get_id() and lapic_send_eoi(), and function declarations
- Add accessor functions lapic_get_cpu_index(), lapic_get_lapic_id(),
  lapic_set_cpu_index(), and lapic_set_lapic_id() to encapsulate
  the CPU/APIC ID mapping tables
- Replace IMPS_LAPIC_READ/WRITE macros with direct register access
  through the i386_lapic_base pointer
- Remove send_ipi(), imps_lapic_addr, and related globals from
  smp-imps.c and smp-imps.h
- Update bspsmp.c and asm.h to use the new LAPIC API

While this refactoring centralizes the Local APIC implementation behind
a common interface for C code, some assembly paths continue to access
LAPIC state directly (e.g. CPU identification through i386_lapic_base
and i386_lapic_to_cpu_map). These accesses are retained to preserve the
existing assembly interface and can be revisited in a follow-up change
if the assembly is refactored to use a different mechanism.

Closes #5518
2026-09-01 20:10:14 +00:00
..