aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/programmer.h8
-rw-r--r--include/writeprotect.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/include/programmer.h b/include/programmer.h
index 5fb06260..eaf4a983 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -402,6 +402,14 @@ struct opaque_master {
int (*read) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
int (*write) (struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
int (*erase) (struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen);
+ /*
+ * Callbacks for accessing flash registers. An opaque programmer must
+ * provide these functions for writeprotect operations to be available,
+ * unless it provides custom wp operations instead.
+ */
+ int (*read_register)(const struct flashctx *flash, enum flash_reg reg, uint8_t *value);
+ int (*write_register)(const struct flashctx *flash, enum flash_reg reg, uint8_t value);
+ /* Callbacks for overiding default writeprotect operations with custom ones. */
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 *);
diff --git a/include/writeprotect.h b/include/writeprotect.h
index e27403dc..12926c4d 100644
--- a/include/writeprotect.h
+++ b/include/writeprotect.h
@@ -86,4 +86,7 @@ enum flashrom_wp_result wp_read_cfg(struct flashrom_wp_cfg *, struct flashrom_fl
/* Get a list of protection ranges supported by the chip */
enum flashrom_wp_result wp_get_available_ranges(struct flashrom_wp_ranges **, struct flashrom_flashctx *);
+/* Checks if writeprotect functions can be used with the current flash/programmer */
+bool wp_operations_available(struct flashrom_flashctx *);
+
#endif /* !__WRITEPROTECT_H__ */