diff options
author | Edward O'Callaghan <quasisec@google.com> | 2023-05-15 13:51:57 +1000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-16 04:24:02 +0000 |
commit | 1ee88b4cb3781af8795bb64b94ac90289f0c70e4 (patch) | |
tree | c101229134a60de4c988ba3de87623be381dbbbb /futility/updater.c | |
parent | 37634642631daeb219b8c798239e19da42614c8a (diff) | |
download | vboot-1ee88b4cb3781af8795bb64b94ac90289f0c70e4.tar.gz |
futility/: Inline write_firmware() as write_system_firmware()
Avoid confusing indirections.
BUG=b:282585789
BRANCH=none
TEST=`cros_run_unit_tests --host --packages vboot_reference`.
Change-Id: I5fdc01affcce2399955b594abf98c7550815b56b
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4532319
Tested-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'futility/updater.c')
-rw-r--r-- | futility/updater.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/futility/updater.c b/futility/updater.c index da46704b..1a823924 100644 --- a/futility/updater.c +++ b/futility/updater.c @@ -292,16 +292,6 @@ static int set_try_cookies(struct updater_config *cfg, const char *target, return 0; } -int write_firmware(struct updater_config *cfg, - const struct firmware_image *image, const char *section_name) -{ - const char *sections[2] = {0}; - - sections[0] = section_name; - return write_system_firmware(cfg, image, - section_name ? sections : NULL); -} - /* * Returns True if we should start the update process for given image. */ @@ -348,7 +338,9 @@ static int write_ec_firmware(struct updater_config *cfg, return 0; } - return write_firmware(cfg, image, section_name); + /* TODO(quasisec): Uses cros_ec to program the EC. */ + const char *sections[2] = { section_name, NULL }; + return write_system_firmware(cfg, image, sections); } /* @@ -925,7 +917,8 @@ static enum updater_error_codes update_try_rw_firmware( STATUS("TRY-RW UPDATE: Updating %s to try on reboot.\n", target); - if (write_firmware(cfg, image_to, target)) + const char *sections[2] = { target, NULL }; + if (write_system_firmware(cfg, image_to, sections)) return UPDATE_ERR_WRITE_FIRMWARE; /* @@ -955,7 +948,8 @@ static enum updater_error_codes update_try_rw_firmware( if (legacy_needs_update(cfg)) { has_update = 1; STATUS("LEGACY UPDATE: Updating %s.\n", FMAP_RW_LEGACY); - write_firmware(cfg, image_to, FMAP_RW_LEGACY); + const char *sections[2] = { FMAP_RW_LEGACY, NULL }; + write_system_firmware(cfg, image_to, sections); } return UPDATE_ERR_DONE; @@ -1032,7 +1026,8 @@ static enum updater_error_codes update_legacy_firmware( { STATUS("LEGACY UPDATE: Updating firmware %s.\n", FMAP_RW_LEGACY); - if (write_firmware(cfg, image_to, FMAP_RW_LEGACY)) + const char *sections[2] = { FMAP_RW_LEGACY, NULL }; + if (write_system_firmware(cfg, image_to, sections)) return UPDATE_ERR_WRITE_FIRMWARE; return UPDATE_ERR_DONE; @@ -1090,7 +1085,7 @@ static enum updater_error_codes update_whole_firmware( return UPDATE_ERR_TPM_ROLLBACK; /* FMAP may be different so we should just update all. */ - if (write_firmware(cfg, image_to, NULL) || update_ec_firmware(cfg)) + if (write_system_firmware(cfg, image_to, NULL) || update_ec_firmware(cfg)) return UPDATE_ERR_WRITE_FIRMWARE; return UPDATE_ERR_DONE; |