diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 2004-09-27 17:40:25 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 2004-09-27 17:40:25 +0000 |
commit | f5b9bdbebfa8bad301ddc0e2a2d9d26fbc47d24b (patch) | |
tree | 141ee475ac579a1758029f6e635b6ee51a394154 /sys/arch | |
parent | 83dfef72c076af993a379b674041e30dcc3fa52d (diff) |
Change busdma to map coherent dmamem memory as uncached if the host
system has non-coherent caches. This will help some drivers to work better.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mips64/include/pmap.h | 11 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/busdma.c | 13 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/pmap.c | 11 |
3 files changed, 17 insertions, 18 deletions
diff --git a/sys/arch/mips64/include/pmap.h b/sys/arch/mips64/include/pmap.h index 6514b8831dd..515ce2eb6eb 100644 --- a/sys/arch/mips64/include/pmap.h +++ b/sys/arch/mips64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.5 2004/09/23 08:42:38 pefo Exp $ */ +/* $OpenBSD: pmap.h,v 1.6 2004/09/27 17:40:24 pefo Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -89,6 +89,14 @@ typedef struct pmap { } *pmap_t; #ifdef _KERNEL + +/* flags for pv_entry */ +#define PV_UNCACHED 0x0001 /* Page is mapped unchached */ +#define PV_CACHED 0x0002 /* Page has been cached */ +#define PV_ATTR_MOD 0x0004 +#define PV_ATTR_REF 0x0008 +#define PV_PRESERVE (PV_UNCACHED|PV_CACHED|PV_ATTR_MOD|PV_ATTR_REF) + extern struct pmap kernel_pmap_store; #define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) @@ -107,6 +115,7 @@ int pmap_is_page_ro( pmap_t, vaddr_t, int); void pmap_kenter_cache(vaddr_t va, paddr_t pa, vm_prot_t prot, int cache); void pmap_prefer(vaddr_t, vaddr_t *); void pmap_set_modify(vm_page_t); +void pmap_page_cache(vm_page_t, int); #define pmap_proc_iflush(p,va,len) /* nothing yet (handled in trap now) */ #define pmap_unuse_final(p) /* nothing yet */ diff --git a/sys/arch/mips64/mips64/busdma.c b/sys/arch/mips64/mips64/busdma.c index d6c5a532f9e..fcec109333b 100644 --- a/sys/arch/mips64/mips64/busdma.c +++ b/sys/arch/mips64/mips64/busdma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: busdma.c,v 1.5 2004/09/17 19:28:05 miod Exp $ */ +/* $OpenBSD: busdma.c,v 1.6 2004/09/27 17:40:24 pefo Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -35,6 +35,7 @@ #include <uvm/uvm_extern.h> +#include <mips64/archtype.h> #include <machine/cpu.h> #include <machine/autoconf.h> @@ -498,12 +499,10 @@ _dmamem_map(t, segs, nsegs, size, kvap, flags) VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); segs[curseg].ds_vaddr = va; -#if 0 - if (flags & BUS_DMAMEM_NOSYNC) - pmap_changebit(addr, PG_N, ~0); - else - pmap_changebit(addr, 0, ~PG_N); -#endif + + if (flags & BUS_DMA_COHERENT && + sys_config.system_type == SGI_O2) + pmap_page_cache(PHYS_TO_VM_PAGE(addr - t->dma_offs), PV_UNCACHED); } } diff --git a/sys/arch/mips64/mips64/pmap.c b/sys/arch/mips64/mips64/pmap.c index 0c0114d82b1..b4387059f03 100644 --- a/sys/arch/mips64/mips64/pmap.c +++ b/sys/arch/mips64/mips64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.13 2004/09/23 12:38:28 pefo Exp $ */ +/* $OpenBSD: pmap.c,v 1.14 2004/09/27 17:40:24 pefo Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -49,13 +49,6 @@ extern void mem_zero_page(vaddr_t); -/* flags for pv_entry */ -#define PV_UNCACHED 0x0001 /* Page is mapped unchached */ -#define PV_CACHED 0x0002 /* Page has been cached */ -#define PV_ATTR_MOD 0x0004 -#define PV_ATTR_REF 0x0008 -#define PV_PRESERVE (PV_UNCACHED|PV_CACHED|PV_ATTR_MOD|PV_ATTR_REF) - struct pool pmap_pmap_pool; struct pool pmap_pv_pool; @@ -1285,10 +1278,8 @@ pmap_enter_pv(pmap_t pmap, vaddr_t va, vm_page_t pg, u_int *npte) * to be mapped uncached. */ if (((pv->pv_va ^ va) & CpuCacheAliasMask) != 0) { -#ifdef PMAPDEBUG printf("pmap_enter: VAC for pa %p, %p != %p\n", VM_PAGE_TO_PHYS(pg), npv->pv_va, va); -#endif pmap_page_cache(pg, PV_UNCACHED); Mips_SyncCache(); *npte = (*npte & ~PG_CACHEMODE) | PG_UNCACHED; |