summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Cederman <cederman@gaisler.com>2014-08-11 10:02:13 +0200
committerDaniel Hellstrom <daniel@gaisler.com>2014-08-22 13:10:59 +0200
commit62f373fb57a7c3d6b4bc86f59f42169a84bddf06 (patch)
treec88232faddf62d8da670f5bed33fcefc9d47b4f4
parentscore/sparc: Add comment on icache flush after trap table update (diff)
downloadrtems-62f373fb57a7c3d6b4bc86f59f42169a84bddf06.tar.bz2
bsp/sparc: Flush only instruction cache
The flush instruction on LEON flushes both the data and the instruction cache. Flushing of just the instruction cache can be done by setting the "flush instruction cache" bit in the cache control register.
-rw-r--r--c/src/lib/libbsp/sparc/leon3/include/cache_.h5
-rw-r--r--c/src/lib/libbsp/sparc/leon3/include/leon.h5
2 files changed, 9 insertions, 1 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/include/cache_.h b/c/src/lib/libbsp/sparc/leon3/include/cache_.h
index 70c1e2c9fc..c7813678b9 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/cache_.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/cache_.h
@@ -134,7 +134,10 @@ static inline void _CPU_cache_unfreeze_data(void)
static inline void _CPU_cache_invalidate_entire_instruction(void)
{
- __asm__ volatile ("flush");
+ uint32_t cache_reg = leon3_get_cache_control_register();
+
+ cache_reg |= LEON3_REG_CACHE_CTRL_FI;
+ leon3_set_cache_control_register(cache_reg);
}
static inline void _CPU_cache_invalidate_instruction_range(
diff --git a/c/src/lib/libbsp/sparc/leon3/include/leon.h b/c/src/lib/libbsp/sparc/leon3/include/leon.h
index 1fc4e28e40..14cbc85796 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/leon.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/leon.h
@@ -86,6 +86,11 @@ extern "C" {
#define LEON_REG_TIMER_CONTROL_LD 0x00000004 /* 1 = load counter */
/* 0 = no function */
+/*
+ * The following defines the bits in the LEON Cache Control Register.
+ */
+#define LEON3_REG_CACHE_CTRL_FI 0x00200000 /* Flush instruction cache */
+
/* LEON3 Interrupt Controller */
extern volatile struct irqmp_regs *LEON3_IrqCtrl_Regs;
/* LEON3 GP Timer */