summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2007-11-25 15:42:16 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2007-11-25 15:42:16 +0000
commit7170ccc0b035f3ca11f8714cface932fac693eb6 (patch)
tree9168d9d49210ac41f522bc98a451d225eb9c209a /sys/arch/i386
parent90f41937ab4b61995a21cb11b4a11acfa9835d4c (diff)
fake out the apm device to switch between apm and acpi on i386. now
a single device node will talk to the right kernel code automatically. ok deraadt
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/conf/files.i3864
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c8
-rw-r--r--sys/arch/i386/i386/apm.c7
-rw-r--r--sys/arch/i386/i386/conf.c8
-rw-r--r--sys/arch/i386/include/conf.h12
5 files changed, 23 insertions, 16 deletions
diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386
index 911dc51b6bd..cff1f90b9de 100644
--- a/sys/arch/i386/conf/files.i386
+++ b/sys/arch/i386/conf/files.i386
@@ -1,4 +1,4 @@
-# $OpenBSD: files.i386,v 1.167 2007/11/16 21:07:01 mbalmer Exp $
+# $OpenBSD: files.i386,v 1.168 2007/11/25 15:42:15 tedu Exp $
#
# new style config file for i386 architecture
#
@@ -300,6 +300,8 @@ attach apm at bios
file arch/i386/i386/apm.c apm needs-count
file arch/i386/i386/apmcall.S apm
+file arch/i386/i386/acpiapm.c
+
# Intel SMP specification 1.4
define mpbios
file arch/i386/i386/mpbios.c mpbios needs-flag
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index 058141b1bd3..74c0b9e5dd6 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.9 2007/11/25 09:11:12 jsg Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.10 2007/11/25 15:42:15 tedu Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -24,6 +24,8 @@
#include <uvm/uvm_extern.h>
#include <machine/bus.h>
+#include <machine/conf.h>
+#include <machine/acpiapm.h>
#include <i386/isa/isa_machdep.h>
#include <dev/isa/isareg.h>
@@ -173,5 +175,9 @@ 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;
+ acpiapm_close = acpiclose;
+ acpiapm_ioctl = acpiioctl;
+ acpiapm_kqfilter = acpikqfilter;
cpuresetfn = acpi_reset;
}
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c
index 866636a9f25..77cd81bc530 100644
--- a/sys/arch/i386/i386/apm.c
+++ b/sys/arch/i386/i386/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.78 2007/11/03 03:37:08 weingart Exp $ */
+/* $OpenBSD: apm.c,v 1.79 2007/11/25 15:42:15 tedu Exp $ */
/*-
* Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved.
@@ -66,6 +66,7 @@
#include <i386/isa/nvram.h>
#include <dev/isa/isavar.h>
+#include <machine/acpiapm.h>
#include <machine/biosvar.h>
#include <machine/apmvar.h>
@@ -916,6 +917,10 @@ apmattach(struct device *parent, struct device *self, void *aux)
}
/* All is well, let the rest of the world know */
+ acpiapm_open = apmopen;
+ acpiapm_close = apmclose;
+ acpiapm_ioctl = apmioctl;
+ acpiapm_kqfilter = apmkqfilter;
apm_attached = 1;
}
} else {
diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c
index 0c63792a2ae..cdd1f90f7da 100644
--- a/sys/arch/i386/i386/conf.c
+++ b/sys/arch/i386/i386/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.119 2007/09/18 18:13:06 mk Exp $ */
+/* $OpenBSD: conf.c,v 1.120 2007/11/25 15:42:15 tedu Exp $ */
/* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */
/*
@@ -151,8 +151,6 @@ cdev_decl(mcd);
#include "sequencer.h"
cdev_decl(music);
#include "joy.h"
-#include "acpi.h"
-#include "apm.h"
#include "bthub.h"
#include "pctr.h"
#include "bios.h"
@@ -224,7 +222,7 @@ struct cdevsw cdevsw[] =
cdev_disk_init(NCCD,ccd), /* 18: concatenated disk driver */
cdev_ss_init(NSS,ss), /* 19: SCSI scanner */
cdev_uk_init(NUK,uk), /* 20: unknown SCSI */
- cdev_apm_init(NAPM,apm), /* 21: Advanced Power Management */
+ cdev_acpiapm_init(1,acpiapm), /* 21: Power Management stuff */
cdev_fd_init(1,filedesc), /* 22: file descriptor pseudo-device */
cdev_bpftun_init(NBPFILTER,bpf),/* 23: Berkeley packet filter */
cdev_notdef(), /* 24 */
@@ -307,7 +305,7 @@ struct cdevsw cdevsw[] =
cdev_hotplug_init(NHOTPLUG,hotplug), /* 82: devices hot plugging */
cdev_gpio_init(NGPIO,gpio), /* 83: GPIO interface */
cdev_nvram_init(NNVRAM,nvram), /* 84: NVRAM interface */
- cdev_acpi_init(NACPI,acpi), /* 85: ACPI */
+ cdev_notdef(), /* 85: ACPI (deprecated) */
cdev_bthub_init(NBTHUB,bthub), /* 86: bthub */
};
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
diff --git a/sys/arch/i386/include/conf.h b/sys/arch/i386/include/conf.h
index cbf6a0b33cc..2c6e683ec90 100644
--- a/sys/arch/i386/include/conf.h
+++ b/sys/arch/i386/include/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.12 2005/12/31 21:22:34 miod Exp $ */
+/* $OpenBSD: conf.h,v 1.13 2007/11/25 15:42:15 tedu Exp $ */
/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */
/*
@@ -49,13 +49,7 @@ cdev_decl(fd);
cdev_decl(pc);
-#define cdev_apm_init(c,n) {\
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
- (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
- (dev_type_mmap((*))) enodev, 0, D_KQFILTER, dev_init(c,n,kqfilter) }
-
-#define cdev_acpi_init(c,n) {\
+#define cdev_acpiapm_init(c,n) {\
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
@@ -78,5 +72,7 @@ cdev_decl(acpi);
cdev_decl(apm);
+cdev_decl(acpiapm);
+
#define pctrpoll seltrue
cdev_decl(pctr);