writeprotect: Add some debug logging if wp_verify fails
Change-Id: I5fcaf767570418f90ae44826a1135d9b49653033
Signed-off-by: Evan Benn <evanbenn@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/67720
Original-Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Original-Reviewed-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71002
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/writeprotect.c b/writeprotect.c
index c25ddc9..11219e2 100644
--- a/writeprotect.c
+++ b/writeprotect.c
@@ -136,6 +136,7 @@
return FLASHROM_WP_ERR_WRITE_FAILED;
}
+ enum flashrom_wp_result ret = FLASHROM_WP_OK;
/* Verify each register */
for (reg = STATUS1; reg < MAX_REGISTERS; reg++) {
if (!write_masks[reg])
@@ -145,14 +146,18 @@
if (spi_read_register(flash, reg, &value))
return FLASHROM_WP_ERR_READ_FAILED;
+ msg_cdbg2("%s: wp_verify reg:%u value:0x%x\n", __func__, reg, value);
uint8_t actual = value & write_masks[reg];
uint8_t expected = reg_values[reg] & write_masks[reg];
- if (actual != expected)
- return FLASHROM_WP_ERR_VERIFY_FAILED;
+ if (actual != expected) {
+ msg_cdbg("%s: wp_verify failed: reg:%u actual:0x%x expected:0x%x\n",
+ __func__, reg, actual, expected);
+ ret = FLASHROM_WP_ERR_VERIFY_FAILED;
+ }
}
- return FLASHROM_WP_OK;
+ return ret;
}
/** Get the range selected by a WP configuration. */