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.
This commit is contained in:
parent
fece6942a1
commit
8684f0c4a8
@ -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 @@ _bus_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
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,
|
||||
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: bcm2835_obio.c,v 1.15 2013/01/27 17:44:39 matt Exp $
|
||||
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 @@ obio_attach(device_t parent, device_t self, void *aux)
|
||||
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");
|
||||
|
||||
|
@ -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 @@ struct bus_space {
|
||||
* 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;
|
||||
|
Loading…
Reference in New Issue
Block a user