Software sync checks for shutdown-requested in all code paths

Previously,
1) AP-RO, EC-RO -> checked
2) AP-RW, EC-RO transition to EC-RW -> checked
3) AP-RW, EC-RW already -> NOT checked

Now, (3) calls VbExIsShutdownRequested() as well.

This fix is needed to avoid inconsistent behavior of software sync
after we ship a RW update.

Whether we *should* actually shut down or not based on how/why we
booted is a separate issue to be addressed by the U-boot
implementation of VbExIsShutdownRequested() in a separate CL.

BUG=chromium-os:38645
BRANCH=all
TEST=make runtests

Manual testing also possible - force AP-RW firmware, then reboot with
lid closed.  Previously, the first boot would shut down because of
(2), but subsequent reboots of the AP only wouldn't because of (3).

Change-Id: I226202f48d793b88a30ffa62731de878f8c22315
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43044
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Randall Spangler
2013-02-11 10:08:51 -08:00
committed by ChromeBot
parent fe510c0620
commit 886a9047f0
2 changed files with 39 additions and 0 deletions

View File

@@ -742,6 +742,18 @@ VbError_t VbEcSoftwareSync(VbCommonParams *cparams)
}
VBDEBUG(("VbEcSoftwareSync() in EC-RW and it matches\n"));
/*
* If shutdown is requested, just power the AP back off. This
* covers the case where the lid is closed when then system
* boots.
*/
if (VbExIsShutdownRequested()) {
VBDEBUG(("VbEcSoftwareSync() "
"sees shutdown-requested\n"));
return VBERROR_SHUTDOWN_REQUESTED;
}
return VBERROR_SUCCESS;
}