From 451813ef0c12ebf31b68e7a29c2752d882879ab6 Mon Sep 17 00:00:00 2001 From: Joel Kitching Date: Wed, 29 May 2019 15:22:54 +0800 Subject: vboot: don't use VB2_NV_DISPLAY_REQUEST for diagnostic mode Display initialization code now directly checks VB2_NV_DIAG_REQUEST. There is no need for diagnostic mode flow to set VB2_NV_DISPLAY_REQUEST. BUG=b:124141368, chromium:948592, chromium:967298, b:133175864 TEST=make clean && make runtests BRANCH=none Change-Id: I9748bf03c11c5698c181c177634d73fb34fd2d59 Signed-off-by: Joel Kitching Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1634452 Commit-Queue: Jason Clinton Tested-by: Jason Clinton Reviewed-by: Julius Werner --- firmware/lib/vboot_api_kernel.c | 41 +++++++++++++++-------------------------- firmware/lib/vboot_ui.c | 2 -- 2 files changed, 15 insertions(+), 28 deletions(-) (limited to 'firmware') diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index e32c9500..35f33813 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -414,33 +414,22 @@ VbError_t VbSelectAndLoadKernel( retval = VbBootRecovery(ctx); VbExEcEnteringMode(0, VB_EC_RECOVERY); } else if (DIAGNOSTIC_UI && vb2_nv_get(ctx, VB2_NV_DIAG_REQUEST)) { - /* If display is unavailable and was not requested, request it - and reboot. This is not a normal state. */ - if (!(vb2_get_sd(ctx)->flags & VB2_SD_FLAG_DISPLAY_AVAILABLE) && - !vb2_nv_get(ctx, VB2_NV_DISPLAY_REQUEST)) { - VB2_DEBUG("ERROR: Diagnostic mode needs a display " - "request; rebooting\n"); - vb2_nv_set(ctx, VB2_NV_DISPLAY_REQUEST, 1); + vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 0); + + /* + * Diagnostic boot. This has a UI but only power button + * is used for input so no detachable-specific UI is + * needed. This mode is also 1-shot so it's placed + * before developer mode. + */ + retval = VbBootDiagnostic(ctx); + /* + * The diagnostic menu should either boot a rom, or + * return either of reboot or shutdown. The following + * check is a safety precaution. + */ + if (!retval) retval = VBERROR_REBOOT_REQUIRED; - } else { - vb2_nv_set(ctx, VB2_NV_DISPLAY_REQUEST, 0); - vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 0); - - /* - * Diagnostic boot. This has a UI but only power button - * is used for input so no detachable-specific UI is - * needed. This mode is also 1-shot so it's placed - * before developer mode. - */ - retval = VbBootDiagnostic(ctx); - /* - * The diagnostic menu should either boot a rom, or - * return either of reboot or shutdown. The following - * check is a safety precaution. - */ - if (!retval) - retval = VBERROR_REBOOT_REQUIRED; - } } else if (ctx->flags & VB2_CONTEXT_DEVELOPER_MODE) { if (kparams->inflags & VB_SALK_INFLAGS_VENDOR_DATA_SETTABLE) ctx->flags |= VB2_CONTEXT_VENDOR_DATA_SETTABLE; diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c index 8321fbbb..7fc7a307 100644 --- a/firmware/lib/vboot_ui.c +++ b/firmware/lib/vboot_ui.c @@ -392,8 +392,6 @@ static VbError_t vb2_check_diagnostic_key(struct vb2_context *ctx, uint32_t key) { if (DIAGNOSTIC_UI && (key == VB_KEY_CTRL('C') || key == VB_KEY_F(12))) { VB2_DEBUG("Diagnostic mode requested, rebooting\n"); - if (!(vb2_get_sd(ctx)->flags & VB2_SD_FLAG_DISPLAY_AVAILABLE)) - vb2_nv_set(ctx, VB2_NV_DISPLAY_REQUEST, 1); vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 1); return VBERROR_REBOOT_REQUIRED; -- cgit v1.2.1