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 | |
parent | 21ff7344d116df7f6963f1a699ed4b175d8485d7 (diff) | |
download | u-boot-imx-b8112091bbd03835920787bbe474d796248a5999.zip u-boot-imx-b8112091bbd03835920787bbe474d796248a5999.tar.gz u-boot-imx-b8112091bbd03835920787bbe474d796248a5999.tar.bz2 |
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')
-rw-r--r-- | arch/nios2/cpu/cpu.c | 24 | ||||
-rw-r--r-- | arch/nios2/cpu/start.S | 25 |
2 files changed, 25 insertions, 24 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; } diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S index 91e9c31..8758e7e 100644 --- a/arch/nios2/cpu/start.S +++ b/arch/nios2/cpu/start.S @@ -20,7 +20,7 @@ /* RESTART */ .text - .global _start + .global _start, _except_start, _except_end _start: wrctl status, r0 /* Disable interrupts */ @@ -99,29 +99,6 @@ _cur: movhi r5, %hi(_cur - _start) jmp r4 _reloc: - /* - * 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). - */ -#if !defined(CONFIG_ROM_STUBS) - movhi r4, %hi(_except_start) - ori r4, r4, %lo(_except_start) - movhi r5, %hi(_except_end) - ori r5, r5, %lo(_except_end) - movhi r6, %hi(CONFIG_SYS_EXCEPTION_ADDR) - ori r6, r6, %lo(CONFIG_SYS_EXCEPTION_ADDR) - beq r4, r6, 7f /* Skip if at proper addr */ - -6: ldwio r7, 0(r4) - stwio r7, 0(r6) - addi r4, r4, 4 - addi r6, r6, 4 - bne r4, r5, 6b -7: -#endif - /* STACK INIT -- zero top two words for call back chain. */ movhi sp, %hi(CONFIG_SYS_INIT_SP) ori sp, sp, %lo(CONFIG_SYS_INIT_SP) |