summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/sparc/ChangeLog8
-rw-r--r--c/src/lib/libbsp/sparc/shared/bspstart.c29
2 files changed, 37 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/ChangeLog b/c/src/lib/libbsp/sparc/ChangeLog
index 32348679c5..76ac229f1d 100644
--- a/c/src/lib/libbsp/sparc/ChangeLog
+++ b/c/src/lib/libbsp/sparc/ChangeLog
@@ -1,5 +1,13 @@
2007-09-05 Daniel Hellstrom <daniel@gaisler.com>
+ * shared/bspstart.c: LEON2 and LEON3 Data cache snooping detection on
+ startup, for drivers. (LEON2,3 are configurable processors, they can
+ be with or without DCache snooping. Caches without snooping needs the
+ drivers to flush cache or use the sparc instruction lda to force
+ cache miss...)
+
+2007-09-05 Daniel Hellstrom <daniel@gaisler.com>
+
* shared/amba/ambapp.c, shared/include/ambapp.h: New files.
2007-09-05 Daniel Hellstrom <daniel@gaisler.com>
diff --git a/c/src/lib/libbsp/sparc/shared/bspstart.c b/c/src/lib/libbsp/sparc/shared/bspstart.c
index 17b3cfe74c..2ccd3a750f 100644
--- a/c/src/lib/libbsp/sparc/shared/bspstart.c
+++ b/c/src/lib/libbsp/sparc/shared/bspstart.c
@@ -47,6 +47,14 @@ rtems_cpu_table Cpu_table;
extern uint32_t rdb_start;
+#ifdef LEON2
+/*
+ * Tells us if data cache snooping is available
+ */
+
+int CPU_SPARC_HAS_SNOOPING;
+#endif
+
/*
* Use the shared implementations of the following routines
*/
@@ -55,6 +63,23 @@ void bsp_postdriver_hook(void);
void bsp_libc_init( void *, uint32_t, int );
extern void bsp_spurious_initialize();
+#ifdef LEON2
+/*
+ * set_snooping
+ *
+ * Read the data cache configuration register to determine if
+ * bus snooping is available. This is needed for some drivers so
+ * that they can select the most efficient copy routines.
+ *
+ */
+
+static inline int set_snooping(void)
+{
+ unsigned int tmp = *(unsigned int *)0x80000014; /* Cache control register */
+ return ((tmp>>23) & 1); /* Data cache snooping enabled */
+}
+#endif
+
/*
* bsp_pretasking_hook
*
@@ -118,4 +143,8 @@ void bsp_start( void )
}
BSP_Configuration.work_space_start = work_space_start;
+
+ #ifdef LEON2
+ CPU_SPARC_HAS_SNOOPING = set_snooping();
+ #endif
}