summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2011-12-02 10:53:35 +0100
committerGedare Bloom <gedare@rtems.org>2012-03-27 16:29:22 -0400
commit39671330dc7db16955af7fb240f93d1ae192603f (patch)
tree58260d6cc5c4cf125366168c9bd54d0b26de507a /c/src/lib/libbsp
parentARM: PR2042: Provide stub for ARMv6-M (diff)
downloadrtems-39671330dc7db16955af7fb240f93d1ae192603f.tar.bz2
GRETH: added support for non-snooping GRETH 10/100 systems
When data cache snooping is not present the cache needs flushing, the SPARC LEON CPUs does not have to ability to flush individual cache rows and flushing all cache is expensive. Instead the LDA instruction is used to force cache miss on individual loads during the IP-align copy operation required anyway. GRETH GBIT non-snooping systems are still unsupported, since it use zero-copy (can deal with unaligned DMA). Let the bsp.h select if the GRETH driver is supported. Currently only the LEON2/LEON3 platforms BSPs builds the driver. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
Diffstat (limited to 'c/src/lib/libbsp')
-rw-r--r--c/src/lib/libbsp/sparc/leon2/include/bsp.h4
-rw-r--r--c/src/lib/libbsp/sparc/leon2/include/leon.h8
-rw-r--r--c/src/lib/libbsp/sparc/leon3/include/bsp.h4
-rw-r--r--c/src/lib/libbsp/sparc/leon3/include/leon.h8
4 files changed, 24 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/leon2/include/bsp.h b/c/src/lib/libbsp/sparc/leon2/include/bsp.h
index 3375d1034f..994f89bd8c 100644
--- a/c/src/lib/libbsp/sparc/leon2/include/bsp.h
+++ b/c/src/lib/libbsp/sparc/leon2/include/bsp.h
@@ -60,6 +60,10 @@ extern int rtems_smc91111_driver_attach_leon2(
#define HAS_SMC91111
+/* Configure GRETH driver */
+#define GRETH_SUPPORTED
+#define GRETH_MEM_LOAD(addr) leon_r32_no_cache(addr)
+
/*
* The synchronous trap is an arbitrarily chosen software trap.
*/
diff --git a/c/src/lib/libbsp/sparc/leon2/include/leon.h b/c/src/lib/libbsp/sparc/leon2/include/leon.h
index 168ebe5b52..c183c90ff4 100644
--- a/c/src/lib/libbsp/sparc/leon2/include/leon.h
+++ b/c/src/lib/libbsp/sparc/leon2/include/leon.h
@@ -369,6 +369,14 @@ extern LEON_Register_Map LEON_REG;
#define LEON_REG_TIMER_COUNTER_DEFINED_MASK 0x00000003
#define LEON_REG_TIMER_COUNTER_CURRENT_MODE_MASK 0x00000003
+/* Load 32-bit word by forcing a cache-miss */
+static inline unsigned int leon_r32_no_cache(uintptr_t addr)
+{
+ unsigned int tmp;
+ asm volatile (" lda [%1] 1, %0\n" : "=r"(tmp) : "r"(addr));
+ return tmp;
+}
+
#endif /* !ASM */
#ifdef __cplusplus
diff --git a/c/src/lib/libbsp/sparc/leon3/include/bsp.h b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
index 340ec6f126..421d850272 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/bsp.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
@@ -73,6 +73,10 @@ extern int rtems_leon_greth_driver_attach(
#define HAS_SMC91111
+/* Configure GRETH driver */
+#define GRETH_SUPPORTED
+#define GRETH_MEM_LOAD(addr) leon_r32_no_cache(addr)
+
extern int CPU_SPARC_HAS_SNOOPING;
diff --git a/c/src/lib/libbsp/sparc/leon3/include/leon.h b/c/src/lib/libbsp/sparc/leon3/include/leon.h
index b953e59b40..cd50629176 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/leon.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/leon.h
@@ -326,6 +326,14 @@ extern int LEON3_Cpu_Index;
#define LEON_REG_TIMER_COUNTER_DEFINED_MASK 0x00000003
#define LEON_REG_TIMER_COUNTER_CURRENT_MODE_MASK 0x00000003
+/* Load 32-bit word by forcing a cache-miss */
+static inline unsigned int leon_r32_no_cache(uintptr_t addr)
+{
+ unsigned int tmp;
+ asm volatile (" lda [%1] 1, %0\n" : "=r"(tmp) : "r"(addr));
+ return tmp;
+}
+
#endif /* !ASM */
#ifdef __cplusplus