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 /fmap.c | |
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 'fmap.c')
-rw-r--r-- | fmap.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -167,7 +167,7 @@ static int fmap_lsearch_rom(struct fmap **fmap_out, goto _finalize_ret; } - ret = flashctx->chip->read(flashctx, buf + rom_offset, rom_offset, len); + ret = read_flash(flashctx, buf + rom_offset, rom_offset, len); if (ret) { msg_pdbg("Cannot read ROM contents.\n"); goto _free_ret; @@ -232,7 +232,7 @@ static int fmap_bsearch_rom(struct fmap **fmap_out, struct flashctx *const flash /* Read errors are considered non-fatal since we may * encounter locked regions and want to continue. */ - if (flashctx->chip->read(flashctx, (uint8_t *)fmap, offset, sig_len)) { + if (read_flash(flashctx, (uint8_t *)fmap, offset, sig_len)) { /* * Print in verbose mode only to avoid excessive * messages for benign errors. Subsequent error @@ -245,7 +245,7 @@ static int fmap_bsearch_rom(struct fmap **fmap_out, struct flashctx *const flash if (memcmp(fmap, FMAP_SIGNATURE, sig_len) != 0) continue; - if (flashctx->chip->read(flashctx, (uint8_t *)fmap + sig_len, + if (read_flash(flashctx, (uint8_t *)fmap + sig_len, offset + sig_len, sizeof(*fmap) - sig_len)) { msg_cerr("Cannot read %zu bytes at offset %06zx\n", sizeof(*fmap) - sig_len, offset + sig_len); @@ -277,7 +277,7 @@ static int fmap_bsearch_rom(struct fmap **fmap_out, struct flashctx *const flash goto _free_ret; } - if (flashctx->chip->read(flashctx, (uint8_t *)fmap + sizeof(*fmap), + if (read_flash(flashctx, (uint8_t *)fmap + sizeof(*fmap), offset + sizeof(*fmap), fmap_len - sizeof(*fmap))) { msg_cerr("Cannot read %zu bytes at offset %06zx\n", fmap_len - sizeof(*fmap), offset + sizeof(*fmap)); |