diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-05-07 18:06:40 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-05-07 18:06:40 +0000 |
commit | 97dfb91d59894043e6da5e2699ea2ca959bb5e2e (patch) | |
tree | c794a0abc2c57d8e99c1d519ca5bc2781a26d256 | |
parent | 80f0b9d565c94a1d9a57915e12b8e2435f9188c2 (diff) |
Introduce a new cmmu operation, cachectl_pa, similar to cachectl, but taking
a pa instead of a pmap_kernel va. The cachectl operation is now deprecated and
will disappear soon.
-rw-r--r-- | sys/arch/luna88k/luna88k/m8820x.c | 46 | ||||
-rw-r--r-- | sys/arch/m88k/include/cmmu.h | 5 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m88110.c | 20 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m8820x.c | 46 |
4 files changed, 112 insertions, 5 deletions
diff --git a/sys/arch/luna88k/luna88k/m8820x.c b/sys/arch/luna88k/luna88k/m8820x.c index 2c7255f71d1..cf53b7e6d5a 100644 --- a/sys/arch/luna88k/luna88k/m8820x.c +++ b/sys/arch/luna88k/luna88k/m8820x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m8820x.c,v 1.1 2004/04/21 15:24:03 aoyama Exp $ */ +/* $OpenBSD: m8820x.c,v 1.2 2004/05/07 18:06:39 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * @@ -138,6 +138,7 @@ void m8820x_cmmu_flush_cache(int, paddr_t, psize_t); void m8820x_cmmu_flush_inst_cache(int, paddr_t, psize_t); void m8820x_cmmu_flush_data_cache(int, paddr_t, psize_t); void m8820x_dma_cachectl(vaddr_t, vsize_t, int); +void m8820x_dma_cachectl_pa(paddr_t, psize_t, int); void m8820x_cmmu_dump_config(void); void m8820x_cmmu_show_translation(unsigned, unsigned, unsigned, int); void m8820x_show_apr(unsigned); @@ -159,6 +160,7 @@ struct cmmu_p cmmu8820x = { m8820x_cmmu_flush_inst_cache, m8820x_cmmu_flush_data_cache, m8820x_dma_cachectl, + m8820x_dma_cachectl_pa, #ifdef DDB m8820x_cmmu_dump_config, m8820x_cmmu_show_translation, @@ -1247,6 +1249,48 @@ m8820x_dma_cachectl(vaddr_t va, vsize_t size, int op) #endif /* !BROKEN_MMU_MASK */ } +void +m8820x_dma_cachectl_pa(paddr_t pa, psize_t size, int op) +{ +#if !defined(BROKEN_MMU_MASK) + psize_t count; + + while (size != 0) { + count = NBPG - (va & PGOFSET); + + if (size < count) + count = size; + + switch (op) { + case DMA_CACHE_SYNC: + m8820x_cmmu_sync_cache(pa, count); + break; + case DMA_CACHE_SYNC_INVAL: + m8820x_cmmu_sync_inval_cache(pa, count); + break; + default: + m8820x_cmmu_inval_cache(pa, count); + break; + } + + pa += count; + size -= count; + } +#else + switch (op) { + case DMA_CACHE_SYNC: + m8820x_cmmu_sync_cache(pa, size); + break; + case DMA_CACHE_SYNC_INVAL: + m8820x_cmmu_sync_inval_cache(pa, size); + break; + default: + m8820x_cmmu_inval_cache(pa, size); + break; + } +#endif /* !BROKEN_MMU_MASK */ +} + #ifdef DDB union ssr { unsigned bits; diff --git a/sys/arch/m88k/include/cmmu.h b/sys/arch/m88k/include/cmmu.h index c3e6bca6107..d9bce283e64 100644 --- a/sys/arch/m88k/include/cmmu.h +++ b/sys/arch/m88k/include/cmmu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cmmu.h,v 1.1 2004/04/26 12:34:05 miod Exp $ */ +/* $OpenBSD: cmmu.h,v 1.2 2004/05/07 18:06:39 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -67,6 +67,7 @@ struct cmmu_p { void (*cmmu_flush_inst_cache_func)(int, paddr_t, psize_t); void (*cmmu_flush_data_cache_func)(int, paddr_t, psize_t); void (*dma_cachectl_func)(vaddr_t, vsize_t, int); + void (*dma_cachectl_pa_func)(paddr_t, psize_t, int); /* DDB only */ void (*cmmu_dump_config_func)(void); void (*cmmu_show_translation_func)(unsigned, unsigned, unsigned, int); @@ -93,6 +94,7 @@ extern struct cmmu_p *cmmu; #define cmmu_flush_inst_cache(a, b, c) (cmmu->cmmu_flush_inst_cache_func)(a, b, c) #define cmmu_flush_data_cache(a, b, c) (cmmu->cmmu_flush_data_cache_func)(a, b, c) #define dma_cachectl(a, b, c) (cmmu->dma_cachectl_func)(a, b, c) +#define dma_cachectl_pa(a, b, c) (cmmu->dma_cachectl_pa_func)(a, b, c) #define cmmu_dump_config (cmmu->cmmu_dump_config_func) #define cmmu_show_translation(a, b, c, d) (cmmu->cmmu_show_translation_func)(a, b, c, d) #define show_apr(ap) (cmmu->show_apr_func)(ap) @@ -100,4 +102,3 @@ extern struct cmmu_p *cmmu; #endif /* _LOCORE */ #endif /* _MACHINE_CMMU_H_ */ - diff --git a/sys/arch/mvme88k/mvme88k/m88110.c b/sys/arch/mvme88k/mvme88k/m88110.c index c1cf9752b4d..e544c80ab4c 100644 --- a/sys/arch/mvme88k/mvme88k/m88110.c +++ b/sys/arch/mvme88k/mvme88k/m88110.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88110.c,v 1.13 2004/01/02 17:08:57 miod Exp $ */ +/* $OpenBSD: m88110.c,v 1.14 2004/05/07 18:06:34 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * All rights reserved. @@ -105,6 +105,7 @@ void m88110_cmmu_flush_cache(int, paddr_t, psize_t); void m88110_cmmu_flush_inst_cache(int, paddr_t, psize_t); void m88110_cmmu_flush_data_cache(int, paddr_t, psize_t); void m88110_dma_cachectl(vaddr_t, vsize_t, int); +void m88110_dma_cachectl_pa(paddr_t, psize_t, int); void m88110_cmmu_dump_config(void); void m88110_cmmu_show_translation(unsigned, unsigned, unsigned, int); void m88110_show_apr(unsigned); @@ -126,6 +127,7 @@ struct cmmu_p cmmu88110 = { m88110_cmmu_flush_inst_cache, m88110_cmmu_flush_data_cache, m88110_dma_cachectl, + m88110_dma_cachectl_pa, #ifdef DDB m88110_cmmu_dump_config, m88110_cmmu_show_translation, @@ -553,6 +555,22 @@ m88110_dma_cachectl(vaddr_t va, vsize_t size, int op) } } +void +m88110_dma_cachectl_pa(paddr_t pa, psize_t size, int op) +{ + switch (op) { + case DMA_CACHE_SYNC: + m88110_cmmu_sync_cache(pa, size); + break; + case DMA_CACHE_SYNC_INVAL: + m88110_cmmu_sync_inval_cache(pa, size); + break; + default: + m88110_cmmu_inval_cache(pa, size); + break; + } +} + #ifdef DDB void m88110_cmmu_dump_config(void) diff --git a/sys/arch/mvme88k/mvme88k/m8820x.c b/sys/arch/mvme88k/mvme88k/m8820x.c index bd9e55301bf..e3f8c32405d 100644 --- a/sys/arch/mvme88k/mvme88k/m8820x.c +++ b/sys/arch/mvme88k/mvme88k/m8820x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m8820x.c,v 1.31 2004/01/20 14:35:54 miod Exp $ */ +/* $OpenBSD: m8820x.c,v 1.32 2004/05/07 18:06:35 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * @@ -138,6 +138,7 @@ void m8820x_cmmu_flush_cache(int, paddr_t, psize_t); void m8820x_cmmu_flush_inst_cache(int, paddr_t, psize_t); void m8820x_cmmu_flush_data_cache(int, paddr_t, psize_t); void m8820x_dma_cachectl(vaddr_t, vsize_t, int); +void m8820x_dma_cachectl_pa(paddr_t, psize_t, int); void m8820x_cmmu_dump_config(void); void m8820x_cmmu_show_translation(unsigned, unsigned, unsigned, int); void m8820x_show_apr(unsigned); @@ -159,6 +160,7 @@ struct cmmu_p cmmu8820x = { m8820x_cmmu_flush_inst_cache, m8820x_cmmu_flush_data_cache, m8820x_dma_cachectl, + m8820x_dma_cachectl_pa, #ifdef DDB m8820x_cmmu_dump_config, m8820x_cmmu_show_translation, @@ -1502,6 +1504,48 @@ m8820x_dma_cachectl(vaddr_t va, vsize_t size, int op) #endif /* !BROKEN_MMU_MASK */ } +void +m8820x_dma_cachectl_pa(paddr_t pa, psize_t size, int op) +{ +#if !defined(BROKEN_MMU_MASK) + psize_t count; + + while (size != 0) { + count = NBPG - (va & PGOFSET); + + if (size < count) + count = size; + + switch (op) { + case DMA_CACHE_SYNC: + m8820x_cmmu_sync_cache(pa, count); + break; + case DMA_CACHE_SYNC_INVAL: + m8820x_cmmu_sync_inval_cache(pa, count); + break; + default: + m8820x_cmmu_inval_cache(pa, count); + break; + } + + pa += count; + size -= count; + } +#else + switch (op) { + case DMA_CACHE_SYNC: + m8820x_cmmu_sync_cache(pa, size); + break; + case DMA_CACHE_SYNC_INVAL: + m8820x_cmmu_sync_inval_cache(pa, size); + break; + default: + m8820x_cmmu_inval_cache(pa, size); + break; + } +#endif /* !BROKEN_MMU_MASK */ +} + #ifdef DDB union ssr { unsigned bits; |