summaryrefslogtreecommitdiffstats
path: root/flash.h
diff options
context:
space:
mode:
Diffstat (limited to 'flash.h')
-rw-r--r--flash.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/flash.h b/flash.h
index a1e766920..883b6f4b4 100644
--- a/flash.h
+++ b/flash.h
@@ -103,6 +103,8 @@ enum write_granularity {
*/
#define NUM_ERASEFUNCTIONS 8
+#define MAX_CHIP_RESTORE_FUNCTIONS 4
+
/* Feature bits used for non-SPI only */
#define FEATURE_REGISTERMAP (1 << 0)
#define FEATURE_LONG_RESET (0 << 4)
@@ -248,6 +250,8 @@ struct flashchip {
struct wp *wp;
};
+typedef int (*chip_restore_fn_cb_t)(struct flashctx *flash, uint8_t status);
+
struct flashrom_flashctx {
struct flashchip *chip;
/* FIXME: The memory mappings should be saved in a more structured way. */
@@ -275,6 +279,12 @@ struct flashrom_flashctx {
*/
int address_high_byte;
bool in_4ba_mode;
+
+ int chip_restore_fn_count;
+ struct chip_restore_func_data {
+ chip_restore_fn_cb_t func;
+ uint8_t status;
+ } chip_restore_fn[MAX_CHIP_RESTORE_FUNCTIONS];
};
/* Timing used in probe routines. ZERO is -2 to differentiate between an unset
@@ -350,6 +360,7 @@ int do_read(struct flashctx *, const char *filename);
int do_erase(struct flashctx *);
int do_write(struct flashctx *, const char *const filename, const char *const referencefile);
int do_verify(struct flashctx *, const char *const filename);
+int register_chip_restore(chip_restore_fn_cb_t func, struct flashctx *flash, uint8_t status);
/* Something happened that shouldn't happen, but we can go on. */
#define ERROR_NONFATAL 0x100