From aee6bd69fefac653cfc4a5679eb387d7c3280d14 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Thu, 7 Apr 2016 12:21:03 +0800 Subject: Support doing battery cut-off in firmware stage. Add a new crossystem value "battery_cutoff_request" to indicate that next reboot should cut-off battery and shutdown during firmware stage. This request is primarily for factories to ship devices in an safe state. Previously we have done same thing by running "ectool battery-cutoff" but that creates a problem which "ectool" (and the one to request for cut-off) must live in developer mode while the device must be shipped in normal mode. The mode transition was solved by setting "disable_dev_request=1", but that flag is may get lost on x86 systems (having NV storage in CMOS) when the battery is cut-off . From the experience from Ryu, such settings (dev mode transition and battery cut-off) should be done together inside firmware execution so we can create a new flag, battery_cutoff_request, to finalize device properly. BRANCH=none BUG=chromium:601705 TEST=emerge-chell depthcharge vboot_reference chromeos-bootimage crossystem battery_cutoff_request=1 # Unplug AC adapter reboot # See device rebooted and then shutdown immediately. # Press power button and system won't boot. # Attach AC adapter and now system boots. CQ-DEPEND=CL:337596,CL:338193 Change-Id: I73ccae15b337cd65786106646546c67c155b8fa6 Reviewed-on: https://chromium-review.googlesource.com/337602 Commit-Ready: Hung-Te Lin Tested-by: Hung-Te Lin Reviewed-by: Duncan Laurie --- firmware/stub/vboot_api_stub.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'firmware/stub') diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c index 2299a033..7bc4cb86 100644 --- a/firmware/stub/vboot_api_stub.c +++ b/firmware/stub/vboot_api_stub.c @@ -166,6 +166,11 @@ VbError_t VbExEcVbootDone(int in_recovery) return VBERROR_SUCCESS; } +VbError_t VbExEcBatteryCutOff(void) +{ + return VBERROR_SUCCESS; +} + enum VbEcBootMode_t VbGetMode(void) { return vboot_mode; -- cgit v1.2.1