diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2013-12-04 17:15:12 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-12-05 22:30:58 +0000 |
commit | 1762de9d19d2671cc56e5a479055379a346030d3 (patch) | |
tree | 21f6ec886e9abcf9638c8a88767b8299d7eddfe7 /include/panic.h | |
parent | b45f3b9f348c550a7389973d916b8b7cb6b25a88 (diff) | |
download | chrome-ec-1762de9d19d2671cc56e5a479055379a346030d3.tar.gz |
extract common core code
Move the non-core dependent code out of core/$(CORE) directory to
common/ directory.
Put all panic printing code in common/panic_output.c
Put timer management code in common/timer.c
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=chrome-os-partner:23574
TEST=./util/make_all.sh
use "crash divzero" and "panicinfo" on Link.
Change-Id: Ia4e1ebc74cd53da55fe24f69e96f39f512b9336d
Reviewed-on: https://chromium-review.googlesource.com/178871
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Jeremy Thorpe <jeremyt@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/panic.h')
-rw-r--r-- | include/panic.h | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/include/panic.h b/include/panic.h index 2647592448..40bab2487e 100644 --- a/include/panic.h +++ b/include/panic.h @@ -11,13 +11,8 @@ #include <stdarg.h> -/* Data saved across reboots */ -struct panic_data { - uint8_t arch; /* Architecture (PANIC_ARCH_*) */ - uint8_t struct_version; /* Structure version (currently 2) */ - uint8_t flags; /* Flags (PANIC_DATA_FLAG_*) */ - uint8_t reserved; /* Reserved; set 0 */ - +/* ARM Cortex-Mx registers saved on panic */ +struct cortex_panic_data { uint32_t regs[12]; /* psp, ipsr, msp, r4-r11, lr(=exc_return). * In version 1, that was uint32_t regs[11] = * psp, ipsr, lr, r4-r11 @@ -30,6 +25,19 @@ struct panic_data { uint32_t shcsr; uint32_t hfsr; uint32_t dfsr; +}; + +/* Data saved across reboots */ +struct panic_data { + uint8_t arch; /* Architecture (PANIC_ARCH_*) */ + uint8_t struct_version; /* Structure version (currently 2) */ + uint8_t flags; /* Flags (PANIC_DATA_FLAG_*) */ + uint8_t reserved; /* Reserved; set 0 */ + + /* core specific panic data */ + union { + struct cortex_panic_data cm; /* Cortex-Mx registers */ + }; /* * These fields go at the END of the struct so we can find it at the @@ -42,6 +50,14 @@ struct panic_data { #define PANIC_DATA_MAGIC 0x21636e50 /* "Pnc!" */ #define PANIC_ARCH_CORTEX_M 1 /* Cortex-M architecture */ +/* + * Panic data goes at the end of RAM. This is safe because we don't context + * switch away from the panic handler before rebooting, and stacks and data + * start at the beginning of RAM. + */ +#define PANIC_DATA_PTR ((struct panic_data *)\ + (CONFIG_RAM_BASE + CONFIG_RAM_SIZE - sizeof(struct panic_data))) + /* Flags for panic_data.flags */ /* panic_data.frame is valid */ #define PANIC_DATA_FLAG_FRAME_VALID (1 << 0) @@ -70,6 +86,13 @@ void panic_puts(const char *s); */ void panic_printf(const char *format, ...); +/* + * Print saved panic information + * + * @param pdata pointer to saved panic data + */ +void panic_data_print(const struct panic_data *pdata); + /** * Report an assertion failure and reset * |