/* * Initialize fixed idt vectors for use by local apic. */ void lapic_boot_init(paddr_t lapic_base) { static int clk_irq = 0; #ifdef MULTIPROCESSOR static int ipi_irq = 0; #endif lapic_map(lapic_base); #ifdef MULTIPROCESSOR idt_vec_set(LAPIC_IPI_VECTOR, Xintripi); idt_vec_set(LAPIC_IPI_INVLTLB, Xintripi_invltlb); idt_vec_set(LAPIC_IPI_INVLPG, Xintripi_invlpg); idt_vec_set(LAPIC_IPI_INVLRANGE, Xintripi_invlrange); idt_vec_set(LAPIC_IPI_RELOADCR3, Xintripi_reloadcr3); #endif idt_vec_set(LAPIC_SPURIOUS_VECTOR, Xintrspurious); idt_vec_set(LAPIC_TIMER_VECTOR, Xintrltimer); evcount_attach(&clk_count, "clock", &clk_irq); #ifdef MULTIPROCESSOR evcount_attach(&ipi_count, "ipi", &ipi_irq); #endif }
static int madt_lapic_enumerate(struct lapic_enumerator *e) { vm_paddr_t lapic_addr; int bsp_apic_id; KKASSERT(madt_phyaddr != 0); lapic_addr = madt_lapic_pass1(); if (lapic_addr == 0) panic("madt_lapic_enumerate: no local apic"); lapic_map(lapic_addr); bsp_apic_id = APIC_ID(lapic->id); if (bsp_apic_id == APICID_MAX) { /* * XXX * Some old brain dead BIOS will set BSP's LAPIC apic id * to 255, though all LAPIC entries in MADT are valid. */ kprintf("%s invalid BSP LAPIC apic id %d\n", __func__, bsp_apic_id); return EINVAL; } if (madt_lapic_pass2(bsp_apic_id)) panic("madt_lapic_enumerate: madt_lapic_pass2 failed"); return 0; }
static void madt_lapic_enumerate(struct lapic_enumerator *e) { vm_paddr_t lapic_addr; int bsp_apic_id; KKASSERT(madt_phyaddr != 0); lapic_addr = madt_lapic_pass1(); if (lapic_addr == 0) panic("madt_lapic_enumerate: no local apic\n"); lapic_map(lapic_addr); bsp_apic_id = APIC_ID(lapic->id); if (madt_lapic_pass2(bsp_apic_id)) panic("madt_lapic_enumerate: madt_lapic_pass2 failed\n"); }