Edward O'Callaghan submitted this change.

View Change


Approvals: build bot (Jenkins): Verified Sam McNally: Looks good to me, approved Nikolai Artemiev: Looks good to me, but someone else must approve
tree/: Convert printlock func ptr into enumerate values

Converting the printlock function pointer
within the flashchip struct into enum values allows for
the flashchips db to be turn into pure, declarative data.
A nice side-effect of this is to reduce link-time symbol
space of chipdrivers and increase modularity of the
spi25_statusreg.c and related implementations.

BUG=none
TEST=ninja test.

Change-Id: I9131348f72c1010e2c213dca4dc4b675a8d8681e
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/69934
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sam McNally <sammc@google.com>
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
---
M flashrom.c
M include/chipdrivers.h
M include/flash.h
M spi25_statusreg.c
4 files changed, 159 insertions(+), 97 deletions(-)

diff --git a/flashrom.c b/flashrom.c
index c5b795c..b135e58 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1179,9 +1179,11 @@

/* Flash registers may more likely not be mapped if the chip was forced.
* Lock info may be stored in registers, so avoid lock info printing. */
- if (!force)
- if (flash->chip->printlock)
- flash->chip->printlock(flash);
+ if (!force) {
+ printlockfunc_t *printlock = lookup_printlock_func_ptr(flash);
+ if (printlock)
+ printlock(flash);
+ }

/* Get out of the way for later runs. */
unmap_flash(flash);
diff --git a/include/chipdrivers.h b/include/chipdrivers.h
index bac7785..a2e75d1 100644
--- a/include/chipdrivers.h
+++ b/include/chipdrivers.h
@@ -68,30 +68,6 @@
int spi_read_register(const struct flashctx *flash, enum flash_reg reg, uint8_t *value);
int spi_write_register(const struct flashctx *flash, enum flash_reg reg, uint8_t value);
void spi_prettyprint_status_register_bit(uint8_t status, int bit);
-int spi_prettyprint_status_register_plain(struct flashctx *flash);
-int spi_prettyprint_status_register_default_welwip(struct flashctx *flash);
-int spi_prettyprint_status_register_bp1_srwd(struct flashctx *flash);
-int spi_prettyprint_status_register_bp2_srwd(struct flashctx *flash);
-int spi_prettyprint_status_register_bp3_srwd(struct flashctx *flash);
-int spi_prettyprint_status_register_bp4_srwd(struct flashctx *flash);
-int spi_prettyprint_status_register_bp2_bpl(struct flashctx *flash);
-int spi_prettyprint_status_register_bp2_tb_bpl(struct flashctx *flash);
-int spi_prettyprint_status_register_amic_a25l032(struct flashctx *flash);
-int spi_prettyprint_status_register_at25df(struct flashctx *flash);
-int spi_prettyprint_status_register_at25df_sec(struct flashctx *flash);
-int spi_prettyprint_status_register_at25f(struct flashctx *flash);
-int spi_prettyprint_status_register_at25f512a(struct flashctx *flash);
-int spi_prettyprint_status_register_at25f512b(struct flashctx *flash);
-int spi_prettyprint_status_register_at25f4096(struct flashctx *flash);
-int spi_prettyprint_status_register_at25fs010(struct flashctx *flash);
-int spi_prettyprint_status_register_at25fs040(struct flashctx *flash);
-int spi_prettyprint_status_register_at26df081a(struct flashctx *flash);
-int spi_prettyprint_status_register_en25s_wp(struct flashctx *flash);
-int spi_prettyprint_status_register_n25q(struct flashctx *flash);
-int spi_prettyprint_status_register_bp2_ep_srwd(struct flashctx *flash);
-int spi_prettyprint_status_register_sst25(struct flashctx *flash);
-int spi_prettyprint_status_register_sst25vf016(struct flashctx *flash);
-int spi_prettyprint_status_register_sst25vf040b(struct flashctx *flash);

/* sfdp.c */
int probe_spi_sfdp(struct flashctx *flash);
diff --git a/include/flash.h b/include/flash.h
index 10c2975..f0357cb 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -351,49 +351,53 @@
TEST_UNLOCK_INJECTOR, /* special case must come last. */
};

-#define NO_PRINTLOCK_FUNC NULL
-#define PRINTLOCK_AT49F printlock_at49f
-#define PRINTLOCK_REGSPACE2_BLOCK_ERASER_0 printlock_regspace2_block_eraser_0
-#define PRINTLOCK_REGSPACE2_BLOCK_ERASER_1 printlock_regspace2_block_eraser_1
-#define PRINTLOCK_SST_FWHUB printlock_sst_fwhub
-#define PRINTLOCK_W39F010 printlock_w39f010
-#define PRINTLOCK_W39L010 printlock_w39l010
-#define PRINTLOCK_W39L020 printlock_w39l020
-#define PRINTLOCK_W39L040 printlock_w39l040
-#define PRINTLOCK_W39V040A printlock_w39v040a
-#define PRINTLOCK_W39V040B printlock_w39v040b
-#define PRINTLOCK_W39V040C printlock_w39v040c
-#define PRINTLOCK_W39V040FA printlock_w39v040fa
-#define PRINTLOCK_W39V040FB printlock_w39v040fb
-#define PRINTLOCK_W39V040FC printlock_w39v040fc
-#define PRINTLOCK_W39V080A printlock_w39v080a
-#define PRINTLOCK_W39V080FA printlock_w39v080fa
-#define PRINTLOCK_W39V080FA_DUAL printlock_w39v080fa_dual
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AMIC_A25L032 spi_prettyprint_status_register_amic_a25l032
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AT25DF spi_prettyprint_status_register_at25df
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AT25DF_SEC spi_prettyprint_status_register_at25df_sec
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AT25F spi_prettyprint_status_register_at25f
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AT25F4096 spi_prettyprint_status_register_at25f4096
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AT25F512A spi_prettyprint_status_register_at25f512a
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AT25F512B spi_prettyprint_status_register_at25f512b
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AT25FS010 spi_prettyprint_status_register_at25fs010
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AT25FS040 spi_prettyprint_status_register_at25fs040
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AT26DF081A spi_prettyprint_status_register_at26df081a
-#define SPI_PRETTYPRINT_STATUS_REGISTER_AT45DB spi_prettyprint_status_register_at45db
-#define SPI_PRETTYPRINT_STATUS_REGISTER_BP1_SRWD spi_prettyprint_status_register_bp1_srwd
-#define SPI_PRETTYPRINT_STATUS_REGISTER_BP2_BPL spi_prettyprint_status_register_bp2_bpl
-#define SPI_PRETTYPRINT_STATUS_REGISTER_BP2_EP_SRWD spi_prettyprint_status_register_bp2_ep_srwd
-#define SPI_PRETTYPRINT_STATUS_REGISTER_BP2_SRWD spi_prettyprint_status_register_bp2_srwd
-#define SPI_PRETTYPRINT_STATUS_REGISTER_BP2_TB_BPL spi_prettyprint_status_register_bp2_tb_bpl
-#define SPI_PRETTYPRINT_STATUS_REGISTER_BP3_SRWD spi_prettyprint_status_register_bp3_srwd
-#define SPI_PRETTYPRINT_STATUS_REGISTER_BP4_SRWD spi_prettyprint_status_register_bp4_srwd
-#define SPI_PRETTYPRINT_STATUS_REGISTER_DEFAULT_WELWIP spi_prettyprint_status_register_default_welwip
-#define SPI_PRETTYPRINT_STATUS_REGISTER_EN25S_WP spi_prettyprint_status_register_en25s_wp
-#define SPI_PRETTYPRINT_STATUS_REGISTER_N25Q spi_prettyprint_status_register_n25q
-#define SPI_PRETTYPRINT_STATUS_REGISTER_PLAIN spi_prettyprint_status_register_plain
-#define SPI_PRETTYPRINT_STATUS_REGISTER_SST25 spi_prettyprint_status_register_sst25
-#define SPI_PRETTYPRINT_STATUS_REGISTER_SST25VF016 spi_prettyprint_status_register_sst25vf016
-#define SPI_PRETTYPRINT_STATUS_REGISTER_SST25VF040B spi_prettyprint_status_register_sst25vf040b
+enum printlock_func {
+ NO_PRINTLOCK_FUNC,
+ PRINTLOCK_AT49F,
+ PRINTLOCK_REGSPACE2_BLOCK_ERASER_0,
+ PRINTLOCK_REGSPACE2_BLOCK_ERASER_1,
+ PRINTLOCK_SST_FWHUB,
+ PRINTLOCK_W39F010,
+ PRINTLOCK_W39L010,
+ PRINTLOCK_W39L020,
+ PRINTLOCK_W39L040,
+ PRINTLOCK_W39V040A,
+ PRINTLOCK_W39V040B,
+ PRINTLOCK_W39V040C,
+ PRINTLOCK_W39V040FA,
+ PRINTLOCK_W39V040FB,
+ PRINTLOCK_W39V040FC,
+ 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,
+ SPI_PRETTYPRINT_STATUS_REGISTER_AT25F4096,
+ SPI_PRETTYPRINT_STATUS_REGISTER_AT25F512A,
+ SPI_PRETTYPRINT_STATUS_REGISTER_AT25F512B,
+ SPI_PRETTYPRINT_STATUS_REGISTER_AT25FS010,
+ SPI_PRETTYPRINT_STATUS_REGISTER_AT25FS040,
+ SPI_PRETTYPRINT_STATUS_REGISTER_AT26DF081A,
+ SPI_PRETTYPRINT_STATUS_REGISTER_AT45DB,
+ SPI_PRETTYPRINT_STATUS_REGISTER_BP1_SRWD,
+ SPI_PRETTYPRINT_STATUS_REGISTER_BP2_BPL,
+ SPI_PRETTYPRINT_STATUS_REGISTER_BP2_EP_SRWD,
+ SPI_PRETTYPRINT_STATUS_REGISTER_BP2_SRWD,
+ SPI_PRETTYPRINT_STATUS_REGISTER_BP2_TB_BPL,
+ SPI_PRETTYPRINT_STATUS_REGISTER_BP3_SRWD,
+ SPI_PRETTYPRINT_STATUS_REGISTER_BP4_SRWD,
+ SPI_PRETTYPRINT_STATUS_REGISTER_DEFAULT_WELWIP,
+ SPI_PRETTYPRINT_STATUS_REGISTER_EN25S_WP,
+ SPI_PRETTYPRINT_STATUS_REGISTER_N25Q,
+ SPI_PRETTYPRINT_STATUS_REGISTER_PLAIN,
+ SPI_PRETTYPRINT_STATUS_REGISTER_SST25,
+ SPI_PRETTYPRINT_STATUS_REGISTER_SST25VF016,
+ SPI_PRETTYPRINT_STATUS_REGISTER_SST25VF040B,
+};
+typedef int (printlockfunc_t)(struct flashctx *flash);
+printlockfunc_t *lookup_printlock_func_ptr(struct flashctx *flash);

struct flashchip {
const char *vendor;
@@ -460,7 +464,7 @@
enum block_erase_func block_erase;
} block_erasers[NUM_ERASEFUNCTIONS];

- int (*printlock) (struct flashctx *flash);
+ enum printlock_func printlock;
enum blockprotect_func unlock;
enum write_func write;
enum read_func read;
diff --git a/spi25_statusreg.c b/spi25_statusreg.c
index 21a1a15..60e0b46 100644
--- a/spi25_statusreg.c
+++ b/spi25_statusreg.c
@@ -354,8 +354,9 @@

if ((status & bp_mask) != 0) {
msg_cerr("Block protection could not be disabled!\n");
- if (flash->chip->printlock)
- flash->chip->printlock(flash);
+ printlockfunc_t *printlock = lookup_printlock_func_ptr(flash);
+ if (printlock)
+ printlock(flash);
return 1;
}
msg_cdbg("disabled.\n");
@@ -470,7 +471,7 @@
msg_cdbg("Chip status register: Bit %i is %sset\n", bit, (status & (1 << bit)) ? "" : "not ");
}

-int spi_prettyprint_status_register_plain(struct flashctx *flash)
+static int spi_prettyprint_status_register_plain(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -481,7 +482,7 @@
}

/* Print the plain hex value and the welwip bits only. */
-int spi_prettyprint_status_register_default_welwip(struct flashctx *flash)
+static int spi_prettyprint_status_register_default_welwip(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -497,7 +498,7 @@
* AMIC A25L series
* and MX MX25L512
*/
-int spi_prettyprint_status_register_bp1_srwd(struct flashctx *flash)
+static int spi_prettyprint_status_register_bp1_srwd(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -518,7 +519,7 @@
* AMIC A25L series
* PMC Pm25LD series
*/
-int spi_prettyprint_status_register_bp2_srwd(struct flashctx *flash)
+static int spi_prettyprint_status_register_bp2_srwd(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -538,7 +539,7 @@
* ST M25P series
* MX MX25L series
*/
-int spi_prettyprint_status_register_bp3_srwd(struct flashctx *flash)
+static int spi_prettyprint_status_register_bp3_srwd(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -553,7 +554,7 @@
return 0;
}

-int spi_prettyprint_status_register_bp4_srwd(struct flashctx *flash)
+static int spi_prettyprint_status_register_bp4_srwd(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -567,7 +568,7 @@
return 0;
}

-int spi_prettyprint_status_register_bp2_bpl(struct flashctx *flash)
+static int spi_prettyprint_status_register_bp2_bpl(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -583,7 +584,7 @@
return 0;
}

-int spi_prettyprint_status_register_bp2_tb_bpl(struct flashctx *flash)
+static int spi_prettyprint_status_register_bp2_tb_bpl(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -608,7 +609,7 @@
* by the second status register.
*/

-int spi_prettyprint_status_register_amic_a25l032(struct flashctx *flash)
+static int spi_prettyprint_status_register_amic_a25l032(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -667,7 +668,7 @@
}
}

-int spi_prettyprint_status_register_at25df(struct flashctx *flash)
+static int spi_prettyprint_status_register_at25df(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -684,7 +685,7 @@
return 0;
}

-int spi_prettyprint_status_register_at25df_sec(struct flashctx *flash)
+static int spi_prettyprint_status_register_at25df_sec(struct flashctx *flash)
{
/* FIXME: We should check the security lockdown. */
msg_cdbg("Ignoring security lockdown (if present)\n");
@@ -693,7 +694,7 @@
}

/* used for AT25F512, AT25F1024(A), AT25F2048 */
-int spi_prettyprint_status_register_at25f(struct flashctx *flash)
+static int spi_prettyprint_status_register_at25f(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -711,7 +712,7 @@
return 0;
}

-int spi_prettyprint_status_register_at25f512a(struct flashctx *flash)
+static int spi_prettyprint_status_register_at25f512a(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -730,7 +731,7 @@
return 0;
}

-int spi_prettyprint_status_register_at25f512b(struct flashctx *flash)
+static int spi_prettyprint_status_register_at25f512b(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -747,7 +748,7 @@
return 0;
}

-int spi_prettyprint_status_register_at25f4096(struct flashctx *flash)
+static int spi_prettyprint_status_register_at25f4096(struct flashctx *flash)
{
uint8_t status;

@@ -765,7 +766,7 @@
return 0;
}

-int spi_prettyprint_status_register_at25fs010(struct flashctx *flash)
+static int spi_prettyprint_status_register_at25fs010(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -788,7 +789,7 @@
return 0;
}

-int spi_prettyprint_status_register_at25fs040(struct flashctx *flash)
+static int spi_prettyprint_status_register_at25fs040(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -803,7 +804,7 @@
return 0;
}

-int spi_prettyprint_status_register_at26df081a(struct flashctx *flash)
+static int spi_prettyprint_status_register_at26df081a(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -864,7 +865,7 @@

/* === Eon === */

-int spi_prettyprint_status_register_en25s_wp(struct flashctx *flash)
+static int spi_prettyprint_status_register_en25s_wp(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -886,7 +887,7 @@
return spi_disable_blockprotect_generic(flash, 0x5C, 1 << 7, 0, 0xFF);
}

-int spi_prettyprint_status_register_n25q(struct flashctx *flash)
+static int spi_prettyprint_status_register_n25q(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -959,7 +960,7 @@
}

/* Used by Intel/Numonyx S33 and Spansion S25FL-S chips */
-int spi_prettyprint_status_register_bp2_ep_srwd(struct flashctx *flash)
+static int spi_prettyprint_status_register_bp2_ep_srwd(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -990,7 +991,7 @@
spi_prettyprint_status_register_welwip(status);
}

-int spi_prettyprint_status_register_sst25(struct flashctx *flash)
+static int spi_prettyprint_status_register_sst25(struct flashctx *flash)
{
uint8_t status;
int ret = spi_read_register(flash, STATUS1, &status);
@@ -1000,7 +1001,7 @@
return 0;
}

-int spi_prettyprint_status_register_sst25vf016(struct flashctx *flash)
+static int spi_prettyprint_status_register_sst25vf016(struct flashctx *flash)
{
static const char *const bpt[] = {
"none",
@@ -1020,7 +1021,7 @@
return 0;
}

-int spi_prettyprint_status_register_sst25vf040b(struct flashctx *flash)
+static int spi_prettyprint_status_register_sst25vf040b(struct flashctx *flash)
{
static const char *const bpt[] = {
"none",
@@ -1037,3 +1038,58 @@
msg_cdbg("Resulting block protection : %s\n", bpt[(status & 0x1c) >> 2]);
return 0;
}
+
+printlockfunc_t *lookup_printlock_func_ptr(struct flashctx *flash)
+{
+ switch (flash->chip->printlock) {
+ case PRINTLOCK_AT49F: return &printlock_at49f;
+ case PRINTLOCK_REGSPACE2_BLOCK_ERASER_0: return &printlock_regspace2_block_eraser_0;
+ case PRINTLOCK_REGSPACE2_BLOCK_ERASER_1: return &printlock_regspace2_block_eraser_1;
+ case PRINTLOCK_SST_FWHUB: return &printlock_sst_fwhub;
+ case PRINTLOCK_W39F010: return &printlock_w39f010;
+ case PRINTLOCK_W39L010: return &printlock_w39l010;
+ case PRINTLOCK_W39L020: return &printlock_w39l020;
+ case PRINTLOCK_W39L040: return &printlock_w39l040;
+ case PRINTLOCK_W39V040A: return &printlock_w39v040a;
+ case PRINTLOCK_W39V040B: return &printlock_w39v040b;
+ case PRINTLOCK_W39V040C: return &printlock_w39v040c;
+ case PRINTLOCK_W39V040FA: return &printlock_w39v040fa;
+ case PRINTLOCK_W39V040FB: return &printlock_w39v040fb;
+ case PRINTLOCK_W39V040FC: return &printlock_w39v040fc;
+ 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;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_AT25F4096: return &spi_prettyprint_status_register_at25f4096;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_AT25F512A: return &spi_prettyprint_status_register_at25f512a;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_AT25F512B: return &spi_prettyprint_status_register_at25f512b;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_AT25FS010: return &spi_prettyprint_status_register_at25fs010;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_AT25FS040: return &spi_prettyprint_status_register_at25fs040;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_AT26DF081A: return &spi_prettyprint_status_register_at26df081a;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_AT45DB: return &spi_prettyprint_status_register_at45db;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_BP1_SRWD: return &spi_prettyprint_status_register_bp1_srwd;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_BP2_BPL: return &spi_prettyprint_status_register_bp2_bpl;
+ 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_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;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_EN25S_WP: return &spi_prettyprint_status_register_en25s_wp;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_N25Q: return &spi_prettyprint_status_register_n25q;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_PLAIN: return &spi_prettyprint_status_register_plain;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_SST25: return &spi_prettyprint_status_register_sst25;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_SST25VF016: return &spi_prettyprint_status_register_sst25vf016;
+ case SPI_PRETTYPRINT_STATUS_REGISTER_SST25VF040B: return &spi_prettyprint_status_register_sst25vf040b;
+ /* default: non-total function, 0 indicates no unlock function set.
+ * We explicitly do not want a default catch-all case in the switch
+ * to ensure unhandled enum's are compiler warnings.
+ */
+ case NO_PRINTLOCK_FUNC: return NULL;
+ };
+
+ return NULL;
+}

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I9131348f72c1010e2c213dca4dc4b675a8d8681e
Gerrit-Change-Number: 69934
Gerrit-PatchSet: 5
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: Sam McNally <sammc@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-MessageType: merged