diff options
author | dnojiri <dnojiri@chromium.org> | 2020-03-05 11:17:58 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-24 09:41:01 +0000 |
commit | 0377e7a984d9d1051007b2f54da744b8dd8c3917 (patch) | |
tree | ddf0cbaebf1667c018f12180d7f3ff91411f4a1d | |
parent | 4fbd42f531c8e73902c0d3e45f9fd9aa0efd374a (diff) | |
download | chrome-ec-0377e7a984d9d1051007b2f54da744b8dd8c3917.tar.gz |
EFS2: Reset after shutdown if EC is still in RO
When the system boots in recovery mode, EC stays in RO. When a power
button is pressed in recovery screen, currently the system shuts down
and EC continues to stay in RO.
For a battery-less system, when a power button is pressed again, the
system can't boot because there is no PD power (unless the system is
powered otherwise). So, EC needs to be in RW so that it can boot the
AP on the next power button press.
This patch makes EC reset itself when the AP shuts down and EC is still
in RO.
For a chromebook, when a power button is pressed for power-on, the
system may be able to boot using the battery power. However, with this
patch, EC will be able to negotiate PD power while waiting for another
power button press.
The timelines below show the difference between the system without
and with this patch:
PB (for shutdown) PB (for boot)
v v
1) -------------- ... -----+++++++++
2) -|-+++++++++++ ... ++++++++++++++
where:
PB = power button press
-: EC in RO
+: EC in RW
|: Reset
Tests are executed on a reworked Helios.
Signed-off-by: dnojiri <dnojiri@chromium.org>
BUG=chromium:1045209
BRANCH=none
TEST=Boot to recovery screen. Press power button to shutdown.
Verify (after reset) EC jumps to RW and stays in S5.
TEST=Boot to developer screen. Press power button to shutdown.
Verify EC stays in RW.
TEST=Run reboot from OS. Verify system reboots back to S0.
TEST=Run shutdown -H now. Verify system shuts down and stays in S5.
TEST=Hold L_Shift+ESC+F3+Power to trigger HW_REINIT.
TEST=ectool batterycutoff at-shutdown
TEST=test_that firmware_SoftwareSync firmware_DevMode
Change-Id: I6a04a9741351fa06cbadf6725ff71452574db68c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2095754
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: George Engelbrecht <engeg@google.com>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: George Engelbrecht <engeg@google.com>
-rw-r--r-- | common/vboot/efs2.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/common/vboot/efs2.c b/common/vboot/efs2.c index 2e8947b84d..29ad42995f 100644 --- a/common/vboot/efs2.c +++ b/common/vboot/efs2.c @@ -16,6 +16,7 @@ #include "console.h" #include "crc8.h" #include "flash.h" +#include "hooks.h" #include "sha256.h" #include "system.h" #include "task.h" @@ -297,3 +298,28 @@ void vboot_main(void) */ CPRINTS("Exit"); } + +void hook_shutdown(void) +{ + CPRINTS("%s", __func__); + + /* + * We filter the cases which can be interfered with if we execute + * system_reset in HOOK_CHIPSET_SHUTDOWN context. Most cases are + * filtered out by system_is_in_rw (e.g. system_common_shutdown, + * check_pending_cutoff). + */ + if (system_is_in_rw()) + return; + + CPRINTS("Reboot\n\n"); + cflush(); + system_reset(SYSTEM_RESET_LEAVE_AP_OFF); +} +/* + * There can be hooks which are needed to set external chips to a certain state + * in S5. If the initial state (i.e. AP_OFF state) is different from what those + * hooks realize, they need to be considered. This hook runs last (i.e. + * HOOK_PRIO_LAST) to make our landing on S5 as mild as possible. + */ +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, hook_shutdown, HOOK_PRIO_LAST); |