Date: Sun, 9 Sep 2007 16:35:43 GMT From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 126229 for review Message-ID: <200709091635.l89GZhHk045827@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=126229 Change 126229 by gonzo@gonzo_jeeves on 2007/09/09 16:35:08 o Implement bus_dmamap_load_mbuf_sg Affected files ... .. //depot/projects/mips2/src/sys/mips/mips/busdma_machdep.c#6 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips/busdma_machdep.c#6 (text+ko) ==== @@ -672,8 +672,37 @@ { int error = 0; - panic("Unimplemented %s at %s:%d\n", __func__, __FILE__, __LINE__); + M_ASSERTPKTHDR(m0); + + flags |= BUS_DMA_NOWAIT; + *nsegs = -1; + map->flags &= ~DMAMAP_TYPE_MASK; + map->flags |= DMAMAP_MBUF | DMAMAP_COHERENT; + map->buffer = m0; + map->len = 0; + + if (m0->m_pkthdr.len <= dmat->maxsize) { + vm_offset_t lastaddr = 0; + struct mbuf *m; + + for (m = m0; m != NULL && error == 0; m = m->m_next) { + if (m->m_len > 0) { + error = bus_dmamap_load_buffer(dmat, segs, map, + m->m_data, m->m_len, + pmap_kernel(), flags, &lastaddr, nsegs); + map->len += m->m_len; + } + } + } else { + error = EINVAL; + } + + ++*nsegs; + CTR5(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d nsegs %d", + __func__, dmat, dmat->flags, error, *nsegs); + return (error); + } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709091635.l89GZhHk045827>