mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 14:11:15 +02:00
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>
This commit is contained in:

committed by
Felix Singer

parent
985ad5623f
commit
594d3357b6
8
fmap.c
8
fmap.c
@ -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));
|
||||
|
Reference in New Issue
Block a user