diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-04-20 00:42:07 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-04-20 00:42:07 +0000 |
commit | b5396dca6504168d952b238075ba34f507a94e0b (patch) | |
tree | 39015d7d9f61a69ff36284c190932f40b1bc8834 /sys/arch/macppc | |
parent | 7720807a1d9f91f5c0f47d6b1be219d913aef6ac (diff) |
Add a BUS_DMA_ZERO flag for bus_dmamem_alloc() to return zeroed memory.
Saves every damned driver calling bzero(), and continues the M_ZERO,
PR_ZERO symmetry.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r-- | sys/arch/macppc/include/bus.h | 3 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/dma.c | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/arch/macppc/include/bus.h b/sys/arch/macppc/include/bus.h index b56a5f57750..61bc9e5a252 100644 --- a/sys/arch/macppc/include/bus.h +++ b/sys/arch/macppc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.13 2007/02/07 03:20:37 dlg Exp $ */ +/* $OpenBSD: bus.h,v 1.14 2009/04/20 00:42:06 oga Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -463,6 +463,7 @@ bus_space_copy_4(void *v, bus_space_handle_t h1, bus_space_handle_t h2, #define BUS_DMA_READ 0x100 /* mapping is device -> memory only */ #define BUS_DMA_WRITE 0x200 /* mapping is memory -> device only */ #define BUS_DMA_STREAMING 0x400 /* hint: sequential, unidirectional */ +#define BUS_DMA_ZERO 0x800 /* zero memory in dmamem_alloc */ /* Forwards needed by prototypes below. */ diff --git a/sys/arch/macppc/macppc/dma.c b/sys/arch/macppc/macppc/dma.c index 153fe071ecf..d25eb473af5 100644 --- a/sys/arch/macppc/macppc/dma.c +++ b/sys/arch/macppc/macppc/dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.c,v 1.30 2009/04/14 16:01:04 oga Exp $ */ +/* $OpenBSD: dma.c,v 1.31 2009/04/20 00:42:06 oga Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -561,6 +561,8 @@ _dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment, * Allocate pages from the VM system. */ plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK; + if (flags & BUS_DMA_ZERO) + plaflag |= UVM_PLA_ZERO; TAILQ_INIT(&mlist); error = uvm_pglistalloc(size, low, high, |