summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/bus_dma.c9
-rw-r--r--sys/arch/i386/i386/bus_dma.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/bus_dma.c b/sys/arch/amd64/amd64/bus_dma.c
index 5c7fc241b49..3e55a5ea5ab 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.39 2012/12/05 23:20:10 deraadt Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.40 2012/12/08 12:04:21 mpi Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@@ -533,7 +533,10 @@ paddr_t
_bus_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off,
int prot, int flags)
{
- int i;
+ int i, pmapflags = 0;
+
+ if (flags & BUS_DMA_NOCACHE)
+ pmapflags |= PMAP_NOCACHE;
for (i = 0; i < nsegs; i++) {
#ifdef DIAGNOSTIC
@@ -550,7 +553,7 @@ _bus_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off,
continue;
}
- return (segs[i].ds_addr + off);
+ return ((segs[i].ds_addr + off) | pmapflags);
}
/* Page not found. */
diff --git a/sys/arch/i386/i386/bus_dma.c b/sys/arch/i386/i386/bus_dma.c
index 5f1084f8a3e..5544ccbfd82 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.25 2011/06/23 20:44:39 ariane Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.26 2012/12/08 12:04:21 mpi Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -493,7 +493,10 @@ paddr_t
_bus_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off,
int prot, int flags)
{
- int i;
+ int i, pmapflags = 0;
+
+ if (flags & BUS_DMA_NOCACHE)
+ pmapflags |= PMAP_NOCACHE;
for (i = 0; i < nsegs; i++) {
#ifdef DIAGNOSTIC
@@ -510,7 +513,7 @@ _bus_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off,
continue;
}
- return (segs[i].ds_addr + off);
+ return ((segs[i].ds_addr + off) | pmapflags);
}
/* Page not found. */