summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2019-11-27 16:46:44 -0700
committerCommit Bot <commit-bot@chromium.org>2019-12-04 21:41:54 +0000
commitef064921cd3e4d631d53c8d9e5ca6cfbd0b81b1b (patch)
tree5fc8ca54004d5e46df57ad86653d341feee694f9
parentfa6298dfd85fda32617a5f54434085563027bd01 (diff)
downloadvboot-ef064921cd3e4d631d53c8d9e5ca6cfbd0b81b1b.tar.gz
Recovery mode: Skip EC software sync
EC software sync should not be performed in recovery mode, as it breaks the vboot model. BUG=b:145310842 BRANCH=firmware-hatch-12672.B TEST=Verify that EC sync is skipped in recovery mode (coreboot & depthcharge) Change-Id: I771b970b044ed2b13a1cd79f5649af92b0177ac7 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1941037 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
-rw-r--r--firmware/2lib/2ec_sync.c9
-rw-r--r--tests/vb2_ec_sync_tests.c10
2 files changed, 19 insertions, 0 deletions
diff --git a/firmware/2lib/2ec_sync.c b/firmware/2lib/2ec_sync.c
index b884cb85..d2c663d1 100644
--- a/firmware/2lib/2ec_sync.c
+++ b/firmware/2lib/2ec_sync.c
@@ -462,6 +462,15 @@ vb2_error_t vb2api_ec_sync(struct vb2_context *ctx)
return VB2_SUCCESS;
}
+ /*
+ * If the device is in recovery mode, then EC sync should
+ * not be performed.
+ */
+ if (ctx->flags & VB2_CONTEXT_RECOVERY_MODE) {
+ VB2_DEBUG("In recovery mode, skipping EC sync\n");
+ return VB2_SUCCESS;
+ }
+
/* Phase 1; this determines if we need an update */
vb2_error_t phase1_rv = ec_sync_phase1(ctx);
int need_wait_screen = ec_will_update_slowly(ctx);
diff --git a/tests/vb2_ec_sync_tests.c b/tests/vb2_ec_sync_tests.c
index e41edf30..11926111 100644
--- a/tests/vb2_ec_sync_tests.c
+++ b/tests/vb2_ec_sync_tests.c
@@ -389,6 +389,16 @@ static void VbSoftwareSyncTest(void)
mock_in_rw = 1;
shutdown_request_calls_left = 0;
test_ssync(0, 0, "AP-RW shutdown requested");
+
+ /* EC sync not allowed in recovery mode */
+ ResetMocks();
+ ctx->flags |= VB2_CONTEXT_RECOVERY_MODE;
+ test_ssync(0, 0, "No sync in recovery mode");
+ TEST_EQ(ec_ro_protected, 0, "ec ro not protected");
+ TEST_EQ(ec_rw_protected, 0, "ec rw not protected");
+ TEST_EQ(ec_run_image, 0, "ec in ro");
+ TEST_EQ(ec_ro_updated, 0, "ec ro not updated");
+ TEST_EQ(ec_rw_updated, 0, "ec rw not updated");
}
int main(void)