diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 9844e7b22b62..16648641d0af 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -258,7 +258,9 @@ void fw_asybusy(struct fw_xfer *xfer){ /* xfer->ch = timeout((timeout_t *)fw_asystart, (void *)xfer, 20000); */ +#if 0 DELAY(20000); +#endif fw_asystart(xfer); return; } @@ -327,6 +329,9 @@ firewire_xfer_timeout(struct firewire_comm *fc) if (timevalcmp(&xfer->tv, &tv, >)) /* the rests are newer than this */ break; + if (xfer->state == FWXF_START) + /* not sent yet */ + break; device_printf(fc->bdev, "split transaction timeout dst=0x%x tl=0x%x state=%d\n", xfer->send.hdr.mode.hdr.dst, i, xfer->state); @@ -734,7 +739,6 @@ void fw_init(struct firewire_comm *fc) CSRARC(fc, SPED_MAP + 4) = 1; STAILQ_INIT(&fc->devices); - STAILQ_INIT(&fc->pending); /* Initialize csr ROM work space */ SLIST_INIT(&fc->ongocsr); @@ -987,12 +991,7 @@ fw_xfer_done(struct fw_xfer *xfer) if (xfer->fc == NULL) panic("fw_xfer_done: why xfer->fc is NULL?"); - if (xfer->fc->status != FWBUSRESET) - xfer->act.hand(xfer); - else { - printf("fw_xfer_done: pending\n"); - STAILQ_INSERT_TAIL(&xfer->fc->pending, xfer, link); - } + xfer->act.hand(xfer); } void @@ -1597,7 +1596,6 @@ static void fw_attach_dev(struct firewire_comm *fc) { struct fw_device *fwdev, *next; - struct fw_xfer *xfer; int i, err; device_t *devlistp; int devcnt; @@ -1633,16 +1631,6 @@ fw_attach_dev(struct firewire_comm *fc) } free(devlistp, M_TEMP); - /* call pending handlers */ - i = 0; - while ((xfer = STAILQ_FIRST(&fc->pending))) { - STAILQ_REMOVE_HEAD(&fc->pending, link); - i++; - if (xfer->act.hand) - xfer->act.hand(xfer); - } - if (i > 0) - printf("fw_attach_dev: %d pending handlers called\n", i); if (fc->retry_count > 0) { printf("probe failed for %d node\n", fc->retry_count); #if 0 @@ -1895,11 +1883,7 @@ fw_rcv(struct fw_rcv_buf *rb) } STAILQ_REMOVE_HEAD(&bind->xferlist, link); fw_rcv_copy(rb); - if (rb->fc->status != FWBUSRESET) - rb->xfer->act.hand(rb->xfer); - else - STAILQ_INSERT_TAIL(&rb->fc->pending, - rb->xfer, link); + rb->xfer->act.hand(rb->xfer); return; break; case FWACT_CH: diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 3297db695c20..1e205c1735f6 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -136,7 +136,6 @@ struct firewire_comm{ STAILQ_HEAD(, tlabel) tlabels[0x40]; STAILQ_HEAD(, fw_bind) binds; STAILQ_HEAD(, fw_device) devices; - STAILQ_HEAD(, fw_xfer) pending; u_int sid_cnt; #define CSRSIZE 0x4000 u_int32_t csr_arc[CSRSIZE/4]; diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index c9eec114ddb9..4feb8f3d3055 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -76,6 +76,8 @@ SYSCTL_INT(_hw_firewire_fwmem, OID_AUTO, speed, CTLFLAG_RW, &fwmem_speed, 0, SYSCTL_INT(_debug, OID_AUTO, fwmem_debug, CTLFLAG_RW, &fwmem_debug, 0, "Fwmem driver debug flag"); +MALLOC_DEFINE(M_FWMEM, "fwmem", "fwmem/FireWire"); + #define MAXLEN (512 << fwmem_speed) struct fwmem_softc { @@ -94,7 +96,7 @@ fwmem_xfer_req( { struct fw_xfer *xfer; - xfer = fw_xfer_alloc(M_FWXFER); + xfer = fw_xfer_alloc(M_FWMEM); if (xfer == NULL) return NULL; @@ -275,7 +277,7 @@ fwmem_open (dev_t dev, int flags, int fmt, fw_proc *td) fms->refcount ++; } else { fms = (struct fwmem_softc *)malloc(sizeof(struct fwmem_softc), - M_FW, M_WAITOK); + M_FWMEM, M_WAITOK); if (fms == NULL) return ENOMEM; bcopy(&fwmem_eui64, &fms->eui, sizeof(struct fw_eui64)); diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index ba54a7cd9755..6f63b5483755 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -2771,7 +2771,9 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) dbch->buf_offset = - dbch->buf_offset; /* sanity check */ if (resCount != 0) - printf("resCount != 0 !?\n"); + printf("resCount = %d !?\n", + resCount); + /* XXX clear pdb_tr */ goto out; } offset = 0; @@ -2783,6 +2785,7 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) = sizeof(fw_pkt) so this shouldn't happens */ printf("plen(%d) is negative! offset=%d\n", plen, offset); + /* XXX clear pdb_tr */ goto out; } if (plen > 0) { @@ -2793,7 +2796,9 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) printf("splitted payload\n"); /* sanity check */ if (resCount != 0) - printf("resCount != 0 !?\n"); + printf("resCount = %d !?\n", + resCount); + /* XXX clear pdb_tr */ goto out; } vec[nvec].iov_base = ld; diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index 795aade86b76..891c4b214120 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -328,7 +328,7 @@ fwohci_pci_attach(device_t self) err = device_probe_and_attach(sc->fc.bdev); if (err) { - device_printf(self, "FireWire init failed\n"); + device_printf(self, "FireWire init failed with err=%d\n", err); fwohci_pci_detach(self); return EIO; } diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 39c753664c21..3b026993cf01 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -216,6 +216,8 @@ struct sbp_softc { struct fw_bind fwb; bus_dma_tag_t dmat; struct timeval last_busreset; +#define SIMQ_FREEZED 1 + int flags; }; static void sbp_post_explore __P((void *)); @@ -764,6 +766,10 @@ sbp_post_busreset(void *arg) SBP_DEBUG(0) printf("sbp_post_busreset\n"); END_DEBUG + if ((sbp->sim->flags & SIMQ_FREEZED) == 0) { + xpt_freeze_simq(sbp->sim, /*count*/1); + sbp->sim->flags |= SIMQ_FREEZED; + } microtime(&sbp->last_busreset); } @@ -833,6 +839,8 @@ END_DEBUG if (target->num_lun == 0) sbp_free_target(target); } + xpt_release_simq(sbp->sim, /*run queue*/TRUE); + sbp->sim->flags &= ~SIMQ_FREEZED; } #if NEED_RESPONSE