Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Add a dm_maxsegsz public member to bus_dmamap_t. T...



details:   https://anonhg.NetBSD.org/src/rev/5b0e7b145f99
branches:  trunk
changeset: 574685:5b0e7b145f99
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Mar 09 19:04:43 2005 +0000

description:
Add a dm_maxsegsz public member to bus_dmamap_t.  This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create).  dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.

diffstat:

 sys/arch/algor/algor/bus_dma.c               |  17 +++++++++++------
 sys/arch/algor/include/bus.h                 |   5 +++--
 sys/arch/alpha/common/bus_dma.c              |  17 +++++++++++------
 sys/arch/alpha/include/bus.h                 |   5 +++--
 sys/arch/arc/arc/bus_dma.c                   |  13 +++++++++----
 sys/arch/arc/include/bus.h                   |   5 +++--
 sys/arch/arc/jazz/bus_dma_jazz.c             |   6 +++---
 sys/arch/arm/arm32/bus_dma.c                 |  13 +++++++++----
 sys/arch/arm/include/bus.h                   |   5 +++--
 sys/arch/atari/include/bus.h                 |   5 +++--
 sys/arch/cobalt/cobalt/bus.c                 |  13 +++++++++----
 sys/arch/cobalt/include/bus.h                |   5 +++--
 sys/arch/dreamcast/dev/g2/gapspci_dma.c      |  10 +++++++---
 sys/arch/dreamcast/include/bus.h             |   5 +++--
 sys/arch/evbppc/evbppc/bus_dma.c             |  13 +++++++++----
 sys/arch/hp700/include/bus.h                 |   5 +++--
 sys/arch/hpcmips/hpcmips/bus_dma.c           |  13 +++++++++----
 sys/arch/hpcmips/include/bus.h               |   3 ++-
 sys/arch/hpcmips/include/bus_dma_hpcmips.h   |   4 ++--
 sys/arch/hpcsh/include/bus.h                 |   5 +++--
 sys/arch/m68k/include/bus_dma.h              |   5 +++--
 sys/arch/m68k/m68k/bus_dma.c                 |  15 ++++++++++-----
 sys/arch/macppc/include/bus.h                |   5 +++--
 sys/arch/macppc/macppc/bus_dma.c             |  13 +++++++++----
 sys/arch/mips/include/bus_dma.h              |   5 +++--
 sys/arch/mips/mips/bus_dma.c                 |  17 +++++++++++------
 sys/arch/mipsco/include/bus.h                |   5 +++--
 sys/arch/mipsco/mipsco/bus_dma.c             |  13 +++++++++----
 sys/arch/mvme68k/include/bus_dma.h           |   5 +++--
 sys/arch/mvme68k/mvme68k/bus_dma.c           |  15 ++++++++++-----
 sys/arch/newsmips/include/bus.h              |   5 +++--
 sys/arch/newsmips/newsmips/bus.c             |  13 +++++++++----
 sys/arch/ofppc/include/bus.h                 |   5 +++--
 sys/arch/playstation2/include/bus.h          |   5 +++--
 sys/arch/playstation2/playstation2/bus_dma.c |  13 +++++++++----
 sys/arch/pmax/include/bus.h                  |   5 +++--
 sys/arch/pmax/pmax/bus_dma.c                 |  13 +++++++++----
 sys/arch/powerpc/include/bus.h               |   5 +++--
 sys/arch/powerpc/marvell/bus_dma.c           |  13 +++++++++----
 sys/arch/powerpc/powerpc/bus_dma.c           |  15 ++++++++++-----
 sys/arch/sgimips/include/bus.h               |   5 +++--
 sys/arch/sh5/include/bus.h                   |   5 +++--
 sys/arch/sh5/sh5/bus_dma.c                   |  15 ++++++++++-----
 sys/arch/sparc/include/bus.h                 |   5 +++--
 sys/arch/sparc/sparc/machdep.c               |   9 ++++++---
 sys/arch/sparc64/include/bus.h               |   5 +++--
 sys/arch/sparc64/sparc64/machdep.c           |  19 +++++++++++++------
 sys/arch/sun68k/include/bus.h                |   5 +++--
 sys/arch/sun68k/sun68k/bus.c                 |   7 ++++---
 sys/arch/vax/include/bus.h                   |   5 +++--
 sys/arch/vax/vax/bus_dma.c                   |  13 +++++++++----
 sys/arch/x68k/include/bus.h                  |   5 +++--
 sys/arch/x68k/x68k/bus.c                     |  13 +++++++++----
 sys/arch/x86/include/bus.h                   |   5 +++--
 sys/arch/x86/x86/bus_dma.c                   |  13 +++++++++----
 55 files changed, 317 insertions(+), 169 deletions(-)

diffs (truncated from 2561 to 300 lines):

diff -r 23a853eecf64 -r 5b0e7b145f99 sys/arch/algor/algor/bus_dma.c
--- a/sys/arch/algor/algor/bus_dma.c    Wed Mar 09 19:02:22 2005 +0000
+++ b/sys/arch/algor/algor/bus_dma.c    Wed Mar 09 19:04:43 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.11 2005/03/09 04:23:33 simonb Exp $      */
+/*     $NetBSD: bus_dma.c,v 1.12 2005/03/09 19:04:43 matt Exp $        */
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.11 2005/03/09 04:23:33 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.12 2005/03/09 19:04:43 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -92,10 +92,11 @@
        map = (struct algor_bus_dmamap *)mapstore;
        map->_dm_size = size;
        map->_dm_segcnt = nsegments;
-       map->_dm_maxsegsz = maxsegsz;
+       map->_dm_maxmaxsegsz = maxsegsz;
        map->_dm_boundary = boundary;
        map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
        map->_dm_proc = NULL;
+       map->dm_maxsegsz = maxsegsz;
        map->dm_mapsize = 0;            /* no valid mappings */
        map->dm_nsegs = 0;
 
@@ -164,8 +165,8 @@
                sgsize = PAGE_SIZE - ((u_long)vaddr & PGOFSET);
                if (buflen < sgsize)
                        sgsize = buflen;
-               if (map->_dm_maxsegsz < sgsize)
-                       sgsize = map->_dm_maxsegsz;
+               if (map->dm_maxsegsz < sgsize)
+                       sgsize = map->dm_maxsegsz;
 
                /*
                 * Make sure we don't cross any boundaries.
@@ -188,7 +189,7 @@
                } else {
                        if (curaddr == lastaddr &&
                            (map->dm_segs[seg].ds_len + sgsize) <=
-                            map->_dm_maxsegsz &&
+                            map->dm_maxsegsz &&
                            (map->_dm_boundary == 0 ||
                             (map->dm_segs[seg].ds_addr & bmask) ==
                             (curaddr & bmask)))
@@ -242,6 +243,7 @@
         */
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
+       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
 
        if (buflen > map->_dm_size)
                return (EINVAL);
@@ -283,6 +285,7 @@
         */
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
+       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
 
 #ifdef DIAGNOSTIC
        if ((m0->m_flags & M_PKTHDR) == 0)
@@ -329,6 +332,7 @@
         */
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
+       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
 
        resid = uio->uio_resid;
        iov = uio->uio_iov;
@@ -390,6 +394,7 @@
         * No resources to free; just mark the mappings as
         * invalid.
         */
+       map->dm_maxsegsz = map->_dm_maxmaxsegsz;
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
        map->_dm_flags &= ~ALGOR_DMAMAP_COHERENT;
diff -r 23a853eecf64 -r 5b0e7b145f99 sys/arch/algor/include/bus.h
--- a/sys/arch/algor/include/bus.h      Wed Mar 09 19:02:22 2005 +0000
+++ b/sys/arch/algor/include/bus.h      Wed Mar 09 19:04:43 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus.h,v 1.8 2003/06/15 23:08:54 fvdl Exp $     */
+/*     $NetBSD: bus.h,v 1.9 2005/03/09 19:04:43 matt Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -627,7 +627,7 @@
         */
        bus_size_t      _dm_size;       /* largest DMA transfer mappable */
        int             _dm_segcnt;     /* number of segs this map can map */
-       bus_size_t      _dm_maxsegsz;   /* largest possible segment */
+       bus_size_t      _dm_maxmaxsegsz; /* fixed largest possible segment */
        bus_size_t      _dm_boundary;   /* don't cross this */
        int             _dm_flags;      /* misc. flags */
        struct proc     *_dm_proc;      /* proc that owns the mapping */
@@ -640,6 +640,7 @@
        /*
         * PUBLIC MEMBERS: these are used by machine-independent code.
         */
+       bus_size_t      dm_maxsegsz;    /* largest possible segment */
        bus_size_t      dm_mapsize;     /* size of the mapping */
        int             dm_nsegs;       /* # valid segments in mapping */
        bus_dma_segment_t dm_segs[1];   /* segments; variable length */
diff -r 23a853eecf64 -r 5b0e7b145f99 sys/arch/alpha/common/bus_dma.c
--- a/sys/arch/alpha/common/bus_dma.c   Wed Mar 09 19:02:22 2005 +0000
+++ b/sys/arch/alpha/common/bus_dma.c   Wed Mar 09 19:04:43 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.56 2005/03/09 04:23:33 simonb Exp $ */
+/* $NetBSD: bus_dma.c,v 1.57 2005/03/09 19:04:43 matt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.56 2005/03/09 04:23:33 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.57 2005/03/09 19:04:43 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -95,12 +95,13 @@
        map = (struct alpha_bus_dmamap *)mapstore;
        map->_dm_size = size;
        map->_dm_segcnt = nsegments;
-       map->_dm_maxsegsz = maxsegsz;
+       map->_dm_maxmaxsegsz = maxsegsz;
        if (t->_boundary != 0 && t->_boundary < boundary)
                map->_dm_boundary = t->_boundary;
        else
                map->_dm_boundary = boundary;
        map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
+       map->dm_maxsegsz = maxsegsz;
        map->dm_mapsize = 0;            /* no valid mappings */
        map->dm_nsegs = 0;
        map->_dm_window = NULL;
@@ -164,8 +165,8 @@
                sgsize = PAGE_SIZE - ((u_long)vaddr & PGOFSET);
                if (buflen < sgsize)
                        sgsize = buflen;
-               if (map->_dm_maxsegsz < sgsize)
-                       sgsize = map->_dm_maxsegsz;
+               if (map->dm_maxsegsz < sgsize)
+                       sgsize = map->dm_maxsegsz;
 
                /*
                 * Make sure we don't cross any boundaries.
@@ -188,7 +189,7 @@
                        if ((map->_dm_flags & DMAMAP_NO_COALESCE) == 0 &&
                            curaddr == lastaddr &&
                            (map->dm_segs[seg].ds_len + sgsize) <=
-                            map->_dm_maxsegsz &&
+                            map->dm_maxsegsz &&
                            (map->_dm_boundary == 0 ||
                             (map->dm_segs[seg].ds_addr & bmask) ==
                             (curaddr & bmask)))
@@ -241,6 +242,7 @@
         */
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
+       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
 
        if (buflen > map->_dm_size)
                return (EINVAL);
@@ -278,6 +280,7 @@
         */
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
+       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
 
 #ifdef DIAGNOSTIC
        if ((m0->m_flags & M_PKTHDR) == 0)
@@ -367,6 +370,7 @@
         */
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
+       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
 
        resid = uio->uio_resid;
        iov = uio->uio_iov;
@@ -433,6 +437,7 @@
         * No resources to free; just mark the mappings as
         * invalid.
         */
+       map->dm_maxsegsz = map->_dm_maxmaxsegsz;
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
        map->_dm_window = NULL;
diff -r 23a853eecf64 -r 5b0e7b145f99 sys/arch/alpha/include/bus.h
--- a/sys/arch/alpha/include/bus.h      Wed Mar 09 19:02:22 2005 +0000
+++ b/sys/arch/alpha/include/bus.h      Wed Mar 09 19:04:43 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.h,v 1.49 2003/06/15 23:08:54 fvdl Exp $ */
+/* $NetBSD: bus.h,v 1.50 2005/03/09 19:04:43 matt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -699,7 +699,7 @@
         */
        bus_size_t      _dm_size;       /* largest DMA transfer mappable */
        int             _dm_segcnt;     /* number of segs this map can map */
-       bus_size_t      _dm_maxsegsz;   /* largest possible segment */
+       bus_size_t      _dm_maxmaxsegsz; /* fixed largest possible segment */
        bus_size_t      _dm_boundary;   /* don't cross this */
        int             _dm_flags;      /* misc. flags */
 
@@ -716,6 +716,7 @@
        /*
         * PUBLIC MEMBERS: these are used by machine-independent code.
         */
+       bus_size_t      dm_maxsegsz;    /* largest possible segment */
        bus_size_t      dm_mapsize;     /* size of the mapping */
        int             dm_nsegs;       /* # valid segments in mapping */
        bus_dma_segment_t dm_segs[1];   /* segments; variable length */
diff -r 23a853eecf64 -r 5b0e7b145f99 sys/arch/arc/arc/bus_dma.c
--- a/sys/arch/arc/arc/bus_dma.c        Wed Mar 09 19:02:22 2005 +0000
+++ b/sys/arch/arc/arc/bus_dma.c        Wed Mar 09 19:04:43 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.22 2005/01/22 11:08:18 tsutsui Exp $     */
+/*     $NetBSD: bus_dma.c,v 1.23 2005/03/09 19:04:43 matt Exp $        */
 /*     NetBSD: bus_dma.c,v 1.20 2000/01/10 03:24:36 simonb Exp         */
 
 /*-
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.22 2005/01/22 11:08:18 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.23 2005/03/09 19:04:43 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -116,10 +116,11 @@
        map = (struct arc_bus_dmamap *)mapstore;
        map->_dm_size = size;
        map->_dm_segcnt = nsegments;
-       map->_dm_maxsegsz = maxsegsz;
+       map->_dm_maxmaxsegsz = maxsegsz;
        map->_dm_boundary = boundary;
        map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
        map->_dm_proc = NULL;
+       map->dm_maxsegsz = maxsegsz;
        map->dm_mapsize = 0;            /* no valid mappings */
        map->dm_nsegs = 0;
 
@@ -197,7 +198,7 @@
                } else {
                        if (curaddr == lastaddr &&
                            (map->dm_segs[seg].ds_len + sgsize) <=
-                            map->_dm_maxsegsz &&
+                            map->dm_maxsegsz &&
                            (map->_dm_boundary == 0 ||
                             (map->dm_segs[seg]._ds_paddr & bmask) ==
                             (curaddr & bmask)))
@@ -246,6 +247,7 @@
         */
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
+       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
 
        if (buflen > map->_dm_size)
                return EINVAL;
@@ -287,6 +289,7 @@
         */
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
+       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
 
 #ifdef DIAGNOSTIC
        if ((m0->m_flags & M_PKTHDR) == 0)
@@ -333,6 +336,7 @@
         */
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
+       KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
 
        resid = uio->uio_resid;
        iov = uio->uio_iov;
@@ -393,6 +397,7 @@
         * No resources to free; just mark the mappings as
         * invalid.
         */
+       map->dm_maxsegsz = map->_dm_maxmaxsegsz;
        map->dm_mapsize = 0;
        map->dm_nsegs = 0;
        map->_dm_flags &= ~ARC_DMAMAP_COHERENT;
diff -r 23a853eecf64 -r 5b0e7b145f99 sys/arch/arc/include/bus.h
--- a/sys/arch/arc/include/bus.h        Wed Mar 09 19:02:22 2005 +0000
+++ b/sys/arch/arc/include/bus.h        Wed Mar 09 19:04:43 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus.h,v 1.17 2005/01/22 07:35:34 tsutsui Exp $ */
+/*     $NetBSD: bus.h,v 1.18 2005/03/09 19:04:43 matt Exp $    */
 /*     NetBSD: bus.h,v 1.27 2000/03/15 16:44:50 drochner Exp   */
 /*     $OpenBSD: bus.h,v 1.15 1999/08/11 23:15:21 niklas Exp $ */



Home | Main Index | Thread Index | Old Index