summaryrefslogtreecommitdiff
path: root/firmware/lib/vboot_ui_menu.c
Commit message (Collapse)AuthorAgeFilesLines
* Add new GBB_FLAG_FORCE_MANUAL_RECOVERYJulius Werner2018-03-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | It seems like there are some testing use cases where we want the device to boot into the recovery installer but it is impractical to fully simulate a user-triggered recovery. This has become impossible with the recent change to always require manual recovery to boot an image, even when the developer mode switch is enabled (CL:924458). This patch adds a new GBB flag to support this use case. When the flag is set, all recovery mode is manual recovery mode, regardless of wheter the developer mode switch is on or not. Since the GBB_FLAG_ENABLE_SERIAL was killed off before it ever really worked anyway, we can safely reuse the bit reserved for it. BRANCH=None BUG=None TEST=make runtests, manually confirmed on Kevin Change-Id: I4f51dfd20b4ff04c522f53596896dccbceee52dc Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/976660 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* detachables: Allow 'Tab' to display debug info on all screensJulius Werner2018-02-081-0/+3
| | | | | | | | | | | | | | | | | Since we're continuing to support the boot shortcuts Ctrl+D, Ctrl+U and Ctrl+L, it makes sense to also continue to support the debug info shortcut Tab, just in case somebody may want to use it from an external keyboard. This does not affect the existing method to display debug info through the appropriate menu option in any way. BRANCH=None BUG=b:73080278 TEST=make runtests, booted Scarlet and pressed Tab on UART. Change-Id: Ia08404e0ffd1f8cac3d85f3b2fc4ce17a21d743d Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/907759 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* detachables: Ensure menu_idx can't be used uninitalizedMartin Roth2018-02-021-0/+1
| | | | | | | | | | | | | | | | | | | | This fixes a warning with GCC 6.3: firmware/lib/vboot_ui_menu.c: In function 'enter_developer_menu': firmware/lib/vboot_ui_menu.c:211:2: error: 'menu_idx' may be used uninitialized in this function [-Werror=maybe-uninitialized] vb2_change_menu(VB_MENU_DEV, menu_idx); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TEST=Build BUG=None BRANCH=None Change-Id: Idd9449322cccca66d8bd8796a444b9a8ceea9d11 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://chromium-review.googlesource.com/897910 Commit-Ready: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Refactor BROKEN screen handling, add OPTIONS menu to itJulius Werner2018-01-311-42/+45
| | | | | | | | | | | | | | | | | | | | This patch factors the code handling the BROKEN screen out of the recovery_ui() function since it's already pretty much a completely separate piece anyway. It is also rewritten to more closely match the other UI loops and to use the same OPTIONS menu that allows language and debug info access as the existing manual recovery UI. BRANCH=None BUG=b:64400036 TEST=make runtests, boot Scarlet in non-manual recovery mode and play with OPTIONS menu. Also check manual recovery mode menu again, and confirm that language selections and recovery reasons persist when initiating manual recovery from the BROKEN screen. Change-Id: Ib680c4e30d728c16a3661041d9b2987648e592e3 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/892280 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* detachables: Factor out common UI loop input handlingJulius Werner2018-01-311-73/+58
| | | | | | | | | | | | | | | | | | Most of the UI loop input handling is essentially the same between the developer and recovery mode interfaces. This patch factors it out into a separate function, which reduces duplication and will make it easier to add a third UI for non-manual recovery mode. BRANCH=None BUG=None TEST=make runtests, played around with menus on Scarlet Change-Id: I75751770a81eb373f8bc7ed0e5f5dfcb6d2bd464 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/892279 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: The Big RefactorJulius Werner2018-01-311-747/+506
| | | | | | | | | | | | | | | | | | | | | | | | | This patch shuffles around most of the detachable UI code to try to make it more readable and maintainable. The goal is to get the business logic out of the main UI loop functions as much as possible, and concentrate the code handling each individual menu option in a single location. This is a pure refactor and should not change behavior in any (important) way. The adjustments to unit tests are only needed since the old code displayed the same screen twice in certain circumstances, and returning from the LANGUAGE menu to DEVELOPER selected the default option Power Off, although other transitions to that screen select the current default boot target. BRANCH=None BUG=None TEST=make runtests, boot Scarlet and play with all screens. Change-Id: Ibe05cbcb23c964d81f80de741bbd6f2231a2522d Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/888082 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: Combine set_menu_items and set_disabled_idx_maskJulius Werner2018-01-311-58/+35
| | | | | | | | | | | | | | | | | | The disabled_idx_mask always needs to be set according to the current menu, so it makes sense to combine this task with the function that changes menus. Call the new function vb2_change_menu() to indicate its broader set of responsibilities. BRANCH=None BUG=None TEST=make runtest Change-Id: I122783cbc0b35d0d9e866f614646865c5c8a0ed0 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/888081 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: Remove obsolete RECOVERY menuJulius Werner2018-01-311-43/+0
| | | | | | | | | | | | | | This patch removes the RECOVERY menu that is no longer being used. BRANCH=None BUG=None TEST=make runtests Change-Id: I069101ab1418779e2cc4a9f6d1b39166ba2b37ed Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/888080 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* detachables: Replace RECOVERY with OPTIONS menuShelley Chen2018-01-251-104/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the new OPTIONS menu which will function in stead of the old basic RECOVERY menu. The TO_DEV menu is now directly reachable through the VolUp+VolDown key combo. Cancelling any menu or changing USB state will immediately drop back to the menuless base screens (INSERT or NOGOOD). Also contains some minor clean-up here and there, like decoupling code from tests a bit more by reducing reliance on global initializers. Code for the now obsolete RECOVERY menu will be removed in a follow-up patch. BUG=b:67371896, b:64400036 BRANCH=None TEST=Go through all recovery screens, trry various back-and-forth transitions between OPTIONS, LANGUAGE and TO_DEV, in addition to inserting/removing USB at various times. CQ-DEPEND=CL:884840 Change-Id: I95319778e14ce07fe2ada3edf95990560ac7081a Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/770258 Commit-Ready: Julius Werner <jwerner@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* detachables: Define options menuShelley Chen2018-01-231-0/+12
| | | | | | | | | | | | | | | | | This menu will be used by any of the legacy screens. The idea is that when the user hits volume up/down, then they will enter this options menu, which will allow the user to change languages or show debug info. BUG=b:67371896, b:64400036 BRANCH=None TEST=None Change-Id: I31d3e312388b56613368276ec72e5c68ded2264e Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/770257 Commit-Ready: Benjamin Gordon <bmgordon@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* firmware: Stop using vboot1 cparams internallyRandall Spangler2018-01-091-16/+13
| | | | | | | | | | | | | | | | | | Now that vb2_shared_data / vb2_context provides all the same data to lower-level kernel verification code that cparams did, stop passing cparams down to those functions. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I86eb1801ee96d8b56404b74843a8d09e3122567f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852814 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* firmware: Prune down old region APIRandall Spangler2018-01-091-18/+14
| | | | | | | | | | | | | | | | | | | | | | | | The region API was a way for firmware and kernel verification to get at various blocks of caller-provided data. In practice, we only used it internally as a way to get at parts of the GBB. Prune it down to access only the bits of GBB we still need, from the buffer we already know we have. In the long run we should use the same vb2ex_read_resource() API that vb2 firmware verification does, but that should be done in a follow-up CL since it'll need to be coordinated with support in depthcharge. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I5715cb8d88274164a1a73ed4a56bbd93af46f9bf Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852798 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* firmware: Include vb1 shared data in vb2 structRandall Spangler2018-01-091-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, firmware verification uses entirely vb2 structs, including vb2_shared_data. This goes through an ugly translation to the old vb1 VbSharedData to pass it to depthcharge. The vboot kernel verification maintains an equally ugly translation back to the vb2 struct internally. Eventually, we want to get rid of all that and use vb2 all the way down to what crossystem picks up from the OS. But before we can do that, we need to finish translating kernel verification code to use the new vb2 structs. This is a step on that path, using vb2_shared_data equivalents where present and hiding the old vb1 shared data struct as a member of vb2_shared_data so at least the vboot functions don't need to pass around cparams to get at it. This will be followed by more CLs which convert more vboot internals to use vb2 structs directly, and eventually coreboot/depthcharge CLs which pass the vb2 structs from firmware verification directly to kernel verification. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I5df8ce81ba3c3ac3f2cb4229db5461757cd89d8d Reviewed-on: https://chromium-review.googlesource.com/852856 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* firmware: Remove bmpblk codeRandall Spangler2018-01-091-22/+16
| | | | | | | | | | | | | | | | | | | | All screens are now drawn by depthcharge. ToT firmware does not include a bmpblk / bmpfv section in the GBB. Remove the code paths which are no longer used. Also drop a few cparams parameters from functions that no longer use it, now that those functions don't need to access the GBB. BUG=chromium:502066 BRANCH=none TEST=make -j runtests; build bob firmware and check recovery screens Change-Id: I4d2d0a3ba57c34151e65c6f42581df823192a4ae Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852371 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* firmware: simplify audioRandall Spangler2018-01-051-18/+7
| | | | | | | | | | | | | | | | | | | | | | Vboot firmware previously supported a rather complex audio looping library. Our original intent was to allow developers to flash a custom beep sequence / tune as an easter egg. We never fully supported that, but the code to allow it lived on. Get rid of that. Vboot also previously made no assumptions about the frequency of VbExGetTimer(), which was only used by the vboot_audio library. So it spent 10ms every boot measuring the frequency. Which is silly now, because depthcharge implements that as a microsecond timer. Get rid of that measurement and define the timer as a microsecond timer. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I350246874fb36b00149423696285cfcaca0fc526 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/847311 Reviewed-by: Shelley Chen <shchen@chromium.org>
* firmware: use sd->gbb_flagsRandall Spangler2018-01-051-11/+13
| | | | | | | | | | | | | | | | | | Vboot1 code directly referenced the GBB from cparams even though now it has access to the GBB flags via the vb2 context. Refactor all existing code to use the vb2 context, since that takes us one step closer to getting rid of the old vboot1 cparams. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: Ic4a5bf215b723a2eacbf0a4cf0eba8b1338155a2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/847310 Reviewed-by: Shelley Chen <shchen@chromium.org>
* detach_ui_test: Move variables needed for unit tests to private fileShelley Chen2017-12-181-69/+4
| | | | | | | | | | | | | | | Creating a unit test for testing the detachable UI menus. It'll need access to some previously static variables that we will move into this new file. BUG=b:65025540 BRANCH=None TEST=emerge-fizz vboot_reference with no errors Change-Id: I249b152380dd55160e151506e00efd23bbbd1a5b Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/830679 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Revert "vboot: Fix INSERT screen error when valid Kernel USB is not inserted"Philip Chen2017-12-121-3/+1
| | | | | | | | | | | | | | | BUG=b:70538502 BRANCH=none TEST=enter VB_MENU_TO_DEV reliably This reverts commit 805726997cc7c3a95b1fd24de5e6909712e4f11c. Change-Id: I08a29084ac9ae53794fd5c44128e06ad6e2faea9 Reviewed-on: https://chromium-review.googlesource.com/822050 Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* vboot: Use 2nvstorage instead of vboot_nvstorageRandall Spangler2017-12-111-10/+9
| | | | | | | | | | | | | | | | | | Remove the old vboot1 vboot_nvstorage library (VbNv*() functions) and use the vboot2 library (vb2_nv_*()) instead. This is needed in preparation for moving to 64-byte records; no sense in implementing that change twice... Should be (better be) no change in system behavior. BUG=chromium:789276 BRANCH=none TEST=make runtests compare output of crossystem before/after change (should be identical) Change-Id: I10f9975b0824263064b9a74a3c6daadcecc085d3 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/794732
* vboot_ui_menu: honour power button press in RECOVERY_NO_GOOD_SCREENRizwan Qureshi2017-12-111-1/+2
| | | | | | | | | | | | | | | | | Curretly power button press is ignored in RECOVERY_NO_GOOD_SCREEN, Allow user to power off system from RECOVERY_NO_GOOD_SCREEN. BUG=None Branch=None Test=verify that the system powers of from NO_GOOD screen. Change-Id: I768cd5a448c4493a4d9de756b2047c19cdf961ef Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com> Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/812304 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot: Fix INSERT screen error when valid Kernel USB is not insertedBarnali Sarkar2017-12-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | In Recovery Mode, when an USB key is inserted where valid OS is not present, it shows "VB_SCREEN_RECOVERY_NO_GOOD" screen. But, once removing that USB key, the screen should go back to INSERT screen again. This functionality was not working after the below Commit - I2bab22fcbb0bb3cdfffe585eb633231ba8015fc3 This patch fixes this issue by assigning the current_menu as "VB_MENU_RECOVERY_INSERT" every time when there is No Disk found. BUG=none BRANCH=none TEST=Tested on Soraka to check that INSERT screen comes back once Non-Valid OS Pendrive is removed from board. Change-Id: I74efff562ba00a3e96b82ee158f9613f53c059b5 Signed-off-by: Barnali Sarkar <barnali.sarkar@intel.com> Reviewed-on: https://chromium-review.googlesource.com/810824 Commit-Ready: Rizwan Qureshi <rizwan.qureshi@intel.corp-partner.google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: create menu items for legacy screensstabilize-10176.65.Bstabilize-10176.58.Bstabilize-10176.54.Bstabilize-10176.47.Bstabilize-10176.13.Brelease-R64-10176.BShelley Chen2017-11-231-2/+18
| | | | | | | | | | | | | | | | | Previously, we didn't require any action on these legacy screens, so didn't update current_screen when displaying these. Now, will be adding language switching and debug display for these screens, so need to keep track of them. BUG=b:65470853, b:67371896, b:64400036 BRANCH=None TEST=None Change-Id: I2bab22fcbb0bb3cdfffe585eb633231ba8015fc3 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/676269 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix vboot compilation with coreboot-sdkStefan Reinauer2017-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=Upstream builder does not fail with uninitialized variable anymore like this: firmware/lib/vboot_ui_menu.c: In function 'vb2_get_current_menu_size': firmware/lib/vboot_ui_menu.c:255:15: error: 'temp_menu' may be used uninitialized in this function [-Werror=maybe-uninitialized] *menu_array = temp_menu; ~~~~~~~~~~~~^~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Change-Id: Idb1690c7b0becf3556cad379160fe152707ae843 Reviewed-on: https://chromium-review.googlesource.com/777805 Commit-Ready: Stefan Reinauer <reinauer@google.com> Tested-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: Use Volup+Voldown to exit recovery graphicfactory-fizz-10139.BShelley Chen2017-11-161-7/+11
| | | | | | | | | | | | | | | | | | Previously, we were able to exit the initial recovery graphic with either the volume up or volume down button. However, we would only like the user to exit the screen when they know what they are doing, we are making it so that they can only intentionally exit (with volup + voldown simultaneously pressed). BUG=b:67371896 BRANCH=None TEST=reboot into recovery and press volume up + volume down keys. Make sure we exit to the recovery menu screen. Change-Id: I7dfb4a0e42c8b88e9b075e886cea1adfe248246c Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/766847 Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Implement disable dev mode for enterpriseShelley Chen2017-11-161-101/+36
| | | | | | | | | | | | | | | | | | | | | When develper mode is disabled (through FWMP), don't allow user to see the dev warning screen. Boot straight to TO_NORM and disable the cancel option. Basically, the user will only be able to enable OS verification, power off, or change the language. There is also no 30 second timeout during bootup. BUG=b:65595945 BRANCH=None TEST=Force disable_dev_boot flag to 1 and ensure the TO_NORM menu is displayed w/o a cancel option. Scroll through options to make sure they work as expected. Make sure debug message is displayed indicating dev mode is disabled. Wait > 30 secs to ensure timeout doesn't occur. Change-Id: I7d2bcd369694e886866f9dedff05d81a40f8270a Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/757115 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot_ui_menu: Use volume down short press at recovery menu screenFurquan Shaikh2017-11-141-1/+1
| | | | | | | | | | | | | | | | | Fix the typo made in https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/757123 for usage of volume down button at recovery menu screen. It should be short press instead of long press. BUG=b:64992445,b:65013794 BRANCH=None TEST=Verified that volume down short press works as expected on recovery menu. Change-Id: Ia9a172439ac3bbd1ea395778e83a95c988816e01 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/767059 Reviewed-by: Shelley Chen <shchen@chromium.org>
* buttons: Update button codes for vup, vdn and powerFurquan Shaikh2017-11-091-9/+11
| | | | | | | | | | | | | | | | | | | 1. Differentiate button codes for short press and long press of volume up and volume down. 2. Add a new code for volume up-down combo press since it is expected to be used for one of the firmware screens. 3. Treat volume down long press as Ctrl-D on developer screen. 4. Treat volume up long press as Ctrl-U on developer screen. CQ-DEPEND=CL:756254 BUG=b:64992445,b:65013794 BRANCH=None TEST=Verified that buttons work as expected on Soraka. Change-Id: I5d443f43f785b973f3ff4aeaac52b152ed2fe0bd Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/757123 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Call VbExEcRunningRW to set IN_RW flagDaisuke Nojiri2017-10-301-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | CL:693008 changed check_ac_active so that we ask CR50 to verify EC is in RO. While this is the right decision, on some platforms ECs can't reset EC_IN_RW. This causes check_ec_active to set IN_RW wrongly when EC is in RO after reboot. This patch replaces VbExTrustEC with VbExEcRunningRW. If RW is owned it may say it's in RO. Then, the software sync will proceed and flash RW while the EC is running RW copy. It also removes redundant checks for VbExTrustEC() when deciding whether to allow developer mode to be enabled from the INSERT screen. The INSERT screen can only be reached by manual recovery, which resets the EC, we don't need to check again before going to TODEV. BUG=b:67976359 BRANCH=none TEST=make runtests Change-Id: Ide722146ca8683411dd9072a39387aa9531f6cfc Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/740878
* detachables: Remove screen blankingShelley Chen2017-10-261-5/+0
| | | | | | | | | | | | | | | This is not necessary anymore and rendering is taken care of in depthcharge. BUG=b:35585623 BRANCH=None TEST=reboot and scroll through menus and make sure that rendering is still good. Change-Id: I078751014c8f84fb2ee403b6895e9dfa58e758d6 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/731114 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* detachables: Print error if enable normal mode when FORCE_DEV onShelley Chen2017-10-201-13/+28
| | | | | | | | | | | | | | | | | | Print a debug error and beep when user tries to enable normal mode when FORCE_DEV gbb flag is enabled. BUG=b:67828898 BRANCH=None TEST=Boot up with gbb flag 0x8 enabled. Select "Enabled OS Verification" and select confirm. Should see error message printed and a beep. Confirm switching to normal mode screen will not appear. Change-Id: Ic02558eb4a86555cebc9c1cd6972d0f0600b4ff1 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/730415 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot_ui_menu: Checking vb2_update_menu return valueShelley Chen2017-10-181-0/+2
| | | | | | | | | | | | | | If return value is not VBERROR_SUCCESS, return with an error. BUG=None BRANCH=None TEST=None Change-Id: I1402277567b901701cdd68d74968e43e838c89da Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/707496 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Check EC_IN_RW before proceeding to recovery modeDaisuke Nojiri2017-10-051-11/+4
| | | | | | | | | | | | | | | | | | | | | | Depthcharge currently asks EC whether recovery was requested manually or not without verifying EC is in RO or not. If EC-RW is compromised, recovery switch state can be spoofed. This patch makes Depthcharge check EC_IN_RW to determine whether EC is in RO or not. Only if it's in RO and it says recovery button was pressed at boot, we proceed to the recovery process. All other recovery requests including manual recovery requested by a (compromised) host will end up with 'broken' screen. BUG=b:66516882 BRANCH=none TEST=Boot Fizz. make runtests. Change-Id: I01d2df05fe22e79bbc949f5cb83db605147667b3 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/693008 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot: Handle power button press in broken screenDivya Chellap2017-10-051-2/+7
| | | | | | | | | | | | | | | | | | power button press is not being handled in broken screen (VB_SCREEN_OS_BROKEN) if the user wants to exit out of it. BUG=none BRANCH=none TEST=verified power button key functionality in broken screen in Soraka board Change-Id: I64cbb79479e3e0579aeec4e87894441acf26c9fa Signed-off-by: Divya Chellap <divya.chellappa@intel.com> Reviewed-on: https://chromium-review.googlesource.com/674886 Commit-Ready: Divya Chellappa <divya.chellappa@intel.com> Tested-by: Divya Chellappa <divya.chellappa@intel.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Subrata Banik <subrata.banik@intel.com>
* detachables: fix setting selected_idx of DEV_WARNING menuShelley Chen2017-09-151-1/+1
| | | | | | | | | | | | | | | Selecting cancel from DEV_MENU should not set the selected_idx to loc. It should be set to power off. BUG=b:35585623 BRANCH=None TEST=go to DEV_MENU, hit cancel and make sure that power off is selected item Change-Id: I8cae397c7174b5bd52a3a27736cd3d5a57412e63 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/667933 Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Set TO_DEV menu's default selection to cancelShelley Chen2017-09-151-7/+10
| | | | | | | | | | | | | BUG=b:65546569 BRANCH=None TEST=Boot into recovery, selection Disabled OS Verification. Ensure that in next menu, Cancel is selected. Also, setting default for TO_NORM menu to Confirm. Change-Id: Ibf72ec15aa38b1b815be97a08cfe7c9ee2615390 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/665356 Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Ensure keyboard input in TO_DEV menu trustedShelley Chen2017-09-151-3/+16
| | | | | | | | | | | | | | | | | | Add in check at TO_DEV menu screen to make sure that the navigation keys (up/down, volup/voldown) are trusted. Beep when user tries to use unstrusted keys (usb keyboard) in the TO_DEV menu so that the user knows they're doing something wrong. USB keyboard return key will still work in the TO_DEV menu. BUG=b:65546569 BRANCH=None TEST=test out using up/down keys in TO_DEV menu and make sure that they are disabled and hear beeps. Change-Id: Ifc7183c7ca35efaf079abb196a90ab7305380642 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/665355 Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Disable Network Boot OptionShelley Chen2017-09-131-0/+3
| | | | | | | | | | | | BUG=b:65595963 BRANCH=None TEST=enabled Dev mode, reboot, select developer options & make sure Network Boot doesn't appear in menu. Change-Id: I30953d037740259b06011ecb141d508db114b79e Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/664298 Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Power button turns off device on RECOVERY_INSERT screenShelley Chen2017-09-131-11/+11
| | | | | | | | | | | | BUG=b:64400325 BRANCH=None TEST=boot up into recovery, press power button ensure device shuts down. Change-Id: Ia8e6e91921e81692a2e57b1f77163c656b56ea85 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/646488 Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Display recovery insert icon at recovery startupShelley Chen2017-08-211-8/+28
| | | | | | | | | | | | | | | | | | | | | When user first starts up recovery (3 finger salute), display usb insert instructions and original insert graphic until user starts pushing volume buttons. If the user pushes power button during while the icon is displayed (no menu items), device will shut down (this is to accomodate users that accidentally enter the recovery screen and want to exit quickly). Upon user pressing the volume buttons, the insert icon will disappear and user will see the menu items and be able to scroll up/down. BUG=b:64400325 BRANCH=None TEST=boot into recovery. Make sure graphic shown until start pushing volume buttons. Change-Id: I4a5001271a0b84d1237d4bbc6a098afa10cb9372 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/617600 Reviewed-by: Julius Werner <jwerner@chromium.org>
* lib/vboot_ui_menu: Consider volume buttons in vb2_update_selectionFurquan Shaikh2017-08-181-0/+2
| | | | | | | | | | | | | | | | | vb2_update_selection considered only KEY_UP and KEY_DOWN inputs to update the selection. This resulted in volume buttons not working on firmware screen to update the selection. Add volume buttons as valid inputs in vb2_update_selection. BUG=b:64839396 BRANCH=None TEST=Verified that volume buttons work on firmware screen. Change-Id: I08bfa91eafb170fb450649a2abaafe7f4d58e17b Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/621787 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: Skip "Enable Developer Mode" in DEV modeShelley Chen2017-08-141-69/+107
| | | | | | | | | | | | | | | | | | | | When DUT is already in dev mode, don't let user select the "Enable Developer Mode" selection in the menu. Add disabled_idx_mask to VbExDisplayMenu API to allow for disabling of menu items in the future if needed. BUG=b:63078243, b:35585623 BRANCH=None TEST=reboot into recovery with DUT already in dev mode. Make sure can't scroll to "Enable Developer Mode: entry. reboot into recovery with DUT in normal mode. Make sure "Enable Developer Mode" entry is selectable. CQ-DEPEND=CL:565335 Change-Id: Ic71fe6aa2e41337787a0c2278f729356edb155fd Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/598430 Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Select power off after language selectionShelley Chen2017-08-011-3/+22
| | | | | | | | | | | | | | | | | | Set current selection to power off after exiting the languages menu. Previously, we were just defaulting to selecting the 0 index. However, this won't work anymore if we hide the "Enable Developer Mode" entry in the recovery menu due to that entry being at the 0th index. BUG=b:63078243, b:35585623 BRANCH=None TEST=Boot into recovery when machine in normal mode. Select languages menu, make language selection and make sure that when return to recovery menu, power off item is selected. Change-Id: I479c2270ca99197fd8c44386ab1ca4526ae7d64a Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/565527 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* detachables: Fix language menu size in recoveryShelley Chen2017-06-221-4/+9
| | | | | | | | | | | | | BUG=b:35585623 BRANCH=None TEST=Reboot into recovery, scroll to language menu and make sure that you can scroll and select other languages. Change-Id: I6fe7f0550b05e33eaeef928cd23932f5a40fe9ad Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/544897 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* detachables: Remove locale switch on up arrowShelley Chen2017-05-271-8/+0
| | | | | | | | | | | | | | | This was old code that switched locale when pressing up arrow. BUG=b:35585623 BRANCH=None TEST=Boot to recovery and make sure up arrow doesn't change the locale. Change-Id: Ibb4d2785170a2e36d599e4af56de3dfd922c5957 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/517283 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* detachables: Adding language selection menuShelley Chen2017-05-271-15/+64
| | | | | | | | | | | | | | Handle displaying of language menu. BUG=b:35585623 BRANCH=None TEST=Reboot and select Language from menu, select language and make sure displays menu items in current language. Change-Id: I518021c5278895e95cb4afdde044091c5bec7233 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/477093 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* detachables: Reset timer every time user moves the cursorShelley Chen2017-05-261-0/+6
| | | | | | | | | | | | | | | In dev mode, after 30 seconds of inactivity, we'll get the usual loud beep and automatic boot from disk. BUG=b:35585623 BRANCH=None TEST=reboot and make sure that fw screen timeout only occurs after 30 seconds of inactivity. Change-Id: Id6552f7213a52ed8c0f083a8388719a8fe79fa77 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/457841 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* detachables: Use locale bitmaps instead of textShelley Chen2017-05-261-37/+25
| | | | | | | | | | BUG=b:35585623 BRANCH=None TEST=reboot and make sure that the bitmaps show up Change-Id: I92a9cf7dc808a22c7ace25763d4ef49824a93054 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/457840
* detachables: New code path for displaying detachable menusstabilize-9592.82.Bstabilize-9592.67.Bstabilize-9592.55.Bstabilize-9592.15.Brelease-R60-9592.BShelley Chen2017-05-251-0/+28
| | | | | | | | | | | BUG=b:35585623 BRANCH=None TEST=None CQ-DEPEND=CL:457863 Change-Id: Ib2f8d93334cecfd80169842994ea7561baf41378 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/457839
* vboot_ui_menu: Show Developer options on USB failureRizwan Qureshi2017-05-231-0/+2
| | | | | | | | | | | | | | | | | | | | | In the current implementation, if the boot from USB fails after pressing Ctrl-U or selecting "Boot USB Image", only a blank screen is shown instead of a menu. There is no option for the user to do anything else except wait for the timeout, after which boot from fixed disk is attempted. This does not seem like an intuitive boot flow. Hence, if the USB boot fails display the current menu, allowing the user to attempt something else. BUG=None BRANCH=None TEST= verfied that menu is displayed on USB boot failure from developer screen. Change-Id: Ide3967be7bba3d87c8a545a0f4ed52da44150fd0 Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com> Reviewed-on: https://chromium-review.googlesource.com/509671 Commit-Ready: Rizwan Qureshi <rizwan.qureshi@intel.corp-partner.google.com> Tested-by: Rizwan Qureshi <rizwan.qureshi@intel.corp-partner.google.com> Reviewed-by: Shelley Chen <shchen@chromium.org>
* poppy: center detachable menu textstabilize-M58-9334.41.0.Bstabilize-9334.58.Brelease-R58-9334.BShelley Chen2017-03-021-2/+6
| | | | | | | | | | | | BUG=b:35585623 BRANCH=None TEST=reboot and make sure menu is centered in fw screen CQ-DEPEND=CL:447818 Change-Id: I7ce5063adab978338af18ad2befe65107fdea21f Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/447838 Reviewed-by: Randall Spangler <rspangler@chromium.org>