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 /common/panic_output.c | |
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 'common/panic_output.c')
-rw-r--r-- | common/panic_output.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/common/panic_output.c b/common/panic_output.c index 8d34adaa38..1d85e0a9d8 100644 --- a/common/panic_output.c +++ b/common/panic_output.c @@ -10,6 +10,7 @@ #include "host_command.h" #include "panic.h" #include "printf.h" +#include "software_panic.h" #include "system.h" #include "task.h" #include "timer.h" @@ -19,6 +20,31 @@ /* Panic data goes at the end of RAM. */ static struct panic_data * const pdata_ptr = PANIC_DATA_PTR; +/* Common SW Panic reasons strings */ +const char * const panic_sw_reasons[] = { +#ifdef CONFIG_SOFTWARE_PANIC + "PANIC_SW_DIV_ZERO", + "PANIC_SW_STACK_OVERFLOW", + "PANIC_SW_PD_CRASH", + "PANIC_SW_ASSERT", + "PANIC_SW_WATCHDOG", + "PANIC_SW_RNG", + "PANIC_SW_PMIC_FAULT", +#endif +}; + +/** + * Check an interrupt vector as being a valid software panic + * @param reason Reason for panic + * @return 0 if not a valid software panic reason, otherwise non-zero. + */ +int panic_sw_reason_is_valid(uint32_t reason) +{ + return (IS_ENABLED(CONFIG_SOFTWARE_PANIC) && + reason >= PANIC_SW_BASE && + (reason - PANIC_SW_BASE) < ARRAY_SIZE(panic_sw_reasons)); +} + /** * Add a character directly to the UART buffer. * |