summaryrefslogtreecommitdiff
path: root/firmware
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* vboot/ui: Fix to_dev action initialization errorHsuan Ting Chen2020-05-262-3/+7
| | | | | | | | | | | | | | | Add an entry storing previous status of physical presence button to vb2_ui_context and reset it when recovery_to_dev_init is called. BUG=b:146399181,b:157390248 TEST=make clean && make runtests BRANCH=none Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ia0294a189713f1f99db7309937ea80ff90849bd8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2214457 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* vboot: reshuffle legacy UI filesJoel Kitching2020-05-259-260/+230
| | | | | | | | | | | | | | | | | | | | | | | | | - Use "vboot_ui_legacy" prefix for all legacy UI-related files. - Merge vboot_display.{c,h} and vboot_ui_legacy_common.c into vboot_ui_legacy.{c,h}. - Move VbDisplayScreen and VbDisplayMenu implementation into their respective vboot_ui_legacy_*.c files. - Update VbCheckDisplayKey to take |screen| argument to avoid reading disp_current_screen global variable. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I777551e4968ca22282901d22a262a8f2ec849702 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:2214615 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2112322 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: move invalid_disk_last into vb2_context_uiJoel Kitching2020-05-223-19/+20
| | | | | | | | | | | | | BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I055499580325a43dcba3e1d037bac60deff30af8 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2210015 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: standardize shutdown_required function signatureJoel Kitching2020-05-203-23/+28
| | | | | | | | | | | | | | | | Stardardize to match that of a UI action function. Also move power_button global into vb2_ui_context object. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I59eb3b4dbd2f4a5630e8cceaef256ff93579c965 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2192864 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Add recovery reason code for CSE Lite SKU errorsSridhar Siricilla2020-05-182-0/+8
| | | | | | | | | | | | | | Add Intel CSE Lite SKU error code to the recovery reason code list. Further, use recovery subcodes to indicate specific CSE Lite SKU errors. The recovery subcodes have been defined in the coreboot cse common lib. BUG=b:153520354 Signed-off-by: Sridhar Siricilla <sridhar.siricilla@intel.corp-partner.google.com> Change-Id: Id24c06452d349306804ee5b0b93a6abc3fe3bdbc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2148557 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org>
* vboot/ui: hide phone recovery flow when disabledJoel Kitching2020-05-182-2/+18
| | | | | | | | | | | | | | | | | | | If phone recovery flow is disabled according to vb2api_phone_recovery_enabled(), then hide the "Recovery using phone" menu item from the RECOVERY_SELECT screen. BUG=b:146399181, b:147744345 TEST=make clean && make runtests TEST=Upgrade secdata_kernel to v1, boot to recovery mode, check menu BRANCH=none Change-Id: Id2d23b5a1cc31dec12befa60a9a52790b129495c Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2201056 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>
* vboot: move VbExGetLocalizationCount to vboot2Joel Kitching2020-05-184-20/+21
| | | | | | | | | | | | | | | | | Rename VbExGetLocalizationCount to vb2ex_get_locale_count. Change signature to return by value instead of by parameter. BUG=b:146399181, b:156070974 TEST=make clean && make runtests BRANCH=none Change-Id: I4e3986007034724f01c9d42a382398ddacd59f33 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:2190612 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2193151 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: add developer and to_norm screensJoel Kitching2020-05-184-44/+248
| | | | | | | | | | | | | | | | Developer mode can boot internal or external disk. Support for booting legacy firmware ("Ctrl+L") will be added in a subsequent CL. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I45590e20727bd84375d10ca5ef906206d0ecd805 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2192863 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: make dev boot target functions consistentJoel Kitching2020-05-181-1/+13
| | | | | | | | | | | | | | | | | | | | | vb2_get_dev_boot_target() should only return: BOOT_USB iff vb2_dev_boot_usb_allowed() BOOT_LEGACY iff vb2_dev_boot_legacy_allowed() Otherwise, fallback to BOOT_DISK. BUG=None TEST=make clean && make runtests BRANCH=none Change-Id: Ic67915d0888f640f6e7b04c91f99346412cc18ee Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2203301 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>
* vboot: Add language selection screen to vb2_screenstabilize-quickfix-13099.93.Bstabilize-13099.94.Bstabilize-13099.90.Bstabilize-13099.85.Bstabilize-13099.73.Bstabilize-13099.72.Bstabilize-13099.70.Bstabilize-13099.118.Bstabilize-13099.110.Bstabilize-13099.101.Brelease-R84-13099.Bfactory-test-13099.17.BYu-Ping Wu2020-05-151-0/+2
| | | | | | | | | | | | Add VB2_SCREEN_LANGUAGE_SELECT to enum vb2_screen. BRANCH=none BUG=b:146399181 TEST=USE="menu_UI" emerge-nami depthcharge Change-Id: I441e5dd65c8c1f91ec868d3ab477b61b0c3e9cc5 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2200577
* vboot: enable phone recoveryYu-Ping Wu2020-05-141-2/+2
| | | | | | | | | | | | | Enable the phone recovery functionality and UI. BRANCH=none BUG=b:153596126 TEST=make runtests Change-Id: If4fc29db44903e79cecd959a9b558c509ad19e1a Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2196093 Reviewed-by: Joel Kitching <kitching@chromium.org>
* 2sha: Add SHA-224 and SHA-384 hash algorithmsJulius Werner2020-05-126-27/+84
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the SHA-224 and SHA-384 hash algorithms, which are basically just variants of SHA-256 and SHA-512 (respectively) with different initialization vectors and truncating a bit of the final output. They are only added to serve vboot's role as all-purpose crypto toolbox for callers (e.g. coreboot, where I need SHA-384 to support a certain SoC boot descriptor right now) and not intended for actual use as signature or firmware body hashes -- therefore, we only add the hash algorithms themselves and don't create enum values for them in enum vb2_crypto_algorithm or other structures. Also clarify the difference between UNROLL_LOOPS and UNROLL_LOOPS_SHA512 in the Makefile, since it was totally not obvious to me. BRANCH=None BUG=None TEST=make runtest and make runtest UNROLL_LOOPS=1 Cq-Depend: chromium:2191082 Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ic132d4dfe5967f03be4666b26c47d32c1235f4a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2183551 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: implement advanced_optionsJoel Kitching2020-05-111-6/+31
| | | | | | | | | | | | | | | Implement advanced_options menu item and screen. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I870133db74d773771ea92a280fdfb4864706bd71 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2186958 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Add developer screens to vb2_screenYu-Ping Wu2020-05-091-0/+4
| | | | | | | | | | | | | Add VB2_SCREEN_DEVELOPER_MODE and VB2_SCREEN_DEVELOPER_TO_NORM to enum vb2_screen. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: Ie949eedbf5d564f73fd6288bbc3630af83335dbb Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2186571 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: implement to_dev transition flowJoel Kitching2020-05-075-20/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce three new action hooks: - vb2_screen_info.init Init function runs once when changing to the screen. - vb2_screen_info.action Action function runs repeatedly while on the screen. - vb2_menu_item: Action function takes precedence over target screen if non-NULL. Create the VB2_SCREEN_RECOVERY_TO_DEV screen, and add a keyboard shortcut to get to that screen directly when in manual recovery mode: Ctrl+D. The TO_DEV screen repeatedly checks for the correct physical verification state. When that state is triggered, it switches to dev mode and reboots. The trigger depends on physical presence type: - PHYSICAL_PRESENCE_KEYBOARD: wait for ENTER key on the confirm button, pressed by internal keyboard - !PHYSICAL_PRESENCE_KEYBOARD: wait for the physical presence button (recovery or power) to be pressed and released - SPACE character also cancels in order to preserve prior behaviour Note that currently there is no way to exit developer mode once it has been enabled. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: If3ff248d98859d530c3a24524618c6282a5ac5b5 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2168072 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: remove validate_selection functionJoel Kitching2020-05-072-36/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Given that we are sending the full vb2_ui_context into UI-related functions, it's impossible to fully validate that called functions don't modify UI state in unexpected ways. Assume UI-related functions are mutating vb2_ui_context data correctly. Screen init functions (see CL:2168072) will be used to set selected_item and disabled_mask before displaying a screen for the first time. change_screen() is also changed to return a vb2_error_t value to be more consistent with action functions. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: Icda68f95a835b9143b8dd085d8dbdb7bced04775 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2182084 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Rename VB_AUX_FW_* to VB2_AUXFW_*factory-drallion-13080.BYu-Ping Wu2020-05-057-24/+24
| | | | | | | | | | | | | | For naming consistency, rename any variations of "AUX_FW" to "auxfw". BRANCH=none BUG=none TEST=make runtests Cq-Depend: chromium:2154265 Change-Id: Icf74215f5babf19228f2f362c3c29c9b14794dfc Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2154266 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: move locale_id from screen_state into ui_contextJoel Kitching2020-05-052-6/+2
| | | | | | | | | | | | | | | | | locale_id is not tied to the current screen -- i.e. it shouldn't revert if we return to the previous screen. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I691bdf7938d2a14cfbe68c7f60dc0103c236733c Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2182083 Tested-by: Hsuan Ting Chen <roccochen@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/ui: initialize vb2_ui_context memory to 0Joel Kitching2020-05-051-0/+1
| | | | | | | | | | | | | | | | Members of vb2_ui_context are undefined unless initialized. memset() the entire struct to 0 initially. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: Ieeb77c576231c4a4afb204e47983e35916be8fe4 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2182082 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Remove reboot-related vboot1-style errorsYu-Ping Wu2020-05-051-13/+2
| | | | | | | | | | | | BRANCH=none BUG=b:124141368, chromium:988410 TEST=make runtests Cq-Depend: chromium:2154269, chromium:2175864 Change-Id: Ib3996ecc83a69ce6780d48f1aa446e81dfd75589 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2167622 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Add advanced options screen to vb2_screenYu-Ping Wu2020-05-051-0/+2
| | | | | | | | | | | | | Add VB2_SCREEN_ADVANCED_OPTIONS to enum vb2_screen. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: I14f96f870c5f2f7dc462dfd138d4466b3e99d74c Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2175720 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: fix up EC/auxfw sync includesJoel Kitching2020-05-053-12/+6
| | | | | | | | | | | | | BUG=b:124141368, chromium:1016688 TEST=make clean && make runtests BRANCH=none Change-Id: Iabf62e4df5e554da28b191878b76d926299d73b9 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2171544 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Implement common UI loopHsuan Ting Chen2020-05-045-13/+498
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add config DETACHABLE to control the navigation in menu UI. Implement 4 screens: - VB2_SCREEN_RECOVERY_SELECT - VB2_SCREEN_RECOVERY_INVALID - VB2_SCREEN_RECOVERY_PHONE_STEP1 - VB2_SCREEN_RECOVERY_DISK_STEP1 Handling user inputs. - Shutdown request through VbExIsShutdownRequested. - Navigate with up, down, and enter key. - Navigate with volume up, volume down, and power button in DETACHABLE. Implement common UI loop, currently used for manual and non-manual recovery (developer forthcoming). BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge TEST=USE="menu_ui detachable" emerge-nami depthcharge TEST=make clean && make runtests TEST=DETACHABLE=1; make clean && make runtests Cq-Depend: chromium:2152212 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I4e0f2cdf053f75935529826df215b06c8a9af4cc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2117810 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: fix a typo in CL:2112321stabilize-13070.BJoel Kitching2020-04-301-1/+1
| | | | | | | | | | | | | | | | | CL:2112321 inadvertently removed the escape on a \n newline in a VB2_DEBUG string. Put it back. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I19ee4a77d3cc58d6995212151b381ae76c602a42 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2174039 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* 2crypto: Force correct section flags for .rodata arraysJulius Werner2020-04-291-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up fix to CL:2157900. That CL put the problematic arrays into sections with the right name, but they still didn't set the right ELF flags for them (specifically the READONLY flag). This made the assembler unhappy in coreboot, although it still seems to have built things correctly in the end: {standard input}: Assembler messages: {standard input}:359: Warning: setting incorrect section attributes for .rodata.vb2_hash_names {standard input}:369: Warning: setting incorrect section attributes for .rodata.vb2_sig_names This patch throws more ugly hacks at the problem to make it disappear. BRANCH=None BUG=None TEST=Build coreboot for both Arm and x86 boards, confirmed that error messages are gone and objdump shows intended section flags. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Iea93788a13e9fd14d6b5a16626294d5a4b0e5411 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2169480 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Convert reboot-related errors to vboot2-styleYu-Ping Wu2020-04-288-84/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error codes are renamed as follows: VBERROR_SHUTDOWN_REQUESTED --> VB2_REQUEST_SHUTDOWN VBERROR_REBOOT_REQUIRED --> VB2_REQUEST_REBOOT VBERROR_EC_REBOOT_TO_SWITCH_RW --> VB2_REQUEST_REBOOT_EC_SWITCH_RW VBERROR_EC_REBOOT_TO_RO_REQUIRED --> VB2_REQUEST_REBOOT_EC_TO_RO VBERROR_KEEP_LOOPING --> VB2_REQUEST_UI_CONTINUE Since these are not really "errors", they're renamed to VB2_REQUEST_* instead, with larger values to separate from real errors. The old vboot1-style errors will be removed once the errors are renamed in coreboot and depthcharge. BRANCH=none BUG=b:124141368, chromium:988410 TEST=make runtests Change-Id: Ide1328f9c0f2803534fb3f1f1ecd16ad8ea36a4e Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2143030 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Add screens for recovery using diskYu-Ping Wu2020-04-221-0/+4
| | | | | | | | | | | | | Add VB2_SCREEN_RECOVERY_DISK_STEP* to enum vb2_screen. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: Ibfaeb25d00ee340adfb9f7de9188f20a947bae24 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2156701 Reviewed-by: Joel Kitching <kitching@chromium.org>