diff options
author | Hung-Te Lin <hungte@chromium.org> | 2022-02-11 14:24:51 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-14 09:06:39 +0000 |
commit | 707b839fadfd600af4300bc451946f8e8ccf840e (patch) | |
tree | 73cf3834f6e31e9425c708667207ea2eed93162d /futility/updater.c | |
parent | a8f973b82171f933e5877c6cc65b0c2bc510510a (diff) | |
download | vboot-707b839fadfd600af4300bc451946f8e8ccf840e.tar.gz |
futility: updater: add new quirk 'extra_retries'
In early bring up, some devices may have problem when flashrom is
reading or writing to the system flash. To unblock dogfood process,
we want to have a special quirk to retry flashing.
BUG=b:213706510
TEST=make; build and run test
BRANCH=None
Change-Id: I58788f620fb32f7c886d1e5638f4a3605ea77953
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3452846
Reviewed-by: YH Lin <yueherngl@chromium.org>
Commit-Queue: YH Lin <yueherngl@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Diffstat (limited to 'futility/updater.c')
-rw-r--r-- | futility/updater.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/futility/updater.c b/futility/updater.c index 4c650b29..66f42e48 100644 --- a/futility/updater.c +++ b/futility/updater.c @@ -384,6 +384,14 @@ static int emulate_write_firmware(const char *filename, } /* + * Returns the number of retries when reading or writing to flash. + */ +static int get_io_retries(struct updater_config *cfg) +{ + return 1 + get_config_quirk(QUIRK_EXTRA_RETRIES, cfg); +} + +/* * Writes a section from given firmware image to system firmware. * If section_name is NULL, write whole image. * Returns 0 if success, non-zero if error. @@ -410,7 +418,7 @@ static int write_firmware(struct updater_config *cfg, return write_system_firmware(image, diff_image, section_name, &cfg->tempfiles, cfg->do_verify, - cfg->verbosity + 1); + get_io_retries(cfg), cfg->verbosity + 1); } /* @@ -1214,9 +1222,10 @@ enum updater_error_codes update_firmware(struct updater_config *cfg) } if (!image_from->data) { int ret; + INFO("Loading current system firmware...\n"); ret = load_system_firmware(image_from, &cfg->tempfiles, - cfg->verbosity); + get_io_retries(cfg), cfg->verbosity); if (ret == IMAGE_PARSE_FAILURE && cfg->force_update) { WARN("No compatible firmware in system.\n"); cfg->check_platform = 0; @@ -1399,7 +1408,9 @@ static int updater_apply_white_label(struct updater_config *cfg, if (!cfg->image_current.data) { INFO("Loading system firmware for white label...\n"); load_system_firmware(&cfg->image_current, - &cfg->tempfiles, cfg->verbosity); + &cfg->tempfiles, + get_io_retries(cfg), + cfg->verbosity); } tmp_image = get_firmware_image_temp_file( &cfg->image_current, &cfg->tempfiles); |