summaryrefslogtreecommitdiff
path: root/core/cortex-m
diff options
context:
space:
mode:
authorRob Barnes <robbarnes@google.com>2022-11-29 20:54:29 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-12-20 22:18:36 +0000
commit98e00bb45940f1cf31216a20c7441364d43fd8fb (patch)
tree91064c3133ba0ccc54642a1fd936af6e1f2e88a4 /core/cortex-m
parent6f7d0c158d22d27dc0f4aa4e45374d0a695eea83 (diff)
downloadchrome-ec-98e00bb45940f1cf31216a20c7441364d43fd8fb.tar.gz
panic: Publish EC_HOST_EVENT_PANIC on panic
Publish EC_HOST_EVENT_PANIC when a panic occurs. The kernel may use this event to clean up before the system is reset (e.g. sync the drive). This will be a no-op if the kernel doesn't handle it. BUG=b:258195448 BRANCH=None TEST=Observe event in kernel. Pass panic_event unit test. Change-Id: I34b9847778bf17dd113e81158bbbdf999ad2ca33 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4063818 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'core/cortex-m')
-rw-r--r--core/cortex-m/panic.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/cortex-m/panic.c b/core/cortex-m/panic.c
index eefe068931..7d364ec2a0 100644
--- a/core/cortex-m/panic.c
+++ b/core/cortex-m/panic.c
@@ -364,6 +364,9 @@ void __keep report_panic(void)
if (IS_ENABLED(CONFIG_ARMV7M_CACHE))
cpu_clean_invalidate_dcache();
+ if (IS_ENABLED(CONFIG_HOSTCMD_EVENTS))
+ host_set_single_event(EC_HOST_EVENT_PANIC);
+
/* Start safe mode if possible */
if (IS_ENABLED(CONFIG_SYSTEM_SAFE_MODE)) {
/* TODO: check for nested exceptions */