summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vendorcode/google/chromeos/chromeos.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/vendorcode/google/chromeos/chromeos.c b/src/vendorcode/google/chromeos/chromeos.c
index c2cc0e1c08..828cfd289a 100644
--- a/src/vendorcode/google/chromeos/chromeos.c
+++ b/src/vendorcode/google/chromeos/chromeos.c
@@ -41,8 +41,21 @@ static int vboot_enable_developer(void)
return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_DEVELOPER);
}
+
+static int vboot_enable_recovery(void)
+{
+ struct vboot_handoff *vbho;
+
+ vbho = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
+
+ if (vbho == NULL)
+ return 0;
+
+ return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_RECOVERY);
+}
#else
static inline int vboot_enable_developer(void) { return 0; }
+static inline int vboot_enable_recovery(void) { return 0; }
#endif
int developer_mode_enabled(void)
@@ -52,11 +65,20 @@ int developer_mode_enabled(void)
int recovery_mode_enabled(void)
{
- /* TODO(reinauer): get information from VbInit.
- * the recovery mode switch is not the only reason to go
- * to recovery mode.
+ /*
+ * This is called in multiple places and has to detect
+ * recovery mode triggered from the EC and via shared
+ * recovery reason set with crossystem.
+ *
+ * If shared recovery reason is set:
+ * - before VbInit then get_recovery_mode_from_vbnv() is true
+ * - after VbInit then vboot_enable_recovery() is true
+ *
+ * Otherwise the mainboard handler for get_recovery_mode_switch()
+ * will detect recovery mode initiated by the EC.
*/
- return get_recovery_mode_switch() || get_recovery_mode_from_vbnv();
+ return get_recovery_mode_switch() || get_recovery_mode_from_vbnv() ||
+ vboot_enable_recovery();
}
#if CONFIG_VBOOT_VERIFY_FIRMWARE