Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/arm32 bounce buffer fixes + convert some kasser...



details:   https://anonhg.NetBSD.org/src/rev/18d26490eb63
branches:  trunk
changeset: 784904:18d26490eb63
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Feb 13 23:08:45 2013 +0000

description:
bounce buffer fixes + convert some kassert -> kassertmsg

diffstat:

 sys/arch/arm/arm32/bus_dma.c |  24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diffs (80 lines):

diff -r 392432fe1b2b -r 18d26490eb63 sys/arch/arm/arm32/bus_dma.c
--- a/sys/arch/arm/arm32/bus_dma.c      Wed Feb 13 22:28:41 2013 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c      Wed Feb 13 23:08:45 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.73 2013/02/04 13:26:19 macallan Exp $    */
+/*     $NetBSD: bus_dma.c,v 1.74 2013/02/13 23:08:45 matt Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define _ARM32_BUS_DMA_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.73 2013/02/04 13:26:19 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.74 2013/02/13 23:08:45 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -451,7 +451,9 @@
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
        map->_dm_buftype = _BUS_DMA_BUFTYPE_INVALID;
-       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+       KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+           "dm_maxsegsz %lu _dm_maxmaxsegsz %lu",
+           map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
        if (buflen > map->_dm_size)
                return (EINVAL);
@@ -518,7 +520,9 @@
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
        map->_dm_buftype = _BUS_DMA_BUFTYPE_INVALID;
-       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+       KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+           "dm_maxsegsz %lu _dm_maxmaxsegsz %lu",
+           map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 #ifdef DIAGNOSTIC
        if ((m0->m_flags & M_PKTHDR) == 0)
@@ -640,7 +644,9 @@
         */
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
-       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+       KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+           "dm_maxsegsz %lu _dm_maxmaxsegsz %lu",
+           map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
        resid = uio->uio_resid;
        iov = uio->uio_iov;
@@ -957,7 +963,7 @@
         *      POSTWRITE -- Nothing.
         */
 #ifdef _ARM32_NEED_BUS_DMA_BOUNCE
-       const bool bouncing = (map->_dm_flags & _BUS_DMA_IS_BOUNCING);
+       const bool bouncing = (map->_dm_flags & _BUS_DMAMAP_IS_BOUNCING);
 #else
        const bool bouncing = false;
 #endif
@@ -971,7 +977,8 @@
        if (!bouncing && pre_ops == 0 && post_ops == BUS_DMASYNC_POSTWRITE) {
                return;
        }
-       KASSERT(pre_ops != 0 || (post_ops & BUS_DMASYNC_POSTREAD));
+       KASSERTMSG(bouncing || pre_ops != 0 || (post_ops & BUS_DMASYNC_POSTREAD),
+           "pre_ops %#x post_ops %#x", pre_ops, post_ops);
 #ifdef _ARM32_NEED_BUS_DMA_BOUNCE
        if (bouncing && (ops & BUS_DMASYNC_PREWRITE)) {
                struct arm32_bus_dma_cookie * const cookie = map->_dm_cookie;
@@ -1009,7 +1016,8 @@
 #endif /* _ARM32_NEED_BUS_DMA_BOUNCE */
 
        /* Skip cache frobbing if mapping was COHERENT. */
-       if (!bouncing && (map->_dm_flags & _BUS_DMAMAP_COHERENT)) {
+       if (!bouncing && pre_ops == 0
+           && (map->_dm_flags & _BUS_DMAMAP_COHERENT)) {
                /* Drain the write buffer. */
                cpu_drain_writebuf();
                return;



Home | Main Index | Thread Index | Old Index