diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-01-23 21:17:19 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-01-23 21:17:19 +0000 |
commit | fc15c48025d84e81c8c8e06feda4e4198b7ac619 (patch) | |
tree | 0566eea510a7789f67beba8309b682c0ad05ddd4 | |
parent | d32d3d661b007876e0d8111712385b825cb978e6 (diff) |
Handle not-all-lapics intterupts.
-rw-r--r-- | sys/arch/i386/i386/lapic.c | 32 | ||||
-rw-r--r-- | sys/arch/i386/i386/mpbios.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/include/mpbiosvar.h | 4 |
3 files changed, 27 insertions, 16 deletions
diff --git a/sys/arch/i386/i386/lapic.c b/sys/arch/i386/i386/lapic.c index 877dbfe0dbb..91ee223dd7c 100644 --- a/sys/arch/i386/i386/lapic.c +++ b/sys/arch/i386/i386/lapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lapic.c,v 1.10 2006/12/20 17:50:40 gwk Exp $ */ +/* $OpenBSD: lapic.c,v 1.11 2007/01/23 21:17:18 kettenis Exp $ */ /* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */ /*- @@ -113,8 +113,6 @@ lapic_enable() i82489_writereg(LAPIC_SVR, LAPIC_SVR_ENABLE | LAPIC_SPURIOUS_VECTOR); } -extern struct mp_intr_map *lapic_ints[]; /* XXX header file? */ - void lapic_set_softvectors() { @@ -126,23 +124,37 @@ lapic_set_softvectors() void lapic_set_lvt() { -#ifdef MULTIPROCESSOR struct cpu_info *ci = curcpu(); + int i; + struct mp_intr_map *mpi; - if (0) { +#ifdef MULTIPROCESSOR + if (mp_verbose) { apic_format_redir(ci->ci_dev.dv_xname, "prelint", 0, 0, i82489_readreg(LAPIC_LVINT0)); apic_format_redir(ci->ci_dev.dv_xname, "prelint", 1, 0, i82489_readreg(LAPIC_LVINT1)); } #endif - if (lapic_ints[0]) - i82489_writereg(LAPIC_LVINT0, lapic_ints[0]->redir); - if (lapic_ints[1]) - i82489_writereg(LAPIC_LVINT1, lapic_ints[1]->redir); + + for (i = 0; i < mp_nintrs; i++) { + mpi = &mp_intrs[i]; + if (mpi->ioapic == NULL && (mpi->cpu_id == MPS_ALL_APICS + || mpi->cpu_id == ci->ci_apicid)) { +#ifdef DIAGNOSTIC + if (mpi->ioapic_pin > 1) + panic("lapic_set_lvt: bad pin value %d", + mpi->ioapic_pin); +#endif + if (mpi->ioapic_pin == 0) + i82489_writereg(LAPIC_LVINT0, mpi->redir); + else + i82489_writereg(LAPIC_LVINT1, mpi->redir); + } + } #ifdef MULTIPROCESSOR - if (0) { + if (mp_verbose) { apic_format_redir(ci->ci_dev.dv_xname, "timer", 0, 0, i82489_readreg(LAPIC_LVTT)); apic_format_redir(ci->ci_dev.dv_xname, "pcint", 0, 0, diff --git a/sys/arch/i386/i386/mpbios.c b/sys/arch/i386/i386/mpbios.c index a45df54ee29..415e5c0145c 100644 --- a/sys/arch/i386/i386/mpbios.c +++ b/sys/arch/i386/i386/mpbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpbios.c,v 1.19 2006/11/29 20:03:19 dim Exp $ */ +/* $OpenBSD: mpbios.c,v 1.20 2007/01/23 21:17:18 kettenis Exp $ */ /* $NetBSD: mpbios.c,v 1.2 2002/10/01 12:56:57 fvdl Exp $ */ /*- @@ -454,7 +454,6 @@ int mp_nbus; struct mp_intr_map *mp_intrs; int mp_nintrs; -struct mp_intr_map *lapic_ints[2]; /* XXX */ struct mp_bus *mp_isa_bus; struct mp_bus *mp_eisa_bus; @@ -1122,14 +1121,12 @@ mpbios_int(const u_int8_t *ent, struct mp_intr_map *mpi) sc->sc_pins[pin].ip_map = mpi; } } else { - if (id != MPS_ALL_APICS) - panic("can't deal with not-all-lapics interrupt yet!"); if (pin >= 2) printf("pin %d of local apic doesn't exist!\n", pin); else { mpi->ioapic = NULL; mpi->ioapic_pin = pin; - lapic_ints[pin] = mpi; + mpi->cpu_id = id; } } diff --git a/sys/arch/i386/include/mpbiosvar.h b/sys/arch/i386/include/mpbiosvar.h index 94ac52042bd..a49347c334c 100644 --- a/sys/arch/i386/include/mpbiosvar.h +++ b/sys/arch/i386/include/mpbiosvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpbiosvar.h,v 1.6 2006/11/11 21:47:52 kettenis Exp $ */ +/* $OpenBSD: mpbiosvar.h,v 1.7 2007/01/23 21:17:18 kettenis Exp $ */ /* $NetBSD: mpbiosvar.h,v 1.1.2.3 2000/02/29 13:17:20 sommerfeld Exp $ */ /*- @@ -70,12 +70,14 @@ struct mp_intr_map int type; /* from mp spec intr record */ int flags; /* from mp spec intr record */ u_int32_t redir; + int cpu_id; }; #if defined(_KERNEL) extern int mp_verbose; extern struct mp_bus *mp_busses; extern struct mp_intr_map *mp_intrs; +extern int mp_nintrs; extern struct mp_bus *mp_isa_bus; extern struct mp_bus *mp_eisa_bus; |