summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/2lib/2misc.c8
-rw-r--r--firmware/2lib/include/2api.h15
2 files changed, 23 insertions, 0 deletions
diff --git a/firmware/2lib/2misc.c b/firmware/2lib/2misc.c
index 7c4ca262..8b3aed03 100644
--- a/firmware/2lib/2misc.c
+++ b/firmware/2lib/2misc.c
@@ -713,3 +713,11 @@ char *vb2api_get_debug_info(struct vb2_context *ctx)
buf[DEBUG_INFO_MAX_LENGTH] = '\0';
return buf;
}
+
+void vb2api_prepare_for_extra_reboot(struct vb2_context *ctx)
+{
+ struct vb2_shared_data *sd = vb2_get_sd(ctx);
+
+ vb2_nv_set(ctx, VB2_NV_FW_TRIED, sd->last_fw_slot);
+ vb2_nv_set(ctx, VB2_NV_FW_RESULT, sd->last_fw_result);
+}
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 4c5e1dc6..88ffc2fe 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -1542,4 +1542,19 @@ vb2_error_t vb2ex_diag_memory_full_test(int reset, const char **out);
*/
uint32_t vb2ex_mtime(void);
+/*****************************************************************************/
+/* FW branch only API. */
+
+/**
+ * Prepare for a extra reboot
+ *
+ * To address a firmware bug b/180686277, a mitigation is added which introduces
+ * an additional EC reset. But when both the kernel partitions are corruption,
+ * this mitigiation introduces a reboot loop. To fix the reboot loop, a firmware
+ * branch only vboot API is introduced to prepare for the extra reboot. This
+ * work-around API stores the FW_TRIED and FW_RESULT data into vboot's NV
+ * storage before triggering a reboot.
+ */
+void vb2api_prepare_for_extra_reboot(struct vb2_context *ctx);
+
#endif /* VBOOT_REFERENCE_2API_H_ */