summaryrefslogtreecommitdiff
path: root/sys/arch/hppa
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-04-20 00:42:07 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-04-20 00:42:07 +0000
commitb5396dca6504168d952b238075ba34f507a94e0b (patch)
tree39015d7d9f61a69ff36284c190932f40b1bc8834 /sys/arch/hppa
parent7720807a1d9f91f5c0f47d6b1be219d913aef6ac (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/hppa')
-rw-r--r--sys/arch/hppa/hppa/mainbus.c4
-rw-r--r--sys/arch/hppa/include/bus.h27
2 files changed, 17 insertions, 14 deletions
diff --git a/sys/arch/hppa/hppa/mainbus.c b/sys/arch/hppa/hppa/mainbus.c
index 72cb94111dc..0df5a4bf850 100644
--- a/sys/arch/hppa/hppa/mainbus.c
+++ b/sys/arch/hppa/hppa/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.73 2009/04/14 16:01:04 oga Exp $ */
+/* $OpenBSD: mainbus.c,v 1.74 2009/04/20 00:42:06 oga Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -942,6 +942,8 @@ mbus_dmamem_alloc(void *v, bus_size_t size, bus_size_t alignment,
size = round_page(size);
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
+ if (flags & BUS_DMA_ZERO)
+ plaflag |= UVM_PLA_ZERO;
TAILQ_INIT(&pglist);
if (uvm_pglistalloc(size, 0, -1, alignment, boundary,
diff --git a/sys/arch/hppa/include/bus.h b/sys/arch/hppa/include/bus.h
index 68810683dbd..61f29bef8f8 100644
--- a/sys/arch/hppa/include/bus.h
+++ b/sys/arch/hppa/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.25 2007/05/23 18:07:19 kettenis Exp $ */
+/* $OpenBSD: bus.h,v 1.26 2009/04/20 00:42:06 oga Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -291,18 +291,19 @@ extern const struct hppa_bus_space_tag hppa_bustag;
#define bus_space_vaddr(t,h) \
((t)->hbt_vaddr((t)->hbt_cookie, (h)))
-#define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */
-#define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */
-#define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */
-#define BUS_DMA_COHERENT 0x004 /* hint: map memory DMA coherent */
-#define BUS_DMAMEM_NOSYNC 0x010
-#define BUS_DMA_BUS1 0x020 /* placeholders for bus functions... */
-#define BUS_DMA_BUS2 0x040
-#define BUS_DMA_BUS3 0x080
-#define BUS_DMA_BUS4 0x100
-#define BUS_DMA_STREAMING 0x200 /* hint: sequential, unidirectional */
-#define BUS_DMA_READ 0x400 /* mapping is device -> memory only */
-#define BUS_DMA_WRITE 0x800 /* mapping is memory -> device only */
+#define BUS_DMA_WAITOK 0x0000 /* safe to sleep (pseudo-flag) */
+#define BUS_DMA_NOWAIT 0x0001 /* not safe to sleep */
+#define BUS_DMA_ALLOCNOW 0x0002 /* perform resource allocation now */
+#define BUS_DMA_COHERENT 0x0004 /* hint: map memory DMA coherent */
+#define BUS_DMAMEM_NOSYNC 0x0010
+#define BUS_DMA_BUS1 0x0020 /* placeholders for bus functions... */
+#define BUS_DMA_BUS2 0x0040
+#define BUS_DMA_BUS3 0x0080
+#define BUS_DMA_BUS4 0x0100
+#define BUS_DMA_STREAMING 0x0200 /* hint: sequential, unidirectional */
+#define BUS_DMA_READ 0x0400 /* mapping is device -> memory only */
+#define BUS_DMA_WRITE 0x0800 /* mapping is memory -> device only */
+#define BUS_DMA_ZERO 0x1000 /* zero memory in dmamem_alloc */
/* Forwards needed by prototypes below. */
struct mbuf;