diff options
author | Denis Brockus <dbrockus@chromium.org> | 2019-06-05 10:21:01 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-11 03:24:06 +0000 |
commit | c89e3557f808c504d8feece4d28a96450089b05f (patch) | |
tree | 2d18eb17e3ff71dc055c780b3d2f49a542160207 /core/nds32 | |
parent | c9fe943591d489e254f96fcabc745ddd1b778a6b (diff) | |
download | chrome-ec-c89e3557f808c504d8feece4d28a96450089b05f.tar.gz |
minute-ia: ish software panic
Adding functions for software panic to ISH. This includes
panic_set_reason, panic_get_reason and software_panic.
Added extra output when a software panic is detected.
Had to touch nds32/panic.c in order to make panic_sw_reasons
common.
BUG=b:134502392
BRANCH=none
TEST=Verified with crash assert, with CONFIG_DEBUG_ASSERT defined
Change-Id: Iebfe62a7dcd59b4bbed82b450dfd44cc8eaed1da
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1648958
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'core/nds32')
-rw-r--r-- | core/nds32/panic.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/core/nds32/panic.c b/core/nds32/panic.c index 3dabc1d2f0..9bc06fc409 100644 --- a/core/nds32/panic.c +++ b/core/nds32/panic.c @@ -8,6 +8,7 @@ #include "cpu.h" #include "panic.h" #include "printf.h" +#include "software_panic.h" #include "system.h" #include "task.h" #include "timer.h" @@ -78,18 +79,6 @@ static const char * const itype_exc_type[16] = { #endif /* CONFIG_DEBUG_EXCEPTIONS */ #ifdef CONFIG_SOFTWARE_PANIC -/* Software panic reasons */ -static const char * const panic_sw_reasons[8] = { - "PANIC_SW_DIV_ZERO", - "PANIC_SW_STACK_OVERFLOW", - "PANIC_SW_PD_CRASH", - "PANIC_SW_ASSERT", - "PANIC_SW_WATCHDOG", - NULL, - NULL, - NULL, -}; - void software_panic(uint32_t reason, uint32_t info) { asm volatile ("mov55 $r6, %0" : : "r"(reason)); @@ -163,10 +152,11 @@ static void print_panic_information(uint32_t *regs, uint32_t itype, #ifdef CONFIG_DEBUG_EXCEPTIONS panic_printf("SWID of ITYPE: %x\n", ((itype >> 16) & 0x7fff)); - if ((regs[SOFT_PANIC_GPR_REASON] & 0xfffffff0) == PANIC_SW_BASE) { + if (panic_sw_reason_is_valid(regs[SOFT_PANIC_GPR_REASON])) { #ifdef CONFIG_SOFTWARE_PANIC panic_printf("Software panic reason %s\n", - panic_sw_reasons[(regs[SOFT_PANIC_GPR_REASON] & 0x7)]); + panic_sw_reasons[(regs[SOFT_PANIC_GPR_REASON] - + PANIC_SW_BASE)]); panic_printf("Software panic info 0x%x\n", regs[SOFT_PANIC_GPR_INFO]); #endif |