1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-06-30 21:52:36 +02:00

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>
This commit is contained in:
Carl-Daniel Hailfinger
2012-08-25 01:17:58 +00:00
parent dd73d830f7
commit 5a7cb847f0
23 changed files with 263 additions and 277 deletions

26
flash.h
View File

@ -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 {