summaryrefslogtreecommitdiffstats
path: root/flash.h
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2011-12-20 00:19:29 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2011-12-20 00:19:29 +0000
commitc40cff7b86848f5b248d7fcf20f7d517b60c385d (patch)
tree7f9db61c7b4868e513c4702cfe57bb35ae695266 /flash.h
parent8a3c60cdd0e5632173567923ae1927763e31e857 (diff)
downloadast2050-flashrom-c40cff7b86848f5b248d7fcf20f7d517b60c385d.zip
ast2050-flashrom-c40cff7b86848f5b248d7fcf20f7d517b60c385d.tar.gz
Have all programmer init functions register bus masters/programmers
All programmer types (Parallel, SPI, Opaque) now register themselves into a generic programmer list and probing is now programmer-centric instead of chip-centric. Registering multiple SPI/... masters at the same time is now possible without any problems. Handling multiple flash chips is still unchanged, but now we have the infrastructure to deal with "dual BIOS" and "one flash behind southbridge and one flash behind EC" sanely. A nice side effect is that this patch kills quite a few global variables and improves the situation for libflashrom. Hint for developers: struct {spi,par,opaque}_programmer now have a void *data pointer to store any additional programmer-specific data, e.g. hardware configuration info. Note: flashrom -f -c FOO -r forced_read.bin does not work anymore. We have to find an architecturally clean way to solve this. Corresponding to flashrom svn r1475. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Diffstat (limited to 'flash.h')
-rw-r--r--flash.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/flash.h b/flash.h
index 29ba193..e21a986 100644
--- a/flash.h
+++ b/flash.h
@@ -171,6 +171,7 @@ struct flashctx {
chipaddr virtual_memory;
/* Some flash devices have an additional register space. */
chipaddr virtual_registers;
+ struct registered_programmer *pgm;
};
#define TEST_UNTESTED 0
@@ -224,14 +225,13 @@ enum write_granularity {
write_gran_1byte,
write_gran_256bytes,
};
-extern enum chipbustype buses_supported;
extern int verbose;
extern const char flashrom_version[];
extern char *chip_to_probe;
void map_flash_registers(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(int startchip, struct flashctx *fill_flash, int force);
+int probe_flash(struct registered_programmer *pgm, int startchip, struct flashctx *fill_flash, int force);
int read_flash_to_file(struct flashctx *flash, const char *filename);
int min(int a, int b);
int max(int a, int b);
@@ -256,6 +256,13 @@ int write_buf_to_file(unsigned char *buf, unsigned long size, const char *filena
/* Something happened that shouldn't happen, we'll abort. */
#define ERROR_FATAL -0xee
+#define ERROR_FLASHROM_BUG -200
+/* We reached one of the hardcoded limits of flashrom. This can be fixed by
+ * increasing the limit of a compile-time allocation or by switching to dynamic
+ * allocation.
+ * Note: If this warning is triggered, check first for runaway registrations.
+ */
+#define ERROR_FLASHROM_LIMIT -201
/* cli_output.c */
/* Let gcc and clang check for correct printf-style format strings. */
@@ -297,4 +304,5 @@ int spi_send_command(struct flashctx *flash, unsigned int writecnt, unsigned int
int spi_send_multicommand(struct flashctx *flash, struct spi_command *cmds);
uint32_t spi_get_valid_read_addr(struct flashctx *flash);
+enum chipbustype get_buses_supported(void);
#endif /* !__FLASH_H__ */
OpenPOWER on IntegriCloud