summaryrefslogtreecommitdiff
path: root/sys/arch/macppc/dev/adb.c
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2001-10-03 14:45:38 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2001-10-03 14:45:38 +0000
commit5919548fd8581cb4f12acc4d89ab2ad1dc8989f5 (patch)
tree9d8a92c49d79311c2b2e3dc09c10ec18d9492336 /sys/arch/macppc/dev/adb.c
parentd06ec46e13639684c063927640650c3c355dfd3e (diff)
apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support to poll the battery/AC/charging states of the system. Code by Alexander Guy.
Diffstat (limited to 'sys/arch/macppc/dev/adb.c')
-rw-r--r--sys/arch/macppc/dev/adb.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c
index 439cda2063a..d7ddcc277ab 100644
--- a/sys/arch/macppc/dev/adb.c
+++ b/sys/arch/macppc/dev/adb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.c,v 1.2 2001/09/01 17:43:08 drahn Exp $ */
+/* $OpenBSD: adb.c,v 1.3 2001/10/03 14:45:37 drahn Exp $ */
/* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */
/*-
@@ -47,6 +47,7 @@
#include <macppc/dev/viareg.h>
#include "aed.h"
+#include "apm.h"
/*
* Function declarations.
@@ -74,8 +75,6 @@ struct cfdriver adb_cd = {
NULL, "adb", DV_DULL
};
-extern int adbHardware;
-
static int
adbmatch(parent, cf, aux)
struct device *parent;
@@ -156,7 +155,18 @@ adbattach(parent, self, aux)
totaladbs = CountADBs();
printf(" irq %d", ca->ca_intr[0]);
- printf(": %d targets\n", totaladbs);
+
+ switch (adbHardware) {
+ case ADB_HW_CUDA:
+ printf(": via-cuda ");
+ break;
+ case ADB_HW_PB:
+ printf(": via-pmu ");
+ break;
+ }
+
+ printf("%d targets\n", totaladbs);
+
#if NAED > 0
/* ADB event device for compatibility */
@@ -178,6 +188,15 @@ adbattach(parent, self, aux)
(void)config_found(self, &aa_args, adbprint);
}
+#if NAPM > 0
+ /* Magic for signalling the apm driver to match. */
+ aa_args.origaddr = ADBADDR_APM;
+ aa_args.adbaddr = ADBADDR_APM;
+ aa_args.handler_id = ADBADDR_APM;
+
+ (void)config_found(self, &aa_args, NULL);
+#endif
+
if (adbHardware == ADB_HW_CUDA)
adb_cuda_autopoll();
adb_polling = 0;