diff options
author | Joel Kitching <kitching@google.com> | 2019-05-29 15:22:54 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-07 20:09:44 +0000 |
commit | 451813ef0c12ebf31b68e7a29c2752d882879ab6 (patch) | |
tree | 65fe8c3e0f7a125c258715ae04678c2de57dc574 | |
parent | efd0dc23e855c8ec5a4cd4e0bb08b4ae1e40bfb3 (diff) | |
download | vboot-451813ef0c12ebf31b68e7a29c2752d882879ab6.tar.gz |
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 <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1634452
Commit-Queue: Jason Clinton <jclinton@chromium.org>
Tested-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r-- | firmware/lib/vboot_api_kernel.c | 41 | ||||
-rw-r--r-- | firmware/lib/vboot_ui.c | 2 | ||||
-rw-r--r-- | tests/vboot_api_kernel2_tests.c | 4 | ||||
-rw-r--r-- | tests/vboot_api_kernel4_tests.c | 18 |
4 files changed, 18 insertions, 47 deletions
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; diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c index 66de74aa..c8e269e0 100644 --- a/tests/vboot_api_kernel2_tests.c +++ b/tests/vboot_api_kernel2_tests.c @@ -1408,8 +1408,8 @@ static void VbBootRecTest(void) "F12 todiag - disabled"); TEST_EQ(vb2_nv_get(&ctx, VB2_NV_DIAG_REQUEST), DIAGNOSTIC_UI, " todiag is updated for F12"); - TEST_EQ(vb2_nv_get(&ctx, VB2_NV_DISPLAY_REQUEST), DIAGNOSTIC_UI, - " todiag sets DISPLAY_REQUEST if needed"); + TEST_EQ(vb2_nv_get(&ctx, VB2_NV_DISPLAY_REQUEST), 0, + " todiag doesn't set unneeded DISPLAY_REQUEST"); TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_INSERT, " insert screen"); diff --git a/tests/vboot_api_kernel4_tests.c b/tests/vboot_api_kernel4_tests.c index b3b34022..5d4370c0 100644 --- a/tests/vboot_api_kernel4_tests.c +++ b/tests/vboot_api_kernel4_tests.c @@ -266,27 +266,11 @@ static void VbSlkTest(void) ResetMocks(); mock_switches[1] = VB_SWITCH_FLAG_PHYS_PRESENCE_PRESSED; vb2_nv_set(&ctx_nvram_backend, VB2_NV_DIAG_REQUEST, 1); - vb2_nv_set(&ctx_nvram_backend, VB2_NV_DISPLAY_REQUEST, 1); vbboot_retval = -4; test_slk(VBERROR_SIMULATED, 0, - "Normal boot with diag - display available"); + "Normal boot with diag"); TEST_EQ(vb2_nv_get(&ctx_nvram_backend, VB2_NV_DIAG_REQUEST), 0, " diag not requested"); - TEST_EQ(vb2_nv_get(&ctx_nvram_backend, VB2_NV_DISPLAY_REQUEST), - 0, " DISPLAY_REQUEST disabled"); - - ResetMocks(); - mock_switches[1] = VB_SWITCH_FLAG_PHYS_PRESENCE_PRESSED; - vb2_nv_set(&ctx_nvram_backend, VB2_NV_DIAG_REQUEST, 1); - vb2_nv_set(&ctx_nvram_backend, VB2_NV_DISPLAY_REQUEST, 0); - sd->flags &= ~VB2_SD_FLAG_DISPLAY_AVAILABLE; - vbboot_retval = -4; - test_slk(VBERROR_REBOOT_REQUIRED, 0, - "Normal boot with diag - display unavailable"); - TEST_EQ(vb2_nv_get(&ctx_nvram_backend, VB2_NV_DIAG_REQUEST), - 1, " diag requested"); - TEST_EQ(vb2_nv_get(&ctx_nvram_backend, VB2_NV_DISPLAY_REQUEST), - 1, " DISPLAY_REQUEST needed"); } /* Boot dev */ |