[PATCH v3 7/8] grlib: make memory coherency cpu-independent

Jiri Gaisler jiri at gaisler.se
Fri Jan 18 22:34:52 UTC 2019


---
 bsps/shared/grlib/spw/grspw.c     | 6 +++---
 bsps/sparc/leon2/include/bsp.h    | 2 +-
 bsps/sparc/leon2/start/bspstart.c | 4 ++--
 bsps/sparc/leon3/include/bsp.h    | 2 +-
 bsps/sparc/leon3/start/bspstart.c | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/bsps/shared/grlib/spw/grspw.c b/bsps/shared/grlib/spw/grspw.c
index fbaadd1e13..7d99831e71 100644
--- a/bsps/shared/grlib/spw/grspw.c
+++ b/bsps/shared/grlib/spw/grspw.c
@@ -25,8 +25,8 @@
 
 #include <grlib/grlib_impl.h>
 
-#ifndef CPU_SPARC_HAS_SNOOPING
-#define CPU_SPARC_HAS_SNOOPING 1
+#ifndef GRLIB_DMA_IS_CACHE_COHERENT
+#define GRLIB_DMA_IS_CACHE_COHERENT 1
 #endif
 
 #define DBGSPW_IOCALLS 1
@@ -1897,7 +1897,7 @@ static int grspw_hw_receive(GRSPW_DEV *pDev, char *b, int c) {
 		if (rxlen > c) {
 			rxlen = c;
 		}
-		if (CPU_SPARC_HAS_SNOOPING) {
+		if (GRLIB_DMA_IS_CACHE_COHERENT) {
 /*		if ( 1 ) {*/
 			/*printf("RX_MEMCPY(0x%x, 0x%x, 0x%x)\n", (unsigned int)b, (unsigned int)(rxb+pDev->rxbufcur), (unsigned int)rxlen);*/
 			memcpy(b, rxb+pDev->rxbufcur, rxlen);
diff --git a/bsps/sparc/leon2/include/bsp.h b/bsps/sparc/leon2/include/bsp.h
index e9b98492d7..fee50c055d 100644
--- a/bsps/sparc/leon2/include/bsp.h
+++ b/bsps/sparc/leon2/include/bsp.h
@@ -83,7 +83,7 @@ extern int rtems_smc91111_driver_attach_leon2(
  *  The synchronous trap is an arbitrarily chosen software trap.
  */
 
-extern int   CPU_SPARC_HAS_SNOOPING;
+extern int   GRLIB_DMA_IS_CACHE_COHERENT;
 
 /* Constants */
 
diff --git a/bsps/sparc/leon2/start/bspstart.c b/bsps/sparc/leon2/start/bspstart.c
index f2ed8ae16c..763d03ddc4 100644
--- a/bsps/sparc/leon2/start/bspstart.c
+++ b/bsps/sparc/leon2/start/bspstart.c
@@ -32,7 +32,7 @@
 /*
  * Tells us if data cache snooping is available
  */
-int CPU_SPARC_HAS_SNOOPING;
+int GRLIB_DMA_IS_CACHE_COHERENT;
 
 /*
  * set_snooping
@@ -49,7 +49,7 @@ static inline int set_snooping(void)
 
 void bsp_start( void )
 {
-  CPU_SPARC_HAS_SNOOPING = set_snooping();
+  GRLIB_DMA_IS_CACHE_COHERENT = set_snooping();
 }
 
 /* If RTEMS_DRVMGR_STARTUP is defined extra code is added that
diff --git a/bsps/sparc/leon3/include/bsp.h b/bsps/sparc/leon3/include/bsp.h
index 3fda4edc66..42d23c5a6f 100644
--- a/bsps/sparc/leon3/include/bsp.h
+++ b/bsps/sparc/leon3/include/bsp.h
@@ -101,7 +101,7 @@ extern int rtems_leon_greth_driver_attach(
 #define GRETH_SUPPORTED
 #define GRETH_MEM_LOAD(addr) leon_r32_no_cache((uintptr_t)addr)
 
-extern int   CPU_SPARC_HAS_SNOOPING;
+extern int   GRLIB_DMA_IS_CACHE_COHERENT;
 
 /* Constants */
 
diff --git a/bsps/sparc/leon3/start/bspstart.c b/bsps/sparc/leon3/start/bspstart.c
index 58fc7d0907..aeeb0a08fa 100644
--- a/bsps/sparc/leon3/start/bspstart.c
+++ b/bsps/sparc/leon3/start/bspstart.c
@@ -35,7 +35,7 @@ const unsigned char LEON3_mp_irq __attribute__((weak)) = 14;
 /*
  * Tells us if data cache snooping is available
  */
-int CPU_SPARC_HAS_SNOOPING;
+int GRLIB_DMA_IS_CACHE_COHERENT;
 
 /* Index of CPU, in an AMP system CPU-index may be non-zero */
 uint32_t LEON3_Cpu_Index = 0;
@@ -66,7 +66,7 @@ static inline int set_snooping(void)
  */
 void bsp_start( void )
 {
-  CPU_SPARC_HAS_SNOOPING = set_snooping();
+  GRLIB_DMA_IS_CACHE_COHERENT = set_snooping();
 }
 
 static void leon3_cpu_index_init(void)
-- 
2.17.1




More information about the devel mailing list