path: root/flash.h
diff options
Diffstat (limited to 'flash.h')
1 files changed, 12 insertions, 5 deletions
diff --git a/flash.h b/flash.h
index 301eb7a..a5d3a55 100644
--- a/flash.h
+++ b/flash.h
@@ -48,9 +48,9 @@ typedef uintptr_t chipaddr;
/* Types and macros regarding the maximum flash space size supported by generic code. */
typedef uint32_t chipoff_t; /* Able to store any addressable offset within a supported flash memory. */
typedef uint32_t chipsize_t; /* Able to store the number of bytes of any supported flash memory. */
-#define FL_MAX_CHIPADDR_BITS (24)
-#define FL_MAX_CHIPADDR ((chipoff_t)(1ULL<<FL_MAX_CHIPADDR_BITS)-1)
-#define PRIxCHIPADDR "06"PRIx32
+#define FL_MAX_CHIPOFF_BITS (24)
+#define FL_MAX_CHIPOFF ((chipoff_t)(1ULL<<FL_MAX_CHIPOFF_BITS)-1)
+#define PRIxCHIPOFF "06"PRIx32
int register_shutdown(int (*function) (void *data), void *data);
@@ -209,8 +209,14 @@ struct flashchip {
struct flashctx {
struct flashchip *chip;
+ /* FIXME: The memory mappings should be saved in a more structured way. */
+ /* The physical_* fields store the respective addresses in the physical address space of the CPU. */
+ uintptr_t physical_memory;
+ /* The virtual_* fields store where the respective physical address is mapped into flashrom's address
+ * space. A value equivalent to (chipaddr)ERROR_PTR indicates an invalid mapping (or none at all). */
chipaddr virtual_memory;
- /* Some flash devices have an additional register space. */
+ /* Some flash devices have an additional register space; semantics are like above. */
+ uintptr_t physical_registers;
chipaddr virtual_registers;
struct registered_master *mst;
@@ -252,7 +258,8 @@ void tolower_string(char *str);
/* flashrom.c */
extern const char flashrom_version[];
extern const char *chip_to_probe;
-void map_flash_registers(struct flashctx *flash);
+int map_flash(struct flashctx *flash);
+void unmap_flash(struct flashctx *flash);
int read_memmapped(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
int erase_flash(struct flashctx *flash);
int probe_flash(struct registered_master *mst, int startchip, struct flashctx *fill_flash, int force);
OpenPOWER on IntegriCloud