summaryrefslogtreecommitdiff
path: root/firmware
Commit message (Collapse)AuthorAgeFilesLines
* vboot: Introduce alternate boot functionalityJoel Kitching2020-09-115-2/+140
| | | | | | | | | | | | | | | | | | | | Introduce alternate boot functionality both via keyboard shortcut ("Ctrl+L") to directly boot into the default alternate bootloader, and via menu ("Alternate bootloader" on dev screen) to show a screen listing available bootloaders. BUG=b:146399181, b:161092974 TEST=make clean && make runtests BRANCH=puff, zork Cq-Depend: chromium:2339040 Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I28f157936017719dc95656db147967f5e61a1407 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2335017 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* minidiag: Add storage and memory diagnostic screensMeng-Huan Yu2020-09-104-0/+229
| | | | | | | | | | | | | | | | | BRANCH=none BUG=b:156692539, b:156693348 TEST=emerge-hatch vboot_reference TEST=unittest passed: ( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 MENU_UI=1 DIAGNOSTIC_UI=1 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) Cq-Depend: chromium:2322286, chromium:2328704, chromium:2336239 Cq-Depend: chromium:2361823, chromium:2361582 Signed-off-by: Meng-Huan Yu <menghuan@chromium.org> Change-Id: I8b875b09bd5bcdb65f08c11945b046d2b3c3a113 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2372022 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Always show page up/down buttons in log screenHsuan Ting Chen2020-09-091-69/+22
| | | | | | | | | | | | | | | | | | | Always show page up/down buttons in log screen. Beep if users select the page up button on the first page or the page down button on the last page. BRANCH=puff, zork BUG=b:146399181, b:163301076 TEST=emerge-puff depthcharge TEST=emerge-zork depthcharge TEST=navigate to the debug info screen by <TAB> Cq-Depend: chromium:2361582 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I29a567554f9283ea3fca0f58fb31c7056523c2a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2361823 Commit-Queue: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* minidiag: Add diagnostic menu screenMeng-Huan Yu2020-09-055-9/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | BRANCH=none BUG=b:156692539, b:156693348 TEST=emerge-hatch vboot_reference TEST=unittest passed: ( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 MENU_UI=0 DIAGNOSTIC_UI=0 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) ( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 MENU_UI=1 DIAGNOSTIC_UI=0 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) ( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 MENU_UI=0 DIAGNOSTIC_UI=1 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) ( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 MENU_UI=1 DIAGNOSTIC_UI=1 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) Cq-Depend: chromium:2193314, chromium:2328704 Signed-off-by: Meng-Huan Yu <menghuan@chromium.org> Change-Id: I4f3c64ce53b14437cb14d3c1109e14608d082141 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2318590 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Add refresh flag to support force refresh the screen in actionMeng-Huan Yu2020-09-032-4/+13
| | | | | | | | | | | | | | | | | | | | | | CL:2163088 is working on depthcharge side to support refreshing everything in vboot side, but it is still work in progress. In the meanwhile, we can have a flag to control the refreshing for already support refreshing everytime screen. This flag can be removed after all screens are supported refreshing everytime in vboot. BRANCH=none BUG=b:156692539, b:156693348 TEST=emerge-hatch vboot_reference TEST=verfied in later CL that the screen is refreshed when the action callback set this flag. Signed-off-by: Meng-Huan Yu <menghuan@chromium.org> Change-Id: Ie76e8dce5186d0acfbc176a4cc8079c3df37fd38 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2336239 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Implement firmware log screenHsuan Ting Chen2020-09-033-0/+121
| | | | | | | | | | | | | | | | | | | | | | | Implement firmware log screen which can be accessed from advanced options menu. The screen displays a snapshot for the firmware log using the same layout of debug info screen. BRANCH=puff, zork BUG=b:146399181, b:146105976 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=USE="menu_ui" emerge-puff depthcharge TEST=USE="menu_ui" emerge-zork depthcharge TEST=select "advanced options", and navigate to firmware log screen Cq-Depend: chromium:2334490 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I3cb5800d71925aa20ca4d5636172885e23fd0099 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2328241 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* 2stub: vb2ex_abort()s on host should abort(), not just exit()Julius Werner2020-09-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Our keyblock and preamble fuzzers have been broken since CL:2353775, because they don't set up secdata in the context which the tested functions now depend upon. Unfortunately, we got no alerting about this... I only just happened to look at ClusterFuzz randomly today and saw an odd break in execution statistics around that date. With the new code as it is right now, all fuzzing attempts of the function end up running vb2ex_abort() from the uninitialized secdata. It would be great if the fuzzer could report every time it ends up in that function, but it doesn't seem to do that right now. Supposedly it reports "crashes", but I guess exit(1) is not a crash, so let's switch the line to abort() and see if that gets me the reporting behavior I want (before actually fixing the fuzzer). BRANCH=None BUG=None TEST=None Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ie65838f30fa33a7602db253860afc8eeadcac4c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2389002 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Add reinit screen hookfactory-trogdor-13443.BHsuan Ting Chen2020-08-303-1/+28
| | | | | | | | | | | | | | | | | | | | | | | Re-initialize the log screen when going back from another screen. BRANCH=puff BUG=b:146399181, b:146105976 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=USE="menu_ui" emerge-puff depthcharge when the firmware log screen is implemented, select "advanced options", navigate to firmware log screen, press <TAB> to debug info, and select back to firmware log screen Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ie44805e3bfb14a4a8b660a18a123a184a4c5ea45 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2329224 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> (cherry picked from commit 2cb872fa3056158c35f82a9412e667b69ccf5a49) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2332200 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Fix handling error beep request without screen state changeHsuan Ting Chen2020-08-291-1/+3
| | | | | | | | | | | | | | | | | Check the variable error_beep to handle the error beep request without screen state change. BRANCH=zork BUG=b:146399181 TEST=USE="menu_ui" emerge-zork depthcharge chromeos-bootimage TEST=Enter the debug info screen by <TAB>, select <Page up>, and notice a beep Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Id31fb06c37e2fee9b2eec1030cec06f22e7de854 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2379585 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot2: use hwcrypto for RSA when allowedKangheui Won2020-08-269-27/+95
| | | | | | | | | | | | | | | | | | | Add vb2ex_hwcrypto_rsa_verify support for RSA verification. If firmware implements the function it will used instead of SW implementation in vboot. Also separate hwcrypto stubs to 2stub_hwcrypto.c for depthcharge and coreboot. Depthcharge needs stubs but fails to compile 2stub.c BRANCH=none BUG=b:163710320, b:161205813 TEST=make runtests TEST=check hwcrypto is allowed/disallowed depending on nvmem flag Change-Id: I85573e7cff31f32043db4b0a6b24b642856024e3 Signed-off-by: Kangheui Won <khwon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2353775 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: adjust VB2_SECDATA_KERNEL_FLAGS in non-recovery pathChun-Ta Lin2020-08-241-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, VB2_SECDATA_KERNEL_FLAGS controls experimental features like phone recovery (and its UI), diagnostics entry. All of those are under recovery screen. In order to allow later update pushes to enable specific features in write-protected RO, we should not set those flags in recovery path. Otherwise, it will always toggle back and forth when booting RO recovery path vs. normal boot path. BRANCH=puff BUG=b:165181118 TEST=MENU_UI=0 DIAGNOSTIC_UI=0 make runtests TEST=MENU_UI=0 DIAGNOSTIC_UI=1 make runtests TEST=MENU_UI=1 DIAGNOSTIC_UI=0 make runtests TEST=MENU_UI=1 DIAGNOSTIC_UI=1 make runtests TEST=Cherry-pick locally to ToT of firmware-puff-13324.B with chromium:2360066 to manually check flags on Kaisa device. Change-Id: I7ec45b4ecfa6d50781cec2690dbc88894c734073 Signed-off-by: Chun-Ta Lin <itspeter@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2361983 Tested-by: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Chun-ta Lin <itspeter@chromium.org>
* vboot2: Add prototype for hwcrypto RSAfactory-zork-13427.BKangheui Won2020-08-203-1/+21
| | | | | | | | | | | | | | Introduce new prototype for HW RSA accleration. This is not used on anywhere yet but will unblock coreboot work to support HW RSA. BRANCH=none BUG=b:163710320, b:161205813 TEST=make runtests; emerge-zork coreboot depthcharge Change-Id: Ic4b93f32410efdd06bd012efe58749b6ef0692c6 Signed-off-by: Kangheui Won <khwon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2364338 Reviewed-by: Julius Werner <jwerner@chromium.org>
* inclusive: change usage of sanityDaisuke Nojiri2020-08-1915-27/+27
| | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the term "sanity" with inclusive alternatives. BUG=b:163883397 BRANCH=None TEST=grep -ir sanity TEST=make runtests Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I708a044d89050c442f14fb11a8ae5e98490d56af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2353420 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/ui: Display error for untrusted confirmationHsuan Ting Chen2020-08-182-0/+9
| | | | | | | | | | | | | | | Display a error dialog box while user confirms with untrusted keyboard. BUG=b:144969091, b:161866932 BRANCH=puff TEST=PHYSICAL_PRESENCE_KEYBOARD=1; emerge-puff depthcharge Cq-Depend: chromium:2345837 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I2b0fdc217bbaa23ac71a41bf400c412be634ec0c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2346455 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* minidiag: add entryChun-Ta Lin2020-08-091-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The entry `Launch diagnostics` in recovery screen will set VB2_NV_DIAG_REQUEST and reboot. BRANCH=none BUG=b:155848434 TEST=( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DIAGNOSTIC_UI=0 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) TEST=( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DIAGNOSTIC_UI=1 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) TEST=LOCALES="en" USE="menu_ui minidiag" emerge-nami chromeos-bmpblk vboot_reference depthcharge chromeos-bootimage TEST=Unset by &= ~VB2_SECDATA_KERNEL_FLAG_DIAGNOSTIC_UI_DISABLED manually; trigger recovery mode on device; visually confirmed `Launch diagnostics` is shown; select, reboot and confirm behavior from serial output: "Unset diagnostic request (undo display init)". Cq-Depend: chromium:2282643, chromium:2282664, chromium:2289814 Change-Id: I34af282edee66c5b9943e2d11fb514bac9ccddd8 Signed-off-by: Chun-Ta Lin <itspeter@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2282867 Tested-by: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: create secdata_kernel flag to disable diagnostic UIJoel Kitching2020-08-095-1/+24
| | | | | | | | | | | | | | | | | | | Diagnostic UI is currently not ready to ship. Disable the UI (including both entry point and the UI itself) until it is ready. Also remove unused mock_presence from vboot_api_kernel4_tests. BUG=b:155848434, b:162486211 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I5cad7d40b2f52015f17f930a4d061c9cdf976a49 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2328985 Tested-by: Chun-ta Lin <itspeter@chromium.org> Commit-Queue: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Implement debug info screen navigationHsuan Ting Chen2020-07-311-4/+7
| | | | | | | | | | | | | | | | | | | | The debug info screen can be accessed from advanced option screen. BRANCH=none BUG=b:146399181, b:144969088 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=USE="menu_ui" emerge-nami depthcharge select "advanced options", observe its layout, and navigate to debug info screen Cq-Depend: chromium:2301571 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I1fed968770a2681c28d49869676fb9b4f1d46494 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2301629 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Implement debug info screenHsuan Ting Chen2020-07-317-8/+322
| | | | | | | | | | | | | | | | | | | | | | | | Implement debug info screen with multiple pages. The debug info screen can be accessed using TAB as keyboard shortcut. The menu navigation will be added in a separate CL. The screen has one textbox for displaying one page of debug info, and three buttons: page up, page down, and back. BRANCH=puff BUG=b:146399181, b:144969088 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=USE="menu_ui" emerge-nami depthcharge press tab, observe the debug info on the screen Cq-Depend: chromium:2251685 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I6bc0a49c4d69817825f35435b643b006823b5c03 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2251868 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: disallow DIAGNOSTIC_UI with MENU_UIJoel Kitching2020-07-291-1/+2
| | | | | | | | | | | | | | | | DIAGNOSTIC_UI is incompatible with the new menu_ui ("Groot"). Disallow diagnostic UI under the condition of using MENU_UI. BUG=b:146399181, b:160748354 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Idc09e37a72d355baf7fa42ade7cdfecb3d41eabb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2319415 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/ui: decouple error beep from error messageYu-Ping Wu2020-07-284-16/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Some error such as VB2_UI_ERROR_DEV_EXTERNAL_BOOT_FAILED only requires a beep sound to notify the user. No dialog box will be shown for these errors. Instead of defining them in the vb2_ui_error enum and ignore them in vb2ex_display_ui() in depthcharge, add a new field 'error_beep' to vb2_ui_context and use it for playing error beep sound in the UI loop. Then these beep-only errors can be removed from the enum. Also remove VB2_UI_ERROR_DEV_INTERNAL_NOT_ALLOWED because it is not used everywhere. BRANCH=puff BUG=b:146399181, b:161375587 TEST=emerge-puff depthcharge TEST=b/161375587 is not reproducible Cq-Depend: chromium:2299925 Change-Id: Ia90d1c8a164334d4cfec84281722eb6f2623b111 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2299968 Reviewed-by: Joel Kitching <kitching@chromium.org>
* Reset EC when transitioning to dev modestabilize-13360.BDaisuke Nojiri2020-07-141-1/+1
| | | | | | | | | | | | | | | | | Currently, we reboot the AP (a.k.a. warm-reboot) to transition to dev mode in legacy_menu_ui; and reboot the EC (a.k.a. cold-reboot) in menu_ui and legacy_clamshell_ui. This patch makes legacy_menu_ui also reboot the EC. BUG=b:154228771 BRANCH=none TEST=make runtests Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ie48c8ef5e8744102c8dbafb7929523c54b14d81d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2293050 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: move TPM callbacks to vboot2 namespaceJoel Kitching2020-07-106-76/+79
| | | | | | | | | | | | | | | | Move TPM callback definitions from vboot_api.h to 2api.h. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Cq-Depend: chromium:2282023 Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Iad9da9fd3b6786609148d08b88f2e62ac3dee627 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2282322 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* firmware/2lib: Skip rest of ui_loop after closing error boxShelley Chen2020-07-101-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | Previously, if we see an error box displayed on the screen, and we hit return, not only will we exit the error box, but we will also process the key (ie: return) on the background screen and advance to another screen. Correcting this by setting key to 0, thus skipping all the actions on the background screen in ui_loop() after exiting the error box. BUG=b:144969091 BRANCH=puff TEST=dut-control power_state:rec press ctrl-d press return make sure we exit the error box only and don't advanced to the next screen Signed-off-by: Shelley Chen <shchen@google.com> Change-Id: I64f67bb175b4a67a885b368334fb19f4cf288883 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2278925 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org>
* vboot: create TPM section in 2api.hJoel Kitching2020-07-071-39/+42
| | | | | | | | | | | | | | | Group TPM-related API functions together in the same section. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Ic7fb8b90c3c68a568d75f8c98738bf8cea744622 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2282321 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/ui: pass timer_disabled to vb2ex_display_ui()factory-puff-13329.BYu-Ping Wu2020-07-022-1/+10
| | | | | | | | | | | | | | | | | Add an argument 'timer_disabled' to vb2ex_display_ui(), which will be used when drawing dev mode screen to show the appropriate screen descriptions. BRANCH=none BUG=b:146399181, b:157871585 TEST=make runtests TEST=emerge-puff depthcharge Cq-Depend: chromium:2236550 Change-Id: I48b46838f482bce612106b840476f5f941cc1166 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2241492 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: add screen stack functionalityJoel Kitching2020-06-303-80/+122
| | | | | | | | | | | | | | | | | | | | | | | | Add a stack storing previous screen states. When the user clicks "Back" or presses ESC, revert to the previous state. In order to deal with the possibility of a UI cycle (repeatedly selecting the same sequence of screens) which would eventually use up all available memory, re-use existing target screen states within the stack. In other words, when switching to a specific screen which already exists in the stack, pop until that screen is reached, rather than creating a duplicate stack entry. BUG=b:146399181, b:158256196 TEST=make clean && make runtests BRANCH=none Change-Id: I6fbebc2abb11b26d95d4fcf841eb195b3d589396 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2214617 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* firmware/2lib: Add visual/audio error handlingShelley Chen2020-06-275-9/+67
| | | | | | | | | | | | | | | | | | | | | | Adding an enum parameter to vb2ex_display_ui to facilitate printing errors to the screen. Currently, errors are only printed to the serial console. Also adding in beep if an error is displayed. BUG=b:144969091,b:158635317,b:158639298,b:146399181 BRANCH=None TEST=Boot into dev warning screen and try to hit ctrl-u when no USB is plugged in. Ensure error beep occurs. Ensure in dev mode. Boot into recovery and press ctrl-d. Ensure that error message is printed to the screen and beep occurs. make runtests Cq-Depend: chromium:2243513 Change-Id: I548d624532ad8816497c37a726275b33171e28dc Signed-off-by: Shelley Chen <shchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2243196 Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org>
* vboot: add vb2api_phone_recovery_ui_enabled()stabilize-quickfix-13310.91.Bstabilize-quickfix-13310.76.Bstabilize-quickfix-13310.73.Bstabilize-13310.99.Bstabilize-13310.94.Bstabilize-13310.83.Bstabilize-13310.74.Bstabilize-13310.72.Brelease-R85-13310.BYu-Ping Wu2020-06-255-9/+31
| | | | | | | | | | | | | | | | | | Add a new flag VB2_SECDATA_KERNEL_FLAG_PHONE_RECOVERY_UI_DISABLED to vb2_secdata_kernel_flags to separate phone recovery functionality from UI instructions. Also add vb2api_phone_recovery_ui_enabled() to control the UI behavior. BRANCH=none BUG=b:156532222 TEST=make runtests Cq-Depend: chromium:2260155 Change-Id: Ib91a206e680ba2cb47762d8a5c0c0ce146918b7d Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2259632 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: add power off optionsYu-Ping Wu2020-06-231-0/+25
| | | | | | | | | | | | | | | Add power off options to screens. BRANCH=none BUG=b:146399181, b:145098577 TEST=make runtests TEST=USE="menu_ui" emerge-nami depthcharge Cq-Depend: chromium:2237367 Change-Id: I356c56361a4282b456c3a4661e518a84944e983b Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2237366 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: makeshift debug info screenJoel Kitching2020-06-212-1/+20
| | | | | | | | | | | | | | | | | | | Provide makeshift debug info functionality while implementation of the proper screen is in progress. BUG=b:146399181, b:144969088 TEST=Build and flash; check <TAB> functionality TEST=make clean && make runtests BRANCH=none Cq-Depend: chromium:2253732 Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I0a738f731361d1c344c8fc8f5ecdef5b892f5ba7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2253733 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org>
* vboot/ui: add screens for dev boot from external diskYu-Ping Wu2020-06-202-6/+52
| | | | | | | | | | | | | | | | | | | | | | | Add polling screens for booting from external disk in dev mode. BRANCH=none BUG=b:146399181, b:158973903 TEST=make runtests TEST=emerge-puff depthcharge TEST=1. Enter developer mode screen 2. Select "Boot from external disk", then screen changes to DEVELOPER_BOOT_EXTERNAL 3. Plug in invalid usb, then screen changes to DEVELOPER_INVALID_DISK 4. Unplug usb, then screen changes back to DEVELOPER_BOOT_EXTERNAL 5. Plug in valid usb, then device boots successfully Cq-Depend: chromium:2245066 Change-Id: I633f16ca0d92eaf27eb3b7630ee61b2044942741 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2246298 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: add missing assert.h includeDavid Benjamin2020-06-191-0/+1
| | | | | | | | | | | | BUG=none TEST=make BRANCH=none Signed-off-by: David Benjamin <davidben@chromium.org> Change-Id: I4193d01bf9e65aff1567d4d00ae38811b61ad4c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2252761 Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: rename USB_BOOT_ON_DEV to BOOT_EXTERNAL_ON_DEVfactory-endeavour-13295.BYu-Ping Wu2020-06-171-1/+1
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=make runtests TEST=emerge-puff depthcharge Cq-Depend: chromium:2241263 Change-Id: I4ebfadda3a41c09662f241f04c251784716784e3 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2241418 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: rename USB to more accurate EXTERNALYu-Ping Wu2020-06-1312-43/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename enumerators of the vb2_dev_default_boot_target enum as follows, because the term USB is not quite accurate (we can also boot from an SD card). VB2_DEV_DEFAULT_BOOT_TARGET_DISK --> VB2_DEV_DEFAULT_BOOT_TARGET_INTERNAL VB2_DEV_DEFAULT_BOOT_TARGET_USB --> VB2_DEV_DEFAULT_BOOT_TARGET_EXTERNAL Also perform similar renaming for the following. enum vb2_nv_param: VB2_NV_DEV_BOOT_USB --> VB2_NV_DEV_BOOT_EXTERNAL enum vb2_secdata_fwmp_flags: VB2_SECDATA_FWMP_DEV_ENABLE_USB --> VB2_SECDATA_FWMP_DEV_ENABLE_EXTERNAL constants: VB2_NV_DEV_FLAG_USB --> VB2_NV_DEV_FLAG_EXTERNAL functions: vb2_dev_boot_usb_allowed --> vb2_dev_boot_external_allowed BRANCH=none BUG=none TEST=make runtests Change-Id: Iad16fcf34d76da08c6d8a81e150c7fde927c743b Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2237622 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: add vb2api_use_short_dev_screen_delay() to 2api.hYu-Ping Wu2020-06-104-9/+17
| | | | | | | | | | | | | Add vb2api_use_short_dev_screen_delay() to vboot2 API. BRANCH=none BUG=b:146399181, b:157871585 TEST=make runtests Change-Id: Ice4852a7505e8dba73fa2026e8d433b8e487f556 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2235292 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: publicize vb2_get_dev_boot_target()Yu-Ping Wu2020-06-108-42/+41
| | | | | | | | | | | | | | | | Publicize vb2_get_dev_boot_target() as vb2api_get_dev_default_boot_target(), and move enum vb2_dev_default_boot to 2api.h as enum vb2_dev_default_boot_target. BRANCH=none BUG=b:146399181, b:157871585 TEST=make runtests TEST=emerge-puff depthcharge Change-Id: I8336e63cc273c32a41e6b1f2aad886c3940a6aef Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2234788 Reviewed-by: Joel Kitching <kitching@chromium.org>
* host/lib: add lightweight flashrom wrapper libraryJack Rosenthal2020-06-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | Lightweight wrapper around flashrom, exposing two APIs: flashrom_read(programmer, region, data_out, size_out) flashrom_write(programmer, region, data, size) |region| can be NULL, in which case operate on the whole flash chip. The intended usage of this wrapper library is to read/write VBNV from SPI flash directly, avoiding the call thru mosys (which has deprecated the command). Bringing this logic into crossystem directly will also help with expanding VBNV to 64-bytes. BUG=chromium:1032351,chromium:1030473,chromium:789276 BRANCH=none TEST=provided unit tests Change-Id: I3997bd03a2db7e58e4e76fc200c637dd3b5b20a4 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218888
* vboot/ui: Fix access on to_dev screenHsuan Ting Chen2020-06-041-1/+2
| | | | | | | | | | | | | | | Broken recovery mode should not access to_dev screen. BUG=b:146399181 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests BRANCH=none Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I3e5802c14968aafe40d25e69505c518c0c5b45d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2228256 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: implement phone recovery screensJoel Kitching2020-06-012-5/+23
| | | | | | | | | | | | | | | | Finish implementing phone recovery screen step 1, and implement step 2. (Step 3 is in initramfs.) BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I3b18aa0d6c5ec93cb9b69fec7976db434270db79 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2220820 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: implement disk recovery screensYu-Ping Wu2020-06-011-4/+44
| | | | | | | | | | | | | Implement disk recovery screens for all the 3 steps. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: Iea8fe4650cecb63ea519084ec8a71325ba4e3ebb Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2211981 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: implement language selection screenYu-Ping Wu2020-06-014-39/+198
| | | | | | | | | | | | | | | | | | Implement language selection screen, and add language item to all the other screens. Add a default screen init function default_screen_init() to initialize the default selection to the second item if the first item is the language selection. BRANCH=none BUG=b:146399181, b:144968920 TEST=make runtests TEST=USE="menu_ui" emerge-nami depthcharge Cq-Depend: chromium:2193151, chromium:2192508 Change-Id: I3251b0095ec29ec26cc27745b1089e60894c892c Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2196095 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: do not request recovery for VB2_REQUEST_* from VB2_TRY()Yu-Ping Wu2020-05-292-149/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the returned value is not an error (such as VB2_REQUEST_*), do not call vb2api_fail() from VB2_TRY() to request recovery. During EC sync, instead of explicitly setting VB2_NV_RECOVERY_REQUEST in nvdata to request recovery, utilize vb2api_fail() instead to try the other AP slot before giving up on EC sync and going into recovery. In addition, remove the retry of EC RO sync for the following reasons. EC sync rarely fails, and even if it does, it's not very likely to be a transient problem that disappears on the next attempt. Besides, the RO sync is just a debug feature that only people who have a servo attached and can manually reflash should be using. Therefore, the retry is removed and hence we no longer need to restore the recovery request in nvdata. BRANCH=none BUG=chromium:1075488 TEST=make runtests Change-Id: I9ad8e5e0886679a9a342449553170317b010237b Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2145272 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: fix two return values in vboot_api_stub.cJoel Kitching2020-05-281-3/+4
| | | | | | | | | | | | | | | Also add the 2api.h include for vboot2-style stubs. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Id6522ea139126adce6cee5ba225ab3eb78f31b7e Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218539 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: create VB2_ERROR_EX_SET_VENDOR_DATAJoel Kitching2020-05-281-7/+3
| | | | | | | | | | | | | | | | | Create VB2_ERROR_EX_SET_VENDOR_DATA error code for use in VbExSetVendorData callback. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Cq-Depend: chromium:2218538 Change-Id: I9d75a608185e475837d9cb4a53b943fd2dae6438 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218537 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: move PERIPHERAL_BUSY to vboot2 namespaceJoel Kitching2020-05-281-2/+3
| | | | | | | | | | | | | | | | | Move VBERROR_PERIPHERAL_BUSY to vboot2 namespace as: VB2_ERROR_EX_AUXFW_PERIPHERAL_BUSY BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: Iebc7d73e3a87a8bd4d999be56ad23d6b77d9785c Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:2158865 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2158512 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: move timer and beep functions to vboot2 namespaceJoel Kitching2020-05-2816-100/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move these functions from vboot_api.h into 2api.h: VbExGetTimer --> vb2ex_mtime (usec -> msec) VbExSleepMs --> vb2ex_msleep VbExBeep --> vb2ex_beep Rename the constants: VB_USEC_PER_MSEC --> VB2_USEC_PER_MSEC VB_MSEC_PER_SEC --> VB2_MSEC_PER_SEC Remove the constant VB_USEC_PER_SEC. The error code VBERROR_NO_BACKGROUND_SOUND is dropped since it is not currently used. Update a few printf lines to use VB2_DEBUG instead. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I887112ffd5f68fb6a9c4d9ad624aa420cbd55b4b Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:2158665 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2158666 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/ui: return error if booting from internal failedYu-Ping Wu2020-05-271-5/+1
| | | | | | | | | | | | | | | | When booting from internal disk failed, return error and request recovery. This behavior is consistent with legacy UIs, and is necessary for FAFT firmware_CorruptBothKernelAB.dev to pass. BRANCH=none BUG=b:146399181, b:156880836 TEST=make runtests TEST=firmware_CorruptBothKernelAB.dev passed on puff Change-Id: Id927961ec7fa1788ddd817c133b5bc905b1e8335 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2213210 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: map Ctrl+S to the TO_NORM screenJoel Kitching2020-05-271-0/+2
| | | | | | | | | | | | | | | | Add hotkey to simplify FAFT mode_switcher for new Groot UI. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I91e00c5365c8f5a587786ab7dcfa67765a342824 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2213384 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: stop centralizing keyboard input actionsJoel Kitching2020-05-274-138/+106
| | | | | | | | | | | | | | BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: Ia63537fb13be5f04ae81a6be7e0fac6eaf47cfb7 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2210017 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: improve menu navigation docstringsJoel Kitching2020-05-274-81/+144
| | | | | | | | | | | | | | BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I8cd47503384a8b8f48ccbc12fa6f24c71d02b755 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2210016 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>