Commit Graph

746 Commits

Author SHA1 Message Date
Shelley Chen
2d92620f35 detach_ui_test: Move variables needed for unit tests to private file
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>
2017-12-18 20:33:09 -08:00
Philip Chen
c5c1c679de Revert "vboot: Fix INSERT screen error when valid Kernel USB is not inserted"
BUG=b:70538502
BRANCH=none
TEST=enter VB_MENU_TO_DEV reliably

This reverts commit 805726997c.

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>
2017-12-12 19:58:16 +00:00
Randall Spangler
dff5852c2f vboot: Use 2nvstorage instead of vboot_nvstorage
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
2017-12-11 15:16:25 -08:00
Rizwan Qureshi
626340420e vboot_ui_menu: honour power button press in RECOVERY_NO_GOOD_SCREEN
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>
2017-12-11 03:11:04 -08:00
Barnali Sarkar
805726997c vboot: Fix INSERT screen error when valid Kernel USB is not inserted
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>
2017-12-11 03:11:03 -08:00
Daisuke Nojiri
eb13c06d2b vboot_ui: Let keyboard power button shut down system
This patch allows a power button on a keyboard to shut down the system
when waiting for a user interaction at a firmware screen. The firmware
menu, which is implemented by vboot_ui_menu, shouldn't be affected.

BUG=b:70244028
BRANCH=none
TEST=Verify power button on Fizz can shut down the system at recovery
screen, broken screen, todev scree, and user confirmation screen using
a USB keyboard and a servo. Verify recovery button can confirm dev mode
transition. Run 'make runmisctests' successfully.

Change-Id: Icc7d7a774da19acac3d2938d5748ad2323ba4856
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/811444
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-12-08 03:59:19 -08:00
Randall Spangler
f6780a36ff firmware: header tweaks for depthcharge
Depthcharge currently includes vboot_nvstorage.h directly, instead of
including only the API header files directly.  Add 2nvstorage.h to the
list of headers which can be requested impolitely.

Also fix the definition of ARRAY_SIZE to match exactly what
depthcharge and coreboot provide, so that the compiler does not get
sad when it's included from both libpayload.h and 2common.h.

BUG=chromium:789276
BRANCH=none
TEST=make runtests; emerge-reef depthcharge coreboot

Change-Id: Idc0390eaf813c3079df1676781e8bf5bc9b46450
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/802176
Reviewed-by: Shelley Chen <shchen@chromium.org>
2017-12-01 14:54:40 -08:00
Shelley Chen
085759742e detachables: create menu items for legacy screens
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>
2017-11-23 04:39:15 -08:00
Stefan Reinauer
087a4c8d9c Fix vboot compilation with coreboot-sdk
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>
2017-11-20 18:13:45 -08:00
Randall Spangler
17fb34b647 vboot: Use kernel max rollforward NV storage field
Kernel verification will now roll forward the minimum allowable
version in the TPM no farther than the kernel_max_rollforward setting.

Note that CL:765573 changes chromeos-setgoodkernel so it always sets
kernel_max_rollforward to 0xfffffffe when marking a kernel as good.
That ensures that firmware with this setting will behave the same for
now as existing firmware.

BUG=chromium:783997
BRANCH=none
CQ-DEPEND=CL:765573
TEST=make runtests
     Manual testing:
     crossystem tpm_kernvel --> print current kernel version in TPM
     - Resign the kernel with a higher version
     - Reboot
     - Wait a minute for chromeos-setgoodkernel to run
     crossystem kernel_max_rollforward=0
     - Reboot
     crossystem tpm_kernvel --> has not changed
     - Wait a minute for chromeos-setgoodkernel to run
     crossystem kernel_max_rollforward -> 0xfffffffe
     - Reboot
     crossystem tpm_kernvel --> has changed to the higher version

Change-Id: Ia32ecb7fa4078548cd311541ccbe120570cf1bc5
Reviewed-on: https://chromium-review.googlesource.com/765574
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2017-11-17 20:18:20 -08:00
Randall Spangler
4aaaeca130 nvstorage: Add kernel max rollforward NV storage field
This just adds the kernel_max_rollforward field to the nvstorage
libraries and crossystem.  The firmware does not use it yet; that's
coming in a subsequent CL.

16 of the fields's 32 bits are taken from unused bytes of the kernel
field.  This has no effect on existing usage.

BUG=chromium:783997
BRANCH=none
TEST=make runtests
     Also manual testing.  In a root shell:
     	crossystem kernel_max_rollforward --> Should default to 0

	crossystem kernel_max_rollforward=0xfffffffe
	crossystem kernel_max_rollforward --> Should be 0xfffffffe

     (Note that setting it to 0xffffffff is indistinguishable from the
     -1 value that the crossystem library uses to indicate error, so
     0xffffffff isn't actually usable as a max rollforward limit.  But
     0xfffffffe is, and if we ever get so close to the limit that we
     need to use 0xffffffff, something has already gone horribly wrong
     with our versioning strategy...)

Change-Id: I008f412e6ed3c0b59beb9881268585af69d1ff2e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/765572
Reviewed-by: Julius Werner <jwerner@chromium.org>
2017-11-17 20:18:19 -08:00
Shelley Chen
6014de9844 detachables: Use Volup+Voldown to exit recovery graphic
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>
2017-11-16 08:28:12 -08:00
Shelley Chen
7850034a6d detachables: Implement disable dev mode for enterprise
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>
2017-11-16 08:28:12 -08:00
Furquan Shaikh
4fbe948c51 vboot_ui_menu: Use volume down short press at recovery menu screen
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>
2017-11-14 10:11:19 -08:00
Randall Spangler
ff82ffb0a9 vboot: use VBNV_ constants with VbNvGet()
The vboot1 library VbNvGet() / VbNvSet() functions use enum VbNvParam
(VBNV_*) constants.

The vboot2 library vb2_nv_get() / vb2_nv_set() functions use enum
vb2_nv_param constants.

Do not mix the two.  In the one instance where this happens in the
current code, we get lucky, because VBNV_DEV_BOOT_FASTBOOT_FULL_CAP
and VB2_NV_DEV_BOOT_FASTBOOT_FULL_CAP evaluate to the same value, so
this was harmless.  But fix that now so nobody else copy/pastes that
pattern for a param where this isn't true.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: I1facbe1d97591dc8b1e6b38717924b884949da57
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/764970
Reviewed-by: Julius Werner <jwerner@chromium.org>
2017-11-12 10:49:49 -08:00
Furquan Shaikh
db79418605 buttons: Update button codes for vup, vdn and power
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>
2017-11-09 21:45:56 -08:00
Daisuke Nojiri
e5e03c6d50 Call VbExEcRunningRW to set IN_RW flag
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
2017-10-30 23:21:32 -07:00
Shelley Chen
2aa3dd0f6d detachables: Remove screen blanking
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>
2017-10-26 00:19:48 -07:00
Shelley Chen
8122e0b8b1 detachables: Print error if enable normal mode when FORCE_DEV on
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>
2017-10-20 17:59:29 -07:00
Shelley Chen
0329f9c2ec vboot_ui_menu: Checking vb2_update_menu return value
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>
2017-10-18 06:15:06 -07:00
Andrey Pronin
3b805725c1 tlcl, tpmc: extend GetVersion to report vendor specific data
1) Extend TlclGetVersion to return vendor specific data, if
   requested.
2) Extend 'tpmc getver' to include vendor specific data.

BRANCH=none
BUG=chromium:771561
TEST=unit tests, running 'tpmc getver'

Change-Id: Ic04c242d4e6f33b45a80479be9ab9777b317ebe2
Reviewed-on: https://chromium-review.googlesource.com/706240
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2017-10-12 16:35:30 -07:00
Daisuke Nojiri
95554e4e62 Check EC_IN_RW before proceeding to recovery mode
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>
2017-10-05 21:24:44 -07:00
Divya Chellap
e95ceff307 vboot: Handle power button press in broken screen
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>
2017-10-05 03:04:15 -07:00
Shelley Chen
2ca654f03a detachables: fix setting selected_idx of DEV_WARNING menu
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>
2017-09-15 16:59:22 -07:00
Shelley Chen
1a8b1c008e detachables: Set TO_DEV menu's default selection to cancel
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>
2017-09-15 16:59:22 -07:00
Shelley Chen
1282081609 detachables: Ensure keyboard input in TO_DEV menu trusted
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>
2017-09-15 16:59:22 -07:00
Shelley Chen
7fad48ef55 detachables: Disable Network Boot Option
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>
2017-09-13 01:50:59 -07:00
Shelley Chen
8e0c3e5ad5 detachables: Power button turns off device on RECOVERY_INSERT screen
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>
2017-09-13 01:50:59 -07:00
Daisuke Nojiri
f78d505e04 Support EC early firmware selection
Chromebox ECs perform EFS: verifying firmware before the AP boots.
This patch adds support for EC EFS.

EC EFS uses two slots: one is active slot and one is used for update.
AP is agnostic about which slot is active and which slot is for
update. Instead, AP recognizes one slot as 'active' and the other
as 'update' (or non active) slot.

After update is successful, AP issues a cold reboot command to
activate the new slot.

BUG=b:65028930,b:65264494
BRANCH=none
CQ-DEPEND=CL:616248
TEST=buildall. On Fizz, verify:
1. RW_B is old and updated by soft sync. RW_B is activated and
executed after reboot. System continues to boot to OS.
2. RW_A is old and updated by soft sync. RW_A is activated and
executed after reboot. System continues to boot to OS.

Change-Id: I6ca7686eb28b0b548785cf2c02eca1b67018f469
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/616346
2017-09-08 20:04:33 -07:00
Mattias Nissler
b2b3970923 Add support for IFX FieldUpgradeInfoRequest2 command
Add tpm_lite library support for the IFX specific TPM_FieldUpgrade
subcommand "FieldUpgradeInfoRequest2". Expose this via tpmc so it can
be used from shell scripts.

BRANCH=none
BUG=chromium:728130
TEST=Builds and tpmc ifxfieldupgradeinfo prints plausible results.

Change-Id: Ie58ebccef7fe90f7fca65d7cd9c78e1f16f9f29a
Reviewed-on: https://chromium-review.googlesource.com/562772
Commit-Ready: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
2017-08-23 17:01:24 -07:00
Shelley Chen
93f1142d7a detachables: Display recovery insert icon at recovery startup
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>
2017-08-21 22:03:59 -07:00
Caveh Jalali
5afa7faf7b ec_sync: always call VbExUpdateAuxFw
call VbExUpdateAuxFw() uncontidionally, instead of when we know we
need to do an update.  Vb*AuxFw() already maintains state, so this
doesn't change when we (attempt) to update firmware.

however, this does allow us to iterate over all firmware drivers to
call their .protect() method.  previously, we would only call
.protect() after an actual firmware update.

updated unit tests to match the new logic.

BRANCH=none
BUG=b:35585700
TEST=verified i2c tunnels are protected on reef using
	ectool i2cprotect N status.

Change-Id: I9244db28ed181f568d117092307293202257735b
Signed-off-by: Caveh Jalali <caveh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/620281
Reviewed-by: Julius Werner <jwerner@chromium.org>
2017-08-21 17:55:25 -07:00
Furquan Shaikh
8610346356 lib/vboot_ui_menu: Consider volume buttons in vb2_update_selection
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>
2017-08-18 16:46:34 -07:00
Shelley Chen
8c4b828502 detachables: Skip "Enable Developer Mode" in DEV mode
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>
2017-08-14 20:37:45 -07:00
Shelley Chen
fc7b3972bc detachables: Select power off after language selection
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>
2017-08-01 13:01:42 -07:00
Shelley Chen
356eab1c8e detachables: Set fw screen timeout to 30 secs upon button press
For detachables, the short delay is to fast to them to read/choose
options.  Setting timeout to 30 seconds once user starts scrolling
through the menu.  If no action is taken by the user, will retain
the short delay timeout.

BUG=b:63056097, b:35585623
BRANCH=None
TEST=reboot with gbb flag bit 1 enabled and ensure using short delay.
     reboot and press volume button and make sure using long delay.
     reboot and make sure short delay performed again upon reboot.
     reboot and make sure gbb flag bit 1 = 0 and make sure long delay
     still working as expected.

Change-Id: I31e3ca8aff6b29abca70ca9587deae7f6443d837
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/563817
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-07-31 17:08:29 -07:00
Mattias Nissler
2a7e9b84ac Implement tpmc getversion command.
This command exposes the vendor and TPM firmware version.

BRANCH=none
BUG=chromium:728130
TEST=Builds and tpmc getversion prints plausible results.

Change-Id: Iec556a298e025e10bda00121b40a25d8dc3839d1
Reviewed-on: https://chromium-review.googlesource.com/565287
Commit-Ready: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2017-07-18 00:32:48 -07:00
Caveh Jalali
3dd580298b call depthcharge hooks for auxiliary FW update.
this adds calls to depthcharge (using callbacks) to do auxiliary
firmware updates.  in particular, this is intended to trigger TCPC
updates, but other programmables could also be updated.

no firmware updates take place until a board file has actually
registered a firmware update "driver".  board file updates to follow.

TEST="COV=1 make" passes.
	    depthcharge boots on snappy.
	    with additional follow-on CLs, we can update the ps8751.

the companion depthcharge changes are here:

https://chromium-review.googlesource.com/c/498150/

the working design doc is here:

https://docs.google.com/a/google.com/document/d/1uzS0b3O3Us1QI2Sx7LDkjEfHmuhYB2BolrAoNwCVoc0/edit?usp=sharing

these features depend on vboot API updates:

CQ-DEPEND=CL:498150
BUG=b:35586896
BRANCH=none

Change-Id: If0d634eab08b429a8e7e80f5fe11eab3705bba0f
Signed-off-by: Caveh Jalali <caveh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/505260
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2017-06-28 03:09:49 -07:00
Shelley Chen
7bd4c0375b detachables: Fix language menu size in recovery
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>
2017-06-22 17:03:50 -07:00
Shelley Chen
05418ff02c detachables: Highlight selection w/ Debug Info
Currently with detachable menu, when debug info is
displayed, the current selection is not highlighted.
Changing call in VbDisplayDebugInfo from
VbDisplaySecreen to VbDisplayMenu to ensure
selection is highlighted.  This will have no effect
on firmware screens for non-detachables.

BUG=b:35585623
BRANCH=None
TEST=Compile with and without  USE=detachable_ui
     Reboot and display debug info.  Make sure
     that for detachable menu, selection remains
     highlighted and for non-detachable screens,
     The screen displays as usual.

Change-Id: I0a7a2c4e0ae3ffb82e13dc92a319288d4ccb3997
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/541758
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2017-06-22 17:03:50 -07:00
Randall Spangler
3522e574a2 2lib: Add test_mockable attribute
Some tests mock library functions.  This previously worked due to adding

  CFLAGS += -Xlinker --allow-multiple-definition

to the test binaries.  But the new version of binutils seems to need
the default implementation to be weak if compiled with -O2 in some
cases.  Add test_mockable for use with functions where this is now
needed.

BUG=chromium:723906
BRANCH=none
TEST=Add CFLAGS += -O2 to the makefile, then make -j runtests
     Tests break before this change with -O2, and work afterwards

Change-Id: I95996a3e1086251442055765295a75de4c20ee3c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/527601
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Rahul Chaudhry <rahulchaudhry@chromium.org>
Reviewed-by: Rahul Chaudhry <rahulchaudhry@chromium.org>
2017-06-20 17:24:20 -07:00
Shelley Chen
de4cefc915 detachables: Remove locale switch on up arrow
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>
2017-05-27 10:35:41 -07:00
Shelley Chen
46802fddeb detachables: Adding language selection menu
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>
2017-05-27 10:35:41 -07:00
Shelley Chen
87666b349e detachables: Reset timer every time user moves the cursor
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>
2017-05-26 14:35:33 -07:00
Shelley Chen
2b8ea31e67 detachables: Use locale bitmaps instead of text
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
2017-05-26 14:35:32 -07:00
Shelley Chen
2ed9ca605c detachables: New code path for displaying detachable menus
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
2017-05-25 22:51:14 -07:00
Caveh Jalali
2c85972148 define callback APIs for auxiliary firmware update.
TEST="COV=1 make" passes
	depthcharge still compiles
	in combination with follow-up CLs, ps8751 firmware update
	succeeds.

BUG=b:35586896

Change-Id: Ibadc41e56e4e25ee0aba5c83caa0e3596fb9ad20
Reviewed-on: https://chromium-review.googlesource.com/505259
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-05-23 23:59:11 -07:00
Rizwan Qureshi
f7ce794999 vboot_ui_menu: Show Developer options on USB failure
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>
2017-05-23 03:03:16 -07:00
Duncan Laurie
42f57403ae vboot: Add multiboot kernel type
Add a kernel type for signing multiboot kernel images.

BUG=b:38040849
BRANCH=none
TEST=properly sign a multiboot kernel image and then verify
the resulting image.

Change-Id: If00e7c85244bc59853c305e42543f34c5fabf356
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/497933
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-05-08 12:40:52 -07:00
Shelley Chen
fa0f483782 detachables: Define VbExDisplayMenu()
Create new callback for drawing detachable firmware menus

BUG=b:35585623
BRANCH=None
TEST=None

Change-Id: Ief207f6119f00151e2d480549aaac3a8755cb1b4
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/457838
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2017-03-29 13:43:11 -07:00