From 98e00bb45940f1cf31216a20c7441364d43fd8fb Mon Sep 17 00:00:00 2001 From: Rob Barnes Date: Tue, 29 Nov 2022 20:54:29 +0000 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4063818 Reviewed-by: Daisuke Nojiri Code-Coverage: Zoss --- core/cortex-m/panic.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/cortex-m') 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 */ -- cgit v1.2.1