From 7902b2b51152980067ed456e31e7b0b8862a4dc7 Mon Sep 17 00:00:00 2001 From: Nikolai Artemiev Date: Tue, 29 Nov 2022 17:30:09 +1100 Subject: 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/70126 Reviewed-by: Edward O'Callaghan Tested-by: build bot (Jenkins) --- include/programmer.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/programmer.h b/include/programmer.h index aaa14071..67e7b4a9 100644 --- a/include/programmer.h +++ b/include/programmer.h @@ -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; }; -- cgit v1.2.3