Anastasia Klimchuk submitted this change.

View Change

Approvals: Peter Marheine: Looks good to me, approved build bot (Jenkins): Verified Matt DeVillier: Looks good to me, but someone else must approve Stefan Reinauer: Looks good to me, approved
ichspi: Check whether chipset is locked when probing opcode

This is follow up (or fix) for
commit 26a1eb514ccefc61b110068cf0eea73c397ba045

When probing opcode, all opcodes in POSSIBLE_OPCODES are reported as
supported, even if the opcode is not in curopcodes. This is relying
on reprogramming on-the-fly to handle the gap between POSSIBLE_OPCODES
and curopcodes. However, for locked chipsets on-the-fly is not
happening (is not possible, since list of opcodes is locked), so we
can't rely on it.
So, we need to check whether chipset is locked.

Ticket: https://ticket.coreboot.org/issues/573

Change-Id: I701a86f030cfef43a1158bf075287ade569254e6
Signed-off-by: Anastasia Klimchuk <aklm@flashrom.org>
Tested-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/85612
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
---
M ichspi.c
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ichspi.c b/ichspi.c
index fc994db..94227de 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1823,8 +1823,12 @@
static bool ich_spi_probe_opcode(const struct flashctx *flash, uint8_t opcode)
{
int ret = find_opcode(curopcodes, opcode);
- if ((ret == -1) && (lookup_spi_type(opcode) <= 3))
- /* opcode is in POSSIBLE_OPCODES, report supported. */
+ if ((ret == -1) && (lookup_spi_type(opcode) <= 3) && (!ichspi_lock))
+ /* opcode is in POSSIBLE_OPCODES, report supported.
+ * Relying on reprogramming on-the-fly
+ * when opcode is not in curopcodes, but is in POSSIBLE_OPCODES.
+ *
+ * on-the-fly does not work for locked chipsets, therefore checking ichspi_lock. */
return true;
return ret >= 0;
}

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

Gerrit-MessageType: merged
Gerrit-Project: flashrom
Gerrit-Branch: 1.5.x
Gerrit-Change-Id: I701a86f030cfef43a1158bf075287ade569254e6
Gerrit-Change-Number: 85612
Gerrit-PatchSet: 2
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Bill XIE <persmule@hardenedlinux.org>
Gerrit-Reviewer: Matt DeVillier <matt.devillier@gmail.com>
Gerrit-Reviewer: Peter Marheine <pmarheine@chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer@coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>