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-03-15 21:50:32 +0000 |
commit | 255c4a92012467ce40ab15389ef0a0f3b516f97c (patch) | |
tree | 6a42148709cd8f8ac854db65d6bf9f6079a193cd /core | |
parent | fd97093693fd60d5907f9de6dc833b22c7316cb0 (diff) | |
download | chrome-ec-255c4a92012467ce40ab15389ef0a0f3b516f97c.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>
Diffstat (limited to 'core')
-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 5a877f8572..a111286144 100644 --- a/core/nds32/panic.c +++ b/core/nds32/panic.c @@ -10,6 +10,7 @@ #include "printf.h" #include "software_panic.h" #include "system.h" +#include "system_safe_mode.h" #include "task.h" #include "timer.h" #include "util.h" @@ -190,6 +191,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(); } |