summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/system.c5
-rw-r--r--common/vboot/efs2.c9
-rw-r--r--common/vboot/vboot.c9
-rw-r--r--include/system.h7
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.