Edward O'Callaghan submitted this change.

View Change


Approvals: build bot (Jenkins): Verified Edward O'Callaghan: Looks good to me, approved
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>
---
M include/programmer.h
1 file changed, 33 insertions(+), 0 deletions(-)

diff --git a/include/programmer.h b/include/programmer.h
index aaa1407..67e7b4a 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -313,6 +313,7 @@
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 @@
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;
};

To view, visit change 70126. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8c43f6b705f36ef18842a04ba6241d3a0b36b232
Gerrit-Change-Number: 70126
Gerrit-PatchSet: 11
Gerrit-Owner: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged