summaryrefslogtreecommitdiff
path: root/common/panic_output.c
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2022-05-10 00:36:02 +1000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-17 16:17:47 +0000
commiteede9612c6bcd553dcb3ce50fdd264e7d7d19bf1 (patch)
treecc5c2193118b6156f758312e60cf8a2462cbdb4f /common/panic_output.c
parenta3809a62ae6626ef210163d6897aeec5b6cef5de (diff)
downloadchrome-ec-eede9612c6bcd553dcb3ce50fdd264e7d7d19bf1.tar.gz
zephyr: panic: Capture the panic information
Re-enable capturing the crash information from Zephyr and placing it in the panic structure at the end of RAM. For the host test environment, use a statically allocated panic data structure. BUG=b:231951177 TEST=zmake build nereid; test crash.ECCrash passes BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Iaf5230da79fbbbc2ffb0ea49555fad096d8dade0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3634901 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/panic_output.c')
-rw-r--r--common/panic_output.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/common/panic_output.c b/common/panic_output.c
index 03c500528e..45fd1f732a 100644
--- a/common/panic_output.c
+++ b/common/panic_output.c
@@ -20,17 +20,15 @@
#include "util.h"
/*
- * TODO(b/178011288): use persistent storage for panic data in
- * Zephyr OS
+ * For host tests, use a static area for panic data.
*/
-#ifdef CONFIG_ZEPHYR
+#ifdef CONFIG_BOARD_NATIVE_POSIX
static struct panic_data zephyr_panic_data;
#undef PANIC_DATA_PTR
#undef CONFIG_PANIC_DATA_BASE
#define PANIC_DATA_PTR (&zephyr_panic_data)
#define CONFIG_PANIC_DATA_BASE (&zephyr_panic_data)
#endif
-
/* Panic data goes at the end of RAM. */
static struct panic_data * const pdata_ptr = PANIC_DATA_PTR;
@@ -178,7 +176,7 @@ uintptr_t get_panic_data_start(void)
if (pdata_ptr->magic != PANIC_DATA_MAGIC)
return 0;
- if (IS_ENABLED(CONFIG_ZEPHYR))
+ if (IS_ENABLED(CONFIG_BOARD_NATIVE_POSIX))
return (uintptr_t)pdata_ptr;
return ((uintptr_t)CONFIG_PANIC_DATA_BASE
@@ -199,11 +197,8 @@ static uint32_t get_panic_data_size(void)
* Please note that this function can move jump data and jump tags.
* It can also delete panic data from previous boot, so this function
* should be used when we are sure that we don't need it.
- *
- * TODO(b/178011288): figure out an appropriate implementation for
- * Zephyr.
*/
-#ifdef CONFIG_ZEPHYR
+#ifdef CONFIG_BOARD_NATIVE_POSIX
struct panic_data *get_panic_data_write(void)
{
return pdata_ptr;
@@ -291,7 +286,7 @@ struct panic_data *get_panic_data_write(void)
return pdata_ptr;
}
-#endif /* CONFIG_ZEPHYR */
+#endif /* CONFIG_BOARD_NATIVE_POSIX */
static void panic_init(void)
{