diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2017-10-27 11:23:44 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-30 23:21:32 -0700 |
commit | e5e03c6d50fd4c4a0cd95b68eeb52f0c8e98bfc6 (patch) | |
tree | 5ae16e2b9ef4b576962ae56f3951647a36eacf5b /tests | |
parent | 8a6456084df1aaa3e0f8f67db66459ec08b1b6bc (diff) | |
download | vboot-e5e03c6d50fd4c4a0cd95b68eeb52f0c8e98bfc6.tar.gz |
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
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ec_sync_tests.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ec_sync_tests.c b/tests/ec_sync_tests.c index 56f3baae..1d5f8c1b 100644 --- a/tests/ec_sync_tests.c +++ b/tests/ec_sync_tests.c @@ -33,6 +33,7 @@ static VbSharedDataHeader *shared = (VbSharedDataHeader *)shared_data; static GoogleBinaryBlockHeader gbb; static int mock_in_rw; +static VbError_t in_rw_retval; static int protect_retval; static int ec_ro_protected; static int ec_rw_protected; @@ -94,6 +95,7 @@ static void ResetMocks(void) ec_run_image = 0; /* 0 = RO, 1 = RW */ ec_ro_updated = 0; ec_rw_updated = 0; + in_rw_retval = VBERROR_SUCCESS; protect_retval = VBERROR_SUCCESS; update_retval = VBERROR_SUCCESS; run_retval = VBERROR_SUCCESS; @@ -142,6 +144,12 @@ int VbExTrustEC(int devidx) return !mock_in_rw; } +VbError_t VbExEcRunningRW(int devidx, int *in_rw) +{ + *in_rw = mock_in_rw; + return in_rw_retval; +} + VbError_t VbExEcProtect(int devidx, enum VbSelectFirmware_t select) { if (select == VB_SELECT_FIRMWARE_READONLY) @@ -159,6 +167,7 @@ VbError_t VbExEcDisableJump(int devidx) VbError_t VbExEcJumpToRW(int devidx) { ec_run_image = 1; + mock_in_rw = 1; return run_retval; } @@ -237,6 +246,12 @@ static void test_ssync(VbError_t retval, int recovery_reason, const char *desc) static void VbSoftwareSyncTest(void) { + /* AP-RO cases */ + ResetMocks(); + in_rw_retval = VBERROR_SIMULATED; + test_ssync(VBERROR_EC_REBOOT_TO_RO_REQUIRED, + VBNV_RECOVERY_EC_UNKNOWN_IMAGE, "Unknown EC image"); + /* Calculate hashes */ ResetMocks(); mock_ec_rw_hash_size = 0; |