diff options
author | Edward O'Callaghan <quasisec@google.com> | 2022-08-16 18:23:33 +1000 |
---|---|---|
committer | Felix Singer <felixsinger@posteo.net> | 2022-11-01 01:16:26 +0000 |
commit | 594d3357b6a4d883b6b87295bf4b9b6400777d18 (patch) | |
tree | 765d729f5ce7b2e54e176f29e0cb6a2eb75a8ad6 /tests | |
parent | 985ad5623f8c2695ffc07d4bdbacbf2d85d4c11a (diff) | |
download | flashrom-594d3357b6a4d883b6b87295bf4b9b6400777d18.tar.gz flashrom-594d3357b6a4d883b6b87295bf4b9b6400777d18.tar.bz2 flashrom-594d3357b6a4d883b6b87295bf4b9b6400777d18.zip |
tree/: Convert flashchip read 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.
TEST='R|W|E && --flash-name' on ARM, AMD & Intel DUT's.
Change-Id: I612d46fefedf2b69e7e2064aa857fa0756efb4e7
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66788
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/chip.c | 9 | ||||
-rw-r--r-- | tests/chip_wp.c | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/tests/chip.c b/tests/chip.c index 284b7e40..79d0c87a 100644 --- a/tests/chip.c +++ b/tests/chip.c @@ -147,12 +147,13 @@ static void teardown(struct flashrom_layout **layout) } extern write_func_t *g_test_write_injector; +extern read_func_t *g_test_read_injector; static const struct flashchip chip_8MiB = { .vendor = "aklm", .total_size = MOCK_CHIP_SIZE / KiB, .tested = TEST_OK_PREW, - .read = read_chip, + .read = TEST_READ_INJECTOR, .write = TEST_WRITE_INJECTOR, .unlock = unlock_chip, .block_erasers = @@ -168,7 +169,7 @@ static const struct flashchip chip_W25Q128_V = { .vendor = "aklm&dummyflasher", .total_size = 16 * 1024, .tested = TEST_OK_PREW, - .read = spi_chip_read, + .read = SPI_CHIP_READ, .write = SPI_CHIP_WRITE256, .unlock = spi_disable_blockprotect, .page_size = 256, @@ -206,6 +207,7 @@ void erase_chip_test_success(void **state) }; g_test_write_injector = write_chip; + g_test_read_injector = read_chip; struct flashrom_flashctx flashctx = { 0 }; struct flashrom_layout *layout; struct flashchip mock_chip = chip_8MiB; @@ -265,6 +267,7 @@ void read_chip_test_success(void **state) }; g_test_write_injector = write_chip; + g_test_read_injector = read_chip; struct flashrom_flashctx flashctx = { 0 }; struct flashrom_layout *layout; struct flashchip mock_chip = chip_8MiB; @@ -337,6 +340,7 @@ void write_chip_test_success(void **state) }; g_test_write_injector = write_chip; + g_test_read_injector = read_chip; struct flashrom_flashctx flashctx = { 0 }; struct flashrom_layout *layout; struct flashchip mock_chip = chip_8MiB; @@ -435,6 +439,7 @@ void verify_chip_test_success(void **state) }; g_test_write_injector = write_chip; + g_test_read_injector = read_chip; struct flashrom_flashctx flashctx = { 0 }; struct flashrom_layout *layout; struct flashchip mock_chip = chip_8MiB; diff --git a/tests/chip_wp.c b/tests/chip_wp.c index 3c9be409..8f6cb5fd 100644 --- a/tests/chip_wp.c +++ b/tests/chip_wp.c @@ -64,7 +64,7 @@ static const struct flashchip chip_W25Q128_V = { .vendor = "aklm&dummyflasher", .total_size = 16 * 1024, .tested = TEST_OK_PREW, - .read = spi_chip_read, + .read = SPI_CHIP_READ, .write = SPI_CHIP_WRITE256, .unlock = spi_disable_blockprotect, .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_WRSR_EXT2 | FEATURE_WRSR2 | FEATURE_WRSR3, |