summaryrefslogtreecommitdiff
path: root/arch/nios2/cpu/cpu.c
diff options
context:
space:
mode:
authorThomas Chou <thomas@wytron.com.tw>2015-10-06 06:09:19 (GMT)
committerThomas Chou <thomas@wytron.com.tw>2015-10-22 23:58:58 (GMT)
commitb8112091bbd03835920787bbe474d796248a5999 (patch)
treefca39e9faf9ec5bedf7a7545405a04c3179b015b /arch/nios2/cpu/cpu.c
parent21ff7344d116df7f6963f1a699ed4b175d8485d7 (diff)
downloadu-boot-b8112091bbd03835920787bbe474d796248a5999.tar.xz
nios2: convert copy_exception_trampoline to use dm cpu data
Convert copy_exception_trampoline() to use dm cpu data. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Diffstat (limited to 'arch/nios2/cpu/cpu.c')
-rw-r--r--arch/nios2/cpu/cpu.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
index e4217c8..ff0fa20 100644
--- a/arch/nios2/cpu/cpu.c
+++ b/arch/nios2/cpu/cpu.c
@@ -29,6 +29,27 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
+/*
+ * COPY EXCEPTION TRAMPOLINE -- copy the tramp to the
+ * exception address. Define CONFIG_ROM_STUBS to prevent
+ * the copy (e.g. exception in flash or in other
+ * softare/firmware component).
+ */
+#ifndef CONFIG_ROM_STUBS
+static void copy_exception_trampoline(void)
+{
+ extern int _except_start, _except_end;
+ void *except_target = (void *)gd->arch.exception_addr;
+
+ if (&_except_start != except_target) {
+ memcpy(except_target, &_except_start,
+ &_except_end - &_except_start);
+ flush_cache(gd->arch.exception_addr,
+ &_except_end - &_except_start);
+ }
+}
+#endif
+
int arch_cpu_init_dm(void)
{
struct udevice *dev;
@@ -41,6 +62,9 @@ int arch_cpu_init_dm(void)
return -ENODEV;
gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+#ifndef CONFIG_ROM_STUBS
+ copy_exception_trampoline();
+#endif
return 0;
}