diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-05-09 18:41:23 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-05-09 18:41:23 +0000 |
commit | 052c31bc9ec07ffcaa801396e2e593da62cc5b79 (patch) | |
tree | a1cc78c0ee627af7b81bbf2dc1eb728b0b33b62d | |
parent | 0d1b058efaae956c9ed04e921e31579f0b337110 (diff) |
Import global ACPI interrupt code from amd64.
ok brad@
-rw-r--r-- | sys/arch/i386/i386/ioapic.c | 32 | ||||
-rw-r--r-- | sys/arch/i386/i386/mpbios.c | 5 | ||||
-rw-r--r-- | sys/arch/i386/include/apicvar.h | 3 | ||||
-rw-r--r-- | sys/arch/i386/include/i82093var.h | 3 |
4 files changed, 38 insertions, 5 deletions
diff --git a/sys/arch/i386/i386/ioapic.c b/sys/arch/i386/i386/ioapic.c index a80bea4457c..7a7620f4932 100644 --- a/sys/arch/i386/i386/ioapic.c +++ b/sys/arch/i386/i386/ioapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioapic.c,v 1.8 2006/04/08 20:50:38 kettenis Exp $ */ +/* $OpenBSD: ioapic.c,v 1.9 2006/05/09 18:41:22 kettenis Exp $ */ /* $NetBSD: ioapic.c,v 1.7 2003/07/14 22:32:40 lukem Exp $ */ /*- @@ -114,6 +114,7 @@ int ioapic_cold = 1; struct ioapic_softc *ioapics; /* head of linked list */ int nioapics = 0; /* number attached */ +static int ioapic_vecbase; void ioapic_set_id(struct ioapic_softc *); @@ -181,6 +182,24 @@ ioapic_find(int apicid) return (NULL); } +/* + * For the case the I/O APICs were configured using ACPI, there must + * be an option to match global ACPI interrupts with APICs. + */ +struct ioapic_softc * +ioapic_find_bybase(int vec) +{ + struct ioapic_softc *sc; + + for (sc = ioapics; sc != NULL; sc = sc->sc_next) { + if (vec >= sc->sc_apic_vecbase && + vec < (sc->sc_apic_vecbase + sc->sc_apic_sz)) + return sc; + } + + return NULL; +} + static __inline void ioapic_add(struct ioapic_softc *sc) { @@ -266,6 +285,17 @@ ioapic_attach(struct device *parent, struct device *self, void *aux) sc->sc_apic_sz = (ver_sz & IOAPIC_MAX_MASK) >> IOAPIC_MAX_SHIFT; sc->sc_apic_sz++; + if (aaa->apic_vecbase != -1) + sc->sc_apic_vecbase = aaa->apic_vecbase; + else { + /* + * XXX this assumes ordering of ioapics in the table. + * Only needed for broken BIOS workaround (see mpbios.c) + */ + sc->sc_apic_vecbase = ioapic_vecbase; + ioapic_vecbase += sc->sc_apic_sz; + } + if (mp_verbose) { printf(", %s mode", aaa->flags & IOAPIC_PICMODE ? "PIC" : "virtual wire"); diff --git a/sys/arch/i386/i386/mpbios.c b/sys/arch/i386/i386/mpbios.c index c37ac264198..dc84748df6d 100644 --- a/sys/arch/i386/i386/mpbios.c +++ b/sys/arch/i386/i386/mpbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpbios.c,v 1.11 2006/05/01 17:01:14 kettenis Exp $ */ +/* $OpenBSD: mpbios.c,v 1.12 2006/05/09 18:41:22 kettenis Exp $ */ /* $NetBSD: mpbios.c,v 1.2 2002/10/01 12:56:57 fvdl Exp $ */ /*- @@ -1058,7 +1058,8 @@ mpbios_ioapic(ent, self) aaa.apic_id = entry->apic_id; aaa.apic_version = entry->apic_version; aaa.apic_address = (u_long)entry->apic_address; - aaa.flags = (mp_fps->mpfb2 & 0x80) ? IOAPIC_PICMODE : IOAPIC_VWIRE; + aaa.apic_vecbase = -1; + aaa.flags = (mp_fps->mpfb2 & 0x80) ? IOAPIC_PICMODE : IOAPIC_VWIRE; config_found_sm(self, &aaa, mp_print, mp_match); } diff --git a/sys/arch/i386/include/apicvar.h b/sys/arch/i386/include/apicvar.h index aac452fca40..f81773835a9 100644 --- a/sys/arch/i386/include/apicvar.h +++ b/sys/arch/i386/include/apicvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: apicvar.h,v 1.2 2004/06/13 21:49:16 niklas Exp $ */ +/* $OpenBSD: apicvar.h,v 1.3 2006/05/09 18:41:22 kettenis Exp $ */ /* $NetBSD: apicvar.h,v 1.1.2.3 2000/02/27 20:25:00 sommerfeld Exp $ */ /*- @@ -50,6 +50,7 @@ struct apic_attach_args { #define IOAPIC_PICMODE 0x01 #define IOAPIC_VWIRE 0x02 paddr_t apic_address; + int apic_vecbase; }; void apic_format_redir(char *, char *, int, u_int32_t, u_int32_t); diff --git a/sys/arch/i386/include/i82093var.h b/sys/arch/i386/include/i82093var.h index 58ead2893dc..f57dee99392 100644 --- a/sys/arch/i386/include/i82093var.h +++ b/sys/arch/i386/include/i82093var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82093var.h,v 1.4 2005/11/23 09:24:52 mickey Exp $ */ +/* $OpenBSD: i82093var.h,v 1.5 2006/05/09 18:41:22 kettenis Exp $ */ /* $NetBSD: i82093var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */ /*- @@ -60,6 +60,7 @@ struct ioapic_softc { struct ioapic_softc *sc_next; int sc_apicid; int sc_apic_vers; + int sc_apic_vecbase; /* global int base if ACPI */ int sc_apic_sz; /* apic size*/ int sc_flags; paddr_t sc_pa; /* PA of ioapic */ |