summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-07-01 15:52:13 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-07-01 15:52:13 +0000
commit6a50fe780e2add833aff44329694a6eed3d30baa (patch)
tree383f60449f14b665eed4f1081784c7ffa0744b54 /sys
parent678fa1cde78379fc42ed4d419d511431fac3c1a2 (diff)
Move acpi(4) attach glue into acpi_machdep.c.
ok guenther@, deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c41
-rw-r--r--sys/arch/amd64/conf/files.amd643
-rw-r--r--sys/arch/i386/conf/files.i3863
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c41
-rw-r--r--sys/dev/acpi/acpi.c44
-rw-r--r--sys/dev/acpi/files.acpi3
6 files changed, 84 insertions, 51 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index ce27079fdbb..483a6fb10f9 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.82 2018/06/25 22:33:24 kettenis Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.83 2018/07/01 15:52:12 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -32,11 +32,12 @@
#include <machine/cpuvar.h>
-#include <dev/isa/isareg.h>
#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
#include <dev/acpi/acpidev.h>
#include <dev/acpi/dsdt.h>
+#include <dev/isa/isareg.h>
+#include <dev/pci/pcivar.h>
#include "isa.h"
#include "ioapic.h"
@@ -64,6 +65,42 @@ extern int acpi_savecpu(void) __returns_twice;
u_int8_t *acpi_scan(struct acpi_mem_map *, paddr_t, size_t);
+int acpi_match(struct device *, void *, void *);
+void acpi_attach(struct device *, struct device *, void *);
+
+struct cfattach acpi_ca = {
+ sizeof(struct acpi_softc), acpi_match, acpi_attach
+};
+
+int
+acpi_match(struct device *parent, void *match, void *aux)
+{
+ struct bios_attach_args *ba = aux;
+ struct cfdata *cf = match;
+
+ /* sanity */
+ if (strcmp(ba->ba_name, cf->cf_driver->cd_name))
+ return (0);
+
+ if (!acpi_probe(parent, cf, ba))
+ return (0);
+
+ return (1);
+}
+
+void
+acpi_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct acpi_softc *sc = (struct acpi_softc *)self;
+ struct bios_attach_args *ba = aux;
+
+ sc->sc_iot = ba->ba_iot;
+ sc->sc_memt = ba->ba_memt;
+ sc->sc_dmat = &pci_bus_dma_tag;
+
+ acpi_attach_common(sc, ba->ba_acpipbase);
+}
+
int
acpi_map(paddr_t pa, size_t len, struct acpi_mem_map *handle)
{
diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64
index b28df143bb5..e6cad55a64e 100644
--- a/sys/arch/amd64/conf/files.amd64
+++ b/sys/arch/amd64/conf/files.amd64
@@ -1,4 +1,4 @@
-# $OpenBSD: files.amd64,v 1.95 2018/01/25 15:06:29 mpi Exp $
+# $OpenBSD: files.amd64,v 1.96 2018/07/01 15:52:12 kettenis Exp $
maxpartitions 16
maxusers 2 16 128
@@ -232,6 +232,7 @@ include "dev/gpio/files.gpio"
# ACPI
#
include "dev/acpi/files.acpi"
+attach acpi at bios
file arch/amd64/amd64/acpi_machdep.c acpi
file arch/amd64/amd64/acpi_wakecode.S acpi & !small_kernel
diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386
index 7962e8d33dc..3e856c5dd16 100644
--- a/sys/arch/i386/conf/files.i386
+++ b/sys/arch/i386/conf/files.i386
@@ -1,4 +1,4 @@
-# $OpenBSD: files.i386,v 1.237 2018/01/25 15:06:29 mpi Exp $
+# $OpenBSD: files.i386,v 1.238 2018/07/01 15:52:12 kettenis Exp $
#
# new style config file for i386 architecture
#
@@ -389,6 +389,7 @@ include "dev/onewire/files.onewire"
include "dev/sdmmc/files.sdmmc"
include "dev/acpi/files.acpi"
+attach acpi at bios
file arch/i386/i386/acpi_machdep.c acpi
file arch/i386/i386/acpi_wakecode.S acpi & !small_kernel
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index e14e91f29bc..3f2420cb51e 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.66 2018/06/25 22:33:24 kettenis Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.67 2018/07/01 15:52:12 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -39,10 +39,11 @@
#include <machine/cpuvar.h>
#include <machine/npx.h>
-#include <dev/isa/isareg.h>
#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
#include <dev/acpi/acpidev.h>
+#include <dev/isa/isareg.h>
+#include <dev/pci/pcivar.h>
#include "apm.h"
#include "isa.h"
@@ -74,6 +75,42 @@ extern void intr_calculatemasks(void);
u_int8_t *acpi_scan(struct acpi_mem_map *, paddr_t, size_t);
+int acpi_match(struct device *, void *, void *);
+void acpi_attach(struct device *, struct device *, void *);
+
+struct cfattach acpi_ca = {
+ sizeof(struct acpi_softc), acpi_match, acpi_attach
+};
+
+int
+acpi_match(struct device *parent, void *match, void *aux)
+{
+ struct bios_attach_args *ba = aux;
+ struct cfdata *cf = match;
+
+ /* sanity */
+ if (strcmp(ba->ba_name, cf->cf_driver->cd_name))
+ return (0);
+
+ if (!acpi_probe(parent, cf, ba))
+ return (0);
+
+ return (1);
+}
+
+void
+acpi_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct acpi_softc *sc = (struct acpi_softc *)self;
+ struct bios_attach_args *ba = aux;
+
+ sc->sc_iot = ba->ba_iot;
+ sc->sc_memt = ba->ba_memt;
+ sc->sc_dmat = &pci_bus_dma_tag;
+
+ acpi_attach_common(sc, ba->ba_acpipbase);
+}
+
int
acpi_map(paddr_t pa, size_t len, struct acpi_mem_map *handle)
{
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index ef23283a92a..d6d5f4d5a9e 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.351 2018/07/01 10:27:34 kettenis Exp $ */
+/* $OpenBSD: acpi.c,v 1.352 2018/07/01 15:52:12 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -205,48 +205,6 @@ struct cfdriver acpi_cd = {
NULL, "acpi", DV_DULL
};
-#if defined(__amd64__) || defined(__i386__)
-
-#include <machine/biosvar.h>
-
-int acpi_match(struct device *, void *, void *);
-void acpi_attach(struct device *, struct device *, void *);
-
-struct cfattach acpi_ca = {
- sizeof(struct acpi_softc), acpi_match, acpi_attach
-};
-
-int
-acpi_match(struct device *parent, void *match, void *aux)
-{
- struct bios_attach_args *ba = aux;
- struct cfdata *cf = match;
-
- /* sanity */
- if (strcmp(ba->ba_name, cf->cf_driver->cd_name))
- return (0);
-
- if (!acpi_probe(parent, cf, ba))
- return (0);
-
- return (1);
-}
-
-void
-acpi_attach(struct device *parent, struct device *self, void *aux)
-{
- struct acpi_softc *sc = (struct acpi_softc *)self;
- struct bios_attach_args *ba = aux;
-
- sc->sc_iot = ba->ba_iot;
- sc->sc_memt = ba->ba_memt;
- sc->sc_dmat = &pci_bus_dma_tag;
-
- acpi_attach_common(sc, ba->ba_acpipbase);
-}
-
-#endif
-
uint8_t
acpi_pci_conf_read_1(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
diff --git a/sys/dev/acpi/files.acpi b/sys/dev/acpi/files.acpi
index 647b5b7c212..e05135f2c2e 100644
--- a/sys/dev/acpi/files.acpi
+++ b/sys/dev/acpi/files.acpi
@@ -1,11 +1,10 @@
-# $OpenBSD: files.acpi,v 1.45 2018/07/01 10:29:30 kettenis Exp $
+# $OpenBSD: files.acpi,v 1.46 2018/07/01 15:52:12 kettenis Exp $
#
# Config file and device description for machine-independent ACPI code.
# Included by ports that need it.
define acpi {}
device acpi
-attach acpi at bios
file dev/acpi/acpi.c acpi needs-flag
file dev/acpi/acpiutil.c acpi
file dev/acpi/dsdt.c acpi