mirror of
https://review.coreboot.org/flashrom.git
synced 2025-10-29 04:12:11 +01:00
linux_mtd: Provide no-op delay implementation
Flashrom has several magic programmer_delay() calls scattered throughout
its codebase (see cli_classic.s/main() and
flashrom.c/flashrom_image_write(), at least). These delays are
superfluous for the linux_mtd programmer, because it's an opaque
programmer in which all protocol details are handled by the kernel
driver.
Stub out the delay function, so we don't waste up to 1.1 seconds of
needless delay time, depending on the operation and CLI vs libflashrom
usage.
BUG=b:325539928
TEST=`elogtool add 0xa7` on a linux_mtd system (such as a Mediatek
Chromebook):
Time improvement - reduces from ~1.5s wall clock to about 0.4s
CPU usage: -90%, as most of the CPU cycles (before this change) are
spent in needless magic-delay busy loops
Change-Id: I3ac69d3fd7cfc689c5b32c130d044516ed846c29
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/80771
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
committed by
Anastasia Klimchuk
parent
537050351a
commit
0802655531
@@ -429,6 +429,14 @@ static enum flashrom_wp_result linux_mtd_wp_get_available_ranges(struct flashrom
|
||||
return FLASHROM_WP_ERR_RANGE_LIST_UNAVAILABLE;
|
||||
}
|
||||
|
||||
static void linux_mtd_nop_delay(const struct flashctx *flash, unsigned int usecs)
|
||||
{
|
||||
/*
|
||||
* Ignore delay requests. The Linux MTD framework brokers all flash
|
||||
* protocol, including timing, resets, etc.
|
||||
*/
|
||||
}
|
||||
|
||||
static const struct opaque_master linux_mtd_opaque_master = {
|
||||
/* max_data_{read,write} don't have any effect for this programmer */
|
||||
.max_data_read = MAX_DATA_UNSPECIFIED,
|
||||
@@ -441,6 +449,7 @@ static const struct opaque_master linux_mtd_opaque_master = {
|
||||
.wp_read_cfg = linux_mtd_wp_read_cfg,
|
||||
.wp_write_cfg = linux_mtd_wp_write_cfg,
|
||||
.wp_get_ranges = linux_mtd_wp_get_available_ranges,
|
||||
.delay = linux_mtd_nop_delay,
|
||||
};
|
||||
|
||||
/* Returns 0 if setup is successful, non-zero to indicate error */
|
||||
|
||||
Reference in New Issue
Block a user