summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpedro <pedro@openbsd.org>2005-12-10 13:45:38 +0000
committerpedro <pedro@openbsd.org>2005-12-10 13:45:38 +0000
commit24a1ecc63de5a4661cebcda1163d772a7de20317 (patch)
treedbc0b9e3df36a7f2a268d4dbb2d503a1ea76a9e5
parentadd an option to increase the multicast ttl which is currently limited (diff)
downloadwireguard-openbsd-24a1ecc63de5a4661cebcda1163d772a7de20317.tar.xz
wireguard-openbsd-24a1ecc63de5a4661cebcda1163d772a7de20317.zip
Just poll for PMU_INT_ADB_AUTO and PMU_INT_ADB interrupts when resetting
the device, should fix a huge delay attaching adb(4) on some boxes, thanks to everyone who tested, okay deraadt@.
-rw-r--r--sys/arch/macppc/dev/pm_direct.c10
-rw-r--r--sys/arch/macppc/dev/pm_direct.h4
2 files changed, 11 insertions, 3 deletions
diff --git a/sys/arch/macppc/dev/pm_direct.c b/sys/arch/macppc/dev/pm_direct.c
index e199a1086a8..fb531c308eb 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.15 2005/12/06 02:38:24 pedro Exp $ */
+/* $OpenBSD: pm_direct.c,v 1.16 2005/12/10 13:45:38 pedro Exp $ */
/* $NetBSD: pm_direct.c,v 1.9 2000/06/08 22:10:46 tsubai Exp $ */
/*
@@ -562,6 +562,7 @@ pm_adb_op(u_char *buffer, void *compRout, void *data, int command)
int s;
int rval;
int ndelay;
+ int waitfor; /* interrupts to poll for */
PMData pmdata;
struct adbCommand packet;
@@ -589,6 +590,11 @@ pm_adb_op(u_char *buffer, void *compRout, void *data, int command)
} else
pmdata.num_data = 3;
+ if (command == PMU_RESET_ADB)
+ waitfor = PMU_INT_ADB_AUTO | PMU_INT_ADB;
+ else
+ waitfor = PMU_INT_ALL;
+
pmdata.data[0] = (u_char)(command & 0xff);
pmdata.data[1] = 0;
/* if the command is LISTEN, copy ADB data to PM buffer */
@@ -635,7 +641,7 @@ pm_adb_op(u_char *buffer, void *compRout, void *data, int command)
/* wait until the PM interrupt is occurred */
ndelay = 0x8000;
while (adbWaiting == 1) {
- if (read_via_reg(VIA1, vIFR) != 0)
+ if (read_via_reg(VIA1, vIFR) & waitfor)
pm_intr();
#ifdef PM_GRAB_SI
(void)intr_dispatch(0x70);
diff --git a/sys/arch/macppc/dev/pm_direct.h b/sys/arch/macppc/dev/pm_direct.h
index c3e4d3f238c..c096fe55cb4 100644
--- a/sys/arch/macppc/dev/pm_direct.h
+++ b/sys/arch/macppc/dev/pm_direct.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pm_direct.h,v 1.7 2005/11/16 12:28:54 kettenis Exp $ */
+/* $OpenBSD: pm_direct.h,v 1.8 2005/12/10 13:45:38 pedro Exp $ */
/* $NetBSD: pm_direct.h,v 1.5 1999/07/12 15:54:55 tsubai Exp $ */
/*
@@ -76,6 +76,7 @@ void pm_init_brightness(void);
void pm_eject_pcmcia(int);
/* PMU commands */
+#define PMU_RESET_ADB 0x00 /* Reset ADB */
#define PMU_POWER_OFF 0x7e /* Turn Power off */
#define PMU_RESET_CPU 0xd0 /* Reset CPU */
@@ -108,6 +109,7 @@ void pm_eject_pcmcia(int);
#define PMU_INT_BATTERY 0x20
#define PMU_INT_WAKEUP 0x40
#define PMU_INT_TICK 0x80 /* 1-second tick interrupt */
+#define PMU_INT_ALL 0xff /* Mask of all interrupts */
/* Bits to use with the PMU_POWER_CTRL0 command */
#define PMU_POW0_ON 0x80 /* OR this to power ON the device */