Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jul 2026 22:50:21 +0000
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        Abdelkader Boudih <freebsd@seuros.com>
Subject:   git: 8a765654f937 - main - firewire: remove dead code across the subsystem
Message-ID:  <6a5ea62d.320bc.600e19c2@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=8a765654f937e30104b6ebc28be66241b53d2a9e

commit 8a765654f937e30104b6ebc28be66241b53d2a9e
Author:     Abdelkader Boudih <freebsd@seuros.com>
AuthorDate: 2026-07-20 22:48:17 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-07-20 22:48:20 +0000

    firewire: remove dead code across the subsystem
    
    Reviewed by:    adrian
    Differential Revision:  https://reviews.freebsd.org/D58310
---
 sys/dev/firewire/firewire.c   | 120 +-------------------------------
 sys/dev/firewire/fwcrom.c     |   5 --
 sys/dev/firewire/fwdev.c      |   9 ---
 sys/dev/firewire/fwohci.c     | 158 ------------------------------------------
 sys/dev/firewire/fwohci_pci.c |   9 +--
 sys/dev/firewire/if_fwe.c     |  32 ---------
 sys/dev/firewire/if_fwip.c    |  11 ---
 sys/dev/firewire/sbp.c        |  54 ---------------
 sys/dev/firewire/sbp_targ.c   |  33 ---------
 9 files changed, 3 insertions(+), 428 deletions(-)

diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c
index 1020aff31929..e4624485e0c0 100644
--- a/sys/dev/firewire/firewire.c
+++ b/sys/dev/firewire/firewire.c
@@ -306,9 +306,6 @@ fw_asystart(struct fw_xfer *xfer)
 	FW_GLOCK(fc);
 	xfer->flag = FWXF_INQ;
 	STAILQ_INSERT_TAIL(&xfer->q->q, xfer, link);
-#if 0
-	xfer->q->queued++;
-#endif
 	FW_GUNLOCK(fc);
 	/* Kick DMA for non-mbuf xfers */
 	if (xfer->mbuf == NULL)
@@ -588,9 +585,6 @@ fw_xferq_drain(struct fw_xferq *xferq)
 
 	while ((xfer = STAILQ_FIRST(&xferq->q)) != NULL) {
 		STAILQ_REMOVE_HEAD(&xferq->q, link);
-#if 0
-		xferq->queued--;
-#endif
 		xfer->resp = EAGAIN;
 		xfer->flag = FWXF_SENTERR;
 		fw_xfer_done(xfer);
@@ -880,21 +874,6 @@ void fw_init(struct firewire_comm *fc)
 		STAILQ_INIT(&fc->tlabels[i]);
 	}
 
-/* DV depend CSRs see blue book */
-#if 0
-	CSRARC(fc, oMPR) = 0x3fff0001; /* # output channel = 1 */
-	CSRARC(fc, oPCR) = 0x8000007a;
-	for (i = 4; i < 0x7c/4; i += 4) {
-		CSRARC(fc, i + oPCR) = 0x8000007a;
-	}
-
-	CSRARC(fc, iMPR) = 0x00ff0001; /* # input channel = 1 */
-	CSRARC(fc, iPCR) = 0x803f0000;
-	for (i = 4; i < 0x7c/4; i += 4) {
-		CSRARC(fc, i + iPCR) = 0x0;
-	}
-#endif
-
 	fc->crom_src_buf = NULL;
 
 #ifdef FW_VMACCESS
@@ -980,9 +959,6 @@ fw_bindadd(struct firewire_comm *fc, struct fw_bind *fwb)
 int
 fw_bindremove(struct firewire_comm *fc, struct fw_bind *fwb)
 {
-#if 0
-	struct fw_xfer *xfer, *next;
-#endif
 	struct fw_bind *tfw;
 
 	FW_GLOCK(fc);
@@ -996,14 +972,6 @@ fw_bindremove(struct firewire_comm *fc, struct fw_bind *fwb)
 	FW_GUNLOCK(fc);
 	return (1);
 found:
-#if 0
-	/* shall we do this? */
-	for (xfer = STAILQ_FIRST(&fwb->xferlist); xfer != NULL; xfer = next) {
-		next = STAILQ_NEXT(xfer, link);
-		fw_xfer_free(xfer);
-	}
-	STAILQ_INIT(&fwb->xferlist);
-#endif
 	FW_GUNLOCK(fc);
 
 	return 0;
@@ -1210,9 +1178,6 @@ fw_xfer_unload(struct fw_xfer *xfer)
 		if (xfer->flag & FWXF_INQ) {
 			STAILQ_REMOVE(&xfer->q->q, xfer, fw_xfer, link);
 			xfer->flag &= ~FWXF_INQ;
-	#if 0
-			xfer->q->queued--;
-	#endif
 		}
 		FW_GUNLOCK(xfer->fc);
 
@@ -1221,15 +1186,8 @@ fw_xfer_unload(struct fw_xfer *xfer)
 		 * xfer after it's freed.
 		 */
 		fw_tl_free(xfer->fc, xfer);
-#if 1
-		if (xfer->flag & FWXF_START)
-			/*
-			 * This could happen if:
-			 *  1. We call fwohci_arcv() before fwohci_txd().
-			 *  2. firewire_watch() is called.
-			 */
+		if (firewire_debug && (xfer->flag & FWXF_START))
 			printf("fw_xfer_free FWXF_START\n");
-#endif
 	}
 	xfer->flag = FWXF_INIT;
 	xfer->resp = 0;
@@ -1267,10 +1225,6 @@ fw_xfer_free(struct fw_xfer *xfer)
 void
 fw_asy_callback_free(struct fw_xfer *xfer)
 {
-#if 0
-	printf("asyreq done flag=0x%02x resp=%d\n",
-				xfer->flag, xfer->resp);
-#endif
 	fw_xfer_free(xfer);
 }
 
@@ -2110,20 +2064,7 @@ fw_rcv(struct fw_rcv_buf *rb)
 	struct fw_bind *bind;
 	int tcode;
 	int oldstate;
-#if 0
-	int i, len;
-	{
-		uint32_t *qld;
-		int i;
-		qld = (uint32_t *)buf;
-		printf("spd %d len:%d\n", spd, len);
-		for (i = 0; i <= len && i < 32; i+= 4) {
-			printf("0x%08x ", ntohl(qld[i/4]));
-			if ((i % 16) == 15) printf("\n");
-		}
-		if ((i % 16) != 15) printf("\n");
-	}
-#endif
+
 	fp = (struct fw_pkt *)rb->vec[0].iov_base;
 	tcode = fp->mode.common.tcode;
 	switch (tcode) {
@@ -2142,17 +2083,7 @@ fw_rcv(struct fw_rcv_buf *rb)
 			    fp->mode.hdr.tlrt >> 2,
 			    fp->mode.hdr.tlrt & 3,
 			    fp->mode.rresq.data);
-#if 0
-			printf("try ad-hoc work around!!\n");
-			rb->xfer = fw_tl2xfer(rb->fc, fp->mode.hdr.src,
-			    (fp->mode.hdr.tlrt >> 2)^3);
-			if (rb->xfer == NULL) {
-				printf("no use...\n");
-				return;
-			}
-#else
 			return;
-#endif
 		}
 		fw_rcv_copy(rb);
 		if (rb->xfer->recv.hdr.mode.wres.rtcode != RESP_CMP)
@@ -2167,10 +2098,6 @@ fw_rcv(struct fw_rcv_buf *rb)
 			fw_xfer_done(rb->xfer);
 			break;
 		case FWXF_START:
-#if 0
-			if (firewire_debug)
-				printf("not sent yet tl=%x\n", rb->xfer->tl);
-#endif
 			break;
 		default:
 			device_printf(rb->fc->bdev, "%s: "
@@ -2230,19 +2157,11 @@ fw_rcv(struct fw_rcv_buf *rb)
 			resfp->mode.rresb.rtcode = RESP_ADDRESS_ERROR;
 			resfp->mode.rresb.extcode = 0;
 			resfp->mode.rresb.len = 0;
-/*
-			rb->xfer->hand = fw_xferwake;
-*/
 			rb->xfer->hand = fw_xfer_free;
 			if (fw_asyreq(rb->fc, -1, rb->xfer))
 				fw_xfer_free(rb->xfer);
 			return;
 		}
-#if 0
-		len = 0;
-		for (i = 0; i < rb->nvec; i++)
-			len += rb->vec[i].iov_len;
-#endif
 		rb->xfer = STAILQ_FIRST(&bind->xferlist);
 		if (rb->xfer == NULL) {
 			device_printf(rb->fc->bdev, "%s: "
@@ -2253,41 +2172,6 @@ fw_rcv(struct fw_rcv_buf *rb)
 		fw_rcv_copy(rb);
 		rb->xfer->hand(rb->xfer);
 		return;
-#if 0 /* shouldn't happen ?? or for GASP */
-	case FWTCODE_STREAM:
-	{
-		struct fw_xferq *xferq;
-
-		xferq = rb->fc->ir[sub];
-#if 0
-		printf("stream rcv dma %d len %d off %d spd %d\n",
-			sub, len, off, spd);
-#endif
-		if (xferq->queued >= xferq->maxq) {
-			printf("receive queue is full\n");
-			return;
-		}
-		rb->xfer = fw_xfer_alloc_buf(M_FWXFER, 0,
-		    vec[0].iov_len);
-		if (rb->xfer == NULL)
-			return;
-		fw_rcv_copy(rb)
-		xferq->queued++;
-		STAILQ_INSERT_TAIL(&xferq->q, rb->xfer, link);
-		sc = device_get_softc(rb->fc->bdev);
-		if (SEL_WAITING(&xferq->rsel))
-			selwakeuppri(&xferq->rsel, FWPRI);
-		if (xferq->flag & FWXFERQ_WAKEUP) {
-			xferq->flag &= ~FWXFERQ_WAKEUP;
-			wakeup((caddr_t)xferq);
-		}
-		if (xferq->flag & FWXFERQ_HANDLER) {
-			xferq->hand(xferq);
-		}
-		return;
-		break;
-	}
-#endif
 	default:
 		device_printf(rb->fc->bdev,"%s: unknown tcode %d\n",
 		    __func__, tcode);
diff --git a/sys/dev/firewire/fwcrom.c b/sys/dev/firewire/fwcrom.c
index ec88902e582e..32c391f0b11f 100644
--- a/sys/dev/firewire/fwcrom.c
+++ b/sys/dev/firewire/fwcrom.c
@@ -309,12 +309,7 @@ crom_desc(struct crom_context *cc, char *buf, int len)
 	reg = crom_get(cc);
 	switch (reg->key & CSRTYPE_MASK) {
 	case CSRTYPE_I:
-#if 0
-		len -= snprintf(buf, len, "%d", reg->val);
-		buf += strlen(buf);
-#else
 		*buf = '\0';
-#endif
 		break;
 	case CSRTYPE_C:
 		len -= snprintf(buf, len, "offset=0x%04x(%d)",
diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c
index 18c2da6d2d94..cea5ad3075ad 100644
--- a/sys/dev/firewire/fwdev.c
+++ b/sys/dev/firewire/fwdev.c
@@ -284,10 +284,6 @@ fw_read_async(struct fw_drv1 *d, struct uio *uio, int ioflag)
 	STAILQ_REMOVE_HEAD(&d->rq, link);
 	FW_GUNLOCK(xfer->fc);
 	fp = &xfer->recv.hdr;
-#if 0 /* for GASP ?? */
-	if (fc->irx_post != NULL)
-		fc->irx_post(fc, fp->mode.ld);
-#endif
 	tinfo = &xfer->fc->tcode[fp->mode.hdr.tcode];
 	err = uiomove(fp, tinfo->hdr_len, uio);
 	if (err)
@@ -469,11 +465,6 @@ isoloop:
 			it->queued = 0;
 		} else if (slept == 0) {
 			slept = 1;
-#if 0	/* XXX to avoid lock recursion */
-			err = fc->itx_enable(fc, it->dmach);
-			if (err)
-				goto out;
-#endif
 			err = msleep(it, FW_GMTX(fc), FWPRI, "fw_write", hz);
 			if (err)
 				goto out;
diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c
index d78312682e0c..1d5a4d686d81 100644
--- a/sys/dev/firewire/fwohci.c
+++ b/sys/dev/firewire/fwohci.c
@@ -465,11 +465,7 @@ fwohci_probe_phy(struct fwohci_softc *sc, device_t dev)
 
 		/* check programPhyEnable */
 		reg2 = fwphy_rddata(sc, 5);
-#if 0
-		if (e1394a && (OREAD(sc, OHCI_HCCCTL) & OHCI_HCC_PRPHY)) {
-#else	/* XXX force to enable 1394a */
 		if (e1394a) {
-#endif
 			if (firewire_debug)
 				device_printf(dev,
 					"Enable 1394a Enhancements\n");
@@ -687,18 +683,6 @@ fwohci_init(struct fwohci_softc *sc, device_t dev)
 		return ENOMEM;
 	}
 
-#if 0
-	bzero(&sc->fc.config_rom[0], CROMSIZE);
-	sc->fc.config_rom[1] = 0x31333934;
-	sc->fc.config_rom[2] = 0xf000a002;
-	sc->fc.config_rom[3] = OREAD(sc, OHCI_EUID_HI);
-	sc->fc.config_rom[4] = OREAD(sc, OHCI_EUID_LO);
-	sc->fc.config_rom[5] = 0;
-	sc->fc.config_rom[0] = (4 << 24) | (5 << 16);
-
-	sc->fc.config_rom[0] |= fw_crc16(&sc->fc.config_rom[1], 5*4);
-#endif
-
 /* SID receive buffer must align 2^11 */
 #define	OHCI_SIDSIZE	(1 << 11)
 	sc->sid_buf = fwdma_malloc(&sc->fc, OHCI_SIDSIZE, OHCI_SIDSIZE,
@@ -897,11 +881,6 @@ txloop:
 	if (xfer == NULL) {
 		goto kick;
 	}
-#if 0
-	if (dbch->xferq.queued == 0) {
-		device_printf(sc->fc.dev, "TX queue empty\n");
-	}
-#endif
 	STAILQ_REMOVE_HEAD(&dbch->xferq.q, link);
 	db_tr->xfer = xfer;
 	xfer->flag = FWXF_START;
@@ -990,11 +969,6 @@ again:
 			printf("dmamap_load: err=%d\n", err);
 		bus_dmamap_sync(dbch->dmat, db_tr->dma_map,
 						BUS_DMASYNC_PREWRITE);
-#if 0 /* OHCI_OUTPUT_MODE == 0 */
-		for (i = 2; i < db_tr->dbcnt; i++)
-			FWOHCI_DMA_SET(db_tr->db[i].db.desc.cmd,
-						OHCI_OUTPUT_MORE);
-#endif
 	}
 	if (maxdesc < db_tr->dbcnt) {
 		maxdesc = db_tr->dbcnt;
@@ -1099,10 +1073,8 @@ fwohci_txd(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
 		bus_dmamap_sync(dbch->dmat, tr->dma_map,
 			BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(dbch->dmat, tr->dma_map);
-#if 1
 		if (firewire_debug > 1)
 			dump_db(sc, ch);
-#endif
 		if (status & OHCI_CNTL_DMA_DEAD) {
 			/* Stop DMA */
 			OWRITE(sc, OHCI_DMACTLCLR(off), OHCI_CNTL_DMA_RUN);
@@ -1143,10 +1115,6 @@ fwohci_txd(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
 		if (tr->xfer != NULL) {
 			xfer = tr->xfer;
 			if (xfer->flag & FWXF_RCVD) {
-#if 0
-				if (firewire_debug)
-					printf("already rcvd\n");
-#endif
 				fw_xfer_done(xfer);
 			} else {
 				microtime(&xfer->tv);
@@ -1480,11 +1448,7 @@ fwohci_next_cycle(struct firewire_comm *fc, int cycle_now)
 	cycle = cycle_now & 0x1fff;
 	sec = cycle_now >> 13;
 #define CYCLE_MOD	0x10
-#if 1
 #define CYCLE_DELAY	8	/* min delay to start DMA */
-#else
-#define CYCLE_DELAY	7000	/* min delay to start DMA */
-#endif
 	cycle = cycle + CYCLE_DELAY;
 	if (cycle >= 8000) {
 		sec++;
@@ -1540,18 +1504,8 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach)
 		fwohci_txbufdb(sc, dmach, chunk);
 		if (prev != NULL) {
 			db = ((struct fwohcidb_tr *)(prev->end))->db;
-#if 0 /* XXX necessary? */
-			FWOHCI_DMA_SET(db[ldesc].db.desc.cmd,
-						OHCI_BRANCH_ALWAYS);
-#endif
-#if 0 /* if bulkxfer->npacket changes */
-			db[ldesc].db.desc.depend = db[0].db.desc.depend =
-				((struct fwohcidb_tr *)
-				(chunk->start))->bus_addr | dbch->ndesc;
-#else
 			FWOHCI_DMA_SET(db[0].db.desc.depend, dbch->ndesc);
 			FWOHCI_DMA_SET(db[ldesc].db.desc.depend, dbch->ndesc);
-#endif
 		}
 		STAILQ_REMOVE_HEAD(&it->stvalid, link);
 		STAILQ_INSERT_TAIL(&it->stdma, chunk, link);
@@ -1567,9 +1521,6 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach)
 	if (stat & (OHCI_CNTL_DMA_ACTIVE | OHCI_CNTL_CYCMATCH_S))
 		return 0;
 
-#if 0
-	OWRITE(sc, OHCI_ITCTLCLR(dmach), OHCI_CNTL_DMA_RUN);
-#endif
 	OWRITE(sc, OHCI_IT_MASKCLR, 1 << dmach);
 	OWRITE(sc, OHCI_IT_STATCLR, 1 << dmach);
 	OWRITE(sc, OHCI_IT_MASK, 1 << dmach);
@@ -1580,17 +1531,12 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach)
 		((struct fwohcidb_tr *)(first->start))->bus_addr | dbch->ndesc);
 	if (firewire_debug > 1) {
 		printf("fwohci_itxbuf_enable: kick 0x%08x\n", stat);
-#if 1
 		dump_dma(sc, ITX_CH + dmach);
-#endif
 	}
 	if ((stat & OHCI_CNTL_DMA_RUN) == 0) {
-#if 1
 		/* Don't start until all chunks are buffered */
 		if (STAILQ_FIRST(&it->stfree) != NULL)
 			goto out;
-#endif
-#if 1
 		/* Clear cycle match counter bits */
 		OWRITE(sc, OHCI_ITCTLCLR(dmach), 0xffff0000);
 
@@ -1601,9 +1547,6 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach)
 		OWRITE(sc, OHCI_ITCTL(dmach),
 				OHCI_CNTL_CYCMATCH_S | (cycle_match << 16)
 				| OHCI_CNTL_DMA_RUN);
-#else
-		OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_DMA_RUN);
-#endif
 		if (firewire_debug > 1) {
 			printf("cycle_match: 0x%04x->0x%04x\n",
 						cycle_now, cycle_match);
@@ -1710,9 +1653,6 @@ fwohci_irx_enable(struct firewire_comm *fc, int dmach)
 							| dbch->ndesc);
 	OWRITE(sc, OHCI_IRCTL(dmach), OHCI_CNTL_DMA_RUN);
 	OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_DMA_IR);
-#if 0
-	dump_db(sc, IRX_CH + dmach);
-#endif
 	return err;
 }
 
@@ -1952,17 +1892,9 @@ fwohci_intr_dma(struct fwohci_softc *sc, uint32_t stat, int count)
 		}
 	}
 	if (stat & OHCI_INT_DMA_PRRS) {
-#if 0
-		dump_dma(sc, ARRS_CH);
-		dump_db(sc, ARRS_CH);
-#endif
 		fwohci_arcv(sc, &sc->arrs, count);
 	}
 	if (stat & OHCI_INT_DMA_PRRQ) {
-#if 0
-		dump_dma(sc, ARRQ_CH);
-		dump_db(sc, ARRQ_CH);
-#endif
 		fwohci_arcv(sc, &sc->arrq, count);
 	}
 	if (stat & OHCI_INT_CYC_LOST) {
@@ -1970,9 +1902,6 @@ fwohci_intr_dma(struct fwohci_softc *sc, uint32_t stat, int count)
 			sc->cycle_lost++;
 		if (sc->cycle_lost > 10) {
 			sc->cycle_lost = -1;
-#if 0
-			OWRITE(sc, OHCI_LNKCTLCLR, OHCI_CNTL_CYCTIMER);
-#endif
 			OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_CYC_LOST);
 			device_printf(fc->dev, "too many cycles lost, "
 			 "no cycle master present?\n");
@@ -2195,9 +2124,6 @@ fwohci_tbuf_update(struct fwohci_softc *sc, int dmach)
 		STAILQ_REMOVE_HEAD(&it->stdma, link);
 		switch (stat & FWOHCIEV_MASK) {
 		case FWOHCIEV_ACKCOMPL:
-#if 0
-			device_printf(fc->dev, "0x%08x\n", count);
-#endif
 			break;
 		default:
 			device_printf(fc->dev,
@@ -2225,9 +2151,6 @@ fwohci_rbuf_update(struct fwohci_softc *sc, int dmach)
 	ir = fc->ir[dmach];
 	ldesc = sc->ir[dmach].ndesc - 1;
 
-#if 0
-	dump_db(sc, dmach);
-#endif
 	if ((ir->flag & FWXFERQ_HANDLER) == 0)
 		FW_GLOCK(fc);
 	fwdma_sync_multiseg_all(sc->ir[dmach].am, BUS_DMASYNC_POSTREAD);
@@ -2326,11 +2249,6 @@ dump_db(struct fwohci_softc *sc, uint32_t ch)
 	struct fwohci_dbch *dbch;
 	struct fwohcidb_tr *cp = NULL, *pp;
 	struct fwohcidb *curr = NULL;
-#if 0
-	struct fwohcidb *prev
-	struct fwohcidb *next = NULL;
-	struct fwohcidb_tr *np = NULL;
-#endif
 	int idb, jdb;
 	uint32_t cmd, off;
 
@@ -2360,28 +2278,15 @@ dump_db(struct fwohci_softc *sc, uint32_t ch)
 		return;
 	}
 	pp = dbch->top;
-#if 0
-	prev = pp->db;
-#endif
 	for (idb = 0; idb < dbch->ndb; idb++) {
 		cp = STAILQ_NEXT(pp, link);
 		if (cp == NULL) {
 			curr = NULL;
 			goto outdb;
 		}
-#if 0
-		np = STAILQ_NEXT(cp, link);
-#endif
 		for (jdb = 0; jdb < dbch->ndesc; jdb++) {
 			if ((cmd  & 0xfffffff0) == cp->bus_addr) {
 				curr = cp->db;
-#if 0
-				if (np != NULL) {
-					next = np->db;
-				} else {
-					next = NULL;
-				}
-#endif
 				goto outdb;
 			}
 		}
@@ -2390,22 +2295,11 @@ dump_db(struct fwohci_softc *sc, uint32_t ch)
 			curr = NULL;
 			goto outdb;
 		}
-#if 0
-		prev = pp->db;
-#endif
 	}
 outdb:
 	if (curr != NULL) {
-#if 0
-		printf("Prev DB %d\n", ch);
-		print_db(pp, prev, ch, dbch->ndesc);
-#endif
 		printf("Current DB %d\n", ch);
 		print_db(cp, curr, ch, dbch->ndesc);
-#if 0
-		printf("Next DB %d\n", ch);
-		print_db(np, next, ch, dbch->ndesc);
-#endif
 	} else {
 		printf("dbdump err ch = %d cmd = 0x%08x\n", ch, cmd);
 	}
@@ -2517,15 +2411,9 @@ fwohci_ibr(struct firewire_comm *fc)
 	 * Set root hold-off bit so that non cyclemaster capable node
 	 * shouldn't became the root node.
 	 */
-#if 1
 	fun = fwphy_rddata(sc, FW_PHY_IBR_REG);
 	fun |= FW_PHY_IBR | FW_PHY_RHB;
 	fun = fwphy_wrdata(sc, FW_PHY_IBR_REG, fun);
-#else	/* Short bus reset */
-	fun = fwphy_rddata(sc, FW_PHY_ISBR_REG);
-	fun |= FW_PHY_ISBR | FW_PHY_RHB;
-	fun = fwphy_wrdata(sc, FW_PHY_ISBR_REG, fun);
-#endif
 	FW_GUNLOCK(fc);
 }
 
@@ -2533,9 +2421,6 @@ void
 fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer)
 {
 	struct fwohcidb_tr *db_tr;
-#if 0
-	struct fwohcidb_tr *fdb_tr;
-#endif
 	struct fwohci_dbch *dbch;
 	struct fwohcidb *db;
 	struct fw_pkt *fp;
@@ -2549,10 +2434,6 @@ fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer)
 	chtag = sc->it[dmach].xferq.flag & 0xff;
 
 	db_tr = (struct fwohcidb_tr *)(bulkxfer->start);
-#if 0
-	fdb_tr = (struct fwohcidb_tr *)(bulkxfer->end);
-device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, db_tr->bus_addr, fdb_tr->bus_addr);
-#endif
 	for (idb = 0; idb < dbch->xferq.bnpacket; idb++) {
 		db = db_tr->db;
 		fp = (struct fw_pkt *)db_tr->buf;
@@ -2570,33 +2451,14 @@ device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, db_tr->bus_addr, fdb_
 		FWOHCI_DMA_CLEAR(db[2].db.desc.cmd, OHCI_COUNT_MASK);
 		FWOHCI_DMA_SET(db[2].db.desc.cmd, fp->mode.stream.len);
 		FWOHCI_DMA_WRITE(db[2].db.desc.res, 0);
-#if 0 /* if bulkxfer->npackets changes */
-		db[2].db.desc.cmd = OHCI_OUTPUT_LAST
-			| OHCI_UPDATE
-			| OHCI_BRANCH_ALWAYS;
-		db[0].db.desc.depend =
-			= db[dbch->ndesc - 1].db.desc.depend
-			= STAILQ_NEXT(db_tr, link)->bus_addr | dbch->ndesc;
-#else
 		FWOHCI_DMA_SET(db[0].db.desc.depend, dbch->ndesc);
 		FWOHCI_DMA_SET(db[dbch->ndesc - 1].db.desc.depend, dbch->ndesc);
-#endif
 		bulkxfer->end = (caddr_t)db_tr;
 		db_tr = STAILQ_NEXT(db_tr, link);
 	}
 	db = ((struct fwohcidb_tr *)bulkxfer->end)->db;
 	FWOHCI_DMA_CLEAR(db[0].db.desc.depend, 0xf);
 	FWOHCI_DMA_CLEAR(db[dbch->ndesc - 1].db.desc.depend, 0xf);
-#if 0 /* if bulkxfer->npackets changes */
-	db[dbch->ndesc - 1].db.desc.control |= OHCI_INTERRUPT_ALWAYS;
-	/* OHCI 1.1 and above */
-	db[0].db.desc.control |= OHCI_INTERRUPT_ALWAYS;
-#endif
-#if 0
-	db_tr = (struct fwohcidb_tr *)bulkxfer->start;
-	fdb_tr = (struct fwohcidb_tr *)bulkxfer->end;
-device_printf(sc->fc.dev, "DB %08x %3d %08x %08x\n", bulkxfer, bulkxfer->npacket, db_tr->bus_addr, fdb_tr->bus_addr);
-#endif
 	return;
 }
 
@@ -2625,10 +2487,8 @@ fwohci_add_tx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr,
 
 	FWOHCI_DMA_WRITE(db[2].db.desc.cmd,
 		OHCI_OUTPUT_LAST | OHCI_UPDATE | OHCI_BRANCH_ALWAYS);
-#if 1
 	FWOHCI_DMA_WRITE(db[0].db.desc.res, 0);
 	FWOHCI_DMA_WRITE(db[2].db.desc.res, 0);
-#endif
 	return 0;
 }
 
@@ -2697,9 +2557,6 @@ fwohci_arcv_swap(struct fw_pkt *fp, int len)
 #endif
 
 	ld0 = FWOHCI_DMA_READ(fp->mode.ld[0]);
-#if 0
-	printf("ld0: x%08x\n", ld0);
-#endif
 	fp0 = (struct fw_pkt *)&ld0;
 	/* determine length to swap */
 	switch (fp0->mode.common.tcode) {
@@ -2817,12 +2674,6 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count)
 	status = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) >> OHCI_STATUS_SHIFT;
 	resCount = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) & OHCI_COUNT_MASK;
 	while (status & OHCI_CNTL_DMA_ACTIVE) {
-#if 0
-
-		if (off == OHCI_ARQOFF)
-			printf("buf 0x%08x, status 0x%04x, resCount 0x%04x\n",
-			    db_tr->bus_addr, status, resCount);
-#endif
 		len = dbch->xferq.psize - resCount;
 		ld = (uint8_t *)db_tr->buf;
 		if (dbch->pdb_tr == NULL) {
@@ -2931,17 +2782,10 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count)
 
 /* DMA result-code will be written at the tail of packet */
 			stat = FWOHCI_DMA_READ(*(uint32_t *)(ld - sizeof(struct fwohci_trailer)));
-#if 0
-			printf("plen: %d, stat %x\n",
-			    plen ,stat);
-#endif
 			spd = (stat >> 21) & 0x3;
 			event = (stat >> 16) & 0x1f;
 			switch (event) {
 			case FWOHCIEV_ACKPEND:
-#if 0
-				printf("fwohci_arcv: ack pending tcode=0x%x..\n", fp->mode.common.tcode);
-#endif
 				/* fall through */
 			case FWOHCIEV_ACKCOMPL:
 			{
@@ -2971,9 +2815,7 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count)
 				    dbch->buf_offset, len,
 				    OREAD(sc, OHCI_DMACTL(off)),
 				    fp->mode.common.tcode, stat);
-#if 1 /* XXX */
 				goto err;
-#endif
 				break;
 			}
 #ifdef COUNT_PACKETS
diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c
index 4abebb3b9468..609651aad849 100644
--- a/sys/dev/firewire/fwohci_pci.c
+++ b/sys/dev/firewire/fwohci_pci.c
@@ -206,9 +206,7 @@ fwohci_pci_init(device_t self)
 
 	cmd = pci_read_config(self, PCIR_COMMAND, 2);
 	cmd |= PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN;
-#if 1  /* for broken hardware */
-	cmd &= ~PCIM_CMD_MWRICEN;
-#endif
+	cmd &= ~PCIM_CMD_MWRICEN;	/* for broken hardware */
 	pci_write_config(self, PCIR_COMMAND, cmd, 2);
 
 	latency = olatency = pci_read_config(self, PCIR_LATTIMER, 1);
@@ -242,11 +240,6 @@ fwohci_pci_attach(device_t self)
 	int err;
 	int rid;
 
-#if 0
-	if (bootverbose)
-		firewire_debug = bootverbose;
-#endif
-
 	mtx_init(FW_GMTX(&sc->fc), "firewire", NULL, MTX_DEF);
 	fwohci_pci_init(self);
 
diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c
index 763950e59bac..bf7ed29fc5b4 100644
--- a/sys/dev/firewire/if_fwe.c
+++ b/sys/dev/firewire/if_fwe.c
@@ -319,10 +319,6 @@ fwe_init(void *arg)
 	if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
 	if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
 
-#if 0
-	/* attempt to start output */
-	fwe_start(ifp);
-#endif
 }
 
 
@@ -442,9 +438,6 @@ fwe_as_output(struct fwe_softc *fwe, if_t ifp)
 		FWE_LOCK(fwe);
 		xfer = STAILQ_FIRST(&fwe->xferlist);
 		if (xfer == NULL) {
-#if 0
-			printf("if_fwe: lack of xfer\n");
-#endif
 			FWE_UNLOCK(fwe);
 			break;
 		}
@@ -478,10 +471,6 @@ fwe_as_output(struct fwe_softc *fwe, if_t ifp)
 			i++;
 		}
 	}
-#if 0
-	if (i > 1)
-		printf("%d queued\n", i);
-#endif
 	if (i > 0)
 		xferq->start(fwe->fd.fc);
 }
@@ -496,9 +485,6 @@ fwe_as_input(struct fw_xferq *xferq)
 	struct fw_bulkxfer *sxfer;
 	struct fw_pkt *fp;
 	struct epoch_tracker et;
-#if 0
-	u_char *c;
-#endif
 
 	fwe = (struct fwe_softc *)xferq->sc;
 	ifp = fwe->eth_softc.ifp;
@@ -527,26 +513,8 @@ fwe_as_input(struct fw_xferq *xferq)
 		}
 
 		m->m_data += HDR_LEN + ETHER_ALIGN;
-#if 0
-		c = mtod(m, u_char *);
-#endif
 		m->m_len = m->m_pkthdr.len = fp->mode.stream.len - ETHER_ALIGN;
 		m->m_pkthdr.rcvif = ifp;
-#if 0
-		FWEDEBUG(ifp, "%02x %02x %02x %02x %02x %02x\n"
-			 "%02x %02x %02x %02x %02x %02x\n"
-			 "%02x %02x %02x %02x\n"
-			 "%02x %02x %02x %02x\n"
-			 "%02x %02x %02x %02x\n"
-			 "%02x %02x %02x %02x\n",
-			 c[0], c[1], c[2], c[3], c[4], c[5],
-			 c[6], c[7], c[8], c[9], c[10], c[11],
-			 c[12], c[13], c[14], c[15],
-			 c[16], c[17], c[18], c[19],
-			 c[20], c[21], c[22], c[23],
-			 c[20], c[21], c[22], c[23]
-		);
-#endif
 		NET_EPOCH_ENTER(et);
 		if_input(ifp, m);
 		NET_EPOCH_EXIT(et);
diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c
index 8ac139361a89..103ccf75b863 100644
--- a/sys/dev/firewire/if_fwip.c
+++ b/sys/dev/firewire/if_fwip.c
@@ -341,10 +341,6 @@ fwip_init(void *arg)
 	if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
 	if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
 
-#if 0
-	/* attempt to start output */
-	fwip_start(ifp);
-#endif
 }
 
 static int
@@ -488,9 +484,6 @@ fwip_async_output(struct fwip_softc *fwip, if_t ifp)
 		xfer = STAILQ_FIRST(&fwip->xferlist);
 		if (xfer == NULL) {
 			FWIP_UNLOCK(fwip);
-#if 0
-			printf("if_fwip: lack of xfer\n");
-#endif
 			break;
 		}
 		STAILQ_REMOVE_HEAD(&fwip->xferlist, link);
@@ -633,10 +626,6 @@ fwip_async_output(struct fwip_softc *fwip, if_t ifp)
 			i++;
 		}
 	}
-#if 0
-	if (i > 1)
-		printf("%d queued\n", i);
-#endif
 	if (i > 0)
 		xferq->start(fc);
 }
diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c
index d8c5f2dd68b7..81f4ac50f5cf 100644
--- a/sys/dev/firewire/sbp.c
+++ b/sys/dev/firewire/sbp.c
@@ -153,9 +153,6 @@ struct sbp_ocb {
 struct sbp_dev {
 #define SBP_DEV_RESET		0	/* accept login */
 #define SBP_DEV_LOGIN		1	/* to login */
-#if 0
-#define SBP_DEV_RECONN		2	/* to reconnect */
-#endif
 #define SBP_DEV_TOATTACH	3	/* to attach */
 #define SBP_DEV_PROBE		4	/* scan lun */
 #define SBP_DEV_ATTACHED	5	/* in operation */
@@ -223,9 +220,6 @@ struct sbp_softc {
 static void sbp_post_explore (void *);
 static void sbp_recv (struct fw_xfer *);
 static void sbp_mgm_callback (struct fw_xfer *);
-#if 0
-static void sbp_cmd_callback (struct fw_xfer *);
-#endif
 static void sbp_orb_pointer (struct sbp_dev *, struct sbp_ocb *);
 static void sbp_doorbell(struct sbp_dev *);
 static void sbp_execute_ocb (void *, bus_dma_segment_t *, int, int);
@@ -323,11 +317,6 @@ END_DEBUG
 
 	device_set_desc(dev, "SBP-2/SCSI over FireWire");
 
-#if 0
-	if (bootverbose)
-		debug = bootverbose;
-#endif
-
 	return (0);
 }
 
@@ -368,11 +357,6 @@ static struct {
 	struct fw_eui64 eui;
 } wired[] = {
 	/* Bus	Target	EUI64 */
-#if 0
-	{0,	2,	{0x00018ea0, 0x01fd0154}},	/* Logitec HDD */
-	{0,	0,	{0x00018ea6, 0x00100682}},	/* Logitec DVD */
-	{0,	1,	{0x00d03200, 0xa412006a}},	/* Yano HDD */
-#endif
 	{-1,	-1,	{0,0}}
 };
 
@@ -1566,25 +1550,15 @@ END_DEBUG
 	inq = (struct scsi_inquiry_data *) ccb->csio.data_ptr;
 	switch (SID_TYPE(inq)) {
 	case T_DIRECT:
-#if 0
-		/*
-		 * XXX Convert Direct Access device to RBC.
-		 * I've never seen FireWire DA devices which support READ_6.
-		 */
-		if (SID_TYPE(inq) == T_DIRECT)
-			inq->device |= T_RBC; /*  T_DIRECT == 0 */
-#endif
 		/* fall through */
 	case T_RBC:
 		/*
 		 * Override vendor/product/revision information.
 		 * Some devices sometimes return strange strings.
 		 */
-#if 1
 		bcopy(sdev->vendor, inq->vendor, sizeof(inq->vendor));
 		bcopy(sdev->product, inq->product, sizeof(inq->product));
 		bcopy(sdev->revision + 2, inq->revision, sizeof(inq->revision));
-#endif
 		break;
 	}
 	/*
@@ -2220,11 +2194,6 @@ sbp_mgm_timeout(void *arg)
 		__func__, sdev->bustgtlun, (uint32_t)ocb->bus_addr);
 	target->mgm_ocb_cur = NULL;
 	sbp_free_ocb(sdev, ocb);
-#if 0
-	/* XXX */
-	printf("run next request\n");
-	sbp_mgm_orb(sdev, ORB_FUN_RUNQUEUE, NULL);
-#endif
 	device_printf(sdev->target->sbp->fd.dev,
 		"%s:%s reset start\n",
 		__func__, sdev->bustgtlun);
@@ -2255,16 +2224,6 @@ sbp_timeout(void *arg)
 	case 3:
 		sbp_target_reset(sdev, sdev->timeout - 1);
 		break;
-#if 0
-	default:
-		/* XXX give up */
-		sbp_cam_detach_target(target);
-		if (target->luns != NULL)
-			free(target->luns, M_SBP);
-		target->num_lun = 0;
-		target->luns = NULL;
-		target->fwdev = NULL;
-#endif
 	}
 }
 
@@ -2388,19 +2347,6 @@ END_DEBUG
 			xpt_done(ccb);
 			return;
 		}
-#if 0
-		/* if we are in probe stage, pass only probe commands */
-		if (sdev->status == SBP_DEV_PROBE) {
-			char *name;
-			name = xpt_path_periph(ccb->ccb_h.path)->periph_name;
-			printf("probe stage, periph name: %s\n", name);
-			if (strcmp(name, "probe") != 0) {
-				ccb->ccb_h.status = CAM_REQUEUE_REQ;
-				xpt_done(ccb);
-				return;
-			}
-		}
-#endif
 		if ((ocb = sbp_get_ocb(sdev)) == NULL) {
 			ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
 			if (sdev->freeze == 0) {
diff --git a/sys/dev/firewire/sbp_targ.c b/sys/dev/firewire/sbp_targ.c
index cd4b3eb3b537..5c0897a2b570 100644
--- a/sys/dev/firewire/sbp_targ.c
+++ b/sys/dev/firewire/sbp_targ.c
@@ -526,12 +526,6 @@ static void
 sbp_targ_send_lstate_events(struct sbp_targ_softc *sc,
     struct sbp_targ_lstate *lstate)
 {
-#if 0
-	struct ccb_hdr *ccbh;
-	struct ccb_immediate_notify *inot;
-
-	printf("%s: not implemented yet\n", __func__);
-#endif
 }
 
 
@@ -707,24 +701,6 @@ process_scsi_status:
 		sbp_cmd_status->status = ccb->csio.scsi_status;
 		sense = &ccb->csio.sense_data;
 
-#if 0		/* XXX What we should do? */
-#if 0
-		sbp_targ_abort(orbi->sc, STAILQ_NEXT(orbi, link));
-#else
-		norbi = STAILQ_NEXT(orbi, link);
-		while (norbi) {
-			printf("%s: status=%d\n", __func__, norbi->state);
-			if (norbi->ccb != NULL) {
-				norbi->ccb->ccb_h.status = CAM_REQ_ABORTED;
*** 35 LINES SKIPPED ***


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a5ea62d.320bc.600e19c2>