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

erasure_layout: Remove redundant verifications from erase_write

Previously, in the worst-case scenario of erasing region content then
writing new data, three rounds of verification were performed inside of
the `erase_write` function through calls to:

  1. `check_erased_range` when erasing with respect to region boundaries
  2. `check_erased_range` for the entire erase block after the loop
     containing verification 1 completed
  3. `verify_range` when all erases/writes were complete

Verification 2 duplicated verification 1 and was orphaned by commit
fa8808595a, which dropped its paired erasefn call but missed this
related step.

Verification 3 duplicated verification which occurs in
`flashrom_image_write` based on `flashctx flags`.

Now, these 2 redundant verifications are removed to improve the
performance of `erase_write`.

This change was tested using the linux_spi programmer to erase and write
to an MT25QL512 chip.

Change-Id: I638835facd9311979c4991cc4ca41a4b9e174bd5
Signed-off-by: Carly Zlabek <carlyzlabek@gmail.com>
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/79354
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
Carly Zlabek 2023-11-21 15:30:20 -06:00 committed by Anastasia Klimchuk
parent e188cc383e
commit 8ac3574fc6

View File

@ -350,13 +350,6 @@ int erase_write(struct flashctx *const flashctx, chipoff_t region_start, chipoff
// after erase make it unselected again
erase_layout[i].layout_list[j].selected = false;
msg_cdbg("E(%"PRIx32":%"PRIx32")", start_addr, start_addr + block_len - 1);
// verify erase
ret = check_erased_range(flashctx, start_addr, block_len);
if (ret) {
msg_cerr("Verifying flash. Erase failed for range %#"PRIx32" : %#"PRIx32", Abort.\n",
start_addr, start_addr + block_len - 1);
goto _end;
}
*all_skipped = false;
}
@ -385,13 +378,6 @@ int erase_write(struct flashctx *const flashctx, chipoff_t region_start, chipoff
*all_skipped = false;
}
// verify write
ret = verify_range(flashctx, newcontents + region_start, region_start, region_end - region_start);
if (ret) {
msg_cerr("Verifying flash. Write failed for range %#"PRIx32" : %#"PRIx32", Abort.\n",
region_start, region_end);
goto _end;
}
_end:
memcpy(newcontents + region_start, old_start_buf, old_start - region_start);