summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@google.com>2021-05-24 15:15:16 -0600
committerCommit Bot <commit-bot@chromium.org>2021-05-25 02:31:02 +0000
commit3be910160e96403323bef44f6e62e33f9af4726c (patch)
tree4f6d1eccff591271d39035b199f8abf6715b9301
parent6dfd310aafde3602edab5dd2108c2c6386748c25 (diff)
downloadvboot-3be910160e96403323bef44f6e62e33f9af4726c.tar.gz
DEDEDE-ONLY: firmware/2lib/2misc: 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. BUG=b:184388049 BRANCH=dedede TEST=Build and boot to OS in Drawlat with a RO 13606.52.0 and RW 13606.199.0 + the fix. Ensure that the firmware_CorruptBothKernelAB.dev test passes instead of boot looping. Change-Id: Id53b9131034fcad6caeb3231c1c92d020b766338 Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2915753 Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Evan Green <evgreen@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-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_ */