aboutsummaryrefslogtreecommitdiffstats
path: root/include/flash.h
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2021-01-15 09:48:12 +0000
committerEdward O'Callaghan <quasisec@chromium.org>2022-05-25 08:08:13 +0000
commit40892b0c08fbc8029921e91511dd3f91fc956f90 (patch)
tree56b6fccd5c99c00649369fcf097c4555313b753c /include/flash.h
parentb86ae179adfb4acb4190ef2abe2ee8905c44f26a (diff)
downloadflashrom-40892b0c08fbc8029921e91511dd3f91fc956f90.tar.gz
flashrom-40892b0c08fbc8029921e91511dd3f91fc956f90.tar.bz2
flashrom-40892b0c08fbc8029921e91511dd3f91fc956f90.zip
libflashrom: Return progress state to the library user
Projects using libflashrom like fwupd expect the user to wait for the operation to complete. To avoid the user thinking the process has "hung" or "got stuck" report back the progress complete of the erase, write and read operations. Add a new --progress flag to the CLI to report progress of operations. Include a test for the dummy spi25 device. TEST=./test_build.sh; ./flashrom -p lspcon_i2c_spi:bus=7 -r /dev/null --progress Change-Id: I7197572bb7f19e3bdb2bde855d70a0f50fd3854c Signed-off-by: Richard Hughes <richard@hughsie.com> Signed-off-by: Daniel Campello <campello@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/49643 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
Diffstat (limited to 'include/flash.h')
-rw-r--r--include/flash.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/flash.h b/include/flash.h
index 27ade09b..45533ba9 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -350,6 +350,9 @@ struct flashrom_flashctx {
chip_restore_fn_cb_t func;
uint8_t status;
} chip_restore_fn[MAX_CHIP_RESTORE_FUNCTIONS];
+ /* Progress reporting */
+ flashrom_progress_callback *progress_callback;
+ struct flashrom_progress *progress_state;
};
/* Timing used in probe routines. ZERO is -2 to differentiate between an unset
@@ -446,6 +449,7 @@ int open_logfile(const char * const filename);
int close_logfile(void);
void start_logging(void);
int flashrom_print_cb(enum flashrom_log_level level, const char *fmt, va_list ap);
+void flashrom_progress_cb(struct flashrom_flashctx *flashctx);
/* Let gcc and clang check for correct printf-style format strings. */
int print(enum flashrom_log_level level, const char *fmt, ...)
#ifdef __MINGW32__
@@ -474,6 +478,7 @@ __attribute__((format(printf, 2, 3)));
#define msg_gspew(...) print(FLASHROM_MSG_SPEW, __VA_ARGS__) /* general debug spew */
#define msg_pspew(...) print(FLASHROM_MSG_SPEW, __VA_ARGS__) /* programmer debug spew */
#define msg_cspew(...) print(FLASHROM_MSG_SPEW, __VA_ARGS__) /* chip debug spew */
+void update_progress(struct flashctx *flash, enum flashrom_progress_stage stage, size_t current, size_t total);
/* spi.c */
struct spi_command {