diff options
| author | Maxime Henrion <mux@FreeBSD.org> | 2003-07-27 13:52:10 +0000 |
|---|---|---|
| committer | Maxime Henrion <mux@FreeBSD.org> | 2003-07-27 13:52:10 +0000 |
| commit | d5afecd06846870c41e2850d88fa9a34d67382fa (patch) | |
| tree | a4a7889831600966a860a57cdff8cfd02bf4f17f /sys/alpha | |
| parent | f5eb4a6a5ed7da44b8aa9611539048dd79aca014 (diff) | |
Notes
Diffstat (limited to 'sys/alpha')
| -rw-r--r-- | sys/alpha/alpha/busdma_machdep.c | 19 | ||||
| -rw-r--r-- | sys/alpha/include/bus.h | 1 |
2 files changed, 12 insertions, 8 deletions
diff --git a/sys/alpha/alpha/busdma_machdep.c b/sys/alpha/alpha/busdma_machdep.c index d743e8da1d0d..279d3a68f209 100644 --- a/sys/alpha/alpha/busdma_machdep.c +++ b/sys/alpha/alpha/busdma_machdep.c @@ -413,24 +413,29 @@ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, bus_dmamap_t *mapp) { + int mflags; + + if (flags & BUS_DMA_NOWAIT) + mflags = M_NOWAIT; + else + mflags = M_WAITOK; + if (flags & BUS_DMA_ZERO) + mflags |= M_ZERO; + /* If we succeed, no mapping/bouncing will be required */ *mapp = &nobounce_dmamap; if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) { - *vaddr = malloc(dmat->maxsize, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK); + *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); } else { /* * XXX Use Contigmalloc until it is merged into this facility * and handles multi-seg allocations. Nobody is doing * multi-seg allocations yet though. */ - mtx_lock(&Giant); - *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK, + *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, dmat->boundary); - mtx_unlock(&Giant); } if (*vaddr == NULL) return (ENOMEM); @@ -894,13 +899,11 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) if (bpage == NULL) break; - mtx_lock(&Giant); bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0ul, dmat->lowaddr, PAGE_SIZE, dmat->boundary); - mtx_unlock(&Giant); if (bpage->vaddr == 0) { free(bpage, M_DEVBUF); break; diff --git a/sys/alpha/include/bus.h b/sys/alpha/include/bus.h index 582484c0b222..53eefd857541 100644 --- a/sys/alpha/include/bus.h +++ b/sys/alpha/include/bus.h @@ -470,6 +470,7 @@ void busspace_generic_barrier(struct alpha_busspace *space, #define BUS_DMA_NOWAIT 0x01 /* not safe to sleep */ #define BUS_DMA_ALLOCNOW 0x02 /* perform resource allocation now */ #define BUS_DMA_COHERENT 0x04 /* hint: map memory in a coherent way */ +#define BUS_DMA_ZERO 0x08 /* allocate zero'ed memory */ #define BUS_DMA_ISA 0x10 /* map memory for ISA dma */ #define BUS_DMA_BUS2 0x20 /* placeholders for bus functions... */ #define BUS_DMA_BUS3 0x40 |
