diff options
author | Thomas Chou <thomas@wytron.com.tw> | 2015-10-06 14:09:19 +0800 |
---|---|---|
committer | Thomas Chou <thomas@wytron.com.tw> | 2015-10-23 07:58:58 +0800 |
commit | b8112091bbd03835920787bbe474d796248a5999 (patch) | |
tree | fca39e9faf9ec5bedf7a7545405a04c3179b015b /arch/nios2/cpu/cpu.c | |
parent | 21ff7344d116df7f6963f1a699ed4b175d8485d7 (diff) | |
download | u-boot-b8112091bbd03835920787bbe474d796248a5999.tar.gz |
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.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c index e4217c8a2c..ff0fa20798 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; } |