1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

programmer: Add get_region to spi/opaque masters

Add a get_region function to spi and opaque masters so that they can
expose access permissions for multiple regions within the flash.

A get_region() implementation is added for the ichspi driver in a
following patch.

Finally, another patch uses get_region() to make read_flash() and
write_flash() skip inaccessable regions, making read, write, and erase
operations work on Intel platforms with active an CSME coprocessor.

This logic will be integrated with layout in the future, but for now
this moves ichspi support forward without making refactoring too hard
later on.

BUG=b:260440773
BRANCH=none
TEST=ninja test

Change-Id: I8c43f6b705f36ef18842a04ba6241d3a0b36b232
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/70126
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nikolai Artemiev 2022-11-29 17:30:09 +11:00 committed by Edward O'Callaghan
parent e712c39507
commit 7902b2b511

View File

@ -313,6 +313,7 @@ struct spi_master {
int (*shutdown)(void *data);
bool (*probe_opcode)(const struct flashctx *flash, uint8_t opcode);
void (*delay) (const struct flashctx *flash, unsigned int usecs);
void (*get_region)(const struct flashctx *flash, unsigned int addr, struct flash_region *region);
void *data;
};
@ -416,6 +417,7 @@ struct opaque_master {
enum flashrom_wp_result (*wp_write_cfg)(struct flashctx *, const struct flashrom_wp_cfg *);
enum flashrom_wp_result (*wp_read_cfg)(struct flashrom_wp_cfg *, struct flashctx *);
enum flashrom_wp_result (*wp_get_ranges)(struct flashrom_wp_ranges **, struct flashctx *);
void (*get_region)(const struct flashctx *flash, unsigned int addr, struct flash_region *region);
int (*shutdown)(void *data);
void *data;
};