diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2017-08-15 16:34:52 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-21 01:07:55 -0700 |
commit | 220c75bd1626c656234d6121af8068c42ff182f8 (patch) | |
tree | 707e65a9874e832e247c4c689e170d5a1b477f0a | |
parent | 729a4ba2bdc20675e24ed9e7d0a98d19934d72f8 (diff) | |
download | chrome-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>
-rw-r--r-- | common/system.c | 12 | ||||
-rw-r--r-- | include/ec_commands.h | 1 |
2 files changed, 12 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; diff --git a/include/ec_commands.h b/include/ec_commands.h index 2e806d4913..45a1db310f 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -3826,6 +3826,7 @@ enum ec_reboot_cmd { /* Flags for ec_params_reboot_ec.reboot_flags */ #define EC_REBOOT_FLAG_RESERVED0 (1 << 0) /* Was recovery request */ #define EC_REBOOT_FLAG_ON_AP_SHUTDOWN (1 << 1) /* Reboot after AP shutdown */ +#define EC_REBOOT_FLAG_SWITCH_RW_SLOT (1 << 2) /* Switch RW slot */ struct __ec_align1 ec_params_reboot_ec { uint8_t cmd; /* enum ec_reboot_cmd */ |