diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-02-01 00:52:20 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-02-01 00:52:20 +0000 |
commit | c7505ccc4bbeb05ca3ed3314b1f337d34648d8c3 (patch) | |
tree | c5ac2e8bf2b29e51290c341c7239665120172c65 /sys/arch | |
parent | e0adcd73a6c637fc4289961817c6406377752116 (diff) |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that
the old vs(4) code is gone.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/m88k/include/cmmu.h | 8 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/m8820x_machdep.c | 84 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/trap.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/bus_dma.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m88110.c | 137 |
5 files changed, 15 insertions, 222 deletions
diff --git a/sys/arch/m88k/include/cmmu.h b/sys/arch/m88k/include/cmmu.h index cd747581fc3..4861b4c7d7f 100644 --- a/sys/arch/m88k/include/cmmu.h +++ b/sys/arch/m88k/include/cmmu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cmmu.h,v 1.20 2007/12/15 19:33:32 miod Exp $ */ +/* $OpenBSD: cmmu.h,v 1.21 2009/02/01 00:52:17 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -45,8 +45,7 @@ struct cmmu_p { void (*flush_tlb)(cpuid_t, u_int, vaddr_t, u_int); void (*flush_cache)(cpuid_t, paddr_t, psize_t); void (*flush_inst_cache)(cpuid_t, paddr_t, psize_t); - void (*dma_cachectl)(pmap_t, vaddr_t, vsize_t, int); - void (*dma_cachectl_pa)(paddr_t, psize_t, int); + void (*dma_cachectl)(paddr_t, psize_t, int); #ifdef MULTIPROCESSOR void (*initialize_cpu)(cpuid_t); #endif @@ -79,8 +78,7 @@ extern __cpu_simple_lock_t cmmu_cpu_lock; #define cmmu_flush_tlb(a, b, c, d) (cmmu->flush_tlb)(a, b, c, d) #define cmmu_flush_cache(a, b, c) (cmmu->flush_cache)(a, b, c) #define cmmu_flush_inst_cache(a, b, c) (cmmu->flush_inst_cache)(a, b, c) -#define dma_cachectl(a, b, c, d) (cmmu->dma_cachectl)(a, b, c, d) -#define dma_cachectl_pa(a, b, c) (cmmu->dma_cachectl_pa)(a, b, c) +#define dma_cachectl(a, b, c) (cmmu->dma_cachectl)(a, b, c) #define cmmu_initialize_cpu(a) (cmmu->initialize_cpu)(a) /* diff --git a/sys/arch/m88k/m88k/m8820x_machdep.c b/sys/arch/m88k/m88k/m8820x_machdep.c index 992279994b9..bda3957101d 100644 --- a/sys/arch/m88k/m88k/m8820x_machdep.c +++ b/sys/arch/m88k/m88k/m8820x_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m8820x_machdep.c,v 1.35 2007/12/15 19:33:34 miod Exp $ */ +/* $OpenBSD: m8820x_machdep.c,v 1.36 2009/02/01 00:52:19 miod Exp $ */ /* * Copyright (c) 2004, 2007, Miodrag Vallat. * @@ -101,8 +101,7 @@ void m8820x_set_uapr(apr_t); void m8820x_flush_tlb(cpuid_t, u_int, vaddr_t, u_int); void m8820x_flush_cache(cpuid_t, paddr_t, psize_t); void m8820x_flush_inst_cache(cpuid_t, paddr_t, psize_t); -void m8820x_dma_cachectl(pmap_t, vaddr_t, vsize_t, int); -void m8820x_dma_cachectl_pa(paddr_t, psize_t, int); +void m8820x_dma_cachectl(paddr_t, psize_t, int); void m8820x_initialize_cpu(cpuid_t); /* This is the function table for the MC8820x CMMUs */ @@ -118,7 +117,6 @@ struct cmmu_p cmmu8820x = { m8820x_flush_cache, m8820x_flush_inst_cache, m8820x_dma_cachectl, - m8820x_dma_cachectl_pa, #ifdef MULTIPROCESSOR m8820x_initialize_cpu, #endif @@ -688,83 +686,7 @@ m8820x_cmmu_inval_cache(int cpu, paddr_t pa, psize_t size) */ void -m8820x_dma_cachectl(pmap_t pmap, vaddr_t _va, vsize_t _size, int op) -{ - u_int32_t psr; - int cpu; -#ifdef MULTIPROCESSOR - struct cpu_info *ci = curcpu(); -#endif - vaddr_t va; - paddr_t pa; - psize_t size, count; - void (*flusher)(int, paddr_t, psize_t); - - va = trunc_cache_line(_va); - size = round_cache_line(_va + _size) - va; - - switch (op) { - case DMA_CACHE_SYNC: - flusher = m8820x_cmmu_sync_cache; - break; - case DMA_CACHE_SYNC_INVAL: - flusher = m8820x_cmmu_sync_inval_cache; - break; - default: - if (va != _va || size != _size) - flusher = m8820x_cmmu_sync_inval_cache; - else - flusher = m8820x_cmmu_inval_cache; - break; - } - -#ifndef MULTIPROCESSOR - cpu = cpu_number(); -#endif - - psr = get_psr(); - set_psr(psr | PSR_IND); - CMMU_LOCK; - - pa = 0; - while (size != 0) { - count = (va & PAGE_MASK) == 0 && size >= PAGE_SIZE ? - PAGE_SIZE : MC88200_CACHE_LINE; - - if ((va & PAGE_MASK) == 0 || pa == 0) { - if (pmap_extract(pmap, va, &pa) == FALSE) - panic("pmap_extract(%p, %p) failed", pmap, va); - } - -#ifdef MULTIPROCESSOR - /* writeback on a single cpu... */ - (*flusher)(ci->ci_cpuid, pa, count); - - /* invalidate on all... */ - if (flusher != m8820x_cmmu_sync_cache) { - for (cpu = 0; cpu < MAX_CPUS; cpu++) { - if (!ISSET(m88k_cpus[cpu].ci_flags, CIF_ALIVE)) - continue; - if (cpu == ci->ci_cpuid) - continue; - m8820x_cmmu_inval_cache(cpu, pa, count); - } - } -#else /* MULTIPROCESSOR */ - (*flusher)(cpu, pa, count); -#endif /* MULTIPROCESSOR */ - - va += count; - pa += count; - size -= count; - } - - CMMU_UNLOCK; - set_psr(psr); -} - -void -m8820x_dma_cachectl_pa(paddr_t _pa, psize_t _size, int op) +m8820x_dma_cachectl(paddr_t _pa, psize_t _size, int op) { u_int32_t psr; int cpu; diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c index b2137b3132e..ea2f7d7efeb 100644 --- a/sys/arch/m88k/m88k/trap.c +++ b/sys/arch/m88k/m88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.64 2008/11/27 20:46:48 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.65 2009/02/01 00:52:19 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -1814,7 +1814,7 @@ cache_flush(struct trapframe *tf) while (len != 0) { count = min(len, PAGE_SIZE - (va & PAGE_MASK)); if (pmap_extract(pmap, va, &pa) != FALSE) - dma_cachectl_pa(pa, count, DMA_CACHE_SYNC); + dma_cachectl(pa, count, DMA_CACHE_SYNC); va += count; len -= count; } diff --git a/sys/arch/mvme88k/mvme88k/bus_dma.c b/sys/arch/mvme88k/mvme88k/bus_dma.c index c1800ec6a0d..fd07b5ab473 100644 --- a/sys/arch/mvme88k/mvme88k/bus_dma.c +++ b/sys/arch/mvme88k/mvme88k/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.8 2008/06/26 05:42:12 ray Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.9 2009/02/01 00:52:19 miod Exp $ */ /* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */ /*- @@ -448,7 +448,7 @@ bus_dmamap_sync(t, map, offset, len, op) if (sublen > len) sublen = len; - dma_cachectl_pa(addr, sublen, op); + dma_cachectl(addr, sublen, op); offset = 0; len -= sublen; diff --git a/sys/arch/mvme88k/mvme88k/m88110.c b/sys/arch/mvme88k/mvme88k/m88110.c index cc0a77d8606..b0235367590 100644 --- a/sys/arch/mvme88k/mvme88k/m88110.c +++ b/sys/arch/mvme88k/mvme88k/m88110.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88110.c,v 1.59 2009/01/29 22:15:27 miod Exp $ */ +/* $OpenBSD: m88110.c,v 1.60 2009/02/01 00:52:19 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * All rights reserved. @@ -91,10 +91,8 @@ void m88110_flush_cache(cpuid_t, paddr_t, psize_t); void m88410_flush_cache(cpuid_t, paddr_t, psize_t); void m88110_flush_inst_cache(cpuid_t, paddr_t, psize_t); void m88410_flush_inst_cache(cpuid_t, paddr_t, psize_t); -void m88110_dma_cachectl(pmap_t, vaddr_t, vsize_t, int); -void m88410_dma_cachectl(pmap_t, vaddr_t, vsize_t, int); -void m88110_dma_cachectl_pa(paddr_t, psize_t, int); -void m88410_dma_cachectl_pa(paddr_t, psize_t, int); +void m88110_dma_cachectl(paddr_t, psize_t, int); +void m88410_dma_cachectl(paddr_t, psize_t, int); void m88110_initialize_cpu(cpuid_t); void m88410_initialize_cpu(cpuid_t); @@ -114,7 +112,6 @@ struct cmmu_p cmmu88110 = { m88110_flush_cache, m88110_flush_inst_cache, m88110_dma_cachectl, - m88110_dma_cachectl_pa, #ifdef MULTIPROCESSOR m88110_initialize_cpu, #endif @@ -136,7 +133,6 @@ struct cmmu_p cmmu88410 = { m88410_flush_cache, m88410_flush_inst_cache, m88410_dma_cachectl, - m88410_dma_cachectl_pa, #ifdef MULTIPROCESSOR m88410_initialize_cpu, #endif @@ -620,130 +616,7 @@ m88110_cmmu_inval_cache(paddr_t pa, psize_t size) */ void -m88110_dma_cachectl(pmap_t pmap, vaddr_t _va, vsize_t _size, int op) -{ - u_int32_t psr; - vaddr_t va; - paddr_t pa; - psize_t size, count; - void (*flusher)(paddr_t, psize_t); - - va = trunc_cache_line(_va); - size = round_cache_line(_va + _size) - va; - - switch (op) { - case DMA_CACHE_SYNC: - flusher = m88110_cmmu_sync_cache; - break; - case DMA_CACHE_SYNC_INVAL: - flusher = m88110_cmmu_sync_inval_cache; - break; - default: - if (va != _va || size != _size || size >= PAGE_SIZE) - flusher = m88110_cmmu_sync_inval_cache; - else - flusher = m88110_cmmu_inval_cache; - break; - } - - psr = get_psr(); - set_psr(psr | PSR_IND); - - if (op != DMA_CACHE_SYNC) - mc88110_inval_inst(); - while (size != 0) { - count = (va & PAGE_MASK) == 0 && size >= PAGE_SIZE ? - PAGE_SIZE : MC88110_CACHE_LINE; - - if (pmap_extract(pmap, va, &pa) != FALSE) { - (*flusher)(pa, count); - } - - va += count; - size -= count; - } - - set_psr(psr); -} - -void -m88410_dma_cachectl(pmap_t pmap, vaddr_t _va, vsize_t _size, int op) -{ - u_int32_t psr; - vaddr_t va; - paddr_t pa; - psize_t size, count; - void (*flusher)(paddr_t, psize_t); - void (*ext_flusher)(void); - - va = trunc_cache_line(_va); - size = round_cache_line(_va + _size) - va; - - switch (op) { - case DMA_CACHE_SYNC: -#if 0 - flusher = m88110_cmmu_sync_cache; - ext_flusher = mc88410_flush; -#endif - break; - case DMA_CACHE_SYNC_INVAL: - flusher = m88110_cmmu_sync_inval_cache; - ext_flusher = mc88410_sync; - break; - default: - if (va != _va || size != _size || size >= PAGE_SIZE) { - flusher = m88110_cmmu_sync_inval_cache; - ext_flusher = mc88410_sync; - } else { - flusher = m88110_cmmu_inval_cache; -#ifdef notyet - ext_flusher = mc88410_inval; -#else - ext_flusher = mc88410_sync; -#endif - } - break; - } - - psr = get_psr(); - set_psr(psr | PSR_IND); - - if (op == DMA_CACHE_SYNC) { - va = trunc_page(_va); - size = round_page(_va + _size) - va; - CMMU_LOCK; - while (size != 0) { - if (pmap_extract(pmap, va, &pa) != FALSE) { - m88110_cmmu_sync_cache(pa, PAGE_SIZE); - mc88410_flush_page(pa); - } - va += PAGE_SIZE; - size -= PAGE_SIZE; - } - CMMU_UNLOCK; - } else { - mc88110_inval_inst(); - while (size != 0) { - count = (va & PAGE_MASK) == 0 && size >= PAGE_SIZE ? - PAGE_SIZE : MC88110_CACHE_LINE; - - if (pmap_extract(pmap, va, &pa) != FALSE) { - (*flusher)(pa, count); - } - - va += count; - size -= count; - } - CMMU_LOCK; - (*ext_flusher)(); - CMMU_UNLOCK; - } - - set_psr(psr); -} - -void -m88110_dma_cachectl_pa(paddr_t _pa, psize_t _size, int op) +m88110_dma_cachectl(paddr_t _pa, psize_t _size, int op) { u_int32_t psr; paddr_t pa; @@ -787,7 +660,7 @@ m88110_dma_cachectl_pa(paddr_t _pa, psize_t _size, int op) } void -m88410_dma_cachectl_pa(paddr_t _pa, psize_t _size, int op) +m88410_dma_cachectl(paddr_t _pa, psize_t _size, int op) { u_int32_t psr; paddr_t pa; |