diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-03-29 19:21:59 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-03-29 19:21:59 +0000 |
commit | a12c9c3255460f1fdd60260d3158d236732f1072 (patch) | |
tree | 4f1eeeb429755e21e4652dcc786c1a9ffcf7ee54 /sys/arch/arm | |
parent | 15d917b49909d373f99de0945cdd7afa929e4550 (diff) |
PMAP_CANFAIL for bus_dmamem_map on all other architectures (and some
whitespace tweaks on i386 so that it matches).
ok kettenis@
Diffstat (limited to 'sys/arch/arm')
-rw-r--r-- | sys/arch/arm/arm/bus_dma.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/arch/arm/arm/bus_dma.c b/sys/arch/arm/arm/bus_dma.c index 5cde68127a3..d0b2c8ed199 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.15 2009/04/20 00:42:05 oga Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.16 2010/03/29 19:21:58 oga Exp $ */ /* $NetBSD: bus_dma.c,v 1.38 2003/10/30 08:44:13 scw Exp $ */ /*- @@ -685,9 +685,10 @@ int _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, caddr_t *kvap, int flags) { - vaddr_t va; + vaddr_t va, sva; + size_t ssize; bus_addr_t addr; - int curseg; + int curseg, error; pt_entry_t *ptep/*, pte*/; #ifdef DEBUG_DMA @@ -703,6 +704,8 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, *kvap = (caddr_t)va; + sva = va; + ssize = size; for (curseg = 0; curseg < nsegs; curseg++) { for (addr = segs[curseg].ds_addr; addr < (segs[curseg].ds_addr + segs[curseg].ds_len); @@ -712,9 +715,18 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, #endif /* DEBUG_DMA */ if (size == 0) panic("_bus_dmamem_map: size botch"); - pmap_enter(pmap_kernel(), va, addr, - VM_PROT_READ | VM_PROT_WRITE, - VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); + error = pmap_enter(pmap_kernel(), va, addr, + VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | + VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL); + if (error) { + /* + * Clean up after ourselves. + * XXX uvm_wait on WAITOK + */ + pmap_update(pmap_kernel()); + uvm_km_free(kernel_map, va, ssize); + return (error); + } /* * If the memory must remain coherent with the * cache then we must make the memory uncacheable |