diff options
author | Rob Barnes <robbarnes@google.com> | 2023-03-14 10:30:00 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-01 21:29:56 +0000 |
commit | ef0566e1e9234461c00987ff6e3236a5ac6a5a42 (patch) | |
tree | d27d0771dcfbb759b3e9fb983cfe82ee57946409 | |
parent | cd2369479ace4cac8080688cb9d9d58220e1e57d (diff) | |
download | chrome-ec-ef0566e1e9234461c00987ff6e3236a5ac6a5a42.tar.gz |
nds32: Support for system safe mode
Add support for entering system safe mode on nds32 based EC. This is
accomplished by returning from exception handler with iret.
BUG=b:269606355
BRANCH=dedede
TEST=Pass system safe mode tast test (with modified Kernel and AP).
Change-Id: Iac87b5ebd55ce0224b277257e137dffb7d764263
Signed-off-by: Rob Barnes <robbarnes@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4334213
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4482722
-rw-r--r-- | core/nds32/panic.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/nds32/panic.c b/core/nds32/panic.c index 4c855b5c06..8b87cc0ef8 100644 --- a/core/nds32/panic.c +++ b/core/nds32/panic.c @@ -9,6 +9,7 @@ #include "panic.h" #include "printf.h" #include "system.h" +#include "system_safe_mode.h" #include "task.h" #include "timer.h" #include "util.h" @@ -198,6 +199,20 @@ void report_panic(uint32_t *regs, uint32_t itype) pdata->nds_n8.ipsw = regs[17]; print_panic_information(regs, itype, regs[16], regs[17]); + + if (IS_ENABLED(CONFIG_SYSTEM_SAFE_MODE)) { + if (start_system_safe_mode() == EC_SUCCESS) { + pdata->flags |= PANIC_DATA_FLAG_SAFE_MODE_STARTED; + /* Current task has been disabled. + * Returning from the exception here should cause the + * highest priority task that wasn't disabled to run. + */ + asm("iret"); + __builtin_unreachable(); + } + pdata->flags |= PANIC_DATA_FLAG_SAFE_MODE_FAIL_PRECONDITIONS; + } + panic_reboot(); } |