diff options
Diffstat (limited to 'sys/dev/firewire/fwohci.c')
-rw-r--r-- | sys/dev/firewire/fwohci.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index a597a34..4dfe5cf 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -549,10 +549,17 @@ fwohci_reset(struct fwohci_softc *sc, device_t dev) /* Initialize async TX */ OWRITE(sc, OHCI_ATQCTLCLR, OHCI_CNTL_DMA_RUN | OHCI_CNTL_DMA_DEAD); OWRITE(sc, OHCI_ATSCTLCLR, OHCI_CNTL_DMA_RUN | OHCI_CNTL_DMA_DEAD); + /* AT Retries */ OWRITE(sc, FWOHCI_RETRY, /* CycleLimit PhyRespRetries ATRespRetries ATReqRetries */ (0xffff << 16 ) | (0x0f << 8) | (0x0f << 4) | 0x0f) ; + + sc->atrq.top = STAILQ_FIRST(&sc->atrq.db_trq); + sc->atrs.top = STAILQ_FIRST(&sc->atrs.db_trq); + sc->atrq.bottom = sc->atrq.top; + sc->atrs.bottom = sc->atrs.top; + for( i = 0, db_tr = sc->atrq.top; i < sc->atrq.ndb ; i ++, db_tr = STAILQ_NEXT(db_tr, link)){ db_tr->xfer = NULL; @@ -1681,6 +1688,9 @@ fwohci_stop(struct fwohci_softc *sc, device_t dev) | OHCI_INT_DMA_PRRQ | OHCI_INT_DMA_PRRS | OHCI_INT_DMA_ARRQ | OHCI_INT_DMA_ARRS | OHCI_INT_PHY_BUS_R); + + fw_drain_txq(&sc->fc); + /* XXX Link down? Bus reset? */ return 0; } @@ -1689,14 +1699,22 @@ int fwohci_resume(struct fwohci_softc *sc, device_t dev) { int i; + struct fw_xferq *ir; + struct fw_bulkxfer *chunk; fwohci_reset(sc, dev); /* XXX resume isochronus receive automatically. (how about TX?) */ for(i = 0; i < sc->fc.nisodma; i ++) { - if((sc->ir[i].xferq.flag & FWXFERQ_RUNNING) != 0) { + ir = &sc->ir[i].xferq; + if((ir->flag & FWXFERQ_RUNNING) != 0) { device_printf(sc->fc.dev, "resume iso receive ch: %d\n", i); - sc->ir[i].xferq.flag &= ~FWXFERQ_RUNNING; + ir->flag &= ~FWXFERQ_RUNNING; + /* requeue stdma to stfree */ + while((chunk = STAILQ_FIRST(&ir->stdma)) != NULL) { + STAILQ_REMOVE_HEAD(&ir->stdma, link); + STAILQ_INSERT_TAIL(&ir->stfree, chunk, link); + } sc->fc.irx_enable(&sc->fc, i); } } |