summaryrefslogtreecommitdiff
path: root/sys/dev/acpi
diff options
context:
space:
mode:
authorPaul Irofti <pirofti@cvs.openbsd.org>2009-08-12 22:25:28 +0000
committerPaul Irofti <pirofti@cvs.openbsd.org>2009-08-12 22:25:28 +0000
commitf37123719247b24820753ca67ab5b1444a09680f (patch)
tree21b6ba36ee13ed2113f3317f00c814c9f92efc05 /sys/dev/acpi
parent7ae88df51fdab02264ebb31d478d81c68a88cec8 (diff)
Add wake support to acpihpet(4).
Patch initially from mlarkin@. KNF and refactoring by me. Okay deraadt@.
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r--sys/dev/acpi/acpihpet.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/dev/acpi/acpihpet.c b/sys/dev/acpi/acpihpet.c
index 087fc29a62e..cf31dfa8f5d 100644
--- a/sys/dev/acpi/acpihpet.c
+++ b/sys/dev/acpi/acpihpet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpihpet.c,v 1.7 2009/01/20 20:23:57 kettenis Exp $ */
+/* $OpenBSD: acpihpet.c,v 1.8 2009/08/12 22:25:27 pirofti Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -31,6 +31,7 @@
int acpihpet_match(struct device *, void *, void *);
void acpihpet_attach(struct device *, struct device *, void *);
+int acpihpet_activate(struct device *, enum devact);
#ifdef __HAVE_TIMECOUNTER
u_int acpihpet_gettime(struct timecounter *tc);
@@ -53,7 +54,11 @@ struct acpihpet_softc {
};
struct cfattach acpihpet_ca = {
- sizeof(struct acpihpet_softc), acpihpet_match, acpihpet_attach
+ sizeof(struct acpihpet_softc),
+ acpihpet_match,
+ acpihpet_attach,
+ NULL,
+ acpihpet_activate
};
struct cfdriver acpihpet_cd = {
@@ -61,6 +66,24 @@ struct cfdriver acpihpet_cd = {
};
int
+acpihpet_activate(struct device *self, enum devact act)
+{
+ struct acpihpet_softc *sc = (struct acpihpet_softc *) self;
+
+ switch(act) {
+ case DVACT_ACTIVATE:
+ if (!cold)
+ bus_space_write_4(sc->sc_iot, sc->sc_ioh,
+ HPET_CONFIGURATION, 1);
+ break;
+ case DVACT_DEACTIVATE:
+ break;
+ }
+
+ return 0;
+}
+
+int
acpihpet_match(struct device *parent, void *match, void *aux)
{
struct acpi_attach_args *aaa = aux;