diff options
-rw-r--r-- | sys/arch/i386/i386/cpu.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/ioapic.c | 59 | ||||
-rw-r--r-- | sys/arch/i386/i386/mpbios.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/include/i82093var.h | 11 |
4 files changed, 16 insertions, 64 deletions
diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c index b1967176f98..23e5ae3911e 100644 --- a/sys/arch/i386/i386/cpu.c +++ b/sys/arch/i386/i386/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.30 2008/06/26 05:42:10 ray Exp $ */ +/* $OpenBSD: cpu.c,v 1.31 2008/10/05 16:57:36 kettenis Exp $ */ /* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */ /*- @@ -298,10 +298,6 @@ cpu_attach(struct device *parent, struct device *self, void *aux) panic("unknown processor type??"); } - /* Mark this ID as taken if it's in the I/O APIC ID area */ - if (ci->ci_apicid < IOAPIC_ID_MAX) - ioapic_id_map &= ~(1 << ci->ci_apicid); - if (mp_verbose) { printf("%s: kstack at 0x%lx for %d bytes\n", ci->ci_dev.dv_xname, kstack, USPACE); diff --git a/sys/arch/i386/i386/ioapic.c b/sys/arch/i386/i386/ioapic.c index 2b3b0dabe14..fe673d2588d 100644 --- a/sys/arch/i386/i386/ioapic.c +++ b/sys/arch/i386/i386/ioapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioapic.c,v 1.16 2008/06/26 05:42:10 ray Exp $ */ +/* $OpenBSD: ioapic.c,v 1.17 2008/10/05 16:57:36 kettenis Exp $ */ /* $NetBSD: ioapic.c,v 1.7 2003/07/14 22:32:40 lukem Exp $ */ /*- @@ -114,20 +114,6 @@ static int ioapic_vecbase; void ioapic_set_id(struct ioapic_softc *); /* - * A bitmap telling what APIC IDs usable for I/O APICs are free. - * The size must be at least IOAPIC_ID_MAX bits (16). - */ -u_int16_t ioapic_id_map = (1 << IOAPIC_ID_MAX) - 1; - -/* - * When we renumber I/O APICs we provide a mapping vector giving us the new - * ID out of the old BIOS supplied one. Each item must be able to hold IDs - * in [0, IOAPIC_ID_MAX << 1), since we use an extra bit to tell if the ID - * has actually been remapped. - */ -u_int8_t ioapic_id_remap[IOAPIC_ID_MAX]; - -/* * Register read/write routines. */ static __inline u_int32_t @@ -258,15 +244,23 @@ ioapic_attach(struct device *parent, struct device *self, void *aux) struct ioapic_softc *sc = (struct ioapic_softc *)self; struct apic_attach_args *aaa = (struct apic_attach_args *)aux; int apic_id; - int8_t new_id; bus_space_handle_t bh; u_int32_t ver_sz; - int i, ioapic_found; + int i; sc->sc_flags = aaa->flags; sc->sc_apicid = aaa->apic_id; - printf(": apid %d pa 0x%lx", aaa->apic_id, aaa->apic_address); + printf(": apid %d", aaa->apic_id); + + if (ioapic_find(aaa->apic_id) != NULL) { + printf(", duplicate apic id (ignored)\n"); + return; + } + + ioapic_add(sc); + + printf(" pa 0x%lx", aaa->apic_address); if (bus_mem_add_mapping(aaa->apic_address, PAGE_SIZE, 0, &bh) != 0) { printf(", map failed\n"); @@ -298,35 +292,6 @@ ioapic_attach(struct device *parent, struct device *self, void *aux) printf(", version %x, %d pins\n", sc->sc_apic_vers, sc->sc_apic_sz); - /* - * If either a LAPIC or an I/O APIC is already at the ID the BIOS - * setup for this I/O APIC, try to find a free ID to use and reprogram - * the chip. Record this remapping since all references done by the - * MP BIOS will be through the old ID. - */ - ioapic_found = ioapic_find(sc->sc_apicid) != NULL; - if (cpu_info[sc->sc_apicid] != NULL || ioapic_found) { - printf("%s: duplicate apic id", sc->sc_dev.dv_xname); - new_id = ffs(ioapic_id_map) - 1; - if (new_id == -1) { - printf(" (and none free, ignoring)\n"); - return; - } - - /* - * If there were many I/O APICs at the same ID, we choose - * to let later references to that ID (in the MP BIOS) refer - * to the first found. - */ - if (!ioapic_found && !IOAPIC_REMAPPED(sc->sc_apicid)) - IOAPIC_REMAP(sc->sc_apicid, new_id); - sc->sc_apicid = new_id; - ioapic_set_id(sc); - } - ioapic_id_map &= ~(1 << sc->sc_apicid); - - ioapic_add(sc); - apic_id = (ioapic_read(sc, IOAPIC_ID) & IOAPIC_ID_MASK) >> IOAPIC_ID_SHIFT; diff --git a/sys/arch/i386/i386/mpbios.c b/sys/arch/i386/i386/mpbios.c index d4663ff89bb..a41e882a478 100644 --- a/sys/arch/i386/i386/mpbios.c +++ b/sys/arch/i386/i386/mpbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpbios.c,v 1.25 2008/09/16 20:02:47 brad Exp $ */ +/* $OpenBSD: mpbios.c,v 1.26 2008/10/05 16:57:36 kettenis Exp $ */ /* $NetBSD: mpbios.c,v 1.2 2002/10/01 12:56:57 fvdl Exp $ */ /*- @@ -1035,7 +1035,7 @@ mpbios_int(const u_int8_t *ent, struct mp_intr_map *mpi) struct mp_intr_map *altmpi; struct mp_bus *mpb; - u_int32_t id = IOAPIC_REMAPPED_ID(entry->dst_apic_id); + u_int32_t id = entry->dst_apic_id; u_int32_t pin = entry->dst_apic_int; u_int32_t bus = entry->src_bus_id; u_int32_t dev = entry->src_bus_irq; diff --git a/sys/arch/i386/include/i82093var.h b/sys/arch/i386/include/i82093var.h index 1c017547fc0..4bd7659fb95 100644 --- a/sys/arch/i386/include/i82093var.h +++ b/sys/arch/i386/include/i82093var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82093var.h,v 1.6 2008/06/26 05:42:10 ray Exp $ */ +/* $OpenBSD: i82093var.h,v 1.7 2008/10/05 16:57:36 kettenis Exp $ */ /* $NetBSD: i82093var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */ /*- @@ -80,15 +80,6 @@ struct ioapic_softc { #define APIC_IRQ_APIC(x) ((x & APIC_INT_APIC_MASK) >> APIC_INT_APIC_SHIFT) #define APIC_IRQ_PIN(x) ((x & APIC_INT_PIN_MASK) >> APIC_INT_PIN_SHIFT) -/* I/O APIC ID remapping helper macros. */ -#define IOAPIC_REMAP_MASK (IOAPIC_ID_MASK >> IOAPIC_ID_SHIFT) -#define IOAPIC_REMAP_FLAG ((IOAPIC_REMAP_MASK + 1) << 1) -#define IOAPIC_REMAP(old_id, new_id) \ - (ioapic_id_remap[(old_id)] = IOAPIC_REMAP_FLAG | (new_id)) -#define IOAPIC_REMAPPED(id) (ioapic_id_remap[(id)] & IOAPIC_REMAP_FLAG) -#define IOAPIC_REMAPPED_ID(id) \ - (IOAPIC_REMAPPED(id) ? ioapic_id_remap[(id)] & IOAPIC_REMAP_MASK : (id)) - void *apic_intr_establish(int, int, int, int (*)(void *), void *, char *); void apic_intr_disestablish(void *); |