Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/55265 )
Change subject: dummyflasher.c: Drop useless macros ......................................................................
dummyflasher.c: Drop useless macros
The `EMULATE_CHIP` and `EMULATE_SPI_CHIP` macros are unconditionally defined as `1`, with no way to change their values. Since this means that the code never gets build-tested using other values, drop these noisy macros.
TEST=Build with `make distclean && make VERSION=none -j` with and without this patch, the flashrom executable does not change.
Change-Id: If46e1c37c3b04b28b4ba1f82c9b3def1e549368f Signed-off-by: Angel Pons th3fanbus@gmail.com --- M dummyflasher.c 1 file changed, 0 insertions(+), 34 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/65/55265/1
diff --git a/dummyflasher.c b/dummyflasher.c index dcf97b5..123abaa 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -22,21 +22,11 @@ #include "chipdrivers.h" #include "programmer.h" #include "flashchips.h" - -/* Remove the #define below if you don't want SPI flash chip emulation. */ -#define EMULATE_SPI_CHIP 1 - -#if EMULATE_SPI_CHIP -#define EMULATE_CHIP 1 #include "spi.h" -#endif
-#if EMULATE_CHIP #include <sys/types.h> #include <sys/stat.h> -#endif
-#if EMULATE_CHIP enum emu_chip { EMULATE_NONE, EMULATE_ST_M25P10_RES, @@ -73,7 +63,6 @@ uint8_t *flashchip_contents; };
-#if EMULATE_SPI_CHIP /* A legit complete SFDP table based on the MX25L6436E (rev. 1.8) datasheet. */ static const uint8_t sfdp_table[] = { 0x53, 0x46, 0x44, 0x50, // @0x00: SFDP signature @@ -100,9 +89,6 @@ 0xFF, 0xFF, 0xFF, 0xFF, // @0x54: Macronix parameter table end };
-#endif -#endif - void *dummy_map(const char *descr, uintptr_t phys_addr, size_t len) { msg_pspew("%s: Mapping %s, 0x%zx bytes at 0x%0*" PRIxPTR "\n", @@ -173,7 +159,6 @@ return; }
-#if EMULATE_SPI_CHIP static int emulate_spi_chip_response(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, @@ -550,7 +535,6 @@ data->emu_status &= ~SPI_SR_WEL; return 0; } -#endif
static int dummy_spi_send_command(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt, @@ -572,7 +556,6 @@
/* Response for unknown commands and missing chip is 0xff. */ memset(readarr, 0xff, readcnt); -#if EMULATE_SPI_CHIP switch (emu_data->emu_chip) { case EMULATE_ST_M25P10_RES: case EMULATE_SST_SST25VF040_REMS: @@ -589,7 +572,6 @@ default: break; } -#endif msg_pspew(" reading %u bytes:", readcnt); for (i = 0; i < readcnt; i++) msg_pspew(" 0x%02x", readarr[i]); @@ -626,7 +608,6 @@ static int dummy_shutdown(void *data) { msg_pspew("%s\n", __func__); -#if EMULATE_CHIP struct emu_data *emu_data = (struct emu_data *)data; if (emu_data->emu_chip != EMULATE_NONE) { if (emu_data->emu_persistent_image && emu_data->emu_modified) { @@ -638,7 +619,6 @@ free(emu_data->emu_persistent_image); free(emu_data->flashchip_contents); } -#endif free(data); return 0; } @@ -648,13 +628,9 @@ char *bustext = NULL; char *tmp = NULL; unsigned int i; -#if EMULATE_SPI_CHIP char *status = NULL; int size = -1; /* size for VARIABLE_SIZE chip device */ -#endif -#if EMULATE_CHIP struct stat image_stat; -#endif char *endptr;
struct emu_data *data = calloc(1, sizeof(struct emu_data)); @@ -825,8 +801,6 @@ } free(tmp);
-#if EMULATE_CHIP -#if EMULATE_SPI_CHIP tmp = extract_programmer_param("size"); if (tmp) { size = strtol(tmp, NULL, 10); @@ -838,7 +812,6 @@ } free(tmp); } -#endif
tmp = extract_programmer_param("emulate"); if (!tmp) { @@ -846,7 +819,6 @@ /* Nothing else to do. */ goto dummy_init_out; } -#if EMULATE_SPI_CHIP if (!strcmp(tmp, "M25P10.RES")) { data->emu_chip = EMULATE_ST_M25P10_RES; data->emu_chip_size = 128 * 1024; @@ -933,7 +905,6 @@ msg_pdbg("Emulating generic SPI flash chip (size=%d bytes)\n", data->emu_chip_size); } -#endif if (data->emu_chip == EMULATE_NONE) { msg_perr("Invalid chip specified for emulation: %s\n", tmp); free(tmp); @@ -957,7 +928,6 @@ } free(tmp);
-#ifdef EMULATE_SPI_CHIP status = extract_programmer_param("spi_status"); if (status) { errno = 0; @@ -972,7 +942,6 @@ msg_pdbg("Initial status register is set to 0x%02x.\n", data->emu_status); } -#endif
data->flashchip_contents = malloc(data->emu_chip_size); if (!data->flashchip_contents) { @@ -1009,7 +978,6 @@ msg_pdbg("doesn't match.\n"); } } -#endif
dummy_init_out: if (register_shutdown(dummy_shutdown, data)) { @@ -1028,7 +996,6 @@ return 0; }
-#if EMULATE_CHIP && EMULATE_SPI_CHIP int probe_variable_size(struct flashctx *flash) { unsigned int i; @@ -1071,4 +1038,3 @@
return 1; } -#endif