diff options
author | Pedro Martelletto <pedro@cvs.openbsd.org> | 2005-12-10 13:45:39 +0000 |
---|---|---|
committer | Pedro Martelletto <pedro@cvs.openbsd.org> | 2005-12-10 13:45:39 +0000 |
commit | 788187ac113fd8f802d3792b6e7fa43720059207 (patch) | |
tree | fe0abd23d97391c026f279315726a1f423f2c301 /sys/arch/macppc/dev | |
parent | d2657625a3a81a42d4b0b47ff6116903fb592f6a (diff) |
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@.
Diffstat (limited to 'sys/arch/macppc/dev')
-rw-r--r-- | sys/arch/macppc/dev/pm_direct.c | 10 | ||||
-rw-r--r-- | sys/arch/macppc/dev/pm_direct.h | 4 |
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 */ |