summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-12-05 19:17:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-12-05 19:17:15 +0000
commit889140cc7443199609393b489e13d395e9e062a1 (patch)
tree9e57175bdada4e31c27b49ac718d0d24dd92e2d2 /sys
parent52e7566f48bd54f2a0a319139b4ca8625857a49c (diff)
Hang acpi(4) below bios(4) instead of mainbus(4). This lets us move acpi(4)
before pcibios(4), and then.... if acpi(4) attaches, skip pcibios(4) since it messes the machines up. Fixes claudio's HP dl320 G5, and almost assuredly others. ok kettenis
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c7
-rw-r--r--sys/arch/amd64/amd64/bios.c39
-rw-r--r--sys/arch/amd64/amd64/mainbus.c27
-rw-r--r--sys/arch/amd64/conf/GENERIC4
-rw-r--r--sys/arch/amd64/conf/RAMDISK5
-rw-r--r--sys/arch/amd64/conf/RAMDISK_CD5
-rw-r--r--sys/arch/amd64/include/biosvar.h18
-rw-r--r--sys/arch/i386/conf/GENERIC27
-rw-r--r--sys/arch/i386/conf/RAMDISK4
-rw-r--r--sys/arch/i386/conf/RAMDISKB4
-rw-r--r--sys/arch/i386/conf/RAMDISKC4
-rw-r--r--sys/arch/i386/conf/RAMDISK_CD4
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c7
-rw-r--r--sys/arch/i386/i386/apm.c24
-rw-r--r--sys/arch/i386/i386/bios.c49
-rw-r--r--sys/arch/i386/i386/mainbus.c28
-rw-r--r--sys/arch/i386/include/biosvar.h18
-rw-r--r--sys/arch/i386/pci/pcibios.c4
-rw-r--r--sys/dev/acpi/acpi.c16
-rw-r--r--sys/dev/acpi/acpimadt.c4
-rw-r--r--sys/dev/acpi/acpivar.h6
-rw-r--r--sys/dev/acpi/files.acpi4
22 files changed, 168 insertions, 140 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index ab7d11fa168..e5eb67b06b1 100644
--- a/sys/arch/amd64/amd64/acpi_machdep.c
+++ b/sys/arch/amd64/amd64/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.10 2007/11/25 09:11:12 jsg Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.11 2007/12/05 19:17:13 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -100,7 +100,7 @@ acpi_scan(struct acpi_mem_map *handle, paddr_t pa, size_t len)
}
int
-acpi_probe(struct device *parent, struct cfdata *match, struct acpi_attach_args *aaa)
+acpi_probe(struct device *parent, struct cfdata *match, struct bios_attach_args *ba)
{
struct acpi_mem_map handle;
u_int8_t *ptr;
@@ -143,7 +143,7 @@ acpi_probe(struct device *parent, struct cfdata *match, struct acpi_attach_args
return (0);
havebase:
- aaa->aaa_pbase = ptr - handle.va + handle.pa;
+ ba->ba_acpipbase = ptr - handle.va + handle.pa;
acpi_unmap(&handle);
return (1);
@@ -153,6 +153,7 @@ void
acpi_attach_machdep(struct acpi_softc *sc)
{
extern void (*cpuresetfn)(void);
+
sc->sc_interrupt = isa_intr_establish(NULL, sc->sc_fadt->sci_int,
IST_LEVEL, IPL_TTY, acpi_interrupt, sc, sc->sc_dev.dv_xname);
cpuresetfn = acpi_reset;
diff --git a/sys/arch/amd64/amd64/bios.c b/sys/arch/amd64/amd64/bios.c
index 3a8684c4a67..d204e377687 100644
--- a/sys/arch/amd64/amd64/bios.c
+++ b/sys/arch/amd64/amd64/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.14 2007/11/25 16:40:04 jmc Exp $ */
+/* $OpenBSD: bios.c,v 1.15 2007/12/05 19:17:14 deraadt Exp $ */
/*
* Copyright (c) 2006 Gordon Willem Klok <gklok@cogeco.ca>
*
@@ -31,6 +31,13 @@
#include <dev/isa/isareg.h>
#include <amd64/include/isa_machdep.h>
+#include <dev/pci/pcivar.h>
+
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+
+#include "acpi.h"
+#include "pci.h"
struct bios_softc {
struct device sc_dev;
@@ -39,6 +46,7 @@ struct bios_softc {
void smbios_info(char *);
int bios_match(struct device *, void *, void *);
void bios_attach(struct device *, struct device *, void *);
+int bios_print(void *, const char *);
char *fixstring(char *);
struct cfattach bios_ca = {
@@ -68,7 +76,7 @@ bios_match(struct device *parent, void *match , void *aux)
struct bios_attach_args *bia = aux;
/* only one */
- if (bios_cd.cd_ndevs || strcmp(bia->bios_dev, bios_cd.cd_name))
+ if (bios_cd.cd_ndevs || strcmp(bia->ba_name, bios_cd.cd_name))
return 0;
return 1;
}
@@ -146,6 +154,22 @@ bios_attach(struct device *parent, struct device *self, void *aux)
break;
}
printf("\n");
+
+#if NACPI > 0
+#if NPCI > 0
+ if (pci_mode != 0)
+#endif
+ {
+ struct bios_attach_args ba;
+
+ memset(&ba, 0, sizeof(ba));
+ ba.ba_name = "acpi";
+ ba.ba_iot = X86_BUS_SPACE_IO;
+ ba.ba_memt = X86_BUS_SPACE_MEM;
+
+ config_found(self, &ba, bios_print);
+ }
+#endif
}
/*
@@ -383,3 +407,14 @@ smbios_info(char * str)
}
}
}
+
+int
+bios_print(void *aux, const char *pnp)
+{
+ struct bios_attach_args *ba = aux;
+
+ if (pnp)
+ printf("%s at %s",
+ ba->ba_name, pnp);
+ return (UNCONF);
+}
diff --git a/sys/arch/amd64/amd64/mainbus.c b/sys/arch/amd64/amd64/mainbus.c
index 3b5bc9743b8..a9627064289 100644
--- a/sys/arch/amd64/amd64/mainbus.c
+++ b/sys/arch/amd64/amd64/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.13 2007/11/16 16:16:07 deraadt Exp $ */
+/* $OpenBSD: mainbus.c,v 1.14 2007/12/05 19:17:14 deraadt Exp $ */
/* $NetBSD: mainbus.c,v 1.1 2003/04/26 18:39:29 fvdl Exp $ */
/*
@@ -52,10 +52,8 @@
#include <machine/i82093var.h>
#include <machine/mpbiosvar.h>
-#if NACPI > 0
#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
-#endif
#if NIPMI > 0
#include <dev/ipmivar.h>
@@ -84,9 +82,6 @@ union mainbus_attach_args {
struct isabus_attach_args mba_iba;
struct cpu_attach_args mba_caa;
struct apic_attach_args aaa_caa;
-#if NACPI > 0
- struct acpi_attach_args mba_aaa;
-#endif
#if NIPMI > 0
struct ipmi_attach_args mba_iaa;
#endif
@@ -160,27 +155,13 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
#if NBIOS > 0
{
- mba.mba_bios.bios_dev = "bios";
- mba.mba_bios.bios_iot = X86_BUS_SPACE_IO;
- mba.mba_bios.bios_memt = X86_BUS_SPACE_MEM;
+ mba.mba_bios.ba_name = "bios";
+ mba.mba_bios.ba_iot = X86_BUS_SPACE_IO;
+ mba.mba_bios.ba_memt = X86_BUS_SPACE_MEM;
config_found(self, &mba.mba_bios, mainbus_print);
}
#endif
-#if NACPI > 0
-#if NPCI > 0
- if (pci_mode != 0)
-#endif
- {
- memset(&mba.mba_aaa, 0, sizeof(mba.mba_aaa));
- mba.mba_aaa.aaa_name = "acpi";
- mba.mba_aaa.aaa_iot = X86_BUS_SPACE_IO;
- mba.mba_aaa.aaa_memt = X86_BUS_SPACE_MEM;
-
- config_found(self, &mba.mba_aaa, mainbus_print);
- }
-#endif
-
#if NIPMI > 0
{
memset(&mba.mba_iaa, 0, sizeof(mba.mba_iaa));
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC
index ae3264f79a0..ffe077d5b60 100644
--- a/sys/arch/amd64/conf/GENERIC
+++ b/sys/arch/amd64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.206 2007/11/25 17:11:12 oga Exp $
+# $OpenBSD: GENERIC,v 1.207 2007/12/05 19:17:14 deraadt Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -40,7 +40,7 @@ pci* at mainbus0
#option ACPIVERBOSE
-acpi0 at mainbus?
+acpi0 at bios?
acpitimer* at acpi?
acpihpet* at acpi?
acpiac* at acpi?
diff --git a/sys/arch/amd64/conf/RAMDISK b/sys/arch/amd64/conf/RAMDISK
index 3bb08fc5231..1f5285754fe 100644
--- a/sys/arch/amd64/conf/RAMDISK
+++ b/sys/arch/amd64/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.42 2007/11/15 22:21:31 deraadt Exp $
+# $OpenBSD: RAMDISK,v 1.43 2007/12/05 19:17:14 deraadt Exp $
machine amd64 # architecture, used by config; REQUIRED
@@ -32,8 +32,9 @@ option MINIROOTSIZE=4480
config bsd root on rd0a swap on rd0b and wd0b and sd0b
mainbus0 at root
+bios0 at mainbus?
-acpi0 at mainbus?
+acpi0 at bios?
#acpitimer* at acpi?
#acpihpet* at acpi?
#acpiac* at acpi?
diff --git a/sys/arch/amd64/conf/RAMDISK_CD b/sys/arch/amd64/conf/RAMDISK_CD
index 09e4d38e5d4..68c27e0c93e 100644
--- a/sys/arch/amd64/conf/RAMDISK_CD
+++ b/sys/arch/amd64/conf/RAMDISK_CD
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK_CD,v 1.78 2007/11/15 22:21:31 deraadt Exp $
+# $OpenBSD: RAMDISK_CD,v 1.79 2007/12/05 19:17:14 deraadt Exp $
machine amd64 # architecture, used by config; REQUIRED
@@ -33,8 +33,9 @@ option MINIROOTSIZE=4480
config bsd root on rd0a swap on rd0b and wd0b and sd0b
mainbus0 at root
+bios0 at mainbus?
-acpi0 at mainbus?
+acpi0 at bios?
#acpitimer* at acpi?
#acpihpet* at acpi?
#acpiac* at acpi?
diff --git a/sys/arch/amd64/include/biosvar.h b/sys/arch/amd64/include/biosvar.h
index c881b648ad7..92e505a2532 100644
--- a/sys/arch/amd64/include/biosvar.h
+++ b/sys/arch/amd64/include/biosvar.h
@@ -1,5 +1,5 @@
/* XXX - DSR */
-/* $OpenBSD: biosvar.h,v 1.7 2006/05/20 22:36:33 deraadt Exp $ */
+/* $OpenBSD: biosvar.h,v 1.8 2007/12/05 19:17:14 deraadt Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -226,17 +226,19 @@ extern volatile struct BIOS_regs {
#include <machine/bus.h>
struct bios_attach_args {
- char *bios_dev;
- u_int bios_func;
- bus_space_tag_t bios_iot;
- bus_space_tag_t bios_memt;
+ char *ba_name;
+ u_int ba_biosfunc;
+ bus_space_tag_t ba_iot;
+ bus_space_tag_t ba_memt;
union {
- void *_p;
- bios_apminfo_t *_bios_apmp;
+ void *_p;
+ bios_apminfo_t *_ba_apmp;
+ paddr_t _ba_acpipbase;
} _;
};
-#define bios_apmp _._bios_apmp
+#define ba_apmp _._ba_apmp
+#define ba_acpipbase _._ba_acpipbase
struct consdev;
struct proc;
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index fcf872d6569..ac05736d1f1 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.594 2007/12/04 23:39:51 deraadt Exp $
+# $OpenBSD: GENERIC,v 1.595 2007/12/05 19:17:13 deraadt Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -41,23 +41,12 @@ mainbus0 at root
cpu0 at mainbus?
bios0 at mainbus0
apm0 at bios0 flags 0x0000 # flags 0x0101 to force protocol version 1.1
+acpi0 at bios?
+#option ACPIVERBOSE
pcibios0 at bios0 flags 0x0000 # use 0x30 for a total verbose
ipmi0 at mainbus? disable # IPMI
esm0 at mainbus? # Dell Embedded Server Management
-isa0 at mainbus0
-isa0 at pcib?
-isa0 at amdpcib?
-isa0 at ichpcib?
-isa0 at piixpcib?
-isa0 at gscpcib?
-isa0 at glxpcib?
-eisa0 at mainbus0
-pci* at mainbus0
-
-#option ACPIVERBOSE
-
-acpi0 at mainbus?
acpitimer* at acpi?
acpihpet* at acpi?
acpiac* at acpi?
@@ -73,6 +62,16 @@ option PCIVERBOSE
option EISAVERBOSE
option USBVERBOSE
+isa0 at mainbus0
+isa0 at pcib?
+isa0 at amdpcib?
+isa0 at ichpcib?
+isa0 at piixpcib?
+isa0 at gscpcib?
+isa0 at glxpcib?
+eisa0 at mainbus0
+pci* at mainbus0
+
pchb* at pci? # PCI-Host bridges
ppb* at pci? # PCI-PCI bridges
pci* at ppb?
diff --git a/sys/arch/i386/conf/RAMDISK b/sys/arch/i386/conf/RAMDISK
index a14c3f2c7d5..fbeee7eb01e 100644
--- a/sys/arch/i386/conf/RAMDISK
+++ b/sys/arch/i386/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.157 2007/11/28 17:05:09 tedu Exp $
+# $OpenBSD: RAMDISK,v 1.158 2007/12/05 19:17:13 deraadt Exp $
machine i386 # architecture, used by config; REQUIRED
@@ -34,7 +34,7 @@ config bsd root on rd0a swap on rd0b and wd0b and sd0b
mainbus0 at root
-acpi0 at mainbus?
+acpi0 at bios?
#acpitimer* at acpi?
#acpihpet* at acpi?
#acpiac* at acpi?
diff --git a/sys/arch/i386/conf/RAMDISKB b/sys/arch/i386/conf/RAMDISKB
index 271c10e115c..b4b53f1ffdb 100644
--- a/sys/arch/i386/conf/RAMDISKB
+++ b/sys/arch/i386/conf/RAMDISKB
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISKB,v 1.101 2007/11/28 17:05:09 tedu Exp $
+# $OpenBSD: RAMDISKB,v 1.102 2007/12/05 19:17:13 deraadt Exp $
machine i386 # architecture, used by config; REQUIRED
@@ -34,7 +34,7 @@ config bsd root on rd0a swap on rd0b and wd0b and sd0b
mainbus0 at root
-acpi0 at mainbus?
+acpi0 at bios?
#acpitimer* at acpi?
#acpihpet* at acpi?
#acpiac* at acpi?
diff --git a/sys/arch/i386/conf/RAMDISKC b/sys/arch/i386/conf/RAMDISKC
index 78f11387b3e..241e6ae92ea 100644
--- a/sys/arch/i386/conf/RAMDISKC
+++ b/sys/arch/i386/conf/RAMDISKC
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISKC,v 1.82 2007/11/28 17:05:09 tedu Exp $
+# $OpenBSD: RAMDISKC,v 1.83 2007/12/05 19:17:13 deraadt Exp $
machine i386 # architecture, used by config; REQUIRED
@@ -34,7 +34,7 @@ config bsd root on rd0a swap on rd0b and wd0b and sd0b
mainbus0 at root
-acpi0 at mainbus?
+acpi0 at bios?
#acpitimer* at acpi?
#acpihpet* at acpi?
#acpiac* at acpi?
diff --git a/sys/arch/i386/conf/RAMDISK_CD b/sys/arch/i386/conf/RAMDISK_CD
index 2a1508f152e..70d746b06bc 100644
--- a/sys/arch/i386/conf/RAMDISK_CD
+++ b/sys/arch/i386/conf/RAMDISK_CD
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK_CD,v 1.146 2007/11/28 17:05:09 tedu Exp $
+# $OpenBSD: RAMDISK_CD,v 1.147 2007/12/05 19:17:13 deraadt Exp $
machine i386 # architecture, used by config; REQUIRED
@@ -36,7 +36,7 @@ config bsd root on rd0a swap on rd0b and wd0b and sd0b
mainbus0 at root
-acpi0 at mainbus?
+acpi0 at bios?
#acpitimer* at acpi?
#acpihpet* at acpi?
#acpiac* at acpi?
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index 74c0b9e5dd6..c25d68b68fd 100644
--- a/sys/arch/i386/i386/acpi_machdep.c
+++ b/sys/arch/i386/i386/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.10 2007/11/25 15:42:15 tedu Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.11 2007/12/05 19:17:13 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -110,7 +110,7 @@ acpi_scan(struct acpi_mem_map *handle, paddr_t pa, size_t len)
}
int
-acpi_probe(struct device *parent, struct cfdata *match, struct acpi_attach_args *aaa)
+acpi_probe(struct device *parent, struct cfdata *match, struct bios_attach_args *ba)
{
struct acpi_mem_map handle;
u_int8_t *ptr;
@@ -163,7 +163,7 @@ acpi_probe(struct device *parent, struct cfdata *match, struct acpi_attach_args
return (0);
havebase:
- aaa->aaa_pbase = ptr - handle.va + handle.pa;
+ ba->ba_acpipbase = ptr - handle.va + handle.pa;
acpi_unmap(&handle);
return (1);
@@ -173,6 +173,7 @@ void
acpi_attach_machdep(struct acpi_softc *sc)
{
extern void (*cpuresetfn)(void);
+
sc->sc_interrupt = isa_intr_establish(NULL, sc->sc_fadt->sci_int,
IST_LEVEL, IPL_TTY, acpi_interrupt, sc, sc->sc_dev.dv_xname);
acpiapm_open = acpiopen;
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c
index 77cd81bc530..2664f915ee8 100644
--- a/sys/arch/i386/i386/apm.c
+++ b/sys/arch/i386/i386/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.79 2007/11/25 15:42:15 tedu Exp $ */
+/* $OpenBSD: apm.c,v 1.80 2007/12/05 19:17:13 deraadt Exp $ */
/*-
* Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved.
@@ -750,11 +750,11 @@ int
apmprobe(struct device *parent, void *match, void *aux)
{
struct bios_attach_args *ba = aux;
- bios_apminfo_t *ap = ba->bios_apmp;
+ bios_apminfo_t *ap = ba->ba_apmp;
bus_space_handle_t ch, dh;
- if (apm_cd.cd_ndevs || strcmp(ba->bios_dev, "apm") ||
- !(ba->bios_apmp->apm_detail & APM_32BIT_SUPPORTED)) {
+ if (apm_cd.cd_ndevs || strcmp(ba->ba_name, "apm") ||
+ !(ba->ba_apmp->apm_detail & APM_32BIT_SUPPORTED)) {
DPRINTF(("%s: %x\n", ba->bios_dev, ba->bios_apmp->apm_detail));
return 0;
}
@@ -772,19 +772,19 @@ apmprobe(struct device *parent, void *match, void *aux)
ap->apm_data_base + ap->apm_data_len > IOM_BEGIN))
return 0;
- if (bus_space_map(ba->bios_memt, ap->apm_code32_base,
+ if (bus_space_map(ba->ba_memt, ap->apm_code32_base,
ap->apm_code_len, 1, &ch) != 0) {
DPRINTF(("apm0: can't map code\n"));
return 0;
}
- bus_space_unmap(ba->bios_memt, ch, ap->apm_code_len);
+ bus_space_unmap(ba->ba_memt, ch, ap->apm_code_len);
- if (bus_space_map(ba->bios_memt, ap->apm_data_base,
+ if (bus_space_map(ba->ba_memt, ap->apm_data_base,
ap->apm_data_len, 1, &dh) != 0) {
DPRINTF(("apm0: can't map data\n"));
return 0;
}
- bus_space_unmap(ba->bios_memt, dh, ap->apm_data_len);
+ bus_space_unmap(ba->ba_memt, dh, ap->apm_data_len);
return 1;
}
@@ -792,7 +792,7 @@ void
apmattach(struct device *parent, struct device *self, void *aux)
{
struct bios_attach_args *ba = aux;
- bios_apminfo_t *ap = ba->bios_apmp;
+ bios_apminfo_t *ap = ba->ba_apmp;
struct apm_softc *sc = (void *)self;
struct apmregs regs;
u_int cbase, clen, l;
@@ -836,7 +836,7 @@ apmattach(struct device *parent, struct device *self, void *aux)
l = max(ap->apm_data_base + ap->apm_data_len + 1,
cbase + clen + 1) -
min(ap->apm_data_base, cbase);
- bus_space_map(ba->bios_memt,
+ bus_space_map(ba->ba_memt,
min(ap->apm_data_base, cbase),
l, 1, &dh);
ch16 = dh;
@@ -846,8 +846,8 @@ apmattach(struct device *parent, struct device *self, void *aux)
dh += ap->apm_data_base - cbase;
} else {
- bus_space_map(ba->bios_memt, cbase, clen + 1, 1, &ch16);
- bus_space_map(ba->bios_memt, ap->apm_data_base,
+ bus_space_map(ba->ba_memt, cbase, clen + 1, 1, &ch16);
+ bus_space_map(ba->ba_memt, ap->apm_data_base,
ap->apm_data_len + 1, 1, &dh);
}
ch32 = ch16;
diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c
index c19880ab3a9..74fc30f9ed2 100644
--- a/sys/arch/i386/i386/bios.c
+++ b/sys/arch/i386/i386/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.74 2007/12/01 19:08:42 miod Exp $ */
+/* $OpenBSD: bios.c,v 1.75 2007/12/05 19:17:13 deraadt Exp $ */
/*
* Copyright (c) 1997-2001 Michael Shalayeff
@@ -57,7 +57,13 @@
#include <dev/isa/isareg.h>
#include <i386/isa/isa_machdep.h>
+#include <dev/pci/pcivar.h>
+
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+
#include "apm.h"
+#include "acpi.h"
#include "pcibios.h"
#include "pci.h"
@@ -125,7 +131,7 @@ biosprobe(struct device *parent, void *match, void *aux)
bootapiver, BOOTARG_APIVER, bootargp, bootargc);
#endif
/* there could be only one */
- if (bios_cd.cd_ndevs || strcmp(bia->bios_dev, bios_cd.cd_name))
+ if (bios_cd.cd_ndevs || strcmp(bia->ba_name, bios_cd.cd_name))
return 0;
if (!(bootapiver & BAPIV_VECTOR) || bootargp == NULL)
@@ -318,6 +324,7 @@ biosattach(struct device *parent, struct device *self, void *aux)
#if NAPM > 0
if (apm && ncpu < 2) {
struct bios_attach_args ba;
+
#if defined(DEBUG) || defined(APMDEBUG)
printf("apminfo: %x, code %x[%x]/%x[%x], data %x[%x], ept %x\n",
apm->apm_detail,
@@ -325,22 +332,40 @@ biosattach(struct device *parent, struct device *self, void *aux)
apm->apm_code16_base, apm->apm_code16_len,
apm->apm_data_base, apm->apm_data_len, apm->apm_entry);
#endif
- ba.bios_dev = "apm";
- ba.bios_func = 0x15;
- ba.bios_memt = bia->bios_memt;
- ba.bios_iot = bia->bios_iot;
- ba.bios_apmp = apm;
+ ba.ba_name = "apm";
+ ba.ba_func = 0x15;
+ ba.ba_memt = bia->ba_memt;
+ ba.ba_iot = bia->ba_iot;
+ ba.ba_apmp = apm;
config_found(self, &ba, bios_print);
}
#endif
+
+#if NACPI > 0
+#if NPCI > 0
+ if (pci_mode_detect() != 0)
+#endif
+ {
+ struct bios_attach_args ba;
+
+ memset(&ba, 0, sizeof(ba));
+ ba.ba_name = "acpi";
+ ba.ba_func = 0x00; /* XXX ? */
+ ba.ba_iot = I386_BUS_SPACE_IO;
+ ba.ba_memt = I386_BUS_SPACE_MEM;
+ if (config_found(self, &ba, bios_print))
+ flags |= BIOSF_PCIBIOS;
+ }
+#endif
+
#if NPCI > 0 && NPCIBIOS > 0
if (!(flags & BIOSF_PCIBIOS)) {
struct bios_attach_args ba;
- ba.bios_dev = "pcibios";
- ba.bios_func = 0x1A;
- ba.bios_memt = bia->bios_memt;
- ba.bios_iot = bia->bios_iot;
+ ba.ba_name = "pcibios";
+ ba.ba_func = 0x1A;
+ ba.ba_memt = bia->ba_memt;
+ ba.ba_iot = bia->ba_iot;
config_found(self, &ba, bios_print);
}
#endif
@@ -498,7 +523,7 @@ bios_print(void *aux, const char *pnp)
if (pnp)
printf("%s at %s function 0x%x",
- ba->bios_dev, pnp, ba->bios_func);
+ ba->ba_name, pnp, ba->ba_func);
return (UNCONF);
}
diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c
index c5b8dc46439..437dea24b55 100644
--- a/sys/arch/i386/i386/mainbus.c
+++ b/sys/arch/i386/i386/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.38 2007/05/29 21:01:56 tedu Exp $ */
+/* $OpenBSD: mainbus.c,v 1.39 2007/12/05 19:17:13 deraadt Exp $ */
/* $NetBSD: mainbus.c,v 1.21 1997/06/06 23:14:20 thorpej Exp $ */
/*
@@ -63,10 +63,7 @@
#include <machine/biosvar.h>
#endif
-#if NACPI > 0
-#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
-#endif
#if NIPMI > 0
#include <dev/ipmivar.h>
@@ -109,9 +106,6 @@ union mainbus_attach_args {
#endif
struct cpu_attach_args mba_caa;
struct apic_attach_args aaa_caa;
-#if NACPI > 0
- struct acpi_attach_args mba_aaa;
-#endif
#if NIPMI > 0
struct ipmi_attach_args mba_iaa;
#endif
@@ -149,26 +143,12 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
#if NBIOS > 0
{
- mba.mba_bios.bios_dev = "bios";
- mba.mba_bios.bios_iot = I386_BUS_SPACE_IO;
- mba.mba_bios.bios_memt = I386_BUS_SPACE_MEM;
+ mba.mba_bios.ba_name = "bios";
+ mba.mba_bios.ba_iot = I386_BUS_SPACE_IO;
+ mba.mba_bios.ba_memt = I386_BUS_SPACE_MEM;
config_found(self, &mba.mba_bios, mainbus_print);
}
#endif
-#if NACPI > 0
-#if NPCI > 0
- if (pci_mode_detect() != 0)
-#endif
- {
- memset(&mba.mba_aaa, 0, sizeof(mba.mba_aaa));
- mba.mba_aaa.aaa_name = "acpi";
- mba.mba_aaa.aaa_iot = I386_BUS_SPACE_IO;
- mba.mba_aaa.aaa_memt = I386_BUS_SPACE_MEM;
-
- if (acpi_probe(self, aux, &mba.mba_aaa))
- config_found(self, &mba.mba_aaa, mainbus_print);
- }
-#endif
#if NIPMI > 0
{
diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h
index 119e09a5b86..75882686370 100644
--- a/sys/arch/i386/include/biosvar.h
+++ b/sys/arch/i386/include/biosvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosvar.h,v 1.48 2006/05/20 22:36:33 deraadt Exp $ */
+/* $OpenBSD: biosvar.h,v 1.49 2007/12/05 19:17:13 deraadt Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -225,17 +225,19 @@ extern volatile struct BIOS_regs {
#include <machine/bus.h>
struct bios_attach_args {
- char *bios_dev;
- u_int bios_func;
- bus_space_tag_t bios_iot;
- bus_space_tag_t bios_memt;
+ char *ba_name;
+ u_int ba_func;
+ bus_space_tag_t ba_iot;
+ bus_space_tag_t ba_memt;
union {
- void *_p;
- bios_apminfo_t *_bios_apmp;
+ void *_p;
+ bios_apminfo_t *_ba_apmp;
+ paddr_t _ba_acpipbase;
} _;
};
-#define bios_apmp _._bios_apmp
+#define ba_apmp _._ba_apmp
+#define ba_acpipbase _._ba_acpipbase
struct consdev;
struct proc;
diff --git a/sys/arch/i386/pci/pcibios.c b/sys/arch/i386/pci/pcibios.c
index 8924c73d0dc..bb51cfff34e 100644
--- a/sys/arch/i386/pci/pcibios.c
+++ b/sys/arch/i386/pci/pcibios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcibios.c,v 1.37 2007/03/19 05:32:05 deraadt Exp $ */
+/* $OpenBSD: pcibios.c,v 1.38 2007/12/05 19:17:13 deraadt Exp $ */
/* $NetBSD: pcibios.c,v 1.5 2000/08/01 05:23:59 uch Exp $ */
/*
@@ -152,7 +152,7 @@ pcibiosprobe(struct device *parent, void *match, void *aux)
u_int32_t rev_maj, rev_min, mech1, mech2, scmech1, scmech2, maxbus;
int rv;
- if (strcmp(ba->bios_dev, "pcibios"))
+ if (strcmp(ba->ba_name, "pcibios"))
return 0;
rv = bios32_service(PCIBIOS_SIGNATURE, &pcibios_entry,
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index a75adf3f7a1..9c860bb2646 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.110 2007/12/05 16:14:14 deraadt Exp $ */
+/* $OpenBSD: acpi.c,v 1.111 2007/12/05 19:17:13 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -334,14 +334,14 @@ acpi_foundprt(struct aml_node *node, void *arg)
int
acpi_match(struct device *parent, void *match, void *aux)
{
- struct acpi_attach_args *aaa = aux;
+ struct bios_attach_args *ba = aux;
struct cfdata *cf = match;
/* sanity */
- if (strcmp(aaa->aaa_name, cf->cf_driver->cd_name))
+ if (strcmp(ba->ba_name, cf->cf_driver->cd_name))
return (0);
- if (!acpi_probe(parent, cf, aaa))
+ if (!acpi_probe(parent, cf, ba))
return (0);
return (1);
@@ -395,7 +395,7 @@ acpi_add_device(struct aml_node *node, void *arg)
void
acpi_attach(struct device *parent, struct device *self, void *aux)
{
- struct acpi_attach_args *aaa = aux;
+ struct bios_attach_args *ba = aux;
struct acpi_softc *sc = (struct acpi_softc *)self;
struct acpi_mem_map handle;
struct acpi_rsdp *rsdp;
@@ -409,10 +409,10 @@ acpi_attach(struct device *parent, struct device *self, void *aux)
#endif
paddr_t facspa;
- sc->sc_iot = aaa->aaa_iot;
- sc->sc_memt = aaa->aaa_memt;
+ sc->sc_iot = ba->ba_iot;
+ sc->sc_memt = ba->ba_memt;
- if (acpi_map(aaa->aaa_pbase, sizeof(struct acpi_rsdp), &handle)) {
+ if (acpi_map(ba->ba_acpipbase, sizeof(struct acpi_rsdp), &handle)) {
printf(": can't map memory\n");
return;
}
diff --git a/sys/dev/acpi/acpimadt.c b/sys/dev/acpi/acpimadt.c
index f7230419249..4e98d561148 100644
--- a/sys/dev/acpi/acpimadt.c
+++ b/sys/dev/acpi/acpimadt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpimadt.c,v 1.15 2007/11/18 21:52:03 kettenis Exp $ */
+/* $OpenBSD: acpimadt.c,v 1.16 2007/12/05 19:17:13 deraadt Exp $ */
/*
* Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org>
*
@@ -119,7 +119,7 @@ void
acpimadt_attach(struct device *parent, struct device *self, void *aux)
{
struct acpi_softc *acpi_sc = (struct acpi_softc *)parent;
- struct device *mainbus = parent->dv_parent;
+ struct device *mainbus = parent->dv_parent->dv_parent;
struct acpi_attach_args *aaa = aux;
struct acpi_madt *madt = (struct acpi_madt *)aaa->aaa_table;
caddr_t addr = (caddr_t)(madt + 1);
diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h
index 2dd1b6558e4..a5a7eb65c26 100644
--- a/sys/dev/acpi/acpivar.h
+++ b/sys/dev/acpi/acpivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpivar.h,v 1.41 2007/11/25 09:11:12 jsg Exp $ */
+/* $OpenBSD: acpivar.h,v 1.42 2007/12/05 19:17:13 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -20,6 +20,7 @@
#include <sys/timeout.h>
#include <sys/rwlock.h>
+#include <machine/biosvar.h>
/* #define ACPI_DEBUG */
#ifdef ACPI_DEBUG
@@ -46,7 +47,6 @@ struct acpi_attach_args {
bus_space_tag_t aaa_iot;
bus_space_tag_t aaa_memt;
void *aaa_table;
- paddr_t aaa_pbase; /* Physical base address of ACPI tables */
struct aml_node *aaa_node;
const char *aaa_dev;
};
@@ -241,7 +241,7 @@ int acpi_map_address(struct acpi_softc *, struct acpi_gas *, bus_addr_t, bus_si
int acpi_map(paddr_t, size_t, struct acpi_mem_map *);
void acpi_unmap(struct acpi_mem_map *);
-int acpi_probe(struct device *, struct cfdata *, struct acpi_attach_args *);
+int acpi_probe(struct device *, struct cfdata *, struct bios_attach_args *);
u_int acpi_checksum(const void *, size_t);
void acpi_attach_machdep(struct acpi_softc *);
int acpi_interrupt(void *);
diff --git a/sys/dev/acpi/files.acpi b/sys/dev/acpi/files.acpi
index 542edb2bb2c..c24ade21fc5 100644
--- a/sys/dev/acpi/files.acpi
+++ b/sys/dev/acpi/files.acpi
@@ -1,11 +1,11 @@
-# $OpenBSD: files.acpi,v 1.15 2007/05/31 17:49:16 gwk Exp $
+# $OpenBSD: files.acpi,v 1.16 2007/12/05 19:17:13 deraadt Exp $
#
# Config file and device description for machine-independent ACPI code.
# Included by ports that need it.
define acpi {}
device acpi
-attach acpi at mainbus
+attach acpi at bios
file dev/acpi/acpi.c acpi needs-flag
file dev/acpi/acpiutil.c acpi
file dev/acpi/dsdt.c acpi