Module Name: src Committed By: cliff Date: Sat Apr 17 07:34:45 UTC 2010
Modified Files: src/sys/arch/mips/mips [matt-nb5-mips64]: bus_dma.c Log Message: - in _bus_dmamap_sync() replace complex/buggy mbuf bounce buffer copy code with simple call to m_copyback To generate a diff of this commit: cvs rdiff -u -r1.22.16.15 -r1.22.16.16 src/sys/arch/mips/mips/bus_dma.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mips/mips/bus_dma.c diff -u src/sys/arch/mips/mips/bus_dma.c:1.22.16.15 src/sys/arch/mips/mips/bus_dma.c:1.22.16.16 --- src/sys/arch/mips/mips/bus_dma.c:1.22.16.15 Fri Apr 16 23:42:25 2010 +++ src/sys/arch/mips/mips/bus_dma.c Sat Apr 17 07:34:45 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.22.16.15 2010/04/16 23:42:25 cliff Exp $ */ +/* $NetBSD: bus_dma.c,v 1.22.16.16 2010/04/17 07:34:45 cliff Exp $ */ /*- * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.22.16.15 2010/04/16 23:42:25 cliff Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.22.16.16 2010/04/17 07:34:45 cliff Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -843,33 +843,10 @@ (char *)cookie->id_bouncebuf + offset, len); break; - case _BUS_DMA_BUFTYPE_MBUF: { - struct mbuf *m = cookie->id_origmbuf; - char *dp = cookie->id_bouncebuf; - char * const ep = dp + offset + len; - - for (; offset >= m->m_len; m = m->m_next) { - offset -= m->m_len; - dp += m->m_len; - } - /* - * Copy the bounce buffer to the caller's buffer. - */ - for (; dp < ep; m = m->m_next) { - /* - * Now at the first mbuf to sync; nail - * each one until we have exhausted the - * length. - */ - minlen = ulmin(len, m->m_len - offset); - memcpy(mtod(m, char *) + offset, dp + offset, minlen); - - offset = 0; - len -= minlen; - dp += minlen; - } + case _BUS_DMA_BUFTYPE_MBUF: + m_copyback(cookie->id_origmbuf, offset, len, + (char *)cookie->id_bouncebuf + offset); break; - } case _BUS_DMA_BUFTYPE_UIO: _bus_dma_uiomove((char *)cookie->id_bouncebuf + offset, cookie->id_origuio, len, UIO_READ);