summaryrefslogtreecommitdiff
path: root/firmware/lib/vboot_api_kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/lib/vboot_api_kernel.c')
-rw-r--r--firmware/lib/vboot_api_kernel.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index d5dda055..e32c9500 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -151,6 +151,31 @@ uint32_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
return retval;
}
+/**
+ * Reset any NVRAM requests.
+ *
+ * @param ctx Vboot context
+ * @return 1 if a reboot is required, 0 otherwise.
+ */
+static int vb2_reset_nv_requests(struct vb2_context *ctx)
+{
+ int need_reboot = 0;
+
+ if (vb2_nv_get(ctx, VB2_NV_DISPLAY_REQUEST)) {
+ VB2_DEBUG("Unset display request (undo display init)\n");
+ vb2_nv_set(ctx, VB2_NV_DISPLAY_REQUEST, 0);
+ need_reboot = 1;
+ }
+
+ if (vb2_nv_get(ctx, VB2_NV_DIAG_REQUEST)) {
+ VB2_DEBUG("Unset diagnostic request (undo display init)\n");
+ vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 0);
+ need_reboot = 1;
+ }
+
+ return need_reboot;
+}
+
VbError_t VbBootNormal(struct vb2_context *ctx)
{
struct vb2_shared_data *sd = vb2_get_sd(ctx);
@@ -161,6 +186,11 @@ VbError_t VbBootNormal(struct vb2_context *ctx)
/* Boot from fixed disk only */
VB2_DEBUG("Entering\n");
+ if (vb2_reset_nv_requests(ctx)) {
+ VB2_DEBUG("Normal mode: reboot to reset NVRAM requests\n");
+ return VBERROR_REBOOT_REQUIRED;
+ }
+
VbError_t rv = VbTryLoadKernel(ctx, VB_DISK_FLAG_FIXED);
VB2_DEBUG("Checking if TPM kernel version needs advancing\n");