summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-09-06 00:03:16 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-09-06 00:03:16 +0000
commit4cb04f22509a2c8469700a9653ff463e740a0629 (patch)
treedef6a97e9b5f1e85480922a49f62f67a24afd84f /c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
parent2007-09-05 Daniel Hellstrom <daniel@gaisler.com> (diff)
downloadrtems-4cb04f22509a2c8469700a9653ff463e740a0629.tar.bz2
2007-09-05 Daniel Hellstrom <daniel@gaisler.com>
* include/bsp.h, startup/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...)
Diffstat (limited to '')
-rw-r--r--c/src/lib/libbsp/sparc/leon3/startup/bspstart.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
index e863250614..baf1b1cbef 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
@@ -42,11 +42,36 @@ rtems_cpu_table Cpu_table;
extern uint32_t rdb_start;
+/*
+ * Tells us if data cache snooping is available
+ */
+
+int CPU_SPARC_HAS_SNOOPING;
+
void bsp_postdriver_hook(void);
void bsp_libc_init( void *, uint32_t, int );
extern void bsp_spurious_initialize();
/*
+ * 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)
+{
+ int tmp;
+ asm(" lda [%1] 2, %0 "
+ : "=r"(tmp)
+ : "r"(0xC)
+ );
+ return (tmp >> 27) & 1;
+}
+
+/*
* bsp_pretasking_hook
*
* BSP pretasking hook. Called just before drivers are initialized.
@@ -112,4 +137,6 @@ void bsp_start( void )
}
BSP_Configuration.work_space_start = work_space_start;
+
+ CPU_SPARC_HAS_SNOOPING = set_snooping();
}