Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add support for link fragmentation and reassemble for IE...
details: https://anonhg.NetBSD.org/src/rev/53e0878d5f41
branches: trunk
changeset: 499190:53e0878d5f41
user: onoe <onoe%NetBSD.org@localhost>
date: Tue Nov 14 11:14:55 2000 +0000
description:
Add support for link fragmentation and reassemble for IEEE-1394.
XXX: drain is still not yet implemented, thus memory leak will occur
in case of any of fragment lost.
diffstat:
sys/dev/ieee1394/fwohci.c | 553 ++++++++++++++++++++++++++++--------------
sys/dev/ieee1394/fwohcivar.h | 6 +-
sys/net/if_ieee1394.h | 41 ++-
sys/net/if_ieee1394subr.c | 406 +++++++++++++++++++++++-------
4 files changed, 699 insertions(+), 307 deletions(-)
diffs (truncated from 1488 to 300 lines):
diff -r 6f8b1903e78d -r 53e0878d5f41 sys/dev/ieee1394/fwohci.c
--- a/sys/dev/ieee1394/fwohci.c Tue Nov 14 11:06:19 2000 +0000
+++ b/sys/dev/ieee1394/fwohci.c Tue Nov 14 11:14:55 2000 +0000
@@ -125,7 +125,7 @@
static void fwohci_uid_collect(struct fwohci_softc *);
static int fwohci_uid_input(struct fwohci_softc *, void *,
struct fwohci_pkt *);
-static int fwohci_uid_lookup(struct fwohci_softc *, u_int8_t *);
+static int fwohci_uid_lookup(struct fwohci_softc *, const u_int8_t *);
static int fwohci_if_inreg(struct device *, u_int32_t, u_int32_t,
void (*)(struct device *, struct mbuf *));
@@ -133,6 +133,11 @@
static int fwohci_if_output(struct device *, struct mbuf *,
void (*)(struct device *, struct mbuf *));
+#ifdef FW_DEBUG
+int fw_verbose = 0;
+int fw_dump = 0;
+#endif
+
int
fwohci_init(struct fwohci_softc *sc, const struct evcnt *ev)
{
@@ -306,52 +311,63 @@
OHCI_CSR_WRITE(sc, OHCI_REG_IntEventClear,
intmask & ~OHCI_Int_BusReset);
#ifdef FW_DEBUG
- printf("%s: intmask=0x%08x:", sc->sc_sc1394.sc1394_dev.dv_xname, intmask);
- if (intmask & OHCI_Int_CycleTooLong)
- printf(" CycleTooLong");
- if (intmask & OHCI_Int_UnrecoverableError)
- printf(" UnrecoverableError");
- if (intmask & OHCI_Int_CycleInconsistent)
- printf(" CycleInconsistent");
- if (intmask & OHCI_Int_BusReset)
- printf(" BusReset");
- if (intmask & OHCI_Int_SelfIDComplete)
- printf(" SelfIDComplete");
- if (intmask & OHCI_Int_LockRespErr)
- printf(" LockRespErr");
- if (intmask & OHCI_Int_PostedWriteErr)
- printf(" PostedWriteErr");
- if (intmask & OHCI_Int_ReqTxComplete)
- printf(" ReqTxComplete(0x%04x)",
- OHCI_ASYNC_DMA_READ(sc, OHCI_CTX_ASYNC_TX_REQUEST,
- OHCI_SUBREG_ContextControlClear));
- if (intmask & OHCI_Int_RespTxComplete)
- printf(" RespTxComplete(0x%04x)",
- OHCI_ASYNC_DMA_READ(sc, OHCI_CTX_ASYNC_TX_RESPONSE,
- OHCI_SUBREG_ContextControlClear));
- if (intmask & OHCI_Int_ARRS)
- printf(" ARRS(0x%04x)",
- OHCI_ASYNC_DMA_READ(sc, OHCI_CTX_ASYNC_RX_RESPONSE,
- OHCI_SUBREG_ContextControlClear));
- if (intmask & OHCI_Int_ARRQ)
- printf(" ARRQ(0x%04x)",
- OHCI_ASYNC_DMA_READ(sc, OHCI_CTX_ASYNC_RX_REQUEST,
- OHCI_SUBREG_ContextControlClear));
- if (intmask & OHCI_Int_IsochRx)
- printf(" IsochRx(0x%08x)",
- OHCI_CSR_READ(sc, OHCI_REG_IsoRecvIntEventClear));
- if (intmask & OHCI_Int_IsochTx)
- printf(" IsochTx(0x%08x)",
- OHCI_CSR_READ(sc, OHCI_REG_IsoXmitIntEventClear));
- if (intmask & OHCI_Int_RQPkt)
- printf(" RQPkt(0x%04x)",
- OHCI_ASYNC_DMA_READ(sc, OHCI_CTX_ASYNC_RX_REQUEST,
- OHCI_SUBREG_ContextControlClear));
- if (intmask & OHCI_Int_RSPkt)
- printf(" RSPkt(0x%04x)",
- OHCI_ASYNC_DMA_READ(sc, OHCI_CTX_ASYNC_RX_RESPONSE,
- OHCI_SUBREG_ContextControlClear));
- printf("\n");
+ if (fw_verbose) {
+ printf("%s: intmask=0x%08x:",
+ sc->sc_sc1394.sc1394_dev.dv_xname, intmask);
+ if (intmask & OHCI_Int_CycleTooLong)
+ printf(" CycleTooLong");
+ if (intmask & OHCI_Int_UnrecoverableError)
+ printf(" UnrecoverableError");
+ if (intmask & OHCI_Int_CycleInconsistent)
+ printf(" CycleInconsistent");
+ if (intmask & OHCI_Int_BusReset)
+ printf(" BusReset");
+ if (intmask & OHCI_Int_SelfIDComplete)
+ printf(" SelfIDComplete");
+ if (intmask & OHCI_Int_LockRespErr)
+ printf(" LockRespErr");
+ if (intmask & OHCI_Int_PostedWriteErr)
+ printf(" PostedWriteErr");
+ if (intmask & OHCI_Int_ReqTxComplete)
+ printf(" ReqTxComplete(0x%04x)",
+ OHCI_ASYNC_DMA_READ(sc,
+ OHCI_CTX_ASYNC_TX_REQUEST,
+ OHCI_SUBREG_ContextControlClear));
+ if (intmask & OHCI_Int_RespTxComplete)
+ printf(" RespTxComplete(0x%04x)",
+ OHCI_ASYNC_DMA_READ(sc,
+ OHCI_CTX_ASYNC_TX_RESPONSE,
+ OHCI_SUBREG_ContextControlClear));
+ if (intmask & OHCI_Int_ARRS)
+ printf(" ARRS(0x%04x)",
+ OHCI_ASYNC_DMA_READ(sc,
+ OHCI_CTX_ASYNC_RX_RESPONSE,
+ OHCI_SUBREG_ContextControlClear));
+ if (intmask & OHCI_Int_ARRQ)
+ printf(" ARRQ(0x%04x)",
+ OHCI_ASYNC_DMA_READ(sc,
+ OHCI_CTX_ASYNC_RX_REQUEST,
+ OHCI_SUBREG_ContextControlClear));
+ if (intmask & OHCI_Int_IsochRx)
+ printf(" IsochRx(0x%08x)",
+ OHCI_CSR_READ(sc,
+ OHCI_REG_IsoRecvIntEventClear));
+ if (intmask & OHCI_Int_IsochTx)
+ printf(" IsochTx(0x%08x)",
+ OHCI_CSR_READ(sc,
+ OHCI_REG_IsoXmitIntEventClear));
+ if (intmask & OHCI_Int_RQPkt)
+ printf(" RQPkt(0x%04x)",
+ OHCI_ASYNC_DMA_READ(sc,
+ OHCI_CTX_ASYNC_RX_REQUEST,
+ OHCI_SUBREG_ContextControlClear));
+ if (intmask & OHCI_Int_RSPkt)
+ printf(" RSPkt(0x%04x)",
+ OHCI_ASYNC_DMA_READ(sc,
+ OHCI_CTX_ASYNC_RX_RESPONSE,
+ OHCI_SUBREG_ContextControlClear));
+ printf("\n");
+ }
#endif /* FW_DEBUG */
if (intmask & OHCI_Int_BusReset) {
/*
@@ -660,8 +676,9 @@
if (val == 0 && ((*pkt->fp_trail & 0x001f0000) >> 16) ==
OHCI_CTXCTL_EVENT_BUS_RESET) {
#ifdef FW_DEBUG
- printf("fwohci_phy_input: BusReset: 0x%08x\n",
- pkt->fp_hdr[2]);
+ if (fw_verbose)
+ printf("fwohci_phy_input: BusReset: 0x%08x\n",
+ pkt->fp_hdr[2]);
#endif
} else {
printf("%s: phy packet corrupted (0x%08x, 0x%08x)\n",
@@ -675,41 +692,48 @@
switch (key) {
case 0:
#ifdef FW_DEBUG
- printf("fwohci_phy_input: PHY Config from %d:", phyid);
- if (val & 0x00800000)
- printf(" ForceRoot");
- if (val & 0x00400000)
- printf(" Gap=%x", (val & 0x003f0000) >> 16);
- printf("\n");
+ if (fw_verbose) {
+ printf("fwohci_phy_input: PHY Config from %d:", phyid);
+ if (val & 0x00800000)
+ printf(" ForceRoot");
+ if (val & 0x00400000)
+ printf(" Gap=%x", (val & 0x003f0000) >> 16);
+ printf("\n");
+ }
#endif
break;
case 1:
#ifdef FW_DEBUG
- printf("fwohci_phy_input: Link-on from %d\n", phyid);
+ if (fw_verbose)
+ printf("fwohci_phy_input: Link-on from %d\n", phyid);
#endif
break;
case 2:
#ifdef FW_DEBUG
- printf("fwohci_phy_input: SelfID from %d:", phyid);
- if (val & 0x00800000) {
- printf(" #%d", (val & 0x00700000) >> 20);
- } else {
- if (val & 0x00400000)
- printf(" LinkActive");
- printf(" Gap=%x", (val & 0x003f0000) >> 16);
- printf(" Spd=S%d", 100 << ((val & 0x0000c000) >> 14));
- if (val & 0x00000800)
- printf(" Cont");
- if (val & 0x00000002)
- printf(" InitiateBusReset");
+ if (fw_verbose) {
+ printf("fwohci_phy_input: SelfID from %d:", phyid);
+ if (val & 0x00800000) {
+ printf(" #%d", (val & 0x00700000) >> 20);
+ } else {
+ if (val & 0x00400000)
+ printf(" LinkActive");
+ printf(" Gap=%x", (val & 0x003f0000) >> 16);
+ printf(" Spd=S%d",
+ 100 << ((val & 0x0000c000) >> 14));
+ if (val & 0x00000800)
+ printf(" Cont");
+ if (val & 0x00000002)
+ printf(" InitiateBusReset");
+ }
+ if (val & 0x00000001)
+ printf(" +");
+ printf("\n");
}
- if (val & 0x00000001)
- printf(" +");
- printf("\n");
#endif
break;
default:
- printf("fwphci_phy_input: Unknown: 0x%08x\n", val);
+ printf("%s: unknown PHY packet: 0x%08x\n",
+ sc->sc_sc1394.sc1394_dev.dv_xname, val);
break;
}
}
@@ -1056,7 +1080,10 @@
again:
fd = fb->fb_desc;
#ifdef FW_DEBUG
-printf("fwohci_buf_pktget: desc %d, off %d, req %d, res %d\n", fd - sc->sc_desc, fb->fb_off, fd->fd_reqcount, fd->fd_rescount);
+ if (fw_verbose)
+ printf("fwohci_buf_pktget: desc %d, off %d, req %d, res %d\n",
+ fd - sc->sc_desc, fb->fb_off, fd->fd_reqcount,
+ fd->fd_rescount);
#endif
bufend = fd->fd_reqcount - fd->fd_rescount;
if (fb->fb_off >= bufend) {
@@ -1097,16 +1124,21 @@
sizeof(pkt->fp_trail));
if (len <= 0) {
#ifdef FW_DEBUG
- printf("fwohci_buf_input: no input (ppb) for %d\n",
- fc->fc_ctx);
+ if (fw_verbose)
+ printf("fwohci_buf_input: no input for ppd%d\n",
+ fc->fc_ctx);
#endif
return 0;
}
+ *pkt->fp_trail = (*pkt->fp_trail & 0xffff) |
+ (TAILQ_FIRST(&fc->fc_buf)->fb_desc->fd_status << 16);
}
len = fwohci_buf_pktget(sc, fc, &p, count);
if (len <= 0) {
#ifdef FW_DEBUG
- printf("fwohci_buf_input: no input for %d\n", fc->fc_ctx);
+ if (fw_verbose)
+ printf("fwohci_buf_input: no input for %d\n",
+ fc->fc_ctx);
#endif
return 0;
}
@@ -1148,8 +1180,9 @@
if (pkt->fp_hlen == 16)
pkt->fp_dlen = pkt->fp_hdr[3] >> 16;
#ifdef FW_DEBUG
- printf("fwohci_buf_input: tcode=0x%x, hlen=%d, dlen=%d\n",
- pkt->fp_tcode, pkt->fp_hlen, pkt->fp_dlen);
+ if (fw_verbose)
+ printf("fwohci_buf_input: tcode=0x%x, hlen=%d, dlen=%d\n",
+ pkt->fp_tcode, pkt->fp_hlen, pkt->fp_dlen);
#endif
/* get data */
@@ -1247,7 +1280,9 @@
fh->fh_handler = handler;
fh->fh_handarg = arg;
#ifdef FW_DEBUG
- printf("fwohci_handler_set: ctx %d, tcode %x, key1 0x%x, key2 0x%x\n", fc->fc_ctx, tcode, key1, key2);
+ if (fw_verbose)
+ printf("fwohci_handler_set: ctx %d, tcode %x, key 0x%x, 0x%x\n",
+ fc->fc_ctx, tcode, key1, key2);
#endif
if (tcode == IEEE1394_TCODE_STREAM_DATA) {
@@ -1255,7 +1290,9 @@
fwohci_ctx_init(sc, fc);
fb = TAILQ_FIRST(&fc->fc_buf);
#ifdef FW_DEBUG
- printf("fwohci_handler_set: SYNC desc %d\n", fb->fb_desc - sc->sc_desc);
+ if (fw_verbose)
+ printf("fwohci_handler_set: SYNC desc %d\n",
+ fb->fb_desc - sc->sc_desc);
#endif
OHCI_SYNC_RX_DMA_WRITE(sc, fc->fc_ctx, OHCI_SUBREG_CommandPtr,
fb->fb_daddr | 1);
@@ -1307,9 +1344,10 @@
if (fh == NULL) {
rcode = IEEE1394_RCODE_ADDRESS_ERROR;
#ifdef FW_DEBUG
- printf("fwohci_arrq_input: no listener: tcode 0x%x, "
- "addr=0x%04x %08x\n", pkt.fp_tcode,
- key1, key2);
+ if (fw_verbose)
+ printf("fwohci_arrq_input: no listener:"
+ " tcode 0x%x, addr=0x%04x %08x\n",
+ pkt.fp_tcode, key1, key2);
Home |
Main Index |
Thread Index |
Old Index