DPRINTF(DBG_LOG|DBG_TIME|DBG_FUNC|DBG_L_V1, ("tcode=0x%x, dlen=%d", pkt->fp_tcode, pkt->fp_dlen)); for (i = 0; (DBG_FLAGS_VAR(fwohci) & DBG_L_BUFFER) && i < pkt->fp_hlen/4; i++) DPRINTF(DBG_LOG|DBG_NOLF|DBG_L_BUFFER, ("%s %08x", i?"":"   ", pkt->fp_hdr[i])); DPRINTF(DBG_LOG|DBG_L_BUFFER, (" $"));
DPRINTFN(1, ("tcode=0x%x, dlen=%d\n", pkt->fp_tcode, pkt->fp_dlen)); for (i = 0; fwohcidebug > 5 && i < pkt->fp_hlen/4; i++) DPRINTFN(5, ("%s %08x", i?"":"   ", pkt->fp_hdr[i])); DPRINTFN(5, (" $\n"));
fwohci_if_input(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt){	int n, len;	struct mbuf *m;	struct iovec *iov;	void (*handler)(struct device *, struct mbuf *) = arg;#if	defined(FWOHCI_DEBUG) && !defined(SMALL_KERNEL)	int i;	DPRINTF(DBG_LOG|DBG_TIME|DBG_FUNC|DBG_L_V1,	   ("tcode=0x%x, dlen=%d", pkt->fp_tcode, pkt->fp_dlen));	for (i = 0; (DBG_FLAGS_VAR(fwohci) & DBG_L_BUFFER) &&	     i < pkt->fp_hlen/4; i++)		DPRINTF(DBG_LOG|DBG_NOLF|DBG_L_BUFFER,		    ("%s %08x", i?"":"   ", pkt->fp_hdr[i]));	DPRINTF(DBG_LOG|DBG_L_BUFFER, (" $"));	if (pkt->fp_dlen) {		for (n = 0, len = pkt->fp_dlen; len > 0; len -= i, n++){			iov = &pkt->fp_iov[n];			for (i = 0; (DBG_FLAGS_VAR(fwohci) & DBG_L_BUFFER) &&			     i < iov->iov_len; i++)				DPRINTF(DBG_LOG|DBG_NOLF|DBG_L_BUFFER,				   ("%s%02x", i&31?i&3?"":" ":i?"\n    ":"    ",				    ((u_int8_t *)iov->iov_base)[i]));			DPRINTF(DBG_LOG|DBG_L_BUFFER, (" $"));		}	}#endif	/* FWOHCI_DEBUG */	len = pkt->fp_dlen;	MGETHDR(m, M_DONTWAIT, MT_DATA);	if (m == NULL)		return IEEE1394_RCODE_COMPLETE;	m->m_len = 16;	if (len + m->m_len > MHLEN) {		MCLGET(m, M_DONTWAIT);		if ((m->m_flags & M_EXT) == 0) {			m_freem(m);			MPRINTF("m_freem", m);			return IEEE1394_RCODE_COMPLETE;		}	}	n = (pkt->fp_hdr[1] >> 16) & OHCI_NodeId_NodeNumber;	if (sc->sc_uidtbl == NULL || n > sc->sc_rootid ||	    sc->sc_uidtbl[n].fu_valid != 0x3) {		printf("%s: packet from unknown node: phy id %d\n",		    sc->sc_sc1394.sc1394_dev.dv_xname, n);		m_freem(m);		MPRINTF("m_freem", m);		fwohci_uid_req(sc, n);		return IEEE1394_RCODE_COMPLETE;	}	bcopy(sc->sc_uidtbl[n].fu_uid, mtod(m, caddr_t), 8);	if (pkt->fp_tcode == IEEE1394_TCODE_ISOCHRONOUS_DATABLOCK) {		m->m_flags |= M_BCAST;		mtod(m, u_int32_t *)[2] = mtod(m, u_int32_t *)[3] = 0;	} else {		mtod(m, u_int32_t *)[2] = htonl(pkt->fp_hdr[1]);		mtod(m, u_int32_t *)[3] = htonl(pkt->fp_hdr[2]);	}	mtod(m, u_int8_t *)[8] = n;	/*XXX: Node id for debug. */	mtod(m, u_int8_t *)[9] = OHCI_BITVAL(*pkt->fp_trail, OHCI_CTXCTL_SPD);	m->m_pkthdr.rcvif = NULL;	/* set in child */	m->m_pkthdr.len = len + m->m_len;	/*	 * We may use receive buffer by external mbuf instead of copy here.	 * But asynchronous receive buffer must be operate in buffer fill	 * mode, so that each receive buffer will shared by multiple mbufs.	 * If upper layer doesn't free mbuf soon, e.g. application program	 * is suspended, buffer must be reallocated.	 * Isochronous buffer must be operate in packet buffer mode, and	 * it is easy to map receive buffer to external mbuf. But it is	 * used for broadcast/multicast only, and is expected not so	 * performance sensitive for now.	 * XXX: The performance may be important for multicast case,	 * so we should revisit here later.	 *						-- onoe	 */	n = 0;	iov = pkt->fp_uio.uio_iov;	while (len > 0) {		bcopy(iov->iov_base, mtod(m, caddr_t) + m->m_len,		    iov->iov_len);		m->m_len += iov->iov_len;		len -= iov->iov_len;		iov++;	}	(*handler)(sc->sc_sc1394.sc1394_if, m);	return IEEE1394_RCODE_COMPLETE;}