On 1/21/19 11:16 AM, Jiri Gaisler wrote:
> On 1/21/19 7:26 AM, Sebastian Huber wrote:
>> On 18/01/2019 23:34, Jiri Gaisler wrote:
>>>    */
>>>   -extern int   CPU_SPARC_HAS_SNOOPING;
>>> +extern int   GRLIB_DMA_IS_CACHE_COHERENT;
>> I would leave the SPARC BSPs as is. Maybe someone uses this 
>> CPU_SPARC_HAS_SNOOPING in external drivers or whatever. I would use the 
>> GRLIB_DMA_IS_CACHE_COHERENT only in the grlib and place something like this 
>> in grlib_impl.h:
>>
>> #include <bsp.h>
>>
>> #ifdef __sparc__
>> #define GRLIB_DMA_IS_CACHE_COHERENT CPU_SPARC_HAS_SNOOPING
>> #else
>> #define GRLIB_DMA_IS_CACHE_COHERENT 1
>> #endif
>>
> OK, I will fix this. I will skip '#include <bsp.h>' as it creates problems in 
> grlib/mem/mctrl.c (redefinition of struct mctrl_regs). However, since 
> CPU_SPARC_HAS_SNOOPING is defined in bsp.h, any external driver that uses 
> CPU_SPARC_HAS_SNOOPING already include bsp.h ...


How about something like this?



diff --git a/bsps/include/grlib/grlib_impl.h b/bsps/include/grlib/grlib_impl.h
index f1260671e0..68cc292886 100644
--- a/bsps/include/grlib/grlib_impl.h
+++ b/bsps/include/grlib/grlib_impl.h
@@ -121,6 +121,9 @@ RTEMS_INLINE_ROUTINE unsigned int grlib_read_uncached32(unsigned int address)
 	);
 	return tmp;
 }
+
+#define GRLIB_DMA_IS_CACHE_COHERENT CPU_SPARC_HAS_SNOOPING
+
 #else
 
 static unsigned char __inline__ grlib_read_uncached8(unsigned int address)
@@ -140,6 +143,8 @@ RTEMS_INLINE_ROUTINE unsigned int grlib_read_uncached32(unsigned int address)
 	return tmp;
 }
 
+#define GRLIB_DMA_IS_CACHE_COHERENT 1
+
 #endif
 
 extern struct ambapp_bus ambapp_plb;
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);
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to