lib/ec_sync_all: Reboot EC to RO after successful AUX FW update

Currently some chips that require AUX FW update request EC reboot to RO
after the FW update is applied successfully while some chips do not. It
is safe to request EC reboot to RO whenever AUX FW update is applied
successfully so that all the chips that require AUX FW update gets reset
to a clean state.

Update tests to handle the updated code flow and return code correctly.

BUG=b:128820536,b:119046668
BRANCH=None
TEST=Ensure that the device boots to ChromeOS. Force a TCPC FW update
and ensure that after it is successfully applied EC reboots to RO.

Cq-Depend: chromium:1625866
Change-Id: I72849620d90284e49cd1a9b31fc5eadede455c51
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1627302
Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Commit-Ready: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Karthikeyan Ramasubramanian 2019-05-22 11:33:40 -06:00 committed by chrome-bot
parent b4b4507d61
commit 80bc32daf1
2 changed files with 17 additions and 12 deletions

View File

@ -78,14 +78,18 @@ VbError_t ec_sync_all(struct vb2_context *ctx)
display_wait_screen(ctx, "AUX FW");
}
/*
* Do Aux FW software sync and protect devices tunneled through the EC.
* Aux FW update may request RO reboot to force EC cold reset so also
* disable display request if needed to prevent a second reboot.
*/
rv = ec_sync_update_aux_fw(ctx);
if (rv)
return rv;
if (fw_update > VB_AUX_FW_NO_UPDATE) {
/* Do Aux FW software sync */
rv = ec_sync_update_aux_fw(ctx);
if (rv)
return rv;
/*
* AUX FW Update is applied successfully. Request EC reboot to
* RO, so that the chips that had FW update gets reset to a
* clean state.
*/
return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
}
/* Phase 3; Completes sync and handles battery cutoff */
rv = ec_sync_phase3(ctx);

View File

@ -469,12 +469,12 @@ static void VbSoftwareSyncTest(void)
ResetMocks();
ec_aux_fw_mock_severity = VB_AUX_FW_FAST_UPDATE;
test_ssync(VBERROR_SUCCESS, 0,
test_ssync(VBERROR_EC_REBOOT_TO_RO_REQUIRED, 0,
"Fast auxiliary FW update needed");
TEST_EQ(screens_count, 0,
" wait screen skipped");
TEST_EQ(ec_aux_fw_update_req, 1, " aux fw update requested");
TEST_EQ(ec_aux_fw_protected, 1, " aux fw protected");
TEST_EQ(ec_aux_fw_protected, 0, " aux fw protected");
ResetMocks();
ec_aux_fw_mock_severity = VB_AUX_FW_SLOW_UPDATE;
@ -484,14 +484,15 @@ static void VbSoftwareSyncTest(void)
ResetMocks();
ec_aux_fw_mock_severity = VB_AUX_FW_SLOW_UPDATE;
test_ssync(VBERROR_SUCCESS, 0,
test_ssync(VBERROR_EC_REBOOT_TO_RO_REQUIRED, 0,
"Slow auxiliary FW update needed");
TEST_EQ(ec_aux_fw_update_req, 1, " aux fw update requested");
TEST_EQ(ec_aux_fw_protected, 1, " aux fw protected");
TEST_EQ(ec_aux_fw_protected, 0, " aux fw protected");
TEST_EQ(screens_displayed[0], VB_SCREEN_WAIT,
" wait screen forced");
ResetMocks();
ec_aux_fw_mock_severity = VB_AUX_FW_FAST_UPDATE;
ec_aux_fw_retval = VBERROR_UNKNOWN;
test_ssync(VBERROR_UNKNOWN, VB2_RECOVERY_AUX_FW_UPDATE,
"Error updating AUX firmware");