diff options
author | Joel Kitching <kitching@google.com> | 2019-05-29 16:25:05 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-07 20:09:43 +0000 |
commit | efd0dc23e855c8ec5a4cd4e0bb08b4ae1e40bfb3 (patch) | |
tree | 7dc12209dcbace8a8c17de3e09e2c54bbb409075 /firmware/lib | |
parent | 40c35a022fc9ff9a2be0f394be45747e8f767931 (diff) | |
download | vboot-efd0dc23e855c8ec5a4cd4e0bb08b4ae1e40bfb3.tar.gz |
vboot: check display init when entering normal mode
In order to simplify code which uses VB2_NV_DISPLAY_REQUEST,
centralize disabling this NVRAM flag to a function called at
the start of VbBootNormal. Also disable VB2_NV_DIAG_REQUEST
here, since display init is enabled for this request as well.
BUG=b:124141368, chromium:948592, chromium:967298, b:133175864
TEST=make clean && make runtests
BRANCH=none
Change-Id: I8aa7c44671ada23c0500cd8a0c5d7f737298bb11
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1634451
Commit-Queue: Jason Clinton <jclinton@chromium.org>
Tested-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'firmware/lib')
-rw-r--r-- | firmware/lib/vboot_api_kernel.c | 30 |
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"); |