summaryrefslogtreecommitdiffstats
path: root/flash.h
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2012-08-25 01:17:58 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2012-08-25 01:17:58 +0000
commit7f0bcba9833ca056a66b6081613a693ee36f78e9 (patch)
treeda511e990c1fdded61ee5dcefae38314c3a5a6cc /flash.h
parentd9119f712612e8e6f508a3e6a839d41a365c2793 (diff)
downloadflashrom-7f0bcba9833ca056a66b6081613a693ee36f78e9.zip
flashrom-7f0bcba9833ca056a66b6081613a693ee36f78e9.tar.gz
Make struct flashchip a field in struct flashctx instead of a complete copy
All the driver conversion work and cleanup has been done by Stefan. flashrom.c and cli_classic.c are a joint work of Stefan and Carl-Daniel. Corresponding to flashrom svn r1579. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'flash.h')
-rw-r--r--flash.h26
1 files changed, 3 insertions, 23 deletions
diff --git a/flash.h b/flash.h
index b41c281..2990202 100644
--- a/flash.h
+++ b/flash.h
@@ -87,6 +87,7 @@ enum chipbustype {
#define FEATURE_WRSR_EITHER (FEATURE_WRSR_EWSR | FEATURE_WRSR_WREN)
struct flashctx;
+typedef int (erasefunc_t)(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
struct flashchip {
const char *vendor;
@@ -148,35 +149,14 @@ struct flashchip {
} voltage;
};
-/* struct flashctx must always contain struct flashchip at the beginning. */
struct flashctx {
- const char *vendor;
- const char *name;
- enum chipbustype bustype;
- uint32_t manufacture_id;
- uint32_t model_id;
- int total_size;
- int page_size;
- int feature_bits;
- uint32_t tested;
- int (*probe) (struct flashctx *flash);
- int probe_timing;
- struct block_eraser block_erasers[NUM_ERASEFUNCTIONS];
- int (*printlock) (struct flashctx *flash);
- int (*unlock) (struct flashctx *flash);
- int (*write) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
- int (*read) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
- struct voltage voltage;
- /* struct flashchip ends here. */
-
+ struct flashchip *chip;
chipaddr virtual_memory;
/* Some flash devices have an additional register space. */
chipaddr virtual_registers;
struct registered_programmer *pgm;
};
-typedef int (erasefunc_t)(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
-
#define TEST_UNTESTED 0
#define TEST_OK_PROBE (1 << 0)
@@ -307,7 +287,7 @@ int print(enum msglevel level, const char *fmt, ...) __attribute__((format(print
int register_include_arg(char *name);
int process_include_args(void);
int read_romlayout(char *name);
-int handle_romentries(struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents);
+int handle_romentries(const struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents);
/* spi.c */
struct spi_command {
OpenPOWER on IntegriCloud