diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2020-06-12 13:33:59 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-13 02:14:53 +0000 |
commit | 278a7b025ce1f9063b39ca771bfc2905feea2e73 (patch) | |
tree | e995e687c940f3c9ccf8451eaa31261a738da2d5 | |
parent | c352ad138dbcf3ff5041626e438841dab6992e68 (diff) | |
download | chrome-ec-278a7b025ce1f9063b39ca771bfc2905feea2e73.tar.gz |
system: Add system_is_manual_recovery API
This patch moves is_manual_recovery from common/vboot to
common/system.c to make it available as a common API.
There is no functionality change.
BUG=none
BRANCH=none
TEST=EFS2 detects manual recovery.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I3e6acd979feb78ff69b78780f1095fee855b4945
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242663
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | common/system.c | 5 | ||||
-rw-r--r-- | common/vboot/efs2.c | 9 | ||||
-rw-r--r-- | common/vboot/vboot.c | 9 | ||||
-rw-r--r-- | include/system.h | 7 |
4 files changed, 16 insertions, 14 deletions
diff --git a/common/system.c b/common/system.c index be900f58fc..8b3e294336 100644 --- a/common/system.c +++ b/common/system.c @@ -855,6 +855,11 @@ void system_common_pre_init(void) } } +int system_is_manual_recovery(void) +{ + return host_is_event_set(EC_HOST_EVENT_KEYBOARD_RECOVERY); +} + /** * Handle a pending reboot command. */ diff --git a/common/vboot/efs2.c b/common/vboot/efs2.c index f1976d8e8e..e6b818c3ad 100644 --- a/common/vboot/efs2.c +++ b/common/vboot/efs2.c @@ -226,11 +226,6 @@ __overridable void show_power_shortage(void) CPRINTS("%s", __func__); } -static int is_manual_recovery(void) -{ - return host_is_event_set(EC_HOST_EVENT_KEYBOARD_RECOVERY); -} - static bool is_battery_ready(void) { /* TODO: Add battery check (https://crbug.com/1045216) */ @@ -264,9 +259,9 @@ void vboot_main(void) system_clear_reset_flags(EC_RESET_FLAG_AP_IDLE); } - if (is_manual_recovery() || + if (system_is_manual_recovery() || (system_get_reset_flags() & EC_RESET_FLAG_STAY_IN_RO)) { - if (is_manual_recovery()) + if (system_is_manual_recovery()) CPRINTS("In recovery mode"); if (!IS_ENABLED(CONFIG_BATTERY) && !IS_ENABLED(HAS_TASK_KEYSCAN)) { diff --git a/common/vboot/vboot.c b/common/vboot/vboot.c index 9819c9c316..1cf9cf7d80 100644 --- a/common/vboot/vboot.c +++ b/common/vboot/vboot.c @@ -165,11 +165,6 @@ __overridable void show_critical_error(void) CPRINTS("%s", __func__); } -static int is_manual_recovery(void) -{ - return host_is_event_set(EC_HOST_EVENT_KEYBOARD_RECOVERY); -} - static bool pd_comm_enabled; bool vboot_allow_usb_pd(void) @@ -204,9 +199,9 @@ void vboot_main(void) return; } - if (is_manual_recovery() || + if (system_is_manual_recovery() || (system_get_reset_flags() & EC_RESET_FLAG_STAY_IN_RO)) { - if (is_manual_recovery()) + if (system_is_manual_recovery()) CPRINTS("Manual recovery"); if (battery_is_present() || has_matrix_keyboard()) { diff --git a/include/system.h b/include/system.h index 360b850470..9842111997 100644 --- a/include/system.h +++ b/include/system.h @@ -39,6 +39,13 @@ void system_pre_init(void); void system_common_pre_init(void); /** + * Checks if manual recovery is detected or not + * + * @return Non zero if manual recovery is detected or zero otherwise. + */ +int system_is_manual_recovery(void); + +/** * System common re-initialization; called to reset persistent state * left by system_common_pre_init(). This is useful for testing * scenarios calling system_common_pre_init() multiple times. |