chromeos/cr50_enable_update.c: Modify recovery flow for cr50

Enable Cr50 update in recovery mode, so that we can at least still
update the process for most cases (that an update is pending in recovery
mode is not impossible but should be unlikely in the field).

Leave manual recovery unaffected so at least that would still work even
if Cr50 wedges in a weird way that it thinks it has an update on every
boot or something.

Setting the recovery_reason to VB2_RECOVERY_TRAIN_AND_REBOOT allows the
update to be applied.

BUG=b:154071064
BRANCH=none
TEST=builds

Thanks to Julius Werner for the suggested fix.

Change-Id: Iba341a750cce8334da4dcf6353ca8cd1268d170f
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41988
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Edward O'Callaghan 2020-06-02 14:41:43 +10:00 committed by Patrick Georgi
parent 5131c6f79a
commit 7c52283f78
1 changed files with 6 additions and 2 deletions

View File

@ -72,8 +72,12 @@ static void enable_update(void *unused)
int cr50_reset_reqd = 0;
uint8_t num_restored_headers;
/* Nothing to do on recovery mode. */
if (vboot_recovery_mode_enabled())
/**
* Never update during manually-triggered recovery to ensure update
* cannot interfere. Non-manual VB2_RECOVERY_TRAIN_AND_REBOOT
* sometimes used to update in factory.
*/
if (vboot_get_context()->flags & VB2_CONTEXT_FORCE_RECOVERY_MODE)
return;
ret = tlcl_lib_init();