summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authoronoe <onoe@NetBSD.org>2001-07-02 10:46:03 +0000
committeronoe <onoe@NetBSD.org>2001-07-02 10:46:03 +0000
commita924a0db99889e2ef9a3c3e8b98207f58df3935a (patch)
tree6e2971fb828fd8d5509ca6fb22939188cc4fa4f0 /sys/dev
parent3a2ef358d9940efde0df8e667d4cbabf16ce115e (diff)
set/reset low level receive handler according to IFF_UP flag of network
interface.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ieee1394/fwohci.c18
-rw-r--r--sys/dev/ieee1394/if_fw.c17
2 files changed, 26 insertions, 9 deletions
diff --git a/sys/dev/ieee1394/fwohci.c b/sys/dev/ieee1394/fwohci.c
index 7c25c9c4725..d73596c312b 100644
--- a/sys/dev/ieee1394/fwohci.c
+++ b/sys/dev/ieee1394/fwohci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fwohci.c,v 1.37 2001/07/02 02:26:40 onoe Exp $ */
+/* $NetBSD: fwohci.c,v 1.38 2001/07/02 10:46:03 onoe Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -889,8 +889,12 @@ fwohci_ctx_alloc(struct fwohci_softc *sc, struct fwohci_ctx **fcp,
return 0;
fail:
- while (i-- > 0)
- fwohci_buf_free(sc, --fb);
+ while (i-- > 0) {
+ fb--;
+ if (fb->fb_desc)
+ fwohci_desc_put(sc, fb->fb_desc, 1);
+ fwohci_buf_free(sc, fb);
+ }
free(fc, M_DEVBUF);
return error;
}
@@ -906,6 +910,8 @@ fwohci_ctx_free(struct fwohci_softc *sc, struct fwohci_ctx *fc)
NULL, NULL);
while ((fb = TAILQ_FIRST(&fc->fc_buf)) != NULL) {
TAILQ_REMOVE(&fc->fc_buf, fb, fb_list);
+ if (fb->fb_desc)
+ fwohci_desc_put(sc, fb->fb_desc, 1);
fwohci_buf_free(sc, fb);
}
free(fc, M_DEVBUF);
@@ -1379,6 +1385,8 @@ fwohci_handler_set(struct fwohci_softc *sc,
free(fh, M_DEVBUF);
}
if (tcode == IEEE1394_TCODE_STREAM_DATA) {
+ OHCI_SYNC_RX_DMA_WRITE(sc, fc->fc_ctx,
+ OHCI_SUBREG_ContextControlClear, OHCI_CTXCTL_RUN);
sc->sc_ctx_ir[fc->fc_ctx] = NULL;
fwohci_ctx_free(sc, fc);
}
@@ -2501,10 +2509,10 @@ fwohci_if_inreg(struct device *self, u_int32_t offhi, u_int32_t offlo,
struct fwohci_softc *sc = (struct fwohci_softc *)self;
fwohci_handler_set(sc, IEEE1394_TCODE_WRITE_REQ_BLOCK, offhi, offlo,
- fwohci_if_input, handler);
+ handler ? fwohci_if_input : NULL, handler);
fwohci_handler_set(sc, IEEE1394_TCODE_STREAM_DATA,
sc->sc_csr[CSR_SB_BROADCAST_CHANNEL] & OHCI_NodeId_NodeNumber,
- IEEE1394_TAG_GASP, fwohci_if_input, handler);
+ IEEE1394_TAG_GASP, handler ? fwohci_if_input : NULL, handler);
return 0;
}
diff --git a/sys/dev/ieee1394/if_fw.c b/sys/dev/ieee1394/if_fw.c
index f4e35a31354..3ab8919787c 100644
--- a/sys/dev/ieee1394/if_fw.c
+++ b/sys/dev/ieee1394/if_fw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_fw.c,v 1.9 2001/06/29 14:46:54 onoe Exp $ */
+/* $NetBSD: if_fw.c,v 1.10 2001/07/02 10:46:03 onoe Exp $ */
/* XXX ALTQ XXX */
@@ -168,9 +168,6 @@ fw_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
if_attach(ifp);
ieee1394_ifattach(ifp, &sc->sc_ic.ic_hwaddr);
- (*psc->sc1394_ifinreg)
- (sc->sc_sc1394.sc1394_dev.dv_parent, FW_FIFO_HI, FW_FIFO_LO,
- fw_input);
sc->sc_flags |= FWF_ATTACHED;
@@ -275,7 +272,13 @@ fw_txint(struct device *self, struct mbuf *m0)
int
fw_init(struct ifnet *ifp)
{
+ struct fw_softc *sc = (struct fw_softc *)ifp->if_softc;
+ struct ieee1394_softc *psc =
+ (struct ieee1394_softc *)sc->sc_sc1394.sc1394_dev.dv_parent;
+ (*psc->sc1394_ifinreg)
+ (sc->sc_sc1394.sc1394_dev.dv_parent, FW_FIFO_HI, FW_FIFO_LO,
+ fw_input);
ifp->if_flags |= IFF_RUNNING;
return 0;
}
@@ -283,8 +286,14 @@ fw_init(struct ifnet *ifp)
void
fw_stop(struct ifnet *ifp, int disable)
{
+ struct fw_softc *sc = (struct fw_softc *)ifp->if_softc;
+ struct ieee1394_softc *psc =
+ (struct ieee1394_softc *)sc->sc_sc1394.sc1394_dev.dv_parent;
struct mbuf *m;
+ (*psc->sc1394_ifinreg)
+ (sc->sc_sc1394.sc1394_dev.dv_parent, FW_FIFO_HI, FW_FIFO_LO,
+ NULL);
for (;;) {
IF_DEQUEUE(&ifp->if_snd, m);
if (m == NULL)