diff options
author | Karthikeyan Ramasubramanian <kramasub@chromium.org> | 2019-05-22 11:33:40 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-21 21:09:55 +0000 |
commit | ea164dcfa5d13d857de1c4969cb02d99ca7c9ad8 (patch) | |
tree | 2417c28a22534f12b98b9e4d341caa14f0673591 | |
parent | 0b9e42d677c39fc50ce591702147b270e5150d5f (diff) | |
download | vboot-firmware-octopus-11297.106.B.tar.gz |
lib/ec_sync_all: Reboot EC to RO after successful AUX FW updatefirmware-octopus-11297.Bfirmware-octopus-11297.83.Bfirmware-octopus-11297.250.Bfirmware-octopus-11297.196.Bfirmware-octopus-11297.106.Bfirmware-11297.250.B
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.
Cq-Depend: chromium:1625866
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.
Change-Id: I72849620d90284e49cd1a9b31fc5eadede455c51
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1672056
Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
-rw-r--r-- | firmware/lib/ec_sync_all.c | 32 | ||||
-rw-r--r-- | tests/ec_sync_tests.c | 9 |
2 files changed, 26 insertions, 15 deletions
diff --git a/firmware/lib/ec_sync_all.c b/firmware/lib/ec_sync_all.c index 96e0d83c..e38dafb8 100644 --- a/firmware/lib/ec_sync_all.c +++ b/firmware/lib/ec_sync_all.c @@ -64,7 +64,7 @@ VbError_t ec_sync_all(struct vb2_context *ctx) struct vb2_shared_data *sd = vb2_get_sd(ctx); VbSharedDataHeader *shared = sd->vbsd; VbAuxFwUpdateSeverity_t fw_update = VB_AUX_FW_NO_UPDATE; - VbError_t rv; + VbError_t rv, update_aux_fw_rv = VBERROR_SUCCESS; /* Phase 1; this determines if we need an update */ VbError_t phase1_rv = ec_sync_phase1(ctx); @@ -107,19 +107,29 @@ 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 - * unload the option ROM if needed to prevent a second reboot. - */ - rv = ec_sync_update_aux_fw(ctx); - if (rv) { - ec_sync_unload_oprom(ctx, shared, need_wait_screen); - return rv; + /* Do Aux FW software sync */ + if (fw_update > VB_AUX_FW_NO_UPDATE) { + update_aux_fw_rv = ec_sync_update_aux_fw(ctx); + /* + * If requesting EC reboot to RO (because some tunnels are + * protected), do not disable the display to avoid reboot + * during display re-init. + */ + if (update_aux_fw_rv == VBERROR_EC_REBOOT_TO_RO_REQUIRED) + return update_aux_fw_rv; } - /* Reboot to unload VGA Option ROM if needed */ + /* Reboot to unload VGA Option ROM for both slow EC & AUX FW updates */ rv = ec_sync_unload_oprom(ctx, shared, need_wait_screen); + /* Something went wrong during AUX FW update */ + if (update_aux_fw_rv) + return update_aux_fw_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. + */ + if (fw_update > VB_AUX_FW_NO_UPDATE) + return VBERROR_EC_REBOOT_TO_RO_REQUIRED; if (rv) return rv; diff --git a/tests/ec_sync_tests.c b/tests/ec_sync_tests.c index 1822fd75..3a820de0 100644 --- a/tests/ec_sync_tests.c +++ b/tests/ec_sync_tests.c @@ -431,23 +431,24 @@ 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; - 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"); |