diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-07-11 09:36:27 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-07-11 09:36:27 +0000 |
commit | 9d682a4ae1ab248336807e15680bca44ff161e05 (patch) | |
tree | 507e0dcaf315952bacfdbc92a1523335193d9d1b /sys/arch/arm | |
parent | 953625aa76abbcc1a81a8d96092a2ec90005f775 (diff) |
Convert bus_dmamem_map(9) to km_alloc(9) in order to make it fail and
not sleep if the allocator cannot obtain a lock when BUS_DMA_NOWAIT is
specified.
idea and inputs from kettenis@, ok miod@
Diffstat (limited to 'sys/arch/arm')
-rw-r--r-- | sys/arch/arm/arm/bus_dma.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/arch/arm/arm/bus_dma.c b/sys/arch/arm/arm/bus_dma.c index 051f7900810..1ef6d858ed3 100644 --- a/sys/arch/arm/arm/bus_dma.c +++ b/sys/arch/arm/arm/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.24 2013/05/10 20:25:28 patrick Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.25 2014/07/11 09:36:25 mpi Exp $ */ /* $NetBSD: bus_dma.c,v 1.38 2003/10/30 08:44:13 scw Exp $ */ /*- @@ -735,6 +735,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t ssize; bus_addr_t addr; int curseg; + const struct kmem_dyn_mode *kd; #ifdef DEBUG_DMA pt_entry_t *ptep; #endif @@ -745,8 +746,8 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, #endif /* DEBUG_DMA */ size = round_page(size); - va = uvm_km_valloc(kernel_map, size); - + kd = flags & BUS_DMA_NOWAIT ? &kd_trylock : &kd_waitok; + va = (vaddr_t)km_alloc(size, &kv_any, &kp_none, kd); if (va == 0) return (ENOMEM); @@ -797,8 +798,7 @@ _bus_dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) panic("_bus_dmamem_unmap"); #endif /* DIAGNOSTIC */ - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* |