diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/bus_dma.c | 10 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/pmap.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/include/bus.h | 3 | ||||
-rw-r--r-- | sys/arch/amd64/include/pmap.h | 7 |
4 files changed, 18 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/bus_dma.c b/sys/arch/amd64/amd64/bus_dma.c index c862560f725..aec2010a601 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.13 2008/12/03 15:46:06 oga Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.14 2009/02/05 01:15:20 oga Exp $ */ /* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */ /*- @@ -413,7 +413,10 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, { vaddr_t va; bus_addr_t addr; - int curseg; + int curseg, pmapflags = 0; + + if (flags & BUS_DMA_NOCACHE) + pmapflags |= PMAP_NOCACHE; size = round_page(size); va = uvm_km_valloc(kernel_map, size); @@ -430,7 +433,8 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, 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); + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED | + pmapflags); } } pmap_update(pmap_kernel()); diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index 34e25c702d5..91797dc3713 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.35 2008/12/18 14:18:29 kurt Exp $ */ +/* $OpenBSD: pmap.c,v 1.36 2009/02/05 01:15:20 oga Exp $ */ /* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */ /* @@ -2170,6 +2170,8 @@ enter_now: npte |= PG_PVLIST; if (wired) npte |= PG_W; + if (flags & PMAP_NOCACHE) + npte |= PG_N; if (va < VM_MAXUSER_ADDRESS) npte |= PG_u; else if (va < VM_MAX_ADDRESS) diff --git a/sys/arch/amd64/include/bus.h b/sys/arch/amd64/include/bus.h index f51456236d1..e2fa9ec1fbf 100644 --- a/sys/arch/amd64/include/bus.h +++ b/sys/arch/amd64/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.13 2008/12/03 15:46:06 oga Exp $ */ +/* $OpenBSD: bus.h,v 1.14 2009/02/05 01:15:20 oga Exp $ */ /* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */ /*- @@ -445,6 +445,7 @@ void bus_space_barrier(bus_space_tag_t, bus_space_handle_t, #define BUS_DMA_STREAMING 0x100 /* hint: sequential, unidirectional */ #define BUS_DMA_READ 0x200 /* mapping is device -> memory only */ #define BUS_DMA_WRITE 0x400 /* mapping is memory -> device only */ +#define BUS_DMA_NOCACHE 0x800 /* map memory uncached */ /* Forwards needed by prototypes below. */ struct mbuf; diff --git a/sys/arch/amd64/include/pmap.h b/sys/arch/amd64/include/pmap.h index b3b36f9de43..59c586db19d 100644 --- a/sys/arch/amd64/include/pmap.h +++ b/sys/arch/amd64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.19 2008/06/10 02:55:39 weingart Exp $ */ +/* $OpenBSD: pmap.h,v 1.20 2009/02/05 01:15:20 oga Exp $ */ /* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */ /* @@ -333,6 +333,11 @@ struct pmap { }; /* + * MD flags that we use for pmap_enter: + */ +#define PMAP_NOCACHE PMAP_MD0 /* set the non-cacheable bit. */ + +/* * We keep mod/ref flags in struct vm_page->pg_flags. */ #define PG_PMAP_MOD PG_PMAP0 |