summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/bus_dma.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/bus_dma.c b/sys/arch/amd64/amd64/bus_dma.c
index 415c2063c20..d6f073eeecd 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.37 2011/06/23 20:44:38 ariane Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.38 2011/07/03 18:31:02 oga Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@@ -470,6 +470,11 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
bus_addr_t addr;
int curseg, pmapflags = 0, error;
+ if (nsegs == 1 && (flags & BUS_DMA_NOCACHE) == 0) {
+ *kvap = (caddr_t)PMAP_DIRECT_MAP(segs[0].ds_addr);
+ return (0);
+ }
+
if (flags & BUS_DMA_NOCACHE)
pmapflags |= PMAP_NOCACHE;
@@ -515,6 +520,8 @@ _bus_dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size)
if ((u_long)kva & PGOFSET)
panic("_bus_dmamem_unmap");
#endif
+ 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);