1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

cli_classic: Defer flashrom_init calibration until after options parsing

flashrom_init() may run through an expensive delay calibration phase,
depending on the system timer behavior (e.g., if high resolution timers
are disabled). This is wholly unnecessary if we're only going to dump
usage output or similar.

Defer the calibration until we've finished our CLI overhead.

BUG=b:325539928
TEST=`flashrom --help` with `sysctl kernel.timer_highres` == 0

Change-Id: I57949ab511df04c6922008fa8cb12467154e2c5e
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/80772
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hsuan-ting Chen <roccochen@google.com>
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
Brian Norris 2024-02-27 13:06:52 -08:00 committed by Anastasia Klimchuk
parent 0802655531
commit 3c5eb532ad

View File

@ -917,10 +917,6 @@ int main(int argc, char *argv[])
print_version();
print_banner();
/* FIXME: Delay calibration should happen in programmer code. */
if (flashrom_init(1))
exit(1);
setbuf(stdout, NULL);
parse_options(argc, argv, optstring, long_options, &options);
@ -1005,6 +1001,10 @@ int main(int argc, char *argv[])
}
}
/* FIXME: Delay calibration should happen in programmer code. */
if (flashrom_init(1))
exit(1);
if (programmer_init(options.prog, options.pparam)) {
msg_perr("Error: Programmer initialization failed.\n");
ret = 1;