From: Heinrich Schuchardt Date: Wed, 2 Dec 2020 13:36:26 +0000 (+0100) Subject: riscv: reset after crash X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-favicon.png?a=commitdiff_plain;h=c353f2b845bbbb7b39ecb3f0aafac889cc25a328;p=u-boot.git riscv: reset after crash If an exception occurs on ARM or x86, we call panic() which will try to reset the board. Do the same on RISC-V. To avoid -Werror=format-zero-length move a '\n' to the string passed to panic. We don't need a message here as depending on CONFIG_PANIC_HANG we will either see ### ERROR ### Please RESET the board ### or resetting ... as next message. Reviewed-by: Rick Chen Signed-off-by: Heinrich Schuchardt --- diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c index 35de98e8ce..fb3ce118c1 100644 --- a/arch/riscv/lib/interrupts.c +++ b/arch/riscv/lib/interrupts.c @@ -27,7 +27,7 @@ static void show_efi_loaded_images(uintptr_t epc) static void show_regs(struct pt_regs *regs) { #ifdef CONFIG_SHOW_REGS - printf("SP: " REG_FMT " GP: " REG_FMT " TP: " REG_FMT "\n", + printf("\nSP: " REG_FMT " GP: " REG_FMT " TP: " REG_FMT "\n", regs->sp, regs->gp, regs->tp); printf("T0: " REG_FMT " T1: " REG_FMT " T2: " REG_FMT "\n", regs->t0, regs->t1, regs->t2); @@ -45,7 +45,7 @@ static void show_regs(struct pt_regs *regs) regs->s7, regs->s8, regs->s9); printf("S10: " REG_FMT " S11: " REG_FMT " T3: " REG_FMT "\n", regs->s10, regs->s11, regs->t3); - printf("T4: " REG_FMT " T5: " REG_FMT " T6: " REG_FMT "\n\n", + printf("T4: " REG_FMT " T5: " REG_FMT " T6: " REG_FMT "\n", regs->t4, regs->t5, regs->t6); #endif } @@ -80,12 +80,12 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs) epc, regs->ra, tval); /* Print relocation adjustments, but only if gd is initialized */ if (gd && gd->flags & GD_FLG_RELOC) - printf("EPC: " REG_FMT " RA: " REG_FMT " reloc adjusted\n\n", + printf("EPC: " REG_FMT " RA: " REG_FMT " reloc adjusted\n", epc - gd->reloc_off, regs->ra - gd->reloc_off); show_regs(regs); show_efi_loaded_images(epc); - hang(); + panic("\n"); } int interrupt_init(void)