summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/pc/usbxhci.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/src/9/pc/usbxhci.c b/sys/src/9/pc/usbxhci.c
index 653fdb0ca..9c9ad60eb 100644
--- a/sys/src/9/pc/usbxhci.c
+++ b/sys/src/9/pc/usbxhci.c
@@ -753,14 +753,23 @@ waittd(Ctlr *ctlr, Wait *w, int tmout)
*r->doorbell = r->id;
while(waserror()){
- if(!r->stopped) {
- if(r == ctlr->cr)
- ctlr->opr[CRCR] |= CA;
- else
- ctlrcmd(ctlr, CR_STOPEP | (r->id<<16) | (r->slot->id<<24), 0, 0, nil);
- r->stopped = 1;
+ if(r->stopped) {
+ ctlr->er->stopped = 1;
+ wakeup(&ctlr->recover);
+
+ /* wait for rescue */
+ tmout = 0;
+ continue;
}
- tmout = 0;
+
+ if(r == ctlr->cr)
+ ctlr->opr[CRCR] |= CA;
+ else
+ ctlrcmd(ctlr, CR_STOPEP | (r->id<<16) | (r->slot->id<<24), 0, 0, nil);
+ r->stopped = 1;
+
+ /* time to abort the transaction */
+ tmout = 5000;
}
if(tmout > 0){
tsleep(&up->sleep, waitdone, w, tmout);