diff options
author | Mathew King <mathewk@chromium.org> | 2019-04-11 11:56:47 -0600 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-13 18:37:56 -0700 |
commit | 351c005eddd763ba89997ebc08ad0e19d2d1c3a0 (patch) | |
tree | e9844999a64816a56b2b2804f78cccf86d69b6a9 /firmware | |
parent | 6ed4c9938ff0026bb2837171242cd39141e34055 (diff) | |
download | vboot-351c005eddd763ba89997ebc08ad0e19d2d1c3a0.tar.gz |
Enable launching diagnostics from OS broken screenstabilize-12088.B
If firmware diagnostics is enabled allow the user to lauch diagnostics
from the OS broken screen. Currently diagnostics can only be launched
from the recovery screen.
BUG=b:130244249
TEST=Tested on arcada device
make runmisctests
BRANCH=none
Change-Id: Ic6946338605599ea7411b5658acb2c6fc960a782
Signed-off-by: Mathew King <mathewk@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1564448
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/include/vboot_api.h | 3 | ||||
-rw-r--r-- | firmware/lib/vboot_ui.c | 30 |
2 files changed, 25 insertions, 8 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index 21ac36b4..66e26ef0 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -774,6 +774,9 @@ VbError_t VbExSetVendorData(const char *vendor_data_value); /* Key code for CTRL + letter */ #define VB_KEY_CTRL(letter) (letter & 0x1f) +/* Key code for fn keys */ +#define VB_KEY_F(num) (num + 0x108) + /* Key codes for required non-printable-ASCII characters. */ enum VbKeyCode_t { VB_KEY_ENTER = '\r', diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c index 6ba46682..9ccc9aa8 100644 --- a/firmware/lib/vboot_ui.c +++ b/firmware/lib/vboot_ui.c @@ -378,6 +378,20 @@ VbError_t vb2_vendor_data_ui(struct vb2_context *ctx) return VBERROR_SUCCESS; } +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)->vbsd->flags & VBSD_OPROM_MATTERS) + vb2_nv_set(ctx, VB2_NV_OPROM_NEEDED, 1); + vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 1); + + return VBERROR_REBOOT_REQUIRED; + } + + return VBERROR_SUCCESS; +} + /* * User interface for confirming launch of diagnostics rom * @@ -832,6 +846,10 @@ static VbError_t recovery_ui(struct vb2_context *ctx) VbCheckDisplayKey(ctx, key, NULL); if (VbWantShutdown(ctx, key)) return VBERROR_SHUTDOWN_REQUESTED; + else if ((retval = + vb2_check_diagnostic_key(ctx, key)) != + VBERROR_SUCCESS) + return retval; VbExSleepMs(REC_KEY_DELAY); } } @@ -922,14 +940,10 @@ static VbError_t recovery_ui(struct vb2_context *ctx) i = 4; break; } - } else if (DIAGNOSTIC_UI && - (key == VB_KEY_CTRL('C') || - key == 0x114)) { /* F12 */ - VB2_DEBUG("Diagnostic requested, rebooting\n"); - if (shared->flags & VBSD_OPROM_MATTERS) - vb2_nv_set(ctx, VB2_NV_OPROM_NEEDED, 1); - vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 1); - return VBERROR_REBOOT_REQUIRED; + } else if ((retval = + vb2_check_diagnostic_key(ctx, key)) != + VBERROR_SUCCESS) { + return retval; } else { VbCheckDisplayKey(ctx, key, NULL); } |