diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-03-07 20:00:19 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-03-07 20:00:19 +0000 |
commit | 34e4ea8e6a04b429e2019dda68817b65a32c1cfb (patch) | |
tree | 1d6effddca25ba90710ee204c9848337403e399f /sys | |
parent | ff97539871b6ded465cd91d6e8089b569177d28d (diff) |
On via-pmu systems, check whether the firmware has found adb devices on the
bus to decide whether to go the long way or not when resetting the bus.
Fixes the long delay probe on Mac Mini. Tested by various.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/macppc/dev/adb.c | 21 | ||||
-rw-r--r-- | sys/arch/macppc/dev/pm_direct.c | 14 |
2 files changed, 28 insertions, 7 deletions
diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c index a192399da4b..cfc5bd8ca7b 100644 --- a/sys/arch/macppc/dev/adb.c +++ b/sys/arch/macppc/dev/adb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adb.c,v 1.18 2006/01/18 23:21:17 miod Exp $ */ +/* $OpenBSD: adb.c,v 1.19 2006/03/07 20:00:18 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 $ */ @@ -249,6 +249,7 @@ int tickle_serial = 0; /* the last packet tickled */ int adb_cuda_serial = 0; /* the current packet */ struct timeout adb_cuda_timeout; struct timeout adb_softintr_timeout; +int adbempty = 0; /* nonzero if no adb devices */ volatile u_char *Via1Base; @@ -1642,9 +1643,25 @@ adbattach(struct device *parent, struct device *self, void *aux) if (strcmp(ca->ca_name, "via-cuda") == 0) adbHardware = ADB_HW_CUDA; - else if (strcmp(ca->ca_name, "via-pmu") == 0) + else if (strcmp(ca->ca_name, "via-pmu") == 0) { adbHardware = ADB_HW_PMU; + /* + * Bus reset can take a long time if no adb devices are + * connected, e.g. on a Mac Mini; so check for an adb + * child in the OF tree to speed up pm_adb_op(). + */ + adbempty = 1; + for (node = OF_child(ca->ca_node); node; node = OF_peer(node)) { + if (OF_getprop(node, "name", name, sizeof name) <= 0) + continue; + if (strcmp(name, "adb") == 0) { + adbempty = 0; + break; + } + } + } + adb_polling = 1; adb_reinit(); diff --git a/sys/arch/macppc/dev/pm_direct.c b/sys/arch/macppc/dev/pm_direct.c index d390239adaa..f683585261e 100644 --- a/sys/arch/macppc/dev/pm_direct.c +++ b/sys/arch/macppc/dev/pm_direct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pm_direct.c,v 1.19 2006/02/22 07:02:23 miod Exp $ */ +/* $OpenBSD: pm_direct.c,v 1.20 2006/03/07 20:00:18 miod Exp $ */ /* $NetBSD: pm_direct.c,v 1.9 2000/06/08 22:10:46 tsubai Exp $ */ /* @@ -550,6 +550,7 @@ pm_adb_op(u_char *buffer, void *compRout, void *data, int command) #endif PMData pmdata; struct adbCommand packet; + extern int adbempty; if (adbWaiting == 1) return 1; @@ -582,11 +583,14 @@ pm_adb_op(u_char *buffer, void *compRout, void *data, int command) * - PowerMac10,1 * causes several pmu interrupts with ifr set to PMU_INT_SNDBRT. * Not processing them prevents us from seeing the adb devices - * afterwards. + * afterwards, so we have to expect it unless we know the adb + * bus is empty. */ - if (command == PMU_RESET_ADB) - waitfor = PMU_INT_ADB_AUTO | PMU_INT_ADB | PMU_INT_SNDBRT; - else + if (command == PMU_RESET_ADB) { + waitfor = PMU_INT_ADB_AUTO | PMU_INT_ADB; + if (adbempty == 0) + waitfor |= PMU_INT_SNDBRT; + } else waitfor = PMU_INT_ALL; pmdata.data[0] = (u_char)(command & 0xff); |