diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-11-11 21:47:53 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-11-11 21:47:53 +0000 |
commit | afdb37b7148eccef5cfd6092d2b7e5b5f0fab79d (patch) | |
tree | 5ec62df08cf6c258b740a1b04200999680578ec6 /sys | |
parent | 00e6ef7266686be23d2685a36eb2cd678695d23a (diff) |
Get rid of magic isa and eisa bus numbers in mpbios code. Pave the way for
alternative sources for interrupt information.
ok gwk@, brad@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/i386/mpbios.c | 23 | ||||
-rw-r--r-- | sys/arch/i386/include/mpbiosvar.h | 6 | ||||
-rw-r--r-- | sys/arch/i386/isa/isa_machdep.c | 16 | ||||
-rw-r--r-- | sys/arch/i386/pci/pci_machdep.c | 14 |
4 files changed, 34 insertions, 25 deletions
diff --git a/sys/arch/i386/i386/mpbios.c b/sys/arch/i386/i386/mpbios.c index 6b3b14b7ab6..8e12677e5a6 100644 --- a/sys/arch/i386/i386/mpbios.c +++ b/sys/arch/i386/i386/mpbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpbios.c,v 1.17 2006/10/03 22:35:01 gwk Exp $ */ +/* $OpenBSD: mpbios.c,v 1.18 2006/11/11 21:47:52 kettenis Exp $ */ /* $NetBSD: mpbios.c,v 1.2 2002/10/01 12:56:57 fvdl Exp $ */ /*- @@ -277,6 +277,13 @@ mpbios_probe(struct device *self) struct mp_map t; + /* + * Skip probe if someone else (e.g. acpi) already provided the + * necessary details. + */ + if (mp_busses) + return (0); + /* see if EBDA exists */ mpbios_page = mpbios_map(0, NBPG, &t); @@ -448,8 +455,8 @@ struct mp_intr_map *mp_intrs; int mp_nintrs; struct mp_intr_map *lapic_ints[2]; /* XXX */ -int mp_isa_bus = -1; /* XXX */ -int mp_eisa_bus = -1; /* XXX */ +struct mp_bus *mp_isa_bus; +struct mp_bus *mp_eisa_bus; static struct mp_bus extint_bus = { "ExtINT", @@ -984,21 +991,21 @@ mpbios_bus(const u_int8_t *ent, struct device *self) mp_busses[bus_id].mb_data = inb(ELCR0) | (inb(ELCR1) << 8); - if (mp_eisa_bus != -1) + if (mp_eisa_bus) printf("%s: multiple eisa busses?\n", self->dv_xname); else - mp_eisa_bus = bus_id; + mp_eisa_bus = &mp_busses[bus_id]; } else if (memcmp(entry->bus_type, "ISA ", 6) == 0) { mp_busses[bus_id].mb_name = "isa"; - mp_busses[bus_id].mb_idx = 0; /* XXX */ + mp_busses[bus_id].mb_idx = bus_id; mp_busses[bus_id].mb_intr_print = mp_print_isa_intr; mp_busses[bus_id].mb_intr_cfg = mp_cfg_isa_intr; - if (mp_isa_bus != -1) + if (mp_isa_bus) printf("%s: multiple isa busses?\n", self->dv_xname); else - mp_isa_bus = bus_id; + mp_isa_bus = &mp_busses[bus_id]; } else { printf("%s: unsupported bus type %6.6s\n", self->dv_xname, entry->bus_type); diff --git a/sys/arch/i386/include/mpbiosvar.h b/sys/arch/i386/include/mpbiosvar.h index bba6da5683e..94ac52042bd 100644 --- a/sys/arch/i386/include/mpbiosvar.h +++ b/sys/arch/i386/include/mpbiosvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpbiosvar.h,v 1.5 2006/05/01 17:01:14 kettenis Exp $ */ +/* $OpenBSD: mpbiosvar.h,v 1.6 2006/11/11 21:47:52 kettenis Exp $ */ /* $NetBSD: mpbiosvar.h,v 1.1.2.3 2000/02/29 13:17:20 sommerfeld Exp $ */ /*- @@ -76,8 +76,8 @@ struct mp_intr_map extern int mp_verbose; extern struct mp_bus *mp_busses; extern struct mp_intr_map *mp_intrs; -extern int mp_isa_bus; -extern int mp_eisa_bus; +extern struct mp_bus *mp_isa_bus; +extern struct mp_bus *mp_eisa_bus; void mpbios_scan(struct device *); int mpbios_probe(struct device *); diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c index ed7165b5bf7..7fd9125e29b 100644 --- a/sys/arch/i386/isa/isa_machdep.c +++ b/sys/arch/i386/isa/isa_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isa_machdep.c,v 1.55 2006/09/19 11:06:33 jsg Exp $ */ +/* $OpenBSD: isa_machdep.c,v 1.56 2006/11/11 21:47:52 kettenis Exp $ */ /* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */ #define ISA_DMA_STATS @@ -520,19 +520,21 @@ isa_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level, if (mp_busses != NULL) { int mpspec_pin = irq; - int bus = mp_isa_bus; int airq; - for (mip = mp_busses[bus].mb_intrs; mip != NULL; + if (mp_isa_bus == NULL) + panic("no isa bus"); + + for (mip = mp_isa_bus->mb_intrs; mip != NULL; mip = mip->next) { if (mip->bus_pin == mpspec_pin) { airq = mip->ioapic_ih | irq; break; } } - if (mip == NULL && mp_eisa_bus != -1) { - for (mip = mp_busses[mp_eisa_bus].mb_intrs; - mip != NULL; mip=mip->next) { + if (mip == NULL && mp_eisa_bus) { + for (mip = mp_eisa_bus->mb_intrs; mip != NULL; + mip = mip->next) { if (mip->bus_pin == mpspec_pin) { airq = mip->ioapic_ih | irq; break; @@ -542,7 +544,7 @@ isa_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level, /* no MP mapping found -- invent! */ if (mip == NULL) - airq = mpbios_invent(irq, type, mp_isa_bus); + airq = mpbios_invent(irq, type, mp_isa_bus->mb_idx); return (apic_intr_establish(airq, type, level, ih_fun, ih_arg, ih_what)); diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c index 07d8c5722c7..79c7b6779b8 100644 --- a/sys/arch/i386/pci/pci_machdep.c +++ b/sys/arch/i386/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.34 2006/09/19 11:06:34 jsg Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.35 2006/11/11 21:47:52 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.28 1997/06/06 23:29:17 thorpej Exp $ */ /*- @@ -480,18 +480,18 @@ pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp) return 0; } } - if (mip == NULL && mp_isa_bus != -1) { - for (mip = mp_busses[mp_isa_bus].mb_intrs; mip != NULL; - mip=mip->next) { + if (mip == NULL && mp_isa_bus) { + for (mip = mp_isa_bus->mb_intrs; mip != NULL; + mip = mip->next) { if (mip->bus_pin == line) { ihp->line = mip->ioapic_ih | line; return 0; } } } - if (mip == NULL && mp_eisa_bus != -1) { - for (mip = mp_busses[mp_eisa_bus].mb_intrs; - mip != NULL; mip=mip->next) { + if (mip == NULL && mp_eisa_bus) { + for (mip = mp_eisa_bus->mb_intrs; mip != NULL; + mip = mip->next) { if (mip->bus_pin == line) { ihp->line = mip->ioapic_ih | line; return 0; |