mirror of
https://review.coreboot.org/flashrom.git
synced 2025-10-20 09:10:52 +02:00

prepare_flash_access provides check the required conditions for erase operation to be performed. If the check fails, operation aborts, i.e. erase does not start. However for the user this information is not clearly messaged, and even more, user still has emergency_help_message. The patch adds message for the user when prepare_flash_access failed and operation itself hasn't started. The message can be repro with dummyflasher for erase ./flashrom -p dummy:hwwp=yes,emulate=S25FL128L --wp-enable \ --wp-range 0x00040000,0x00fc0000 \ -l <(echo '00000000:0004ffff part1') -i part1 -E for write ./flashrom -p dummy:hwwp=yes,emulate=S25FL128L --wp-enable \ --wp-range 0x00040000,0x00fc0000 \ -l <(echo '00000000:0004ffff part1') -i part1 -w <some file> BEFORE for erase, output ends with: can_change_target_regions: cannot fully update part1 region (00000000..0x04ffff) due to chip's write-protection. At least one target region is not fully writable. Aborting. Your flash chip is in an unknown state. Please report this to the mailing list at flashrom@flashrom.org or on chat (see https://flashrom.org/contact.html for details), thanks! So it says "Aborting" but then "Your flash chip is in an unknown state" and likely the user will focus on the second part, the scary message for write, the operation is actually Aborting (no unknown state message) AFTER for erase, output ends with: can_change_target_regions: cannot fully update part1 region (00000000..0x04ffff) due to chip's write-protection. At least one target region is not fully writable. Aborting. Error: some of the required checks to prepare flash access failed. Earlier messages should give more details. Erase operation has not started. for write I added the same info for consistency: can_change_target_regions: cannot fully update part1 region (00000000..0x04ffff) due to chip's write-protection. At least one target region is not fully writable. Aborting. Error: some of the required checks to prepare flash access failed. Earlier messages should give more details. Write operation has not started. Change-Id: Id251c2b7f12df3378feb84b5761581dd272240be Tested-by: Michał Iwanicki <michal.iwanicki@3mdeb.com> Signed-off-by: Anastasia Klimchuk <aklm@flashrom.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/89413 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michał Iwanicki <michal.iwanicki@3mdeb.com> Reviewed-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>