dummyflasher.c: Move 'spi_write_256_chunksize' into emu_data
Move 'spi_write_256_chunksize' out of global scope and
into the emu_data reentrent struct.
Change-Id: I633f4df4bd47e661cd69801f21910b667899d505
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/54721
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72206
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/dummyflasher.c b/dummyflasher.c
index 8448d81..dfdadd1 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -68,6 +68,7 @@
uint32_t wp_start;
uint32_t wp_end;
+ unsigned int spi_write_256_chunksize;
uint8_t *flashchip_contents;
};
@@ -98,7 +99,6 @@
};
-static unsigned int spi_write_256_chunksize = 256;
static int dummy_spi_send_command(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr);
@@ -191,8 +191,8 @@
tmp = extract_programmer_param("spi_write_256_chunksize");
if (tmp) {
- spi_write_256_chunksize = strtoul(tmp, &endptr, 0);
- if (*endptr != '\0' || spi_write_256_chunksize < 1) {
+ data->spi_write_256_chunksize = strtoul(tmp, &endptr, 0);
+ if (*endptr != '\0' || data->spi_write_256_chunksize < 1) {
msg_perr("invalid spi_write_256_chunksize\n");
free(tmp);
return 1;
@@ -441,6 +441,7 @@
return 1;
}
data->emu_chip = EMULATE_NONE;
+ data->spi_write_256_chunksize = 256;
msg_pspew("%s\n", __func__);
@@ -1181,8 +1182,8 @@
static int dummy_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len)
{
- return spi_write_chunked(flash, buf, start, len,
- spi_write_256_chunksize);
+ const struct emu_data *const data = flash->mst->spi.data;
+ return spi_write_chunked(flash, buf, start, len, data->spi_write_256_chunksize);
}
const struct programmer_entry programmer_dummy = {