summaryrefslogtreecommitdiff
path: root/sys/arch/mvmeppc
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2010-03-29 19:21:59 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2010-03-29 19:21:59 +0000
commita12c9c3255460f1fdd60260d3158d236732f1072 (patch)
tree4f1eeeb429755e21e4652dcc786c1a9ffcf7ee54 /sys/arch/mvmeppc
parent15d917b49909d373f99de0945cdd7afa929e4550 (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/mvmeppc')
-rw-r--r--sys/arch/mvmeppc/mvmeppc/bus_dma.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/arch/mvmeppc/mvmeppc/bus_dma.c b/sys/arch/mvmeppc/mvmeppc/bus_dma.c
index ccf2acab2cc..3698b8731c7 100644
--- a/sys/arch/mvmeppc/mvmeppc/bus_dma.c
+++ b/sys/arch/mvmeppc/mvmeppc/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.25 2009/06/07 16:02:41 miod Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.26 2010/03/29 19:21:58 oga Exp $ */
/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
/*-
@@ -486,9 +486,10 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
caddr_t *kvap;
int flags;
{
- vaddr_t va;
+ vaddr_t va, sva;
+ size_t ssize;
bus_addr_t addr;
- int curseg;
+ int curseg, error;
size = round_page(size);
@@ -499,6 +500,8 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
*kvap = (caddr_t)va;
+ sva = va;
+ ssize = size;
for (curseg = 0; curseg < nsegs; curseg++) {
for (addr = PCI_MEM_TO_PHYS(segs[curseg].ds_addr);
addr < (PCI_MEM_TO_PHYS(segs[curseg].ds_addr)
@@ -506,9 +509,18 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
addr += NBPG, va += NBPG, size -= NBPG) {
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);
+ }
}
}
pmap_update(pmap_kernel());