diff options
author | Edward O'Callaghan <quasisec@google.com> | 2022-08-29 10:36:21 +1000 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2022-11-11 13:04:07 +0000 |
commit | 3bba710d98b60eba7ebbae0869fd58f7dc987afd (patch) | |
tree | 0a5fc97c3edad996c21b4c66828dd366e9d0792f /spi25.c | |
parent | 3c44e12a287ce9a91cf97c3303bf4222f63d25c7 (diff) | |
download | flashrom-3bba710d98b60eba7ebbae0869fd58f7dc987afd.tar.gz flashrom-3bba710d98b60eba7ebbae0869fd58f7dc987afd.tar.bz2 flashrom-3bba710d98b60eba7ebbae0869fd58f7dc987afd.zip |
tree/: Convert flashchip erase_block func ptr to enumerate
This forges the way for flashchips.c to be pure declarative
data and lookup functions for dispatch to be pure. This
means that the flashchips data could be extracted out to
be agnostic data of the flashrom code and algorithms.
Change-Id: I02ae7e4c67c5bf34ec2fd7ffe4af8a2aba6fd5e5
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/69133
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'spi25.c')
-rw-r--r-- | spi25.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -619,7 +619,7 @@ int spi_block_erase_dc(struct flashctx *flash, unsigned int addr, unsigned int b } static const struct { - erasefunc_t *func; + enum block_erase_func func; uint8_t opcode; } function_opcode_list[] = { {SPI_BLOCK_ERASE_20, 0x20}, @@ -639,7 +639,7 @@ static const struct { {SPI_BLOCK_ERASE_DC, 0xdc}, }; -erasefunc_t *spi_get_erasefn_from_opcode(uint8_t opcode) +enum block_erase_func spi_get_erasefn_from_opcode(uint8_t opcode) { size_t i; for (i = 0; i < ARRAY_SIZE(function_opcode_list); i++) { @@ -651,14 +651,14 @@ erasefunc_t *spi_get_erasefn_from_opcode(uint8_t opcode) return NO_BLOCK_ERASE_FUNC; } -uint8_t spi_get_opcode_from_erasefn(erasefunc_t *func) +uint8_t spi_get_opcode_from_erasefn(enum block_erase_func func) { size_t i; for (i = 0; i < ARRAY_SIZE(function_opcode_list); i++) { if (function_opcode_list[i].func == func) return function_opcode_list[i].opcode; } - msg_cinfo("%s: unknown erase function (0x%p). Please report " + msg_cinfo("%s: unknown erase function (0x%d). Please report " "this at flashrom@flashrom.org\n", __func__, func); return 0x00; //Assuming 0x00 is not a erase function opcode } |