summaryrefslogtreecommitdiff
path: root/common/system.c
diff options
context:
space:
mode:
authorSam McNally <sammc@chromium.org>2020-02-27 21:29:25 +1100
committerCommit Bot <commit-bot@chromium.org>2020-03-03 07:47:32 +0000
commit6020472e12860d58ec3cf2d6336e4eecc2017b63 (patch)
tree351a3fc55a5e78c838147d7143c42998adcc2dd4 /common/system.c
parent9d3f321689ddcdc0989842055292aeb4e8d6f811 (diff)
downloadchrome-ec-6020472e12860d58ec3cf2d6336e4eecc2017b63.tar.gz
vboot: Add a reboot option to keep EFS in RO with the AP off.
With EFS, the EC will typically switch to RW shortly after boot. cros_ec_softrec_power triggers recovery mode using the hostevent console command after rebooting the EC with ap-off and then simulates a power button press. This requires the EC to remain in RO after rebooting so doesn't currently work with EFS. Add a reboot option "ap-off-in-ro" to request the EC remain in RO with the AP off after rebooting. BUG=b:149657030 TEST=make buildall; firmware_RecoveryCacheBootKeys on puff BRANCH=none Change-Id: I65d291106accebf18bb46d951351def122627e61 Signed-off-by: Sam McNally <sammc@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2077699 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/system.c')
-rw-r--r--common/system.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/common/system.c b/common/system.c
index fa7eccabd5..72a3244fb0 100644
--- a/common/system.c
+++ b/common/system.c
@@ -213,6 +213,10 @@ void system_encode_save_flags(int reset_flags, uint32_t *save_flags)
if (reset_flags & SYSTEM_RESET_LEAVE_AP_OFF)
*save_flags |= EC_RESET_FLAG_AP_OFF;
+ /* Add in stay in RO flag into saved flags. */
+ if (reset_flags & SYSTEM_RESET_STAY_IN_RO)
+ *save_flags |= EC_RESET_FLAG_STAY_IN_RO;
+
/* Save reset flag */
if (reset_flags & (SYSTEM_RESET_HARD | SYSTEM_RESET_WAIT_EXT))
*save_flags |= EC_RESET_FLAG_HARD;
@@ -1213,6 +1217,9 @@ static int command_reboot(int argc, char **argv)
flags &= ~SYSTEM_RESET_HARD;
} else if (!strcasecmp(argv[i], "ap-off")) {
flags |= SYSTEM_RESET_LEAVE_AP_OFF;
+ } else if (!strcasecmp(argv[i], "ap-off-in-ro")) {
+ flags |= (SYSTEM_RESET_LEAVE_AP_OFF |
+ SYSTEM_RESET_STAY_IN_RO);
} else if (!strcasecmp(argv[i], "cancel")) {
reboot_at_shutdown = EC_REBOOT_CANCEL;
return EC_SUCCESS;
@@ -1235,9 +1242,10 @@ static int command_reboot(int argc, char **argv)
system_reset(flags);
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(reboot, command_reboot,
- "[hard|soft] [preserve] [ap-off] [wait-ext] [cancel]",
- "Reboot the EC");
+DECLARE_CONSOLE_COMMAND(
+ reboot, command_reboot,
+ "[hard|soft] [preserve] [ap-off] [wait-ext] [cancel] [ap-off-in-ro]",
+ "Reboot the EC");
#ifdef CONFIG_CMD_SYSLOCK
static int command_system_lock(int argc, char **argv)