summaryrefslogtreecommitdiffstats
path: root/flashrom.c
diff options
context:
space:
mode:
authorNikolai Artemiev <nartemiev@google.com>2023-05-03 11:05:07 +1000
committerAnastasia Klimchuk <aklm@chromium.org>2023-05-09 07:43:23 +0000
commit00c9fac2a66ab2aafc6949166dfc733fd0b747ea (patch)
tree0093e9304ae7d4c657fed35cc47ca7a8ba313921 /flashrom.c
parentfc6a09ba1fe76472a5b5959008cd699eeccd25d5 (diff)
downloadflashrom-00c9fac2a66ab2aafc6949166dfc733fd0b747ea.tar.gz
flashrom-00c9fac2a66ab2aafc6949166dfc733fd0b747ea.tar.bz2
flashrom-00c9fac2a66ab2aafc6949166dfc733fd0b747ea.zip
flashrom: Use WP-based unlocking on opaque masters
Flashrom only tries to use WP-based unlocking if it detects that WP operations are supported. However WP support was detected in a way that ignored WP operations provided by opaque masters. This stopped flashrom from automatically unlocking with some opaque masters, particularly linux_mtd. This commit also deletes part of a test that required the chip unlock function to be called before read/write/erase operations because WP unlocking is now used instead of chip unlocking. BUG=b:280111380 BRANCH=none TEST=Checked flashrom automatically unlocked flash on strongbad (MTD) Change-Id: I1774ad64d82ae47cd085df6045e17e283855c01f Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74930 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/flashrom.c b/flashrom.c
index 07ed0dfca..faffe517e 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -2093,7 +2093,8 @@ int prepare_flash_access(struct flashctx *const flash,
/* Given the existence of read locks, we want to unlock for read, erase and write. */
int ret = 1;
- if (flash->chip->decode_range != NO_DECODE_RANGE_FUNC) {
+ if (flash->chip->decode_range != NO_DECODE_RANGE_FUNC ||
+ (flash->mst->buses_supported & BUS_PROG && flash->mst->opaque.wp_write_cfg)) {
ret = unlock_flash_wp(flash);
if (ret)
msg_cerr("Failed to unlock flash status reg with wp support.\n");