summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-07-26 15:24:36 -0700
committerGerrit <chrome-bot@google.com>2012-07-26 16:50:10 -0700
commit0c32130a57603fc6624c7fd285c71c851836f741 (patch)
tree6505296adad5ee6b542935f664ada888f9a1c52c
parent584e0d2070aca1a5e091442cb9bad0726451ad95 (diff)
downloadvboot-0c32130a57603fc6624c7fd285c71c851836f741.tar.gz
Shut down after EC software sync if lid is closed
So if the EC reboots when the lid is closed (for example, it wakes from hibernate because the AC adapter was inserted), it won't leave the AP powered on. BUG=chrome-os-partner:11087 TEST=manual Reboot EC with lid closed ('reboot hard'). Should finish software sync and shut down. Reboot EC with lid open. Boots. Hibernate EC and wake with lid open. Boots. Hibernate EC and wake with power button press. Boots. Reboot into recovery mode. Boots. Press power button; shuts down. Reboot into recovery mode. Boots. Close lid; shuts down. CQ-DEPEND=*22578 Change-Id: I09d5331222aa10b73518f9f574ec5a32d8e6ac23 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28525 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--firmware/lib/vboot_api_kernel.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 578031d9..9c5dd7f4 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -422,12 +422,13 @@ VbError_t VbEcSoftwareSync(VbSharedDataHeader *shared) {
VBDEBUG(("VbEcSoftwareSync() in RO-Normal; EC-RO\n"));
- /* TODO: If there was no wake event from the EC (such as power button or
- * lid-open), shut down. The AP was powered on simply to verify the EC.
- *
- * Make sure this doesn't shut down when we're leaving recovery mode and
- * jumping back to RW code, though. EC can't currently track that,
- * though that could be passed as an additional reboot flag to the EC. */
+ /* 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;
}
@@ -529,12 +530,15 @@ VbError_t VbEcSoftwareSync(VbSharedDataHeader *shared) {
return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
}
- /* TODO: If there was no wake event from the EC (such as power button or
- * lid-open), shut down. The AP was powered on simply to verify the EC.
- *
- * Make sure this doesn't shut down when we're leaving recovery mode and
- * jumping back to RW code, though. */
VBDEBUG(("VbEcSoftwareSync() in RW; done\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;
}