Attention is currently required from: Thomas Heijligen, Nikolai Artemiev, Sergii Dmytruk.

Nico Huber would like Thomas Heijligen, Nikolai Artemiev and Sergii Dmytruk to review this change.

View Change

dummyflasher: Add emulation for S25FL128L

Used to test WRSR_EXT2/3 support.

Signed-off-by: Nico Huber <nico.h@gmx.de>
Change-Id: Ic3cbea87218c973331b9b83e809e7d438407bc13
---
M dummyflasher.c
1 file changed, 56 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/48/64748/1
diff --git a/dummyflasher.c b/dummyflasher.c
index 22b46b1..c345d5d 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -35,6 +35,7 @@
EMULATE_SST_SST25VF032B,
EMULATE_MACRONIX_MX25L6436,
EMULATE_WINBOND_W25Q128FV,
+ EMULATE_SPANSION_S25FL128L,
EMULATE_VARIABLE_SIZE,
};

@@ -201,12 +202,36 @@
}
}

+ if (data->emu_chip == EMULATE_SPANSION_S25FL128L) {
+ const bool srp0 = (data->emu_status[0] >> 7);
+ const bool srp1 = (data->emu_status[1] & 1);
+
+ const bool wp_active = (srp1 || (srp0 && data->hwwp));
+
+ if (wp_active) {
+ ro_bits = 0xff;
+ } else if (reg == STATUS2) {
+ /* SUS (bit_7) */
+ ro_bits = 0x80;
+ /* Once any of the lock bits (LB[0..3]) are set, they
+ can't be unset. */
+ ro_bits |= data->emu_status[1] & (1 << 2);
+ ro_bits |= data->emu_status[1] & (1 << 3);
+ ro_bits |= data->emu_status[1] & (1 << 4);
+ ro_bits |= data->emu_status[1] & (1 << 5);
+ } else if (reg == STATUS3) {
+ /* Two reserved bits. */
+ ro_bits = 0x11;
+ }
+ }
+
return ro_bits;
}

static void update_write_protection(struct emu_data *data)
{
- if (data->emu_chip != EMULATE_WINBOND_W25Q128FV)
+ if (data->emu_chip != EMULATE_WINBOND_W25Q128FV &&
+ data->emu_chip != EMULATE_SPANSION_S25FL128L)
return;

const struct wp_bits bits = {
@@ -353,6 +378,12 @@
if (readcnt > 0)
memset(readarr, 0x17, readcnt);
break;
+ case EMULATE_SPANSION_S25FL128L:
+ if (readcnt > 0)
+ readarr[0] = 0x60;
+ if (readcnt > 1)
+ readarr[1] = 0x18;
+ break;
default: /* ignore */
break;
}
@@ -410,6 +441,14 @@
if (readcnt > 2)
readarr[2] = 0x18;
break;
+ case EMULATE_SPANSION_S25FL128L:
+ if (readcnt > 0)
+ readarr[0] = 0x01;
+ if (readcnt > 1)
+ readarr[1] = 0x60;
+ if (readcnt > 2)
+ readarr[2] = 0x18;
+ break;
case EMULATE_VARIABLE_SIZE:
if (readcnt > 0)
readarr[0] = (PROGMANUF_ID >> 8) & 0xff;
@@ -764,6 +803,7 @@
case EMULATE_SST_SST25VF032B:
case EMULATE_MACRONIX_MX25L6436:
case EMULATE_WINBOND_W25Q128FV:
+ case EMULATE_SPANSION_S25FL128L:
case EMULATE_VARIABLE_SIZE:
if (emulate_spi_chip_response(writecnt, readcnt, writearr,
readarr, emu_data)) {
@@ -1094,6 +1134,21 @@
data->emu_jedec_ce_c7_size = data->emu_chip_size;
msg_pdbg("Emulating Winbond W25Q128FV SPI flash chip (RDID)\n");
}
+ if (!strcmp(tmp, "S25FL128L")) {
+ data->emu_chip = EMULATE_SPANSION_S25FL128L;
+ data->emu_wrsr_ext2 = true;
+ data->emu_wrsr_ext3 = true;
+ data->emu_chip_size = 16 * 1024 * 1024;
+ data->emu_max_byteprogram_size = 256;
+ data->emu_max_aai_size = 0;
+ data->emu_status_len = 3;
+ data->emu_jedec_se_size = 4 * 1024;
+ data->emu_jedec_be_52_size = 32 * 1024;
+ data->emu_jedec_be_d8_size = 64 * 1024;
+ data->emu_jedec_ce_60_size = data->emu_chip_size;
+ data->emu_jedec_ce_c7_size = data->emu_chip_size;
+ msg_pdbg("Emulating Spansion S25FL128L SPI flash chip (RES, RDID, WP)\n");
+ }

/* The name of variable-size virtual chip. A 4 MiB flash example:
* flashrom -p dummy:emulate=VARIABLE_SIZE,size=4194304

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ic3cbea87218c973331b9b83e809e7d438407bc13
Gerrit-Change-Number: 64748
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Gerrit-Reviewer: Thomas Heijligen <src@posteo.de>
Gerrit-Attention: Thomas Heijligen <src@posteo.de>
Gerrit-Attention: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Gerrit-MessageType: newchange