Alexander Goncharov submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Anastasia Klimchuk: Looks good to me, approved Nikolai Artemiev: Looks good to me, approved
spi25_statusreg: rename amic_a25l032 print to a generic name

Other chips (at least Winbond) will benefit from this change.

Also, drop the FIXME comment, as it can be misleading. The
"pretty print" functions should only display values from the
Status Register, so using an inappropriate function might only
confuse user.

Signed-off-by: Alexander Goncharov <chat@joursoir.net>
Change-Id: I7169a2312698343e1065cdca91a3985e00cb3804
Reviewed-on: https://review.coreboot.org/c/flashrom/+/78874
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
---
M flashchips.c
M include/flash.h
M spi25_statusreg.c
3 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/flashchips.c b/flashchips.c
index d80a574..17807c4 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -745,7 +745,7 @@
.block_erase = SPI_BLOCK_ERASE_C7,
}
},
- .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_AMIC_A25L032, /* bit5: T/B, bit6: prot size */
+ .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_SRWD_SEC_TB_BP2_WELWIP,
.unlock = SPI_DISABLE_BLOCKPROTECT_BP2_SRWD, /* TODO: 2nd status reg (read with 0x35) */
.write = SPI_CHIP_WRITE256,
.read = SPI_CHIP_READ,
@@ -1275,7 +1275,7 @@
.block_erase = SPI_BLOCK_ERASE_C7,
}
},
- .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_AMIC_A25L032, /* bit5: T/B, bit6: prot size */
+ .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_SRWD_SEC_TB_BP2_WELWIP,
.unlock = SPI_DISABLE_BLOCKPROTECT_BP2_SRWD, /* TODO: 2nd status reg (read with 0x35) */
.write = SPI_CHIP_WRITE256,
.read = SPI_CHIP_READ,
@@ -1315,7 +1315,7 @@
.block_erase = SPI_BLOCK_ERASE_C7,
}
},
- .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_AMIC_A25L032, /* bit5: T/B, bit6: prot size */
+ .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_SRWD_SEC_TB_BP2_WELWIP,
.unlock = SPI_DISABLE_BLOCKPROTECT_BP2_SRWD, /* TODO: 2nd status reg (read with 0x35) */
.write = SPI_CHIP_WRITE256,
.read = SPI_CHIP_READ,
diff --git a/include/flash.h b/include/flash.h
index 4c08549..284461e 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -369,7 +369,6 @@
PRINTLOCK_W39V080A,
PRINTLOCK_W39V080FA,
PRINTLOCK_W39V080FA_DUAL,
- SPI_PRETTYPRINT_STATUS_REGISTER_AMIC_A25L032,
SPI_PRETTYPRINT_STATUS_REGISTER_AT25DF,
SPI_PRETTYPRINT_STATUS_REGISTER_AT25DF_SEC,
SPI_PRETTYPRINT_STATUS_REGISTER_AT25F,
@@ -385,6 +384,7 @@
SPI_PRETTYPRINT_STATUS_REGISTER_BP2_EP_SRWD,
SPI_PRETTYPRINT_STATUS_REGISTER_BP2_SRWD,
SPI_PRETTYPRINT_STATUS_REGISTER_BP2_TB_BPL,
+ SPI_PRETTYPRINT_STATUS_REGISTER_SRWD_SEC_TB_BP2_WELWIP,
SPI_PRETTYPRINT_STATUS_REGISTER_BP3_SRWD,
SPI_PRETTYPRINT_STATUS_REGISTER_BP4_SRWD,
SPI_PRETTYPRINT_STATUS_REGISTER_DEFAULT_WELWIP,
diff --git a/spi25_statusreg.c b/spi25_statusreg.c
index bb56ee1..98988af 100644
--- a/spi25_statusreg.c
+++ b/spi25_statusreg.c
@@ -601,16 +601,7 @@
return 0;
}

-/* === Amic ===
- * FIXME: spi_disable_blockprotect is incorrect but works fine for chips using
- * spi_prettyprint_status_register_bp1_srwd or
- * spi_prettyprint_status_register_bp2_srwd.
- * FIXME: spi_disable_blockprotect is incorrect and will fail for chips using
- * spi_prettyprint_status_register_amic_a25l032 if those have locks controlled
- * by the second status register.
- */
-
-static int spi_prettyprint_status_register_amic_a25l032(struct flashctx *flash)
+static int spi_prettyprint_status_register_srwd_sec_tb_bp2_welwip(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -1056,7 +1047,6 @@
case PRINTLOCK_W39V080A: return &printlock_w39v080a;
case PRINTLOCK_W39V080FA: return &printlock_w39v080fa;
case PRINTLOCK_W39V080FA_DUAL: return &printlock_w39v080fa_dual;
- case SPI_PRETTYPRINT_STATUS_REGISTER_AMIC_A25L032: return &spi_prettyprint_status_register_amic_a25l032;
case SPI_PRETTYPRINT_STATUS_REGISTER_AT25DF: return &spi_prettyprint_status_register_at25df;
case SPI_PRETTYPRINT_STATUS_REGISTER_AT25DF_SEC: return &spi_prettyprint_status_register_at25df_sec;
case SPI_PRETTYPRINT_STATUS_REGISTER_AT25F: return &spi_prettyprint_status_register_at25f;
@@ -1072,6 +1062,7 @@
case SPI_PRETTYPRINT_STATUS_REGISTER_BP2_EP_SRWD: return &spi_prettyprint_status_register_bp2_ep_srwd;
case SPI_PRETTYPRINT_STATUS_REGISTER_BP2_SRWD: return &spi_prettyprint_status_register_bp2_srwd;
case SPI_PRETTYPRINT_STATUS_REGISTER_BP2_TB_BPL: return &spi_prettyprint_status_register_bp2_tb_bpl;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_SRWD_SEC_TB_BP2_WELWIP: return &spi_prettyprint_status_register_srwd_sec_tb_bp2_welwip;
case SPI_PRETTYPRINT_STATUS_REGISTER_BP3_SRWD: return &spi_prettyprint_status_register_bp3_srwd;
case SPI_PRETTYPRINT_STATUS_REGISTER_BP4_SRWD: return &spi_prettyprint_status_register_bp4_srwd;
case SPI_PRETTYPRINT_STATUS_REGISTER_DEFAULT_WELWIP: return &spi_prettyprint_status_register_default_welwip;

To view, visit change 78874. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: I7169a2312698343e1065cdca91a3985e00cb3804
Gerrit-Change-Number: 78874
Gerrit-PatchSet: 2
Gerrit-Owner: Alexander Goncharov <chat@joursoir.net>
Gerrit-Reviewer: Alexander Goncharov <chat@joursoir.net>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer@coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged