summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2011-06-15 21:32:06 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2011-06-15 21:32:06 +0000
commitdf2037ddb7442555cd756f9ec3b72fbeba976ec9 (patch)
tree271e985c30ad99f0a96beb3e24ed669399a9453b
parent7e3d4ded2937b75cb2254141749ef129a9a373c0 (diff)
Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb node, and not confuse real adb device attachments. ok mpi@
-rw-r--r--sys/arch/mac68k/dev/adb.c3
-rw-r--r--sys/arch/macppc/dev/abtn.c5
-rw-r--r--sys/arch/macppc/dev/adb.c4
-rw-r--r--sys/arch/macppc/dev/apm.c6
-rw-r--r--sys/dev/adb/adb.h11
-rw-r--r--sys/dev/adb/adb_subr.c4
-rw-r--r--sys/dev/adb/akbd.c5
-rw-r--r--sys/dev/adb/ams.c5
8 files changed, 32 insertions, 11 deletions
diff --git a/sys/arch/mac68k/dev/adb.c b/sys/arch/mac68k/dev/adb.c
index 35e6700950b..43e3614383e 100644
--- a/sys/arch/mac68k/dev/adb.c
+++ b/sys/arch/mac68k/dev/adb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.c,v 1.27 2009/03/15 20:40:25 miod Exp $ */
+/* $OpenBSD: adb.c,v 1.28 2011/06/15 21:32:03 miod Exp $ */
/* $NetBSD: adb.c,v 1.47 2005/06/16 22:43:36 jmc Exp $ */
/* $NetBSD: adb_direct.c,v 1.51 2005/06/16 22:43:36 jmc Exp $ */
@@ -2804,6 +2804,7 @@ adb_attach_deferred(void *v)
/* Get the ADB information */
adbaddr = get_ind_adb_info(&adbdata, adbindex);
+ aa_args.name = adb_device_name;
aa_args.origaddr = (int)(adbdata.origADBAddr);
aa_args.adbaddr = adbaddr;
aa_args.handler_id = (int)(adbdata.devType);
diff --git a/sys/arch/macppc/dev/abtn.c b/sys/arch/macppc/dev/abtn.c
index 48c4a4d97b8..44db50ad7d7 100644
--- a/sys/arch/macppc/dev/abtn.c
+++ b/sys/arch/macppc/dev/abtn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: abtn.c,v 1.13 2011/06/07 16:18:00 mpi Exp $ */
+/* $OpenBSD: abtn.c,v 1.14 2011/06/15 21:32:04 miod Exp $ */
/* $NetBSD: abtn.c,v 1.1 1999/07/12 17:48:26 tsubai Exp $ */
/*-
@@ -77,6 +77,9 @@ abtn_match(struct device *parent, void *cf, void *aux)
{
struct adb_attach_args *aa = aux;
+ if (strcmp(aa->name, adb_device_name) != 0)
+ return (0);
+
if (aa->origaddr == ADBADDR_MISC &&
aa->handler_id == ABTN_HANDLER_ID)
return 1;
diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c
index 16ad1b1d1d9..866c341039a 100644
--- a/sys/arch/macppc/dev/adb.c
+++ b/sys/arch/macppc/dev/adb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.c,v 1.30 2011/05/14 12:01:16 mpi Exp $ */
+/* $OpenBSD: adb.c,v 1.31 2011/06/15 21:32:04 miod 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 $ */
@@ -1687,6 +1687,7 @@ adbattach(struct device *parent, struct device *self, void *aux)
/* Get the ADB information */
adbaddr = get_ind_adb_info(&adbdata, adbindex);
+ aa_args.name = adb_device_name;
aa_args.origaddr = adbdata.origADBAddr;
aa_args.adbaddr = adbaddr;
aa_args.handler_id = adbdata.devType;
@@ -1696,6 +1697,7 @@ 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;
diff --git a/sys/arch/macppc/dev/apm.c b/sys/arch/macppc/dev/apm.c
index 03b23391551..5c266c6d9e8 100644
--- a/sys/arch/macppc/dev/apm.c
+++ b/sys/arch/macppc/dev/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.14 2009/02/26 17:19:47 oga Exp $ */
+/* $OpenBSD: apm.c,v 1.15 2011/06/15 21:32:04 miod Exp $ */
/*-
* Copyright (c) 2001 Alexander Guy. All rights reserved.
@@ -112,6 +112,10 @@ int
apmmatch(struct device *parent, void *match, void *aux)
{
struct adb_attach_args *aa = (void *)aux;
+
+ if (strcmp(aa->name, adb_device_name) != 0)
+ return 0;
+
if (aa->origaddr != ADBADDR_APM ||
aa->handler_id != ADBADDR_APM ||
aa->adbaddr != ADBADDR_APM)
diff --git a/sys/dev/adb/adb.h b/sys/dev/adb/adb.h
index 209688337b6..8600643f93e 100644
--- a/sys/dev/adb/adb.h
+++ b/sys/dev/adb/adb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.h,v 1.3 2007/03/13 20:56:56 miod Exp $ */
+/* $OpenBSD: adb.h,v 1.4 2011/06/15 21:32:05 miod Exp $ */
/* $NetBSD: adbsys.h,v 1.4 2000/12/19 02:59:24 tsubai Exp $ */
/*-
@@ -43,11 +43,14 @@
* Arguments used to attach a device to the Apple Desktop Bus
*/
struct adb_attach_args {
- int origaddr;
- int adbaddr;
- int handler_id;
+ const char *name; /* adb_device_name if real adb device */
+ int origaddr;
+ int adbaddr;
+ int handler_id;
};
+extern const char adb_device_name[];
+
#define ADB_CMDADDR(cmd) ((u_int8_t)(cmd & 0xf0) >> 4)
#define ADBFLUSH(dev) ((((u_int8_t)dev & 0x0f) << 4) | 0x01)
#define ADBLISTEN(dev, reg) ((((u_int8_t)dev & 0x0f) << 4) | 0x08 | reg)
diff --git a/sys/dev/adb/adb_subr.c b/sys/dev/adb/adb_subr.c
index c69bf3caab8..d558f9e3593 100644
--- a/sys/dev/adb/adb_subr.c
+++ b/sys/dev/adb/adb_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb_subr.c,v 1.2 2006/02/09 06:45:41 miod Exp $ */
+/* $OpenBSD: adb_subr.c,v 1.3 2011/06/15 21:32:05 miod Exp $ */
/* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */
/*-
@@ -41,6 +41,8 @@ struct cfdriver adb_cd = {
NULL, "adb", DV_DULL
};
+const char adb_device_name[] = "adb_device";
+
int
adbprint(void *args, const char *name)
{
diff --git a/sys/dev/adb/akbd.c b/sys/dev/adb/akbd.c
index 5f539b595de..d48aed97bf3 100644
--- a/sys/dev/adb/akbd.c
+++ b/sys/dev/adb/akbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: akbd.c,v 1.9 2011/06/13 16:29:11 shadchin Exp $ */
+/* $OpenBSD: akbd.c,v 1.10 2011/06/15 21:32:05 miod Exp $ */
/* $NetBSD: akbd.c,v 1.17 2005/01/15 16:00:59 chs Exp $ */
/*
@@ -100,6 +100,9 @@ akbdmatch(struct device *parent, void *vcf, void *aux)
{
struct adb_attach_args *aa_args = (struct adb_attach_args *)aux;
+ if (strcmp(aa_args->name, adb_device_name) != 0)
+ return (0);
+
if (aa_args->origaddr == ADBADDR_KBD)
return (1);
else
diff --git a/sys/dev/adb/ams.c b/sys/dev/adb/ams.c
index 332772d7660..fa468f60539 100644
--- a/sys/dev/adb/ams.c
+++ b/sys/dev/adb/ams.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ams.c,v 1.5 2007/04/10 22:37:17 miod Exp $ */
+/* $OpenBSD: ams.c,v 1.6 2011/06/15 21:32:05 miod Exp $ */
/* $NetBSD: ams.c,v 1.11 2000/12/19 03:13:40 tsubai Exp $ */
/*
@@ -78,6 +78,9 @@ amsmatch(struct device *parent, void *cf, void *aux)
{
struct adb_attach_args *aa_args = aux;
+ if (strcmp(aa_args->name, adb_device_name) != 0)
+ return (0);
+
if (aa_args->origaddr == ADBADDR_MS)
return 1;
else