summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2011-06-16 10:44:34 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2011-06-16 10:44:34 +0000
commitafdc314fca360e62ef7184865da97fe06eae5273 (patch)
treed0f2173637ef4b88c954b029293d4e15dad7376b
parentf117d653c8892913176c276420742bb60ea7619a (diff)
Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments. Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a via-cuda machine (e.g. my color G3 iMac). ok miod@
-rw-r--r--sys/arch/macppc/dev/adb.c15
-rw-r--r--sys/arch/macppc/dev/apm.c21
-rw-r--r--sys/arch/macppc/dev/piic.c7
-rw-r--r--sys/dev/adb/adb.h5
4 files changed, 20 insertions, 28 deletions
diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c
index 866c341039a..30f08675d1c 100644
--- a/sys/arch/macppc/dev/adb.c
+++ b/sys/arch/macppc/dev/adb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.c,v 1.31 2011/06/15 21:32:04 miod Exp $ */
+/* $OpenBSD: adb.c,v 1.32 2011/06/16 10:44:33 mpi Exp $ */
/* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */
/* $NetBSD: adb_direct.c,v 1.14 2000/06/08 22:10:45 tsubai Exp $ */
@@ -1696,13 +1696,12 @@ adbattach(struct device *parent, struct device *self, void *aux)
}
#if NAPM > 0
- /* Magic for signalling the apm driver to match. */
- aa_args.name = adb_device_name;
- aa_args.origaddr = ADBADDR_APM;
- aa_args.adbaddr = ADBADDR_APM;
- aa_args.handler_id = ADBADDR_APM;
-
- (void)config_found(self, &aa_args, NULL);
+ if (adbHardware == ADB_HW_PMU) {
+ /* Magic for signalling the apm driver to match. */
+ nca.ca_name = "apm";
+ nca.ca_node = node;
+ config_found(self, &nca, NULL);
+ }
#endif
/* Attach I2C controller. */
diff --git a/sys/arch/macppc/dev/apm.c b/sys/arch/macppc/dev/apm.c
index 5c266c6d9e8..b22c77245e0 100644
--- a/sys/arch/macppc/dev/apm.c
+++ b/sys/arch/macppc/dev/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.15 2011/06/15 21:32:04 miod Exp $ */
+/* $OpenBSD: apm.c,v 1.16 2011/06/16 10:44:33 mpi Exp $ */
/*-
* Copyright (c) 2001 Alexander Guy. All rights reserved.
@@ -49,9 +49,8 @@
#include <machine/conf.h>
#include <machine/cpu.h>
#include <machine/apmvar.h>
+#include <machine/autoconf.h>
-#include <dev/adb/adb.h>
-#include <macppc/dev/adbvar.h>
#include <macppc/dev/pm_direct.h>
#if defined(APMDEBUG)
@@ -111,20 +110,12 @@ struct filterops apmread_filtops =
int
apmmatch(struct device *parent, void *match, void *aux)
{
- struct adb_attach_args *aa = (void *)aux;
+ struct confargs *ca = aux;
- if (strcmp(aa->name, adb_device_name) != 0)
- return 0;
+ if (strcmp(ca->ca_name, "apm") != 0)
+ return (0);
- if (aa->origaddr != ADBADDR_APM ||
- aa->handler_id != ADBADDR_APM ||
- aa->adbaddr != ADBADDR_APM)
- return 0;
-
- if (adbHardware != ADB_HW_PMU)
- return 0;
-
- return 1;
+ return (1);
}
void
diff --git a/sys/arch/macppc/dev/piic.c b/sys/arch/macppc/dev/piic.c
index bc4c67dabc3..461bffd4eb9 100644
--- a/sys/arch/macppc/dev/piic.c
+++ b/sys/arch/macppc/dev/piic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: piic.c,v 1.2 2007/05/20 23:38:52 thib Exp $ */
+/* $OpenBSD: piic.c,v 1.3 2011/06/16 10:44:33 mpi Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -55,6 +55,11 @@ int piic_i2c_exec(void *, i2c_op_t, i2c_addr_t,
int
piic_match(struct device *parent, void *cf, void *aux)
{
+ struct confargs *ca = aux;
+
+ if (strcmp(ca->ca_name, "piic") != 0)
+ return (0);
+
return (1);
}
diff --git a/sys/dev/adb/adb.h b/sys/dev/adb/adb.h
index 8600643f93e..35d0fb0db56 100644
--- a/sys/dev/adb/adb.h
+++ b/sys/dev/adb/adb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.h,v 1.4 2011/06/15 21:32:05 miod Exp $ */
+/* $OpenBSD: adb.h,v 1.5 2011/06/16 10:44:33 mpi Exp $ */
/* $NetBSD: adbsys.h,v 1.4 2000/12/19 02:59:24 tsubai Exp $ */
/*-
@@ -78,9 +78,6 @@ typedef struct adb_event_s {
#define ADBADDR_TABLET ADBADDR_ABS
#define ADBADDR_MODEM ADBADDR_DATATX
-#define ADBADDR_APM 0xac0ff /* A faux-addr for the APM driver to
- latch onto */
-
/* Interesting keyboard handler IDs */
#define ADB_STDKBD 1
#define ADB_EXTKBD 2