summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-01-13 13:53:51 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-01-13 13:53:51 +0000
commitc8bbebfc17c8bb1c3bcfaa89aaa1f8f3586e061b (patch)
tree4c47917947e9c106b7c40996bbcf0ed6f261cdd9
parent9c7e0fea63c2ab02df4f18e020bf1813e4896cb3 (diff)
Turn mpbios into a real device, such that people can disable it on crappy
BIOSes. ok deraadt@ (for the amd64 bit, or the i386 bit, can't remember which)
-rw-r--r--sys/arch/amd64/amd64/bios.c17
-rw-r--r--sys/arch/amd64/amd64/mainbus.c8
-rw-r--r--sys/arch/amd64/amd64/mpbios.c52
-rw-r--r--sys/arch/amd64/conf/GENERIC6
-rw-r--r--sys/arch/amd64/conf/RAMDISK4
-rw-r--r--sys/arch/amd64/conf/files.amd6415
-rw-r--r--sys/arch/i386/conf/GENERIC3
-rw-r--r--sys/arch/i386/conf/RAMDISK3
-rw-r--r--sys/arch/i386/conf/files.i3864
-rw-r--r--sys/arch/i386/i386/bios.c17
-rw-r--r--sys/arch/i386/i386/mainbus.c9
-rw-r--r--sys/arch/i386/i386/mpbios.c52
12 files changed, 128 insertions, 62 deletions
diff --git a/sys/arch/amd64/amd64/bios.c b/sys/arch/amd64/amd64/bios.c
index d204e377687..a913b1883ad 100644
--- a/sys/arch/amd64/amd64/bios.c
+++ b/sys/arch/amd64/amd64/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.15 2007/12/05 19:17:14 deraadt Exp $ */
+/* $OpenBSD: bios.c,v 1.16 2009/01/13 13:53:50 kettenis Exp $ */
/*
* Copyright (c) 2006 Gordon Willem Klok <gklok@cogeco.ca>
*
@@ -27,6 +27,7 @@
#include <machine/conf.h>
#include <machine/biosvar.h>
+#include <machine/mpbiosvar.h>
#include <machine/smbiosvar.h>
#include <dev/isa/isareg.h>
@@ -37,6 +38,7 @@
#include <dev/acpi/acpivar.h>
#include "acpi.h"
+#include "mpbios.h"
#include "pci.h"
struct bios_softc {
@@ -170,6 +172,19 @@ bios_attach(struct device *parent, struct device *self, void *aux)
config_found(self, &ba, bios_print);
}
#endif
+
+#if NMPBIOS > 0
+ if (mpbios_probe(self)) {
+ struct bios_attach_args ba;
+
+ memset(&ba, 0, sizeof(ba));
+ ba.ba_name = "mpbios";
+ ba.ba_iot = X86_BUS_SPACE_IO;
+ ba.ba_memt = X86_BUS_SPACE_MEM;
+
+ config_found(self, &ba, bios_print);
+ }
+#endif
}
/*
diff --git a/sys/arch/amd64/amd64/mainbus.c b/sys/arch/amd64/amd64/mainbus.c
index d8a8ccfe2ff..e5df82207ea 100644
--- a/sys/arch/amd64/amd64/mainbus.c
+++ b/sys/arch/amd64/amd64/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.15 2008/12/21 18:49:45 kettenis Exp $ */
+/* $OpenBSD: mainbus.c,v 1.16 2009/01/13 13:53:50 kettenis Exp $ */
/* $NetBSD: mainbus.c,v 1.1 2003/04/26 18:39:29 fvdl Exp $ */
/*
@@ -51,7 +51,6 @@
#include <machine/cpuvar.h>
#include <machine/i82093var.h>
-#include <machine/mpbiosvar.h>
#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
@@ -171,11 +170,6 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
}
#endif
-#if NMPBIOS > 0
- if (mpbios_probe(self))
- mpbios_scan(self);
-#endif
-
if ((cpu_info_primary.ci_flags & CPUF_PRESENT) == 0) {
struct cpu_attach_args caa;
diff --git a/sys/arch/amd64/amd64/mpbios.c b/sys/arch/amd64/amd64/mpbios.c
index 3d553429564..c75a3b9afa7 100644
--- a/sys/arch/amd64/amd64/mpbios.c
+++ b/sys/arch/amd64/amd64/mpbios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpbios.c,v 1.14 2008/12/22 18:01:47 kettenis Exp $ */
+/* $OpenBSD: mpbios.c,v 1.15 2009/01/13 13:53:50 kettenis Exp $ */
/* $NetBSD: mpbios.c,v 1.7 2003/05/15 16:32:50 fvdl Exp $ */
/*-
@@ -107,6 +107,7 @@
#include <machine/specialreg.h>
#include <machine/cpuvar.h>
#include <machine/bus.h>
+#include <machine/biosvar.h>
#include <machine/mpbiosvar.h>
#include <machine/i82093reg.h>
@@ -189,6 +190,34 @@ const struct mpbios_fps *mp_fps;
int mpbios_scanned;
+int mpbios_match(struct device *, void *, void *);
+void mpbios_attach(struct device *, struct device *, void *);
+
+struct cfattach mpbios_ca = {
+ sizeof(struct device), mpbios_match, mpbios_attach
+};
+
+struct cfdriver mpbios_cd = {
+ NULL, "mpbios", DV_DULL
+};
+
+int
+mpbios_match(struct device *parent, void *match, void *aux)
+{
+ struct cfdata *cf = match;
+ struct bios_attach_args *bia = aux;
+
+ if (strcmp(bia->ba_name, cf->cf_driver->cd_name) == 0)
+ return (1);
+ return (0);
+}
+
+void
+mpbios_attach(struct device *parent, struct device *self, void *aux)
+{
+ mpbios_scan(self);
+}
+
int
mp_print(void *aux, const char *pnp)
{
@@ -481,18 +510,7 @@ mpbios_scan(struct device *self)
struct mpbios_int ie;
struct ioapic_softc *sc;
- printf("%s: Intel MP Specification ", self->dv_xname);
-
- switch (mp_fps->spec_rev) {
- case 1:
- printf("(Version 1.1)\n");
- break;
- case 4:
- printf("(Version 1.4)\n");
- break;
- default:
- printf("(unrecognized rev %d)\n", mp_fps->spec_rev);
- }
+ printf(": Intel MP Specification 1.%d\n", mp_fps->spec_rev);
/*
* looks like we've got a MP system. start setting up
@@ -510,7 +528,7 @@ mpbios_scan(struct device *self)
if (mp_fps->mpfb1 != 0) {
struct mpbios_proc pe;
- printf("\n%s: MP default configuration %d\n",
+ printf("%s: MP default configuration %d\n",
self->dv_xname, mp_fps->mpfb1);
/* use default addresses */
@@ -663,6 +681,7 @@ void
mpbios_cpu(const u_int8_t *ent, struct device *self)
{
const struct mpbios_proc *entry = (const struct mpbios_proc *)ent;
+ struct device *mainbus = self->dv_parent->dv_parent;
struct cpu_attach_args caa;
/* XXX move this into the CPU attachment goo. */
@@ -682,7 +701,7 @@ mpbios_cpu(const u_int8_t *ent, struct device *self)
caa.cpu_func = &mp_cpu_funcs;
#endif
- config_found_sm(self, &caa, mp_print, mp_match);
+ config_found_sm(mainbus, &caa, mp_print, mp_match);
}
/*
@@ -953,6 +972,7 @@ void
mpbios_ioapic(const u_int8_t *ent, struct device *self)
{
const struct mpbios_ioapic *entry = (const struct mpbios_ioapic *)ent;
+ struct device *mainbus = self->dv_parent->dv_parent;
struct apic_attach_args aaa;
/* XXX let flags checking happen in ioapic driver.. */
@@ -966,7 +986,7 @@ mpbios_ioapic(const u_int8_t *ent, struct device *self)
aaa.apic_vecbase = -1;
aaa.flags = (mp_fps->mpfb2 & 0x80) ? IOAPIC_PICMODE : IOAPIC_VWIRE;
- config_found_sm(self, &aaa, mp_print, mp_match);
+ config_found_sm(mainbus, &aaa, mp_print, mp_match);
}
int
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC
index 6c969c16062..ecd5d5c1936 100644
--- a/sys/arch/amd64/conf/GENERIC
+++ b/sys/arch/amd64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.253 2009/01/06 23:03:16 jasper Exp $
+# $OpenBSD: GENERIC,v 1.254 2009/01/13 13:53:50 kettenis Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -38,7 +38,7 @@ isa0 at pcib?
isa0 at amdpcib?
pci* at mainbus0
-acpi0 at bios?
+acpi0 at bios0
acpitimer* at acpi?
acpihpet* at acpi?
acpiac* at acpi?
@@ -52,6 +52,8 @@ acpitz* at acpi?
acpimadt0 at acpi?
acpithinkpad* at acpi?
+mpbios0 at bios0
+
ipmi0 at mainbus? disable # IPMI
option PCIVERBOSE
diff --git a/sys/arch/amd64/conf/RAMDISK b/sys/arch/amd64/conf/RAMDISK
index d21211e9254..e2dedbd730a 100644
--- a/sys/arch/amd64/conf/RAMDISK
+++ b/sys/arch/amd64/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.48 2008/12/22 16:35:28 deraadt Exp $
+# $OpenBSD: RAMDISK,v 1.49 2009/01/13 13:53:50 kettenis Exp $
machine amd64 # architecture, used by config; REQUIRED
@@ -45,6 +45,8 @@ acpiprt* at acpi?
acpimadt0 at acpi?
#acpitz* at acpi?
+mpbios0 at bios0
+
cpu0 at mainbus0
ioapic* at mainbus?
isa0 at mainbus0
diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64
index d8345e69cc9..fd5516a0bd3 100644
--- a/sys/arch/amd64/conf/files.amd64
+++ b/sys/arch/amd64/conf/files.amd64
@@ -1,4 +1,4 @@
-# $OpenBSD: files.amd64,v 1.42 2008/12/21 18:49:46 kettenis Exp $
+# $OpenBSD: files.amd64,v 1.43 2009/01/13 13:53:50 kettenis Exp $
maxpartitions 16
maxusers 2 16 128
@@ -36,12 +36,6 @@ file arch/amd64/amd64/mp_setperf.c multiprocessor
file arch/amd64/amd64/apic.c ioapic | lapic
-#Intel SMP specification 1.4
-define mpbios
-file arch/amd64/amd64/mpbios.c mpbios needs-flag
-file arch/amd64/amd64/mpbios_intr_fixup.c mpbios & pci
-
-
file arch/amd64/amd64/consinit.c
file dev/cninit.c
@@ -82,6 +76,13 @@ device bios {}
attach bios at mainbus
file arch/amd64/amd64/bios.c bios needs-flag
+#Intel SMP specification 1.4
+define mpbios
+device mpbios
+attach mpbios at bios
+file arch/amd64/amd64/mpbios.c mpbios needs-flag
+file arch/amd64/amd64/mpbios_intr_fixup.c mpbios & pci
+
define cpu {[apid = -1]}
device cpu
attach cpu at mainbus
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index 62aca4ed821..c5d9ff0663c 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.647 2009/01/06 23:03:16 jasper Exp $
+# $OpenBSD: GENERIC,v 1.648 2009/01/13 13:53:50 kettenis Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -43,6 +43,7 @@ bios0 at mainbus0
ioapic* at mainbus?
apm0 at bios0 flags 0x0000 # flags 0x0101 to force protocol version 1.1
acpi0 at bios?
+mpbios0 at bios0
pcibios0 at bios0 flags 0x0000 # use 0x30 for a total verbose
ipmi0 at mainbus? disable # IPMI
#vmt0 at mainbus? # VMware Tools
diff --git a/sys/arch/i386/conf/RAMDISK b/sys/arch/i386/conf/RAMDISK
index 158d90afc46..78ed4b5beec 100644
--- a/sys/arch/i386/conf/RAMDISK
+++ b/sys/arch/i386/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.166 2009/01/06 23:03:16 jasper Exp $
+# $OpenBSD: RAMDISK,v 1.167 2009/01/13 13:53:50 kettenis Exp $
machine i386 # architecture, used by config; REQUIRED
@@ -50,6 +50,7 @@ bios0 at mainbus0
ioapic* at mainbus?
apm0 at bios0 flags 0x0000 # flags 0x0101 to force protocol version 1.1
#option APMDEBUG
+mpbios0 at bios0
pcibios0 at bios0 flags 0x0000
isa0 at mainbus0
diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386
index fd11d1b184b..89568b35eee 100644
--- a/sys/arch/i386/conf/files.i386
+++ b/sys/arch/i386/conf/files.i386
@@ -1,4 +1,4 @@
-# $OpenBSD: files.i386,v 1.186 2008/12/04 15:24:18 oga Exp $
+# $OpenBSD: files.i386,v 1.187 2009/01/13 13:53:50 kettenis Exp $
#
# new style config file for i386 architecture
#
@@ -304,6 +304,8 @@ file arch/i386/i386/acpiapm.c
# Intel SMP specification 1.4
define mpbios
+device mpbios
+attach mpbios at bios
file arch/i386/i386/mpbios.c mpbios needs-flag
file arch/i386/i386/mpbios_intr_fixup.c mpbios & pci
diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c
index 9023a0a4d29..1012c54a47f 100644
--- a/sys/arch/i386/i386/bios.c
+++ b/sys/arch/i386/i386/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.83 2008/10/28 00:05:32 deraadt Exp $ */
+/* $OpenBSD: bios.c,v 1.84 2009/01/13 13:53:50 kettenis Exp $ */
/*
* Copyright (c) 1997-2001 Michael Shalayeff
@@ -52,6 +52,7 @@
#include <machine/pcb.h>
#include <machine/biosvar.h>
#include <machine/apmvar.h>
+#include <machine/mpbiosvar.h>
#include <machine/smbiosvar.h>
#include <dev/isa/isareg.h>
@@ -64,6 +65,7 @@
#include "apm.h"
#include "acpi.h"
+#include "mpbios.h"
#include "pcibios.h"
#include "pci.h"
@@ -361,6 +363,19 @@ biosattach(struct device *parent, struct device *self, void *aux)
}
#endif
+#if NMPBIOS > 0
+ if (mpbios_probe(self)) {
+ struct bios_attach_args ba;
+
+ memset(&ba, 0, sizeof(ba));
+ ba.ba_name = "mpbios";
+ ba.ba_iot = I386_BUS_SPACE_IO;
+ ba.ba_memt = I386_BUS_SPACE_MEM;
+
+ config_found(self, &ba, bios_print);
+ }
+#endif
+
#if NPCI > 0 && NPCIBIOS > 0
if (!(flags & BIOSF_PCIBIOS)) {
struct bios_attach_args ba;
diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c
index a84966c5fc3..7e6eb30b9c4 100644
--- a/sys/arch/i386/i386/mainbus.c
+++ b/sys/arch/i386/i386/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.42 2008/07/08 05:22:00 dlg Exp $ */
+/* $OpenBSD: mainbus.c,v 1.43 2009/01/13 13:53:50 kettenis Exp $ */
/* $NetBSD: mainbus.c,v 1.21 1997/06/06 23:14:20 thorpej Exp $ */
/*
@@ -49,7 +49,6 @@
#include "isa.h"
#include "apm.h"
#include "bios.h"
-#include "mpbios.h"
#include "acpi.h"
#include "ipmi.h"
#include "esm.h"
@@ -59,7 +58,6 @@
#include <machine/cpuvar.h>
#include <machine/i82093var.h>
-#include <machine/mpbiosvar.h>
#if NBIOS > 0
#include <machine/biosvar.h>
@@ -172,11 +170,6 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
}
#endif
-#if NMPBIOS > 0
- if (mpbios_probe(self))
- mpbios_scan(self);
-#endif
-
if ((cpu_info_primary.ci_flags & CPUF_PRESENT) == 0) {
struct cpu_attach_args caa;
diff --git a/sys/arch/i386/i386/mpbios.c b/sys/arch/i386/i386/mpbios.c
index b328e9c9863..1ce97f2356f 100644
--- a/sys/arch/i386/i386/mpbios.c
+++ b/sys/arch/i386/i386/mpbios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpbios.c,v 1.29 2008/12/29 08:29:35 form Exp $ */
+/* $OpenBSD: mpbios.c,v 1.30 2009/01/13 13:53:50 kettenis Exp $ */
/* $NetBSD: mpbios.c,v 1.2 2002/10/01 12:56:57 fvdl Exp $ */
/*-
@@ -108,6 +108,7 @@
#include <machine/cputypes.h>
#include <machine/cpuvar.h>
#include <machine/bus.h>
+#include <machine/biosvar.h>
#include <machine/mpbiosreg.h>
#include <machine/mpbiosvar.h>
@@ -197,6 +198,34 @@ int mp_verbose = 1;
int mp_verbose = 0;
#endif
+int mpbios_match(struct device *, void *, void *);
+void mpbios_attach(struct device *, struct device *, void *);
+
+struct cfattach mpbios_ca = {
+ sizeof(struct device), mpbios_match, mpbios_attach
+};
+
+struct cfdriver mpbios_cd = {
+ NULL, "mpbios", DV_DULL
+};
+
+int
+mpbios_match(struct device *parent, void *match, void *aux)
+{
+ struct cfdata *cf = match;
+ struct bios_attach_args *bia = aux;
+
+ if (strcmp(bia->ba_name, cf->cf_driver->cd_name) == 0)
+ return (1);
+ return (0);
+}
+
+void
+mpbios_attach(struct device *parent, struct device *self, void *aux)
+{
+ mpbios_scan(self);
+}
+
int
mp_print(void *aux, const char *pnp)
{
@@ -504,18 +533,7 @@ mpbios_scan(struct device *self)
int intr_cnt;
paddr_t lapic_base;
- printf("%s: Intel MP Specification ", self->dv_xname);
-
- switch (mp_fps->spec_rev) {
- case 1:
- printf("(Version 1.1)\n");
- break;
- case 4:
- printf("(Version 1.4)\n");
- break;
- default:
- printf("(unrecognized rev %d)\n", mp_fps->spec_rev);
- }
+ printf(": Intel MP Specification 1.%d\n", mp_fps->spec_rev);
/*
* looks like we've got a MP system. start setting up
@@ -533,7 +551,7 @@ mpbios_scan(struct device *self)
if (mp_fps->mpfb1 != 0) {
struct mpbios_proc pe;
- printf("\n%s: MP default configuration %d\n",
+ printf("%s: MP default configuration %d\n",
self->dv_xname, mp_fps->mpfb1);
/* use default addresses */
@@ -715,6 +733,7 @@ void
mpbios_cpu(const u_int8_t *ent, struct device *self)
{
const struct mpbios_proc *entry = (const struct mpbios_proc *)ent;
+ struct device *mainbus = self->dv_parent->dv_parent;
struct cpu_attach_args caa;
/* XXX move this into the CPU attachment goo. */
@@ -753,7 +772,7 @@ mpbios_cpu(const u_int8_t *ent, struct device *self)
}
#endif
- config_found_sm(self, &caa, mp_print, mp_match);
+ config_found_sm(mainbus, &caa, mp_print, mp_match);
}
/*
@@ -1018,6 +1037,7 @@ void
mpbios_ioapic(const u_int8_t *ent, struct device *self)
{
const struct mpbios_ioapic *entry = (const struct mpbios_ioapic *)ent;
+ struct device *mainbus = self->dv_parent->dv_parent;
struct apic_attach_args aaa;
/* XXX let flags checking happen in ioapic driver.. */
@@ -1031,7 +1051,7 @@ mpbios_ioapic(const u_int8_t *ent, struct device *self)
aaa.apic_vecbase = -1;
aaa.flags = (mp_fps->mpfb2 & 0x80) ? IOAPIC_PICMODE : IOAPIC_VWIRE;
- config_found_sm(self, &aaa, mp_print, mp_match);
+ config_found_sm(mainbus, &aaa, mp_print, mp_match);
}
int