diff options
author | simokawa <simokawa@FreeBSD.org> | 2003-01-26 15:39:04 +0000 |
---|---|---|
committer | simokawa <simokawa@FreeBSD.org> | 2003-01-26 15:39:04 +0000 |
commit | 376bd949e066a9aef4b2331a6b8e66e5eba8132f (patch) | |
tree | 07df55b90f7e481cf05714448e507f62ace570ba /sys/dev/firewire/firewire.c | |
parent | 4865a58cd6760c2a3695e5f7b6b7bf42560ced68 (diff) | |
download | FreeBSD-src-376bd949e066a9aef4b2331a6b8e66e5eba8132f.zip FreeBSD-src-376bd949e066a9aef4b2331a6b8e66e5eba8132f.tar.gz |
- Improve IT/IR DMA queue management.
- Improve debug message for mbuf handling.
- Wait 1 sec for DMA stop in fwohci_i{t,r}x_disable() before freeing buffers.
Diffstat (limited to 'sys/dev/firewire/firewire.c')
-rw-r--r-- | sys/dev/firewire/firewire.c | 178 |
1 files changed, 0 insertions, 178 deletions
diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 7252cea..e555266 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -122,184 +122,6 @@ static driver_t firewire_driver = { }; /* - * transmitter buffer update. - */ -int -fw_tbuf_update(struct firewire_comm *fc, int sub, int flag){ - struct fw_bulkxfer *bulkxfer, *bulkxfer2 = NULL; - struct fw_xferq *it; - int s, err = 0; - - it = fc->it[sub]; - - s = splfw(); - if(it->stdma == NULL){ - bulkxfer = STAILQ_FIRST(&it->stvalid); - }else if(flag != 0){ - bulkxfer = STAILQ_FIRST(&it->stvalid); - if(bulkxfer == it->stdma){ - STAILQ_REMOVE_HEAD(&it->stvalid, link); - it->stdma->flag = 0; - STAILQ_INSERT_TAIL(&it->stfree, it->stdma, link); -#ifdef FWXFERQ_DV - if(!(it->flag & FWXFERQ_DV)) -#endif - wakeup(it); - } - bulkxfer = STAILQ_FIRST(&it->stvalid); - }else{ - bulkxfer = it->stdma; - } - if(bulkxfer != NULL){ - bulkxfer2 = STAILQ_NEXT(bulkxfer, link); -#if 0 - if(it->flag & FWXFERQ_DV && bulkxfer2 == NULL){ - bulkxfer2 = STAILQ_FIRST(&it->stfree); - STAILQ_REMOVE_HEAD(&it->stfree, link); - bcopy(bulkxfer->buf, bulkxfer2->buf, - it->psize * it->btpacket); - STAILQ_INSERT_TAIL(&it->stvalid, bulkxfer2, link); - } -#endif - } - it->stdma = bulkxfer; - it->stdma2 = bulkxfer2; - -#ifdef FWXFERQ_DV - if(it->flag & FWXFERQ_DV){ - struct fw_dvbuf *dvbuf = NULL; - int i, j, chtag; - struct fw_pkt *fp; - u_int64_t cycle, dvsync; - - chtag = it->flag & 0xff; -dvloop: - if(it->dvdma == NULL){ - dvbuf = STAILQ_FIRST(&it->dvvalid); - if(dvbuf != NULL){ - STAILQ_REMOVE_HEAD(&it->dvvalid, link); - it->dvdma = dvbuf; - it->queued = 0; - } - } - if(it->dvdma == NULL) - goto out; - - it->stproc = STAILQ_FIRST(&it->stfree); - if(it->stproc != NULL){ - STAILQ_REMOVE_HEAD(&it->stfree, link); - }else{ - goto out; - } -#if DV_PAL -#define DVSEC 3 -#define DVFRAC 75 /* PAL: 25 Hz (1875 = 25 * 3) */ -#define DVDIFF 5 /* 125 = (8000/300 - 25) * 3 */ -#else -#define DVSEC 100 -#define DVFRAC 2997 /* NTSC: 29.97 Hz (2997 = 29.97 * 100) */ -#define DVDIFF 203 /* 203 = (8000/250 - 29.97) * 100 */ -#endif -#define CYCLEFRAC 0xc00 - cycle = (u_int64_t) 8000 * DVSEC * it->dvsync; - /* least significant 12 bits */ - dvsync = (cycle * CYCLEFRAC / DVFRAC) % CYCLEFRAC; - /* most significat 4 bits */ - cycle = (cycle / DVFRAC + it->dvoffset) & 0xf; - fp = (struct fw_pkt *)(it->dvdma->buf); -#if 1 - fp->mode.ld[2] = htonl(0x80000000 | (cycle << 12) | dvsync); -#else - fp->mode.ld[2] = htonl(0x80000000 | dvsync); -#endif - it->dvsync ++; - it->dvsync %= 2997; - - for( i = 0, j = 0 ; i < it->dvpacket ; i++){ - bcopy(it->dvdma->buf + it->queued * it->psize, - it->stproc->buf + j * it->psize, it->psize); - fp = (struct fw_pkt *)(it->stproc->buf + j * it->psize); - fp->mode.stream.len = htons(488); - fp->mode.stream.chtag = chtag; - fp->mode.stream.tcode = FWTCODE_STREAM; - fp->mode.ld[1] = htonl((fc->nodeid << 24) | 0x00780000 | it->dvdbc); - it->dvdbc++; - it->dvdbc %= 256; - it->queued ++; - j++; - it->dvdiff += DVDIFF; - if(it->dvdiff >= DVFRAC){ - it->dvdiff %= DVFRAC; - fp = (struct fw_pkt *)(it->stproc->buf + j * it->psize); - - fp->mode.stream.len = htons(0x8); - fp->mode.stream.chtag = chtag; - fp->mode.stream.tcode = FWTCODE_STREAM; - fp->mode.ld[1] = htonl((fc->nodeid << 24) | - 0x00780000 | it->dvdbc); - j++; - } - } - it->stproc->npacket = j; - STAILQ_INSERT_TAIL(&it->stvalid, it->stproc, link); - if(it->queued >= it->dvpacket){ - STAILQ_INSERT_TAIL(&it->dvfree, it->dvdma, link); - it->dvdma = NULL; - wakeup(it); - goto dvloop; - } - } -out: -#endif - splx(s); - return err; -} -/* - * receving buffer update. - */ -int -fw_rbuf_update(struct firewire_comm *fc, int sub, int flag){ - struct fw_bulkxfer *bulkxfer, *bulkxfer2 = NULL; - struct fw_xferq *ir; - int s, err = 0; - - ir = fc->ir[sub]; - s = splfw(); - if(ir->stdma != NULL){ - if(flag != 0){ - STAILQ_INSERT_TAIL(&ir->stvalid, ir->stdma, link); - }else{ - ir->stdma->flag = 0; - STAILQ_INSERT_TAIL(&ir->stfree, ir->stdma, link); - } - } - if(ir->stdma2 != NULL){ - bulkxfer = ir->stdma2; - bulkxfer2 = STAILQ_FIRST(&ir->stfree); - if(bulkxfer2 != NULL){ - STAILQ_REMOVE_HEAD(&ir->stfree, link); - } - }else{ - bulkxfer = STAILQ_FIRST(&ir->stfree); - if(bulkxfer != NULL){ - STAILQ_REMOVE_HEAD(&ir->stfree, link); - bulkxfer2 = STAILQ_FIRST(&ir->stfree); - if(bulkxfer2 != NULL){ - STAILQ_REMOVE_HEAD(&ir->stfree, link); - } - }else{ - device_printf(fc->bdev, "no free chunk available\n"); - bulkxfer = STAILQ_FIRST(&ir->stvalid); - STAILQ_REMOVE_HEAD(&ir->stvalid, link); - } - } - splx(s); - ir->stdma = bulkxfer; - ir->stdma2 = bulkxfer2; - return err; -} - -/* * To lookup node id. from EUI64. */ struct fw_device * |