summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-02-08 17:28:49 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-02-19 20:58:08 +0000
commitf0957c86e2397cd47d009de6c3fafb477dbeeca7 (patch)
tree473ebca8a58657c1df8d38bd05b281096aabab2c
parent983b53dce8cbd0c27ee44deed38216fdc795304b (diff)
downloadchrome-ec-f0957c86e2397cd47d009de6c3fafb477dbeeca7.tar.gz
EFS: Give RO chance to perform vboot
When a user presses the power button in recovery screen, the system shuts down but EC stays in RO. In this state if a user presses the power button again, EC won't be given a chance to run EFS. This patch makes EC execute cold reboot when a power button is pressed in G3/S5. BUG=b:73609782 BRANCH=none TEST=Shut down system in recovery screen. Press power button and verify cold boot is executed. Change-Id: I64af0997beae707680792dcf9e656e036c2a9d8e Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/911828
-rw-r--r--common/power_button.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/common/power_button.c b/common/power_button.c
index a5da582afd..94562e5f3e 100644
--- a/common/power_button.c
+++ b/common/power_button.c
@@ -5,6 +5,7 @@
/* Power button module for Chrome EC */
+#include "chipset.h"
#include "common.h"
#include "console.h"
#include "gpio.h"
@@ -13,6 +14,7 @@
#include "keyboard_scan.h"
#include "lid_switch.h"
#include "power_button.h"
+#include "system.h"
#include "task.h"
#include "timer.h"
#include "util.h"
@@ -134,7 +136,16 @@ static void power_button_change_deferred(void)
power_button_is_stable = 1;
CPRINTS("power button %s", new_pressed ? "pressed" : "released");
-
+#ifdef CONFIG_VBOOT_EFS
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ new_pressed && !system_is_in_rw()) {
+ CPRINTS("cold reset");
+ cflush();
+ system_reset(0);
+ while (1)
+ ;
+ }
+#endif
/* Call hooks */
hook_notify(HOOK_POWER_BUTTON_CHANGE);