Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm Add a _BUS_DMAMAP_NOALLOC which tells bus_dmame...



details:   https://anonhg.NetBSD.org/src/rev/d289cea02eec
branches:  trunk
changeset: 784393:d289cea02eec
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Jan 27 18:31:31 2013 +0000

description:
Add a _BUS_DMAMAP_NOALLOC which tells bus_dmamem_alloc to skip that
dmarange when allocating memory.
Add a second dmarange to bcm23xx obio to allow it to map coherently mapped
memory.

diffstat:

 sys/arch/arm/arm32/bus_dma.c         |   7 ++++---
 sys/arch/arm/broadcom/bcm2835_obio.c |  19 +++++++++++--------
 sys/arch/arm/include/bus_defs.h      |   7 ++++---
 3 files changed, 19 insertions(+), 14 deletions(-)

diffs (96 lines):

diff -r af82608a2c90 -r d289cea02eec sys/arch/arm/arm32/bus_dma.c
--- a/sys/arch/arm/arm32/bus_dma.c      Sun Jan 27 17:48:38 2013 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c      Sun Jan 27 18:31:31 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.69 2013/01/27 17:48:38 matt Exp $        */
+/*     $NetBSD: bus_dma.c,v 1.70 2013/01/27 18:31:31 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.69 2013/01/27 17:48:38 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.70 2013/01/27 18:31:31 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1132,7 +1132,8 @@
        if ((dr = t->_ranges) != NULL) {
                error = ENOMEM;
                for (i = 0; i < t->_nranges; i++, dr++) {
-                       if (dr->dr_len == 0)
+                       if (dr->dr_len == 0
+                           || (dr->dr_flags & _BUS_DMAMAP_NOALLOC))
                                continue;
                        error = _bus_dmamem_alloc_range(t, size, alignment,
                            boundary, segs, nsegs, rsegs, flags,
diff -r af82608a2c90 -r d289cea02eec sys/arch/arm/broadcom/bcm2835_obio.c
--- a/sys/arch/arm/broadcom/bcm2835_obio.c      Sun Jan 27 17:48:38 2013 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_obio.c      Sun Jan 27 18:31:31 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_obio.c,v 1.15 2013/01/27 17:44:39 matt Exp $   */
+/*     $NetBSD: bcm2835_obio.c,v 1.16 2013/01/27 18:31:32 matt Exp $   */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_obio.c,v 1.15 2013/01/27 17:44:39 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_obio.c,v 1.16 2013/01/27 18:31:32 matt Exp $");
 
 #include "locators.h"
 #include "obio.h"
@@ -47,7 +47,7 @@
 struct obio_softc {
        device_t                sc_dev;
        bus_dma_tag_t           sc_dmat;
-       struct arm32_dma_range  sc_dmarange;
+       struct arm32_dma_range  sc_dmarange[2];
        bus_space_tag_t         sc_iot;
        bus_space_handle_t      sc_ioh;
        bus_addr_t              sc_base;
@@ -180,11 +180,14 @@
        sc->sc_dev = self;
        sc->sc_dmat = &bcm2835_bus_dma_tag;
 
-       sc->sc_dmarange.dr_sysbase = 0;
-       sc->sc_dmarange.dr_busbase = BCM2835_BUSADDR_CACHE_COHERENT;
-       sc->sc_dmarange.dr_len = physmem * PAGE_SIZE;
-       bcm2835_bus_dma_tag._ranges = &sc->sc_dmarange;
-       bcm2835_bus_dma_tag._nranges = 1;
+       sc->sc_dmarange[0].dr_sysbase = 0;
+       sc->sc_dmarange[0].dr_busbase = BCM2835_BUSADDR_CACHE_COHERENT;
+       sc->sc_dmarange[0].dr_len = physmem * PAGE_SIZE;
+       sc->sc_dmarange[1] = sc->sc_dmarange[0];
+       sc->sc_dmarange[1].dr_sysbase = BCM2835_BUSADDR_CACHE_COHERENT;
+       sc->sc_dmarange[1].dr_flags = _BUS_DMAMAP_NOALLOC;
+       bcm2835_bus_dma_tag._ranges = sc->sc_dmarange;
+       bcm2835_bus_dma_tag._nranges = __arraycount(sc->sc_dmarange);
 
        aprint_normal("\n");
 
diff -r af82608a2c90 -r d289cea02eec sys/arch/arm/include/bus_defs.h
--- a/sys/arch/arm/include/bus_defs.h   Sun Jan 27 17:48:38 2013 +0000
+++ b/sys/arch/arm/include/bus_defs.h   Sun Jan 27 18:31:31 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_defs.h,v 1.6 2013/01/27 17:38:55 matt Exp $        */
+/*     $NetBSD: bus_defs.h,v 1.7 2013/01/27 18:31:31 matt Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -300,8 +300,9 @@
  * Private flags stored in the DMA map.
  */
 #define        _BUS_DMAMAP_COHERENT    0x10000 /* no cache flush necessary on sync */
-#define        _BUS_DMAMAP_IS_BOUNCING 0x20000 /* is bouncing current xfer */
-#define        _BUS_DMAMAP_MEM_XLATE   0x40000 /* translate sys->bus for dmamam_map */
+#define        _BUS_DMAMAP_IS_BOUNCING 0x20000 /* is bouncing current xfer */
+#define        _BUS_DMAMAP_MEM_XLATE   0x40000 /* translate sys->bus for dmamam_map */
+#define        _BUS_DMAMAP_NOALLOC     0x80000 /* don't alloc memory from this range */
 
 /* Forwards needed by prototypes below. */
 struct mbuf;



Home | Main Index | Thread Index | Old Index