[U-Boot] [PATCH v2] nios2: flush data cache after relocating code in start.S
Thomas Chou
thomas at wytron.com.tw
Wed Mar 24 15:52:01 CET 2010
If we relocate the code, the data cache must be flushed before
we jump to the new code.
Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
---
cpu/nios2/start.S | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/cpu/nios2/start.S b/cpu/nios2/start.S
index 31cd5b0..61784d8 100644
--- a/cpu/nios2/start.S
+++ b/cpu/nios2/start.S
@@ -98,6 +98,17 @@ _cur: movhi r5, %hi(_cur - _start)
stwio r7, 0(r5)
addi r5, r5, 4
bne r5, r6, 2b
+
+ /* DCACHE FLUSH -- after relocating code and data
+ */
+ movhi r4, %hi(CONFIG_SYS_DCACHELINE_SIZE)
+ ori r4, r4, %lo(CONFIG_SYS_DCACHELINE_SIZE)
+ movhi r5, %hi(CONFIG_SYS_DCACHE_SIZE)
+ ori r5, r5, %lo(CONFIG_SYS_DCACHE_SIZE)
+ mov r6, r0
+1: flushd 0(r6)
+ add r6, r6, r4
+ bltu r6, r5, 1b
3:
/* ZERO BSS/SBSS -- bss and sbss are assumed to be adjacent
--
1.6.6.1
More information about the U-Boot
mailing list