summaryrefslogtreecommitdiff
path: root/common/system.c
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2017-08-15 16:34:52 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-09-21 01:07:55 -0700
commit220c75bd1626c656234d6121af8068c42ff182f8 (patch)
tree707e65a9874e832e247c4c689e170d5a1b477f0a /common/system.c
parent729a4ba2bdc20675e24ed9e7d0a98d19934d72f8 (diff)
downloadchrome-ec-220c75bd1626c656234d6121af8068c42ff182f8.tar.gz
EFS: Allow EC to switch slot on reboot
Chromebox ECs performs EFS: verifying firmware before the AP boots. This patch updates host commands which are required for the EFS. When EC_REBOOT_FLAG_SWITCH_RW_SLOT is specified, EC_CMD_REBOOT_EC changes the active slot before it reboots the system. BUG=b:65264494 BRANCH=none TEST=On Fizz, verify: 1. RW_B is old and updated by soft sync. RW_B is activated and executed after reboot. System continues to boot to OS. 2. RW_A is old and updated by soft sync. RW_A is activated and executed after reboot. System continues to boot to OS. Change-Id: I08050c985ce0b27b30cb842e6b5b4660f32e5211 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/648450 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/system.c')
-rw-r--r--common/system.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/common/system.c b/common/system.c
index f94c02803e..2af4d2022a 100644
--- a/common/system.c
+++ b/common/system.c
@@ -1384,7 +1384,17 @@ int host_command_reboot(struct host_cmd_handler_args *args)
/* Cancel pending reboot */
reboot_at_shutdown = EC_REBOOT_CANCEL;
return EC_RES_SUCCESS;
- } else if (p.flags & EC_REBOOT_FLAG_ON_AP_SHUTDOWN) {
+ }
+
+ if (p.flags & EC_REBOOT_FLAG_SWITCH_RW_SLOT) {
+#ifdef CONFIG_VBOOT_EFS
+ if (system_set_active_copy(system_get_update_copy()))
+ CPRINTS("Failed to set active slot");
+#else
+ return EC_RES_INVALID_PARAM;
+#endif
+ }
+ if (p.flags & EC_REBOOT_FLAG_ON_AP_SHUTDOWN) {
/* Store request for processing at chipset shutdown */
reboot_at_shutdown = p.cmd;
return EC_RES_SUCCESS;