diff options
author | Rob Barnes <robbarnes@google.com> | 2023-05-09 13:16:06 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-11 00:42:44 +0000 |
commit | 5148f70c2592e08ff292e4b7da48d82d9e8b7724 (patch) | |
tree | e2985e8a504da52dd31952dfb766c88ea7af83c5 | |
parent | 632c7c935a544b6036890d64ce808e9e130e6947 (diff) | |
download | chrome-ec-5148f70c2592e08ff292e4b7da48d82d9e8b7724.tar.gz |
safe_mode: Shorten strings
Many old boards are out of flash space, which makes porting safe mode to
older boards difficult. To make this process smoother shorten strings so
less flash space is needed.
BUG=None
TEST=Safe mode runs
Change-Id: I0934f1a477b01e7c8f71241844ac0eefa093c5ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4519102
Commit-Queue: Rob Barnes <robbarnes@google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Rob Barnes <robbarnes@google.com>
Auto-Submit: Rob Barnes <robbarnes@google.com>
-rw-r--r-- | common/system_safe_mode.c | 19 | ||||
-rw-r--r-- | zephyr/test/system_safe_mode/src/system_safe_mode.c | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/common/system_safe_mode.c b/common/system_safe_mode.c index e49e206b4f..38b7991e12 100644 --- a/common/system_safe_mode.c +++ b/common/system_safe_mode.c @@ -19,6 +19,8 @@ #define STACK_PRINT_SIZE_WORDS 32 +#define CANNOT_ENTER_SAFE_MODE_FMT "Cannot start SSM: %s\n" + static bool in_safe_mode; static const int safe_mode_allowed_hostcmds[] = { @@ -79,8 +81,7 @@ int disable_non_safe_mode_critical_tasks(void) void handle_system_safe_mode_timeout(void) { - panic_printf("Safe mode timeout after %d msec\n", - CONFIG_SYSTEM_SAFE_MODE_TIMEOUT_MSEC); + panic_printf("SSM timeout\n"); panic_reboot(); } DECLARE_DEFERRED(handle_system_safe_mode_timeout); @@ -105,7 +106,7 @@ static void print_panic_stack(void) uint32_t sp; const struct panic_data *pdata = panic_get_data(); - ccprintf("\n========== Stack Contents ==========="); + ccprintf("\nStack Contents"); sp = get_panic_stack_pointer(pdata); for (int i = 0; i < STACK_PRINT_SIZE_WORDS; i++) { if (sp == 0 || @@ -133,7 +134,7 @@ bool command_is_allowed_in_safe_mode(int command) static void system_safe_mode_start(void) { - ccprintf("*** Post Panic System Safe Mode ***\n"); + ccprintf("Post Panic SSM\n"); if (IS_ENABLED(CONFIG_SYSTEM_SAFE_MODE_PRINT_STACK)) print_panic_stack(); if (IS_ENABLED(CONFIG_HOSTCMD_EVENTS)) @@ -144,19 +145,19 @@ DECLARE_DEFERRED(system_safe_mode_start); int start_system_safe_mode(void) { if (!system_is_in_rw()) { - panic_printf("Can only enter safe mode from RW image\n"); + panic_printf(CANNOT_ENTER_SAFE_MODE_FMT, "RO image"); return EC_ERROR_INVAL; } if (system_is_in_safe_mode()) { - panic_printf("Already in system safe mode"); + panic_printf(CANNOT_ENTER_SAFE_MODE_FMT, "Already in SSM"); return EC_ERROR_INVAL; } if (is_current_task_safe_mode_critical()) { /* TODO: Restart critical tasks */ - panic_printf( - "Fault in critical task, cannot enter system safe mode\n"); + panic_printf(CANNOT_ENTER_SAFE_MODE_FMT, + "Panic in critical task"); return EC_ERROR_INVAL; } @@ -173,7 +174,7 @@ int start_system_safe_mode(void) in_safe_mode = true; - panic_printf("\nStarting system safe mode\n"); + panic_printf("Starting SSM\n"); return EC_SUCCESS; } diff --git a/zephyr/test/system_safe_mode/src/system_safe_mode.c b/zephyr/test/system_safe_mode/src/system_safe_mode.c index f75a27ec84..036bc4c8e0 100644 --- a/zephyr/test/system_safe_mode/src/system_safe_mode.c +++ b/zephyr/test/system_safe_mode/src/system_safe_mode.c @@ -177,7 +177,7 @@ ZTEST_USER(system_safe_mode, test_print_stack_contents) uint16_t write_count; regex_t regex; - char *regex_str = "========== Stack Contents ===========\n" + char *regex_str = "Stack Contents\n" "[0-9a-f]{8}: 00000000 00000001 00000002 00000003\n" "[0-9a-f]{8}: 00000004 00000005 00000006 00000007\n" "[0-9a-f]{8}: 00000008 00000009 0000000a 0000000b\n" |