diff options
author | Nicolas Boichat <drinkcat@google.com> | 2017-05-22 14:44:38 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-05-23 05:57:13 -0700 |
commit | eba6e56ed0e22177f19ae6f0fb3114e5c3faf196 (patch) | |
tree | f602a8418bbb8da4b2368fbd59c774dbd5e83404 /common/rollback.c | |
parent | c6cfdbf669e932d60b9e743bcbbf1723352dd1c1 (diff) | |
download | chrome-ec-eba6e56ed0e22177f19ae6f0fb3114e5c3faf196.tar.gz |
rollback: Add CONFIG_ROLLBACK_UPDATE config option
Typically, we do not need RW section to be able to update rollback
information (rollback block should be protected when RW is running),
so we can save some flash space by undefining this option.
BRANCH=none
BUG=b:35586219
TEST=make newsizes saves ~420 bytes on hammer and staff.
Change-Id: Ic457673e56ace083f2ebb1ca0f37f54bf125bfa4
Reviewed-on: https://chromium-review.googlesource.com/511983
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/rollback.c')
-rw-r--r-- | common/rollback.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/common/rollback.c b/common/rollback.c index fedc899135..31775402d6 100644 --- a/common/rollback.c +++ b/common/rollback.c @@ -119,6 +119,7 @@ int rollback_lock(void) return ret; } +#ifdef CONFIG_ROLLBACK_UPDATE int rollback_update(int32_t next_min_version) { struct rollback_data data; @@ -163,6 +164,26 @@ int rollback_update(int32_t next_min_version) return EC_SUCCESS; } +static int command_rollback_update(int argc, char **argv) +{ + int32_t min_version; + char *e; + + if (argc < 2) + return EC_ERROR_PARAM_COUNT; + + min_version = strtoi(argv[1], &e, 0); + + if (*e || min_version < 0) + return EC_ERROR_PARAM1; + + return rollback_update(min_version); +} +DECLARE_CONSOLE_COMMAND(rollbackupdate, command_rollback_update, + "min_version", + "Update rollback info"); +#endif /* CONFIG_ROLLBACK_UPDATE */ + static int command_rollback_info(int argc, char **argv) { int region, ret, min_region; @@ -196,22 +217,3 @@ static int command_rollback_info(int argc, char **argv) DECLARE_SAFE_CONSOLE_COMMAND(rollbackinfo, command_rollback_info, NULL, "Print rollback info"); - -static int command_rollback_update(int argc, char **argv) -{ - int32_t min_version; - char *e; - - if (argc < 2) - return EC_ERROR_PARAM_COUNT; - - min_version = strtoi(argv[1], &e, 0); - - if (*e || min_version < 0) - return EC_ERROR_PARAM1; - - return rollback_update(min_version); -} -DECLARE_CONSOLE_COMMAND(rollbackupdate, command_rollback_update, - "min_version", - "Update rollback info"); |