From 6020472e12860d58ec3cf2d6336e4eecc2017b63 Mon Sep 17 00:00:00 2001 From: Sam McNally Date: Thu, 27 Feb 2020 21:29:25 +1100 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2077699 Reviewed-by: Daisuke Nojiri --- common/system.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'common/system.c') 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) -- cgit v1.2.1