summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/mainbus.c6
-rw-r--r--sys/arch/amd64/amd64/mpbios.c25
-rw-r--r--sys/arch/amd64/include/cpu.h7
-rw-r--r--sys/arch/amd64/include/mpconfig.h5
-rw-r--r--sys/arch/amd64/isa/isa_machdep.c9
-rw-r--r--sys/arch/amd64/pci/pci_machdep.c6
-rw-r--r--sys/dev/acpi/acpimadt.c14
-rw-r--r--sys/dev/acpi/acpiprt.c9
8 files changed, 57 insertions, 24 deletions
diff --git a/sys/arch/amd64/amd64/mainbus.c b/sys/arch/amd64/amd64/mainbus.c
index 4767cf38930..2f661daa01b 100644
--- a/sys/arch/amd64/amd64/mainbus.c
+++ b/sys/arch/amd64/amd64/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.9 2006/11/17 20:55:47 kettenis Exp $ */
+/* $OpenBSD: mainbus.c,v 1.10 2006/11/25 16:59:31 niklas Exp $ */
/* $NetBSD: mainbus.c,v 1.1 2003/04/26 18:39:29 fvdl Exp $ */
/*
@@ -118,8 +118,8 @@ int mp_nbus;
struct mp_intr_map *mp_intrs;
int mp_nintr;
-int mp_isa_bus = -1;
-int mp_eisa_bus = -1;
+struct mp_bus *mp_isa_bus;
+struct mp_bus *mp_eisa_bus;
#ifdef MPVERBOSE
int mp_verbose = 1;
diff --git a/sys/arch/amd64/amd64/mpbios.c b/sys/arch/amd64/amd64/mpbios.c
index 29145529ddc..b95d07262e4 100644
--- a/sys/arch/amd64/amd64/mpbios.c
+++ b/sys/arch/amd64/amd64/mpbios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpbios.c,v 1.7 2006/10/03 22:39:40 gwk Exp $ */
+/* $OpenBSD: mpbios.c,v 1.8 2006/11/25 16:59:31 niklas Exp $ */
/* $NetBSD: mpbios.c,v 1.7 2003/05/15 16:32:50 fvdl Exp $ */
/*-
@@ -276,6 +276,13 @@ mpbios_probe(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, PAGE_SIZE, &t);
@@ -950,21 +957,23 @@ mpbios_bus(ent, self)
mp_busses[bus_id].mb_data =
inb(ELCR0) | (inb(ELCR1) << 8);
- if (mp_eisa_bus != -1)
- printf("oops: multiple isa busses?\n");
+ if (mp_eisa_bus)
+ printf("%s: multiple isa busses?\n",
+ self->dv_xname);
else
- mp_eisa_bus = bus_id;
+ mp_eisa_bus = &mp_busses[bus_id];
#endif
} 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)
- printf("oops: multiple isa busses?\n");
+ 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/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h
index 5d587c39f1f..ee62a9373ba 100644
--- a/sys/arch/amd64/include/cpu.h
+++ b/sys/arch/amd64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.19 2006/11/07 09:09:42 otto Exp $ */
+/* $OpenBSD: cpu.h,v 1.20 2006/11/25 16:59:31 niklas Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
@@ -47,6 +47,11 @@
#include <machine/intrdefs.h>
#include <machine/cacheinfo.h>
+#ifdef MULTIPROCESSOR
+#include <machine/i82489reg.h>
+#include <machine/i82489var.h>
+#endif
+
#include <sys/device.h>
#include <sys/lock.h>
#include <sys/sched.h>
diff --git a/sys/arch/amd64/include/mpconfig.h b/sys/arch/amd64/include/mpconfig.h
index 350b5e2bf3c..922f4e0e31e 100644
--- a/sys/arch/amd64/include/mpconfig.h
+++ b/sys/arch/amd64/include/mpconfig.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpconfig.h,v 1.3 2006/05/10 01:39:04 krw Exp $ */
+/* $OpenBSD: mpconfig.h,v 1.4 2006/11/25 16:59:31 niklas Exp $ */
/* $NetBSD: mpconfig.h,v 1.2 2003/05/11 00:05:52 fvdl Exp $ */
/*
@@ -59,7 +59,8 @@ extern int mp_verbose;
extern struct mp_bus *mp_busses;
extern struct mp_intr_map *mp_intrs;
extern int mp_nintr;
-extern int mp_isa_bus, mp_eisa_bus;
+extern struct mp_bus *mp_isa_bus;
+extern struct mp_bus *mp_eisa_bus;
extern int mp_nbus;
#endif
#endif
diff --git a/sys/arch/amd64/isa/isa_machdep.c b/sys/arch/amd64/isa/isa_machdep.c
index 74efd9479c9..45f164d3420 100644
--- a/sys/arch/amd64/isa/isa_machdep.c
+++ b/sys/arch/amd64/isa/isa_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.c,v 1.9 2006/06/08 03:18:08 weingart Exp $ */
+/* $OpenBSD: isa_machdep.c,v 1.10 2006/11/25 16:59:31 niklas Exp $ */
/* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */
#define ISA_DMA_STATS
@@ -372,8 +372,11 @@ isa_intr_establish(ic, irq, type, level, ih_fun, ih_arg, ih_what)
struct mp_intr_map *mip;
if (mp_busses != NULL) {
- for (mip = mp_busses[mp_isa_bus].mb_intrs; mip != NULL;
- mip = mip->next) {
+ 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 == pin) {
pin = APIC_IRQ_PIN(mip->ioapic_ih);
pic = &mip->ioapic->sc_pic;
diff --git a/sys/arch/amd64/pci/pci_machdep.c b/sys/arch/amd64/pci/pci_machdep.c
index 020f122774f..2b056fadd0b 100644
--- a/sys/arch/amd64/pci/pci_machdep.c
+++ b/sys/arch/amd64/pci/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.c,v 1.8 2006/05/31 06:13:48 weingart Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.9 2006/11/25 16:59:31 niklas Exp $ */
/* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@@ -481,12 +481,12 @@ pci_intr_map(pa, ihp)
}
#if NIOAPIC > 0
if (mp_busses != NULL) {
- if (intr_find_mpmapping(mp_isa_bus, line, ihp) == 0) {
+ if (intr_find_mpmapping(mp_isa_bus->mb_idx, line, ihp) == 0) {
*ihp |= line;
return 0;
}
#if NEISA > 0
- if (intr_find_mpmapping(mp_eisa_bus, line, ihp) == 0) {
+ if (intr_find_mpmapping(mp_eisa_bus->mb_idx, line, ihp) == 0) {
*ihp |= line;
return 0;
}
diff --git a/sys/dev/acpi/acpimadt.c b/sys/dev/acpi/acpimadt.c
index 73dafb46921..b10b3a48177 100644
--- a/sys/dev/acpi/acpimadt.c
+++ b/sys/dev/acpi/acpimadt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpimadt.c,v 1.2 2006/11/20 21:55:23 jordan Exp $ */
+/* $OpenBSD: acpimadt.c,v 1.3 2006/11/25 16:59:31 niklas Exp $ */
/*
* Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org>
*
@@ -154,9 +154,11 @@ acpimadt_attach(struct device *parent, struct device *self, void *aux)
caa.caa_name = "cpu";
caa.cpu_number = entry->madt_lapic.apic_id;
caa.cpu_func = &mp_cpu_funcs;
+#ifdef __i386__
extern int cpu_id, cpu_feature;
caa.cpu_signature = cpu_id;
caa.feature_flags = cpu_feature;
+#endif
config_found(mainbus, &caa, acpimadt_print);
}
@@ -208,8 +210,13 @@ acpimadt_attach(struct device *parent, struct device *self, void *aux)
return;
memset(map, 0, sizeof *map);
+ map->ioapic = apic;
+ map->ioapic_pin = pin - apic->sc_apic_vecbase;
map->bus_pin = entry->madt_override.source;
map->flags = entry->madt_override.flags;
+#ifdef __amd64__ /* XXX */
+ map->global_int = entry->madt_override.global_int;
+#endif
acpimadt_cfg_intr(entry->madt_override.flags, &map->redir);
map->ioapic_ih = APIC_INT_VIA_APIC |
@@ -238,7 +245,12 @@ acpimadt_attach(struct device *parent, struct device *self, void *aux)
return;
memset(map, 0, sizeof *map);
+ map->ioapic = apic;
+ map->ioapic_pin = pin;
map->bus_pin = pin;
+#ifdef __amd64__ /* XXX */
+ map->global_int = -1;
+#endif
map->redir = (IOAPIC_REDLO_DEL_LOPRI << IOAPIC_REDLO_DEL_SHIFT);
map->ioapic_ih = APIC_INT_VIA_APIC |
diff --git a/sys/dev/acpi/acpiprt.c b/sys/dev/acpi/acpiprt.c
index a2c6fdcf259..235cbda90cb 100644
--- a/sys/dev/acpi/acpiprt.c
+++ b/sys/dev/acpi/acpiprt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpiprt.c,v 1.1 2006/11/15 21:39:06 kettenis Exp $ */
+/* $OpenBSD: acpiprt.c,v 1.2 2006/11/25 16:59:31 niklas Exp $ */
/*
* Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org>
*
@@ -166,14 +166,17 @@ acpiprt_prt_add(struct acpiprt_softc *sc, struct aml_value *v)
#endif
memset(map, 0, sizeof *map);
+ map->ioapic = apic;
+ map->ioapic_pin = irq - apic->sc_apic_vecbase;
map->bus_pin = ((addr >> 14) & 0x7c) | (pin & 0x3);
map->redir = IOAPIC_REDLO_ACTLO | IOAPIC_REDLO_LEVEL;
map->redir |= (IOAPIC_REDLO_DEL_LOPRI << IOAPIC_REDLO_DEL_SHIFT);
map->ioapic_ih = APIC_INT_VIA_APIC |
- ((apic->sc_apicid << APIC_INT_APIC_SHIFT) | (irq << APIC_INT_PIN_SHIFT));
+ ((apic->sc_apicid << APIC_INT_APIC_SHIFT) |
+ (map->ioapic_pin << APIC_INT_PIN_SHIFT));
- apic->sc_pins[irq].ip_map = map;
+ apic->sc_pins[map->ioapic_pin].ip_map = map;
map->next = mp_busses[sc->sc_bus].mb_intrs;
mp_busses[sc->sc_bus].mb_intrs = map;