diff options
-rw-r--r-- | sys/arch/alpha/dev/bus_dma.c | 13 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/bus_dma.c | 11 | ||||
-rw-r--r-- | sys/arch/arm/arm/bus_dma.c | 10 | ||||
-rw-r--r-- | sys/arch/aviion/aviion/bus_dma.c | 19 | ||||
-rw-r--r-- | sys/arch/i386/i386/bus_dma.c | 11 | ||||
-rw-r--r-- | sys/arch/landisk/landisk/bus_dma.c | 9 | ||||
-rw-r--r-- | sys/arch/loongson/loongson/bus_dma.c | 11 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/dma.c | 11 | ||||
-rw-r--r-- | sys/arch/octeon/octeon/bus_dma.c | 11 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/bus_dma.c | 11 | ||||
-rw-r--r-- | sys/arch/socppc/socppc/dma.c | 11 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/iommu.c | 11 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/machdep.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/machdep.c | 11 | ||||
-rw-r--r-- | sys/arch/vax/vax/bus_dma.c | 11 |
15 files changed, 86 insertions, 80 deletions
diff --git a/sys/arch/alpha/dev/bus_dma.c b/sys/arch/alpha/dev/bus_dma.c index 1b30fb7a5e4..3d4f2ad546d 100644 --- a/sys/arch/alpha/dev/bus_dma.c +++ b/sys/arch/alpha/dev/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.31 2011/06/23 20:44:38 ariane Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.32 2014/07/11 09:36:25 mpi Exp $ */ /* $NetBSD: bus_dma.c,v 1.40 2000/07/17 04:47:56 thorpej Exp $ */ /*- @@ -583,6 +583,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) size_t ssize; bus_addr_t addr; int curseg, error; + const struct kmem_dyn_mode *kd; /* * If we're only mapping 1 segment, use K0SEG, to avoid @@ -594,9 +595,8 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) } 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); @@ -615,7 +615,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL); if (error) { pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); + km_free((void *)sva, ssize, &kv_any, &kp_none); return (error); } } @@ -648,8 +648,7 @@ _bus_dmamem_unmap(t, kva, size) kva <= (caddr_t)ALPHA_K0SEG_END) return; - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* diff --git a/sys/arch/amd64/amd64/bus_dma.c b/sys/arch/amd64/amd64/bus_dma.c index d625768a5d2..61a1c7cf82c 100644 --- a/sys/arch/amd64/amd64/bus_dma.c +++ b/sys/arch/amd64/amd64/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.43 2014/05/04 20:09:15 sf Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.44 2014/07/11 09:36:25 mpi Exp $ */ /* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */ /*- @@ -467,6 +467,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, pmapflags = 0, error; + const struct kmem_dyn_mode *kd; if (nsegs == 1 && (flags & BUS_DMA_NOCACHE) == 0) { *kvap = (caddr_t)PMAP_DIRECT_MAP(segs[0].ds_addr); @@ -477,7 +478,8 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, pmapflags |= PMAP_NOCACHE; 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); @@ -496,7 +498,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL); if (error) { pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); + km_free((void *)sva, ssize, &kv_any, &kp_none); return (error); } } @@ -521,8 +523,7 @@ _bus_dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) if (kva >= (caddr_t)PMAP_DIRECT_BASE && kva <= (caddr_t)PMAP_DIRECT_END) return; - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* 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); } /* diff --git a/sys/arch/aviion/aviion/bus_dma.c b/sys/arch/aviion/aviion/bus_dma.c index 9da9a61f9c1..0c34ad25df4 100644 --- a/sys/arch/aviion/aviion/bus_dma.c +++ b/sys/arch/aviion/aviion/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.5 2011/10/09 17:08:21 miod Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.6 2014/07/11 09:36:26 mpi Exp $ */ /* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */ /*- @@ -522,11 +522,11 @@ bus_dmamem_map(t, segs, nsegs, size, kvap, flags) size_t ssize; bus_addr_t addr; int curseg, error; + const struct kmem_dyn_mode *kd; 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); @@ -543,10 +543,10 @@ bus_dmamem_map(t, segs, nsegs, size, kvap, flags) 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) { - pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); - return (error); + if (error) { + pmap_update(pmap_kernel()); + km_free((void *)sva, ssize, &kv_any, &kp_none); + return (error); } if (flags & BUS_DMA_COHERENT) pmap_page_uncache(addr); @@ -573,8 +573,7 @@ bus_dmamem_unmap(t, kva, size) panic("bus_dmamem_unmap"); #endif - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* diff --git a/sys/arch/i386/i386/bus_dma.c b/sys/arch/i386/i386/bus_dma.c index f822ed4d2a9..d9c01eda627 100644 --- a/sys/arch/i386/i386/bus_dma.c +++ b/sys/arch/i386/i386/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.29 2014/03/29 18:09:29 guenther Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.30 2014/07/11 09:36:26 mpi Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * All rights reserved. @@ -430,12 +430,14 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t ssize; bus_addr_t addr; int curseg, pmapflags = 0, ret; + struct kmem_pa_mode *kd; if (flags & BUS_DMA_NOCACHE) pmapflags |= PMAP_NOCACHE; 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); @@ -458,7 +460,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL); if (ret) { pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); + km_free((void *)sva, ssize, &kv_any, &kp_none); return (ret); } @@ -482,8 +484,7 @@ _bus_dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) panic("_bus_dmamem_unmap"); #endif - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* diff --git a/sys/arch/landisk/landisk/bus_dma.c b/sys/arch/landisk/landisk/bus_dma.c index 39ef56c0639..fe4c516a500 100644 --- a/sys/arch/landisk/landisk/bus_dma.c +++ b/sys/arch/landisk/landisk/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.9 2010/04/21 03:03:26 deraadt Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.10 2014/07/11 09:36:26 mpi Exp $ */ /* $NetBSD: bus_dma.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */ /* @@ -628,6 +628,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, vaddr_t va; bus_addr_t addr; int curseg; + const struct kmem_dyn_mode *kd; DPRINTF(("bus_dmamem_map: t = %p, segs = %p, nsegs = %d, size = %d, kvap = %p, flags = %x\n", t, segs, nsegs, size, kvap, flags)); @@ -647,8 +648,8 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, /* Always round the size. */ 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); @@ -691,7 +692,7 @@ _bus_dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) size = round_page(size); pmap_kremove((vaddr_t)kva, size); pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, size, &kv_any, &kp_none); } paddr_t diff --git a/sys/arch/loongson/loongson/bus_dma.c b/sys/arch/loongson/loongson/bus_dma.c index d4531a1737b..f547becd9c3 100644 --- a/sys/arch/loongson/loongson/bus_dma.c +++ b/sys/arch/loongson/loongson/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.13 2014/03/21 21:49:45 miod Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.14 2014/07/11 09:36:26 mpi Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -432,6 +432,7 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, paddr_t pa; bus_addr_t addr; int curseg, error, pmap_flags; + const struct kmem_dyn_mode *kd; if (nsegs == 1) { pa = (*t->_device_to_pa)(segs[0].ds_addr); @@ -443,7 +444,8 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, } 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); @@ -466,7 +468,7 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, VM_PROT_WRITE | pmap_flags); if (error) { pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); + km_free((void *)sva, ssize, &kv_any, &kp_none); return (error); } @@ -498,8 +500,7 @@ _dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) if (IS_XKPHYS((vaddr_t)kva)) return; - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* diff --git a/sys/arch/macppc/macppc/dma.c b/sys/arch/macppc/macppc/dma.c index fd0e241e7f7..07860292f2b 100644 --- a/sys/arch/macppc/macppc/dma.c +++ b/sys/arch/macppc/macppc/dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.c,v 1.38 2014/03/31 18:58:41 mpi Exp $ */ +/* $OpenBSD: dma.c,v 1.39 2014/07/11 09:36:26 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -463,12 +463,14 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, size_t ssize; bus_addr_t addr; int curseg, pmapflags = 0, error; + const struct kmem_dyn_mode *kd; if (flags & BUS_DMA_NOCACHE) pmapflags |= PMAP_NOCACHE; 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); @@ -487,7 +489,7 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL); if (error) { pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); + km_free((void *)sva, ssize, &kv_any, &kp_none); return (error); } } @@ -510,8 +512,7 @@ _dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) panic("_bus_dmamem_unmap"); #endif - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* diff --git a/sys/arch/octeon/octeon/bus_dma.c b/sys/arch/octeon/octeon/bus_dma.c index e23963319b1..d8fdd75c82b 100644 --- a/sys/arch/octeon/octeon/bus_dma.c +++ b/sys/arch/octeon/octeon/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.10 2014/05/10 22:25:16 jasper Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.11 2014/07/11 09:36:26 mpi Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -425,6 +425,7 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, paddr_t pa; bus_addr_t addr; int curseg, error, pmap_flags; + const struct kmem_dyn_mode *kd; if (nsegs == 1) { pa = (*t->_device_to_pa)(segs[0].ds_addr); @@ -436,7 +437,8 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, } 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); @@ -459,7 +461,7 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, VM_PROT_WRITE | pmap_flags); if (error) { pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); + km_free((void *)sva, ssize, &kv_any, &kp_none); return (error); } @@ -491,8 +493,7 @@ _dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) if (IS_XKPHYS((vaddr_t)kva)) return; - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* diff --git a/sys/arch/sgi/sgi/bus_dma.c b/sys/arch/sgi/sgi/bus_dma.c index f932d5dd156..915d529ddf7 100644 --- a/sys/arch/sgi/sgi/bus_dma.c +++ b/sys/arch/sgi/sgi/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.34 2014/05/19 21:18:42 miod Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.35 2014/07/11 09:36:26 mpi Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -443,6 +443,7 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, paddr_t pa; bus_addr_t addr; int curseg, error, pmap_flags; + const struct kmem_dyn_mode *kd; #if defined(TGT_INDIGO2) /* @@ -471,7 +472,8 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, } 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); @@ -496,7 +498,7 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, VM_PROT_WRITE | pmap_flags); if (error) { pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); + km_free((void *)sva, ssize, &kv_any, &kp_none); return (error); } @@ -528,8 +530,7 @@ _dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) if (IS_XKPHYS((vaddr_t)kva)) return; - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* diff --git a/sys/arch/socppc/socppc/dma.c b/sys/arch/socppc/socppc/dma.c index dd7f0ac54e3..5bb208fa451 100644 --- a/sys/arch/socppc/socppc/dma.c +++ b/sys/arch/socppc/socppc/dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.c,v 1.10 2014/03/31 18:58:41 mpi Exp $ */ +/* $OpenBSD: dma.c,v 1.11 2014/07/11 09:36:26 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -463,9 +463,11 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, size_t ssize; bus_addr_t addr; int curseg, error; + const struct kmem_dyn_mode *kd; 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); @@ -484,7 +486,7 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL); if (error) { pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); + km_free((void *)sva, ssize, &kv_any, &kp_none); return (error); } } @@ -507,8 +509,7 @@ _dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) panic("_bus_dmamem_unmap"); #endif - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* diff --git a/sys/arch/sparc/sparc/iommu.c b/sys/arch/sparc/sparc/iommu.c index 80bec486482..90de900e83b 100644 --- a/sys/arch/sparc/sparc/iommu.c +++ b/sys/arch/sparc/sparc/iommu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iommu.c,v 1.26 2014/04/08 13:23:51 mpi Exp $ */ +/* $OpenBSD: iommu.c,v 1.27 2014/07/11 09:36:26 mpi Exp $ */ /* $NetBSD: iommu.c,v 1.13 1997/07/29 09:42:04 fair Exp $ */ /* @@ -691,6 +691,7 @@ iommu_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, int cbit; u_long align; int pagesz = PAGE_SIZE; + const struct kmem_dyn_mode *kd; if (nsegs != 1) panic("iommu_dmamem_map: nsegs = %d", nsegs); @@ -709,7 +710,8 @@ iommu_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, va = _bus_dma_valloc_skewed(size, 0, align, segs[0].ds_addr & (align - 1)); #else - 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); #endif if (va == 0) return (ENOMEM); @@ -750,10 +752,7 @@ iommu_dmamem_unmap(bus_dma_tag_t t, void *kva, size_t size) panic("iommu_dmamem_unmap"); #endif - size = round_page(size); - pmap_kremove((vaddr_t)kva, size); - pmap_update(pmap_kernel()); - uvm_unmap(kernel_map, (vaddr_t)kva, (vaddr_t)kva + size); + km_free(kva, round_page(size), &kv_any, &kp_none); } diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index 8f74a95f5e3..53fd055d671 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.158 2014/07/10 21:46:03 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.159 2014/07/11 09:36:26 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -1104,8 +1104,7 @@ _bus_dmamem_unmap(bus_dma_tag_t t, void *kva, size_t size) panic("_bus_dmamem_unmap"); #endif - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, (vaddr_t)size + size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index 98f2c855c33..c78acf20e6e 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.161 2014/07/10 21:46:03 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.162 2014/07/11 09:36:26 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -1440,6 +1440,7 @@ _bus_dmamem_map(t, t0, segs, nsegs, size, kvap, flags) caddr_t *kvap; int flags; { + const struct kmem_dyn_mode *kd; struct vm_page *m; vaddr_t va, sva; size_t ssize; @@ -1453,7 +1454,8 @@ _bus_dmamem_map(t, t0, segs, nsegs, size, kvap, flags) #endif 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); @@ -1477,7 +1479,7 @@ _bus_dmamem_map(t, t0, segs, nsegs, size, kvap, flags) VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL); if (error) { pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); + km_free((void *)sva, ssize, &kv_any, &kp_none); return (error); } va += PAGE_SIZE; @@ -1504,8 +1506,7 @@ _bus_dmamem_unmap(t, t0, kva, size) panic("_bus_dmamem_unmap"); #endif - size = round_page(size); - uvm_km_free(kernel_map, (vaddr_t)kva, size); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* diff --git a/sys/arch/vax/vax/bus_dma.c b/sys/arch/vax/vax/bus_dma.c index 86c0488f2c3..f59b5c4a23f 100644 --- a/sys/arch/vax/vax/bus_dma.c +++ b/sys/arch/vax/vax/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.27 2011/06/23 20:44:39 ariane Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.28 2014/07/11 09:36:26 mpi Exp $ */ /* $NetBSD: bus_dma.c,v 1.5 1999/11/13 00:32:20 thorpej Exp $ */ /*- @@ -427,6 +427,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) size_t ssize; bus_addr_t addr; int curseg, error; + const struct kmem_dyn_mode *kd; /* * Special case (but common): @@ -448,8 +449,8 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) return 0; } 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); @@ -470,7 +471,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL); if (error) { pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, sva, ssize); + km_free((void *)sva, ssize, &kv_any, &kp_none); return (error); } } @@ -500,7 +501,7 @@ _bus_dmamem_unmap(t, kva, size) /* Avoid free'ing if not mapped */ if (kva >= (caddr_t)virtual_avail) - uvm_km_free(kernel_map, (vaddr_t)kva, round_page(size)); + km_free(kva, round_page(size), &kv_any, &kp_none); } /* |