Am 09.11.2011 01:16 schrieb Carl-Daniel Hailfinger:
Am 03.11.2011 23:07 schrieb Carl-Daniel Hailfinger:
Am 02.11.2011 13:41 schrieb Stefan Tauner:
another layer of redirection is - as always - also a possibility: introducing a new struct with pointers to the actual chip and the programmer to be used (and other information related to the actual situation/probing... e.g. access right ranges). but that's probably not needed (yet) and the splitting could be done later anyway if need be. OTOH if it is clear that there will be more information stuffed into struct flashchip, that is not really static and does not need to/should not reside in flashchips.c/struct flashchip, we may better discuss a separation now(?).
We have a big problem: There is almost no information in struct flashchip which is constant in all cases. The name, size and erase structures could be filled in automatically for SFDP stuff. That alone kills the separation idea IMHO.
Turns out separating struct flashchip and struct flashctx (the flash context) is possible, but it required some sed and manual care.
The only difference between struct flashchip and struct flashctx right now are the virtual_memory and virtual_registers members. Compared to my earlier patch, no function signatures have been changed except for flashchip->flashctx replacements. This should make reviews easier.
TODO: Test if flashing still works on hardware (I tested with dummy). Test if printing and wiki printing still works as expected.
Deferred to another patch: Adding struct flashctx to the remaining function signatures. Check if it makes sense to convert some function signatures to use constant.
If you want to verify this patch, run the following command in an unmodified tree: sed -i "s/struct flashchip/struct flashctx/g" *.[ch] and then compare the result to this patch. A few places like print.c and print_wiki.c kept struct flashchip because they don't care about the context and act directly on the flashchips array.
New version, updated to apply against svn HEAD. Please note that this one still duplicates the struct flashchip members manually in struct flashctx. An alternative version will be posted as followup.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-struct_flashctx/flash.h =================================================================== --- flashrom-struct_flashctx/flash.h (Revision 1472) +++ flashrom-struct_flashctx/flash.h (Arbeitskopie) @@ -93,6 +93,8 @@ #define FEATURE_WRSR_WREN (1 << 7) #define FEATURE_WRSR_EITHER (FEATURE_WRSR_EWSR | FEATURE_WRSR_WREN)
+struct flashctx; + struct flashchip { const char *vendor; const char *name; @@ -119,7 +121,7 @@ */ uint32_t tested;
- int (*probe) (struct flashchip *flash); + int (*probe) (struct flashctx *flash);
/* Delay after "enter/exit ID mode" commands in microseconds. * NB: negative values have special meanings, see TIMING_* below. @@ -140,20 +142,42 @@ } eraseblocks[NUM_ERASEREGIONS]; /* a block_erase function should try to erase one block of size * 'blocklen' at address 'blockaddr' and return 0 on success. */ - int (*block_erase) (struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen); + int (*block_erase) (struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen); } block_erasers[NUM_ERASEFUNCTIONS];
- int (*printlock) (struct flashchip *flash); - int (*unlock) (struct flashchip *flash); - int (*write) (struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); - int (*read) (struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); - struct { + 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 { uint16_t min; uint16_t max; } 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, int start, int len); + int (*read) (struct flashctx *flash, uint8_t *buf, int start, int len); + struct voltage voltage; + /* struct flashchip ends here. */ + + chipaddr virtual_memory; /* Some flash devices have an additional register space. */ - chipaddr virtual_memory; chipaddr virtual_registers; };
@@ -203,23 +227,23 @@ extern int verbose; extern const char flashrom_version[]; extern char *chip_to_probe; -void map_flash_registers(struct flashchip *flash); -int read_memmapped(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); -int erase_flash(struct flashchip *flash); -int probe_flash(int startchip, struct flashchip *fill_flash, int force); -int read_flash_to_file(struct flashchip *flash, const char *filename); +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 read_flash_to_file(struct flashctx *flash, const char *filename); int min(int a, int b); int max(int a, int b); void tolower_string(char *str); char *extract_param(char **haystack, const char *needle, const char *delim); -int verify_range(struct flashchip *flash, uint8_t *cmpbuf, unsigned int start, unsigned int len, const char *message); +int verify_range(struct flashctx *flash, uint8_t *cmpbuf, unsigned int start, unsigned int len, const char *message); int need_erase(uint8_t *have, uint8_t *want, unsigned int len, enum write_granularity gran); char *strcat_realloc(char *dest, const char *src); void print_version(void); void print_banner(void); void list_programmers_linebreak(int startcol, int cols, int paren); int selfcheck(void); -int doit(struct flashchip *flash, int force, const char *filename, int read_it, int write_it, int erase_it, int verify_it); +int doit(struct flashctx *flash, int force, const char *filename, int read_it, int write_it, int erase_it, int verify_it); int read_buf_from_file(unsigned char *buf, unsigned long size, const char *filename); int write_buf_to_file(unsigned char *buf, unsigned long size, const char *filename);
@@ -259,7 +283,7 @@ /* layout.c */ int read_romlayout(char *name); int find_romentry(char *name); -int handle_romentries(struct flashchip *flash, uint8_t *oldcontents, uint8_t *newcontents); +int handle_romentries(struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents);
/* spi.c */ struct spi_command { Index: flashrom-struct_flashctx/it87spi.c =================================================================== --- flashrom-struct_flashctx/it87spi.c (Revision 1472) +++ flashrom-struct_flashctx/it87spi.c (Arbeitskopie) @@ -105,9 +105,9 @@
static int it8716f_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); -static int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, +static int it8716f_spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); -static int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, +static int it8716f_spi_chip_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
static const struct spi_programmer spi_programmer_it87xx = { @@ -312,7 +312,7 @@ }
/* Page size is usually 256 bytes */ -static int it8716f_spi_page_program(struct flashchip *flash, uint8_t *buf, +static int it8716f_spi_page_program(struct flashctx *flash, uint8_t *buf, unsigned int start) { unsigned int i; @@ -340,7 +340,7 @@ * IT8716F only allows maximum of 512 kb SPI mapped to LPC memory cycles * Need to read this big flash using firmware cycles 3 byte at a time. */ -static int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, +static int it8716f_spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { fast_spi = 0; @@ -358,7 +358,7 @@ return 0; }
-static int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, +static int it8716f_spi_chip_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { /* Index: flashrom-struct_flashctx/jedec.c =================================================================== --- flashrom-struct_flashctx/jedec.c (Revision 1472) +++ flashrom-struct_flashctx/jedec.c (Arbeitskopie) @@ -91,7 +91,7 @@ msg_cdbg("%s: excessive loops, i=0x%x\n", __func__, i); }
-static unsigned int getaddrmask(struct flashchip *flash) +static unsigned int getaddrmask(struct flashctx *flash) { switch (flash->feature_bits & FEATURE_ADDR_MASK) { case FEATURE_ADDR_FULL: @@ -110,7 +110,7 @@ } }
-static void start_program_jedec_common(struct flashchip *flash, unsigned int mask) +static void start_program_jedec_common(struct flashctx *flash, unsigned int mask) { chipaddr bios = flash->virtual_memory; chip_writeb(0xAA, bios + (0x5555 & mask)); @@ -118,7 +118,7 @@ chip_writeb(0xA0, bios + (0x5555 & mask)); }
-static int probe_jedec_common(struct flashchip *flash, unsigned int mask) +static int probe_jedec_common(struct flashctx *flash, unsigned int mask) { chipaddr bios = flash->virtual_memory; uint8_t id1, id2; @@ -237,7 +237,7 @@ return 1; }
-static int erase_sector_jedec_common(struct flashchip *flash, unsigned int page, +static int erase_sector_jedec_common(struct flashctx *flash, unsigned int page, unsigned int pagesize, unsigned int mask) { chipaddr bios = flash->virtual_memory; @@ -267,7 +267,7 @@ return 0; }
-static int erase_block_jedec_common(struct flashchip *flash, unsigned int block, +static int erase_block_jedec_common(struct flashctx *flash, unsigned int block, unsigned int blocksize, unsigned int mask) { chipaddr bios = flash->virtual_memory; @@ -297,7 +297,7 @@ return 0; }
-static int erase_chip_jedec_common(struct flashchip *flash, unsigned int mask) +static int erase_chip_jedec_common(struct flashctx *flash, unsigned int mask) { chipaddr bios = flash->virtual_memory; int delay_us = 0; @@ -325,7 +325,7 @@ return 0; }
-static int write_byte_program_jedec_common(struct flashchip *flash, uint8_t *src, +static int write_byte_program_jedec_common(struct flashctx *flash, uint8_t *src, chipaddr dst, unsigned int mask) { int tried = 0, failed = 0; @@ -355,7 +355,7 @@ }
/* chunksize is 1 */ -int write_jedec_1(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) +int write_jedec_1(struct flashctx *flash, uint8_t *src, unsigned int start, unsigned int len) { int i, failed = 0; chipaddr dst = flash->virtual_memory + start; @@ -376,7 +376,7 @@ return failed; }
-int write_page_write_jedec_common(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int page_size) +int write_page_write_jedec_common(struct flashctx *flash, uint8_t *src, unsigned int start, unsigned int page_size) { int i, tried = 0, failed; uint8_t *s = src; @@ -424,11 +424,11 @@ * This function is a slightly modified copy of spi_write_chunked. * Each page is written separately in chunks with a maximum size of chunksize. */ -int write_jedec(struct flashchip *flash, uint8_t *buf, unsigned int start, int unsigned len) +int write_jedec(struct flashctx *flash, uint8_t *buf, unsigned int start, int unsigned len) { unsigned int i, starthere, lenhere; /* FIXME: page_size is the wrong variable. We need max_writechunk_size - * in struct flashchip to do this properly. All chips using + * in struct flashctx to do this properly. All chips using * write_jedec have page_size set to max_writechunk_size, so * we're OK for now. */ @@ -458,7 +458,7 @@ }
/* erase chip with block_erase() prototype */ -int erase_chip_block_jedec(struct flashchip *flash, unsigned int addr, +int erase_chip_block_jedec(struct flashctx *flash, unsigned int addr, unsigned int blocksize) { unsigned int mask; @@ -472,7 +472,7 @@ return erase_chip_jedec_common(flash, mask); }
-int probe_jedec(struct flashchip *flash) +int probe_jedec(struct flashctx *flash) { unsigned int mask;
@@ -480,7 +480,7 @@ return probe_jedec_common(flash, mask); }
-int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int size) +int erase_sector_jedec(struct flashctx *flash, unsigned int page, unsigned int size) { unsigned int mask;
@@ -488,7 +488,7 @@ return erase_sector_jedec_common(flash, page, size, mask); }
-int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int size) +int erase_block_jedec(struct flashctx *flash, unsigned int page, unsigned int size) { unsigned int mask;
@@ -496,7 +496,7 @@ return erase_block_jedec_common(flash, page, size, mask); }
-int erase_chip_jedec(struct flashchip *flash) +int erase_chip_jedec(struct flashctx *flash) { unsigned int mask;
Index: flashrom-struct_flashctx/serprog.c =================================================================== --- flashrom-struct_flashctx/serprog.c (Revision 1472) +++ flashrom-struct_flashctx/serprog.c (Arbeitskopie) @@ -302,7 +302,7 @@ static int serprog_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); -static int serprog_spi_read(struct flashchip *flash, uint8_t *buf, +static int serprog_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); static struct spi_programmer spi_programmer_serprog = { .type = SPI_CONTROLLER_SERPROG, @@ -822,7 +822,7 @@ * the advantage that it is much faster for most chips, but breaks those with * non-contiguous address space (like AT45DB161D). When spi_read_chunked is * fixed this method can be removed. */ -static int serprog_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +static int serprog_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { unsigned int i, cur_len; const unsigned int max_read = spi_programmer_serprog.max_data_read; Index: flashrom-struct_flashctx/w39.c =================================================================== --- flashrom-struct_flashctx/w39.c (Revision 1472) +++ flashrom-struct_flashctx/w39.c (Arbeitskopie) @@ -21,7 +21,7 @@
#include "flash.h"
-static int printlock_w39_fwh_block(struct flashchip *flash, unsigned int offset) +static int printlock_w39_fwh_block(struct flashctx *flash, unsigned int offset) { chipaddr wrprotect = flash->virtual_registers + offset + 2; uint8_t locking; @@ -59,7 +59,7 @@ return (locking & ((1 << 2) | (1 << 0))) ? -1 : 0; }
-static int unlock_w39_fwh_block(struct flashchip *flash, unsigned int offset) +static int unlock_w39_fwh_block(struct flashctx *flash, unsigned int offset) { chipaddr wrprotect = flash->virtual_registers + offset + 2; uint8_t locking; @@ -80,7 +80,7 @@ return 0; }
-static uint8_t w39_idmode_readb(struct flashchip *flash, unsigned int offset) +static uint8_t w39_idmode_readb(struct flashctx *flash, unsigned int offset) { chipaddr bios = flash->virtual_memory; uint8_t val; @@ -127,7 +127,7 @@ return 0; }
-static int printlock_w39_common(struct flashchip *flash, unsigned int offset) +static int printlock_w39_common(struct flashctx *flash, unsigned int offset) { uint8_t lock;
@@ -136,7 +136,7 @@ return printlock_w39_tblwp(lock); }
-static int printlock_w39_fwh(struct flashchip *flash) +static int printlock_w39_fwh(struct flashctx *flash) { unsigned int i, total_size = flash->total_size * 1024; int ret = 0; @@ -148,7 +148,7 @@ return ret; }
-static int unlock_w39_fwh(struct flashchip *flash) +static int unlock_w39_fwh(struct flashctx *flash) { unsigned int i, total_size = flash->total_size * 1024; @@ -160,7 +160,7 @@ return 0; }
-int printlock_w39l040(struct flashchip * flash) +int printlock_w39l040(struct flashctx * flash) { uint8_t lock; int ret; @@ -176,7 +176,7 @@ return ret; }
-int printlock_w39v040a(struct flashchip *flash) +int printlock_w39v040a(struct flashctx *flash) { uint8_t lock; int ret = 0; @@ -194,18 +194,18 @@ return ret; }
-int printlock_w39v040b(struct flashchip *flash) +int printlock_w39v040b(struct flashctx *flash) { return printlock_w39_common(flash, 0x7fff2); }
-int printlock_w39v040c(struct flashchip *flash) +int printlock_w39v040c(struct flashctx *flash) { /* Typo in the datasheet? The other chips use 0x7fff2. */ return printlock_w39_common(flash, 0xfff2); }
-int printlock_w39v040fa(struct flashchip *flash) +int printlock_w39v040fa(struct flashctx *flash) { int ret = 0;
@@ -215,7 +215,7 @@ return ret; }
-int printlock_w39v040fb(struct flashchip *flash) +int printlock_w39v040fb(struct flashctx *flash) { int ret = 0;
@@ -225,7 +225,7 @@ return ret; }
-int printlock_w39v040fc(struct flashchip *flash) +int printlock_w39v040fc(struct flashctx *flash) { int ret = 0;
@@ -236,12 +236,12 @@ return ret; }
-int printlock_w39v080a(struct flashchip *flash) +int printlock_w39v080a(struct flashctx *flash) { return printlock_w39_common(flash, 0xffff2); }
-int printlock_w39v080fa(struct flashchip *flash) +int printlock_w39v080fa(struct flashctx *flash) { int ret = 0;
@@ -251,7 +251,7 @@ return ret; }
-int printlock_w39v080fa_dual(struct flashchip *flash) +int printlock_w39v080fa_dual(struct flashctx *flash) { msg_cinfo("Block locking for W39V080FA in dual mode is " "undocumented.\n"); @@ -259,7 +259,7 @@ return -1; }
-int unlock_w39v040fb(struct flashchip *flash) +int unlock_w39v040fb(struct flashctx *flash) { if (unlock_w39_fwh(flash)) return -1; @@ -269,7 +269,7 @@ return 0; }
-int unlock_w39v080fa(struct flashchip *flash) +int unlock_w39v080fa(struct flashctx *flash) { if (unlock_w39_fwh(flash)) return -1; Index: flashrom-struct_flashctx/sst49lfxxxc.c =================================================================== --- flashrom-struct_flashctx/sst49lfxxxc.c (Revision 1472) +++ flashrom-struct_flashctx/sst49lfxxxc.c (Arbeitskopie) @@ -23,7 +23,7 @@ #include "flash.h" #include "chipdrivers.h"
-static int write_lockbits_block_49lfxxxc(struct flashchip *flash, unsigned long address, unsigned char bits) +static int write_lockbits_block_49lfxxxc(struct flashctx *flash, unsigned long address, unsigned char bits) { unsigned long lock = flash->virtual_registers + address + 2; msg_cdbg("lockbits at address=0x%08lx is 0x%01x\n", lock, chip_readb(lock)); @@ -32,7 +32,7 @@ return 0; }
-static int write_lockbits_49lfxxxc(struct flashchip *flash, unsigned char bits) +static int write_lockbits_49lfxxxc(struct flashctx *flash, unsigned char bits) { chipaddr registers = flash->virtual_registers; unsigned int i, left = flash->total_size * 1024; @@ -54,12 +54,12 @@ return 0; }
-int unlock_49lfxxxc(struct flashchip *flash) +int unlock_49lfxxxc(struct flashctx *flash) { return write_lockbits_49lfxxxc(flash, 0); }
-int erase_sector_49lfxxxc(struct flashchip *flash, unsigned int address, unsigned int sector_size) +int erase_sector_49lfxxxc(struct flashctx *flash, unsigned int address, unsigned int sector_size) { uint8_t status; chipaddr bios = flash->virtual_memory; Index: flashrom-struct_flashctx/sharplhf00l04.c =================================================================== --- flashrom-struct_flashctx/sharplhf00l04.c (Revision 1472) +++ flashrom-struct_flashctx/sharplhf00l04.c (Arbeitskopie) @@ -26,7 +26,7 @@ * FIXME: This file is unused. */
-int erase_lhf00l04_block(struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen) +int erase_lhf00l04_block(struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen) { chipaddr bios = flash->virtual_memory + blockaddr; chipaddr wrprotect = flash->virtual_registers + blockaddr + 2; Index: flashrom-struct_flashctx/a25.c =================================================================== --- flashrom-struct_flashctx/a25.c (Revision 1472) +++ flashrom-struct_flashctx/a25.c (Arbeitskopie) @@ -29,7 +29,7 @@ "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); }
-int spi_prettyprint_status_register_amic_a25l05p(struct flashchip *flash) +int spi_prettyprint_status_register_amic_a25l05p(struct flashctx *flash) { uint8_t status;
@@ -45,7 +45,7 @@ return 0; }
-int spi_prettyprint_status_register_amic_a25l40p(struct flashchip *flash) +int spi_prettyprint_status_register_amic_a25l40p(struct flashctx *flash) { uint8_t status;
@@ -60,7 +60,7 @@ return 0; }
-int spi_prettyprint_status_register_amic_a25l032(struct flashchip *flash) +int spi_prettyprint_status_register_amic_a25l032(struct flashctx *flash) { uint8_t status;
@@ -78,7 +78,7 @@ return 0; }
-int spi_prettyprint_status_register_amic_a25lq032(struct flashchip *flash) +int spi_prettyprint_status_register_amic_a25lq032(struct flashctx *flash) { uint8_t status;
Index: flashrom-struct_flashctx/dummyflasher.c =================================================================== --- flashrom-struct_flashctx/dummyflasher.c (Revision 1472) +++ flashrom-struct_flashctx/dummyflasher.c (Arbeitskopie) @@ -62,7 +62,7 @@
static int dummy_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); -static int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, +static int dummy_spi_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
static const struct spi_programmer spi_programmer_dummyflasher = { @@ -548,7 +548,7 @@ return 0; }
-static int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, +static int dummy_spi_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { return spi_write_chunked(flash, buf, start, len, Index: flashrom-struct_flashctx/sst_fwhub.c =================================================================== --- flashrom-struct_flashctx/sst_fwhub.c (Revision 1472) +++ flashrom-struct_flashctx/sst_fwhub.c (Arbeitskopie) @@ -24,7 +24,7 @@
#include "flash.h"
-static int check_sst_fwhub_block_lock(struct flashchip *flash, int offset) +static int check_sst_fwhub_block_lock(struct flashctx *flash, int offset) { chipaddr registers = flash->virtual_registers; uint8_t blockstatus; @@ -50,7 +50,7 @@ return blockstatus & 0x1; }
-static int clear_sst_fwhub_block_lock(struct flashchip *flash, int offset) +static int clear_sst_fwhub_block_lock(struct flashctx *flash, int offset) { chipaddr registers = flash->virtual_registers; uint8_t blockstatus; @@ -68,7 +68,7 @@ return blockstatus; }
-int printlock_sst_fwhub(struct flashchip *flash) +int printlock_sst_fwhub(struct flashctx *flash) { int i;
@@ -78,7 +78,7 @@ return 0; }
-int unlock_sst_fwhub(struct flashchip *flash) +int unlock_sst_fwhub(struct flashctx *flash) { int i, ret=0;
Index: flashrom-struct_flashctx/cli_classic.c =================================================================== --- flashrom-struct_flashctx/cli_classic.c (Revision 1472) +++ flashrom-struct_flashctx/cli_classic.c (Arbeitskopie) @@ -169,8 +169,8 @@ unsigned long size; /* Probe for up to three flash chips. */ const struct flashchip *flash; - struct flashchip flashes[3]; - struct flashchip *fill_flash; + struct flashctx flashes[3]; + struct flashctx *fill_flash; const char *name; int namelen, opt, i; int startchip = 0, chipcount = 0, option_index = 0, force = 0; @@ -409,6 +409,7 @@ } #endif
+ /* Does a chip with the requested name exist in the flashchips array? */ if (chip_to_probe) { for (flash = flashchips; flash && flash->name; flash++) if (!strcmp(flash->name, chip_to_probe)) Index: flashrom-struct_flashctx/at25.c =================================================================== --- flashrom-struct_flashctx/at25.c (Revision 1472) +++ flashrom-struct_flashctx/at25.c (Arbeitskopie) @@ -57,7 +57,7 @@ } }
-int spi_prettyprint_status_register_at25df(struct flashchip *flash) +int spi_prettyprint_status_register_at25df(struct flashctx *flash) { uint8_t status;
@@ -72,7 +72,7 @@ return 0; }
-int spi_prettyprint_status_register_at25df_sec(struct flashchip *flash) +int spi_prettyprint_status_register_at25df_sec(struct flashctx *flash) { /* FIXME: We should check the security lockdown. */ msg_cdbg("Ignoring security lockdown (if present)\n"); @@ -80,7 +80,7 @@ return spi_prettyprint_status_register_at25df(flash); }
-int spi_prettyprint_status_register_at25f(struct flashchip *flash) +int spi_prettyprint_status_register_at25f(struct flashctx *flash) { uint8_t status;
@@ -99,7 +99,7 @@ return 0; }
-int spi_prettyprint_status_register_at25fs010(struct flashchip *flash) +int spi_prettyprint_status_register_at25fs010(struct flashctx *flash) { uint8_t status;
@@ -123,7 +123,7 @@ return 0; }
-int spi_prettyprint_status_register_at25fs040(struct flashchip *flash) +int spi_prettyprint_status_register_at25fs040(struct flashctx *flash) { uint8_t status;
@@ -147,7 +147,7 @@ return 0; }
-int spi_prettyprint_status_register_atmel_at26df081a(struct flashchip *flash) +int spi_prettyprint_status_register_atmel_at26df081a(struct flashctx *flash) { uint8_t status;
@@ -163,7 +163,7 @@ return 0; }
-int spi_disable_blockprotect_at25df(struct flashchip *flash) +int spi_disable_blockprotect_at25df(struct flashctx *flash) { uint8_t status; int result; @@ -203,14 +203,14 @@ return 0; }
-int spi_disable_blockprotect_at25df_sec(struct flashchip *flash) +int spi_disable_blockprotect_at25df_sec(struct flashctx *flash) { /* FIXME: We should check the security lockdown. */ msg_cinfo("Ignoring security lockdown (if present)\n"); return spi_disable_blockprotect_at25df(flash); }
-int spi_disable_blockprotect_at25f(struct flashchip *flash) +int spi_disable_blockprotect_at25f(struct flashctx *flash) { /* spi_disable_blockprotect_at25df is not really the right way to do * this, but the side effects of said function work here as well. @@ -218,7 +218,7 @@ return spi_disable_blockprotect_at25df(flash); }
-int spi_disable_blockprotect_at25fs010(struct flashchip *flash) +int spi_disable_blockprotect_at25fs010(struct flashctx *flash) { uint8_t status; int result; @@ -252,7 +252,7 @@ return 0; }
-int spi_disable_blockprotect_at25fs040(struct flashchip *flash) +int spi_disable_blockprotect_at25fs040(struct flashctx *flash) { uint8_t status; int result; Index: flashrom-struct_flashctx/layout.c =================================================================== --- flashrom-struct_flashctx/layout.c (Revision 1472) +++ flashrom-struct_flashctx/layout.c (Arbeitskopie) @@ -240,7 +240,7 @@ return best_entry; }
-int handle_romentries(struct flashchip *flash, uint8_t *oldcontents, uint8_t *newcontents) +int handle_romentries(struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents) { unsigned int start = 0; int entry; Index: flashrom-struct_flashctx/ichspi.c =================================================================== --- flashrom-struct_flashctx/ichspi.c (Revision 1472) +++ flashrom-struct_flashctx/ichspi.c (Arbeitskopie) @@ -1175,7 +1175,7 @@ return 0; }
-int ich_hwseq_probe(struct flashchip *flash) +int ich_hwseq_probe(struct flashctx *flash) { uint32_t total_size, boundary; uint32_t erase_size_low, size_low, erase_size_high, size_high; @@ -1228,7 +1228,7 @@ return 1; }
-int ich_hwseq_block_erase(struct flashchip *flash, +int ich_hwseq_block_erase(struct flashctx *flash, unsigned int addr, unsigned int len) { @@ -1278,7 +1278,7 @@ return 0; }
-int ich_hwseq_read(struct flashchip *flash, uint8_t *buf, unsigned int addr, +int ich_hwseq_read(struct flashctx *flash, uint8_t *buf, unsigned int addr, unsigned int len) { uint16_t hsfc; @@ -1316,7 +1316,7 @@ return 0; }
-int ich_hwseq_write(struct flashchip *flash, uint8_t *buf, unsigned int addr, +int ich_hwseq_write(struct flashctx *flash, uint8_t *buf, unsigned int addr, unsigned int len) { uint16_t hsfc; Index: flashrom-struct_flashctx/82802ab.c =================================================================== --- flashrom-struct_flashctx/82802ab.c (Revision 1472) +++ flashrom-struct_flashctx/82802ab.c (Arbeitskopie) @@ -40,7 +40,7 @@ msg_cdbg("%s", status & 0x2 ? "WP|TBL#|WP#,ABORT:" : "UNLOCK:"); }
-int probe_82802ab(struct flashchip *flash) +int probe_82802ab(struct flashctx *flash) { chipaddr bios = flash->virtual_memory; uint8_t id1, id2, flashcontent1, flashcontent2; @@ -89,7 +89,7 @@ return 1; }
-uint8_t wait_82802ab(struct flashchip *flash) +uint8_t wait_82802ab(struct flashctx *flash) { uint8_t status; chipaddr bios = flash->virtual_memory; @@ -107,7 +107,7 @@ return status; }
-int unlock_82802ab(struct flashchip *flash) +int unlock_82802ab(struct flashctx *flash) { int i; //chipaddr wrprotect = flash->virtual_registers + page + 2; @@ -118,7 +118,7 @@ return 0; }
-int erase_block_82802ab(struct flashchip *flash, unsigned int page, +int erase_block_82802ab(struct flashctx *flash, unsigned int page, unsigned int pagesize) { chipaddr bios = flash->virtual_memory; @@ -141,7 +141,7 @@ }
/* chunksize is 1 */ -int write_82802ab(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) +int write_82802ab(struct flashctx *flash, uint8_t *src, unsigned int start, unsigned int len) { int i; chipaddr dst = flash->virtual_memory + start; @@ -157,7 +157,7 @@ return 0; }
-int unlock_28f004s5(struct flashchip *flash) +int unlock_28f004s5(struct flashctx *flash) { chipaddr bios = flash->virtual_memory; uint8_t mcfg, bcfg, need_unlock = 0, can_unlock = 0; @@ -209,7 +209,7 @@ return 0; }
-int unlock_lh28f008bjt(struct flashchip *flash) +int unlock_lh28f008bjt(struct flashctx *flash) { chipaddr bios = flash->virtual_memory; uint8_t mcfg, bcfg; Index: flashrom-struct_flashctx/opaque.c =================================================================== --- flashrom-struct_flashctx/opaque.c (Revision 1472) +++ flashrom-struct_flashctx/opaque.c (Arbeitskopie) @@ -41,7 +41,7 @@
const struct opaque_programmer *opaque_programmer = &opaque_programmer_none;
-int probe_opaque(struct flashchip *flash) +int probe_opaque(struct flashctx *flash) { if (!opaque_programmer->probe) { msg_perr("%s called before register_opaque_programmer. " @@ -53,7 +53,7 @@ return opaque_programmer->probe(flash); }
-int read_opaque(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int read_opaque(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { if (!opaque_programmer->read) { msg_perr("%s called before register_opaque_programmer. " @@ -64,7 +64,7 @@ return opaque_programmer->read(flash, buf, start, len); }
-int write_opaque(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int write_opaque(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { if (!opaque_programmer->write) { msg_perr("%s called before register_opaque_programmer. " @@ -75,7 +75,7 @@ return opaque_programmer->write(flash, buf, start, len); }
-int erase_opaque(struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen) +int erase_opaque(struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen) { if (!opaque_programmer->erase) { msg_perr("%s called before register_opaque_programmer. " Index: flashrom-struct_flashctx/dediprog.c =================================================================== --- flashrom-struct_flashctx/dediprog.c (Revision 1472) +++ flashrom-struct_flashctx/dediprog.c (Arbeitskopie) @@ -205,7 +205,7 @@ * @len length * @return 0 on success, 1 on failure */ -static int dediprog_spi_bulk_read(struct flashchip *flash, uint8_t *buf, +static int dediprog_spi_bulk_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { int ret; @@ -253,7 +253,7 @@ return 0; }
-static int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, +static int dediprog_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { int ret; @@ -299,7 +299,7 @@ return 0; }
-static int dediprog_spi_write_256(struct flashchip *flash, uint8_t *buf, +static int dediprog_spi_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { int ret; Index: flashrom-struct_flashctx/spi25.c =================================================================== --- flashrom-struct_flashctx/spi25.c (Revision 1472) +++ flashrom-struct_flashctx/spi25.c (Arbeitskopie) @@ -113,7 +113,7 @@ return spi_send_command(sizeof(cmd), 0, cmd, NULL); }
-static int probe_spi_rdid_generic(struct flashchip *flash, int bytes) +static int probe_spi_rdid_generic(struct flashctx *flash, int bytes) { unsigned char readarr[4]; uint32_t id1; @@ -167,12 +167,12 @@ return 0; }
-int probe_spi_rdid(struct flashchip *flash) +int probe_spi_rdid(struct flashctx *flash) { return probe_spi_rdid_generic(flash, 3); }
-int probe_spi_rdid4(struct flashchip *flash) +int probe_spi_rdid4(struct flashctx *flash) { /* Some SPI controllers do not support commands with writecnt=1 and * readcnt=4. @@ -194,7 +194,7 @@ return 0; }
-int probe_spi_rems(struct flashchip *flash) +int probe_spi_rems(struct flashctx *flash) { unsigned char readarr[JEDEC_REMS_INSIZE]; uint32_t id1, id2; @@ -230,7 +230,7 @@ return 0; }
-int probe_spi_res1(struct flashchip *flash) +int probe_spi_res1(struct flashctx *flash) { static const unsigned char allff[] = {0xff, 0xff, 0xff}; static const unsigned char all00[] = {0x00, 0x00, 0x00}; @@ -274,7 +274,7 @@ return 1; }
-int probe_spi_res2(struct flashchip *flash) +int probe_spi_res2(struct flashctx *flash) { unsigned char readarr[2]; uint32_t id1, id2; @@ -410,7 +410,7 @@ bpt[(status & 0x1c) >> 2]); }
-int spi_prettyprint_status_register(struct flashchip *flash) +int spi_prettyprint_status_register(struct flashctx *flash) { uint8_t status;
@@ -444,7 +444,7 @@ return 0; }
-int spi_chip_erase_60(struct flashchip *flash) +int spi_chip_erase_60(struct flashctx *flash) { int result; struct spi_command cmds[] = { @@ -481,7 +481,7 @@ return 0; }
-int spi_chip_erase_c7(struct flashchip *flash) +int spi_chip_erase_c7(struct flashctx *flash) { int result; struct spi_command cmds[] = { @@ -517,7 +517,7 @@ return 0; }
-int spi_block_erase_52(struct flashchip *flash, unsigned int addr, unsigned int blocklen) +int spi_block_erase_52(struct flashctx *flash, unsigned int addr, unsigned int blocklen) { int result; struct spi_command cmds[] = { @@ -563,7 +563,7 @@ * 32k for SST * 4-32k non-uniform for EON */ -int spi_block_erase_d8(struct flashchip *flash, unsigned int addr, unsigned int blocklen) +int spi_block_erase_d8(struct flashctx *flash, unsigned int addr, unsigned int blocklen) { int result; struct spi_command cmds[] = { @@ -607,7 +607,7 @@ /* Block size is usually * 4k for PMC */ -int spi_block_erase_d7(struct flashchip *flash, unsigned int addr, unsigned int blocklen) +int spi_block_erase_d7(struct flashctx *flash, unsigned int addr, unsigned int blocklen) { int result; struct spi_command cmds[] = { @@ -649,7 +649,7 @@ }
/* Sector size is usually 4k, though Macronix eliteflash has 64k */ -int spi_block_erase_20(struct flashchip *flash, unsigned int addr, unsigned int blocklen) +int spi_block_erase_20(struct flashctx *flash, unsigned int addr, unsigned int blocklen) { int result; struct spi_command cmds[] = { @@ -690,7 +690,7 @@ return 0; }
-int spi_block_erase_60(struct flashchip *flash, unsigned int addr, unsigned int blocklen) +int spi_block_erase_60(struct flashctx *flash, unsigned int addr, unsigned int blocklen) { if ((addr != 0) || (blocklen != flash->total_size * 1024)) { msg_cerr("%s called with incorrect arguments\n", @@ -700,7 +700,7 @@ return spi_chip_erase_60(flash); }
-int spi_block_erase_c7(struct flashchip *flash, unsigned int addr, unsigned int blocklen) +int spi_block_erase_c7(struct flashctx *flash, unsigned int addr, unsigned int blocklen) { if ((addr != 0) || (blocklen != flash->total_size * 1024)) { msg_cerr("%s called with incorrect arguments\n", @@ -728,7 +728,7 @@ * This is according the SST25VF016 datasheet, who knows it is more * generic that this... */ -static int spi_write_status_register_ewsr(struct flashchip *flash, int status) +static int spi_write_status_register_ewsr(struct flashctx *flash, int status) { int result; int i = 0; @@ -776,7 +776,7 @@ return 0; }
-static int spi_write_status_register_wren(struct flashchip *flash, int status) +static int spi_write_status_register_wren(struct flashctx *flash, int status) { int result; int i = 0; @@ -824,7 +824,7 @@ return 0; }
-int spi_write_status_register(struct flashchip *flash, int status) +int spi_write_status_register(struct flashctx *flash, int status) { int ret = 1;
@@ -926,7 +926,7 @@ * Write 0x00 to the status register. Check if any locks are still set (that * part is chip specific). Repeat once. */ -int spi_disable_blockprotect(struct flashchip *flash) +int spi_disable_blockprotect(struct flashctx *flash) { uint8_t status; int result; @@ -968,7 +968,7 @@ * FIXME: Use the chunk code from Michael Karcher instead. * Each page is read separately in chunks with a maximum size of chunksize. */ -int spi_read_chunked(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize) +int spi_read_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize) { int rc = 0; unsigned int i, j, starthere, lenhere, toread; @@ -1007,12 +1007,12 @@ * FIXME: Use the chunk code from Michael Karcher instead. * Each page is written separately in chunks with a maximum size of chunksize. */ -int spi_write_chunked(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize) +int spi_write_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize) { int rc = 0; unsigned int i, j, starthere, lenhere, towrite; /* FIXME: page_size is the wrong variable. We need max_writechunk_size - * in struct flashchip to do this properly. All chips using + * in struct flashctx to do this properly. All chips using * spi_chip_write_256 have page_size set to max_writechunk_size, so * we're OK for now. */ @@ -1055,7 +1055,7 @@ * (e.g. due to size constraints in IT87* for over 512 kB) */ /* real chunksize is 1, logical chunksize is 1 */ -int spi_chip_write_1(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int spi_chip_write_1(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { unsigned int i; int result = 0; @@ -1071,7 +1071,7 @@ return 0; }
-int spi_aai_write(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int spi_aai_write(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { uint32_t pos = start; int result; Index: flashrom-struct_flashctx/pm49fl00x.c =================================================================== --- flashrom-struct_flashctx/pm49fl00x.c (Revision 1472) +++ flashrom-struct_flashctx/pm49fl00x.c (Arbeitskopie) @@ -36,13 +36,13 @@ } }
-int unlock_49fl00x(struct flashchip *flash) +int unlock_49fl00x(struct flashctx *flash) { write_lockbits_49fl00x(flash->virtual_registers, flash->total_size * 1024, 0, flash->page_size); return 0; }
-int lock_49fl00x(struct flashchip *flash) +int lock_49fl00x(struct flashctx *flash) { write_lockbits_49fl00x(flash->virtual_registers, flash->total_size * 1024, 1, flash->page_size); return 0; Index: flashrom-struct_flashctx/linux_spi.c =================================================================== --- flashrom-struct_flashctx/linux_spi.c (Revision 1472) +++ flashrom-struct_flashctx/linux_spi.c (Arbeitskopie) @@ -36,9 +36,9 @@ static int linux_spi_shutdown(void *data); static int linux_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *txbuf, unsigned char *rxbuf); -static int linux_spi_read(struct flashchip *flash, uint8_t *buf, +static int linux_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); -static int linux_spi_write_256(struct flashchip *flash, uint8_t *buf, +static int linux_spi_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
static const struct spi_programmer spi_programmer_linux = { @@ -131,13 +131,13 @@ return 0; }
-static int linux_spi_read(struct flashchip *flash, uint8_t *buf, +static int linux_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { return spi_read_chunked(flash, buf, start, len, (unsigned)getpagesize()); }
-static int linux_spi_write_256(struct flashchip *flash, uint8_t *buf, +static int linux_spi_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { return spi_write_chunked(flash, buf, start, len, ((unsigned)getpagesize()) - 4); Index: flashrom-struct_flashctx/w29ee011.c =================================================================== --- flashrom-struct_flashctx/w29ee011.c (Revision 1472) +++ flashrom-struct_flashctx/w29ee011.c (Arbeitskopie) @@ -24,7 +24,7 @@ /* According to the Winbond W29EE011, W29EE012, W29C010M, W29C011A * datasheets this is the only valid probe function for those chips. */ -int probe_w29ee011(struct flashchip *flash) +int probe_w29ee011(struct flashctx *flash) { chipaddr bios = flash->virtual_memory; uint8_t id1, id2; Index: flashrom-struct_flashctx/spi.c =================================================================== --- flashrom-struct_flashctx/spi.c (Revision 1472) +++ flashrom-struct_flashctx/spi.c (Arbeitskopie) @@ -97,7 +97,7 @@ return result; }
-int default_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int default_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { unsigned int max_data = spi_programmer->max_data_read; if (max_data == MAX_DATA_UNSPECIFIED) { @@ -109,7 +109,7 @@ return spi_read_chunked(flash, buf, start, len, max_data); }
-int default_spi_write_256(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int default_spi_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { unsigned int max_data = spi_programmer->max_data_write; if (max_data == MAX_DATA_UNSPECIFIED) { @@ -121,7 +121,7 @@ return spi_write_chunked(flash, buf, start, len, max_data); }
-int spi_chip_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { unsigned int addrbase = 0; if (!spi_programmer->read) { @@ -160,7 +160,7 @@ * .write_256 = spi_chip_write_1 */ /* real chunksize is up to 256, logical chunksize is 256 */ -int spi_chip_write_256(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int spi_chip_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { if (!spi_programmer->write_256) { msg_perr("%s called, but SPI page write is unsupported on this " Index: flashrom-struct_flashctx/wbsio_spi.c =================================================================== --- flashrom-struct_flashctx/wbsio_spi.c (Revision 1472) +++ flashrom-struct_flashctx/wbsio_spi.c (Arbeitskopie) @@ -62,7 +62,7 @@
static int wbsio_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); -static int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); +static int wbsio_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
static const struct spi_programmer spi_programmer_wbsio = { .type = SPI_CONTROLLER_WBSIO, @@ -194,7 +194,7 @@ return 0; }
-static int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +static int wbsio_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { return read_memmapped(flash, buf, start, len); } Index: flashrom-struct_flashctx/sst28sf040.c =================================================================== --- flashrom-struct_flashctx/sst28sf040.c (Revision 1472) +++ flashrom-struct_flashctx/sst28sf040.c (Arbeitskopie) @@ -30,7 +30,7 @@ #define RESET 0xFF #define READ_ID 0x90
-int protect_28sf040(struct flashchip *flash) +int protect_28sf040(struct flashctx *flash) { chipaddr bios = flash->virtual_memory;
@@ -45,7 +45,7 @@ return 0; }
-int unprotect_28sf040(struct flashchip *flash) +int unprotect_28sf040(struct flashctx *flash) { chipaddr bios = flash->virtual_memory;
@@ -60,7 +60,7 @@ return 0; }
-int erase_sector_28sf040(struct flashchip *flash, unsigned int address, unsigned int sector_size) +int erase_sector_28sf040(struct flashctx *flash, unsigned int address, unsigned int sector_size) { chipaddr bios = flash->virtual_memory;
@@ -76,7 +76,7 @@ }
/* chunksize is 1 */ -int write_28sf040(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) +int write_28sf040(struct flashctx *flash, uint8_t *src, unsigned int start, unsigned int len) { int i; chipaddr bios = flash->virtual_memory; @@ -100,7 +100,7 @@ return 0; }
-static int erase_28sf040(struct flashchip *flash) +static int erase_28sf040(struct flashctx *flash) { chipaddr bios = flash->virtual_memory;
@@ -114,7 +114,7 @@ return 0; }
-int erase_chip_28sf040(struct flashchip *flash, unsigned int addr, unsigned int blocklen) +int erase_chip_28sf040(struct flashctx *flash, unsigned int addr, unsigned int blocklen) { if ((addr != 0) || (blocklen != flash->total_size * 1024)) { msg_cerr("%s called with incorrect arguments\n", Index: flashrom-struct_flashctx/stm50flw0x0x.c =================================================================== --- flashrom-struct_flashctx/stm50flw0x0x.c (Revision 1472) +++ flashrom-struct_flashctx/stm50flw0x0x.c (Arbeitskopie) @@ -36,7 +36,7 @@ * The ST M50FLW080B and STM50FLW080B chips have to be unlocked, * before you can erase them or write to them. */ -static int unlock_block_stm50flw0x0x(struct flashchip *flash, int offset) +static int unlock_block_stm50flw0x0x(struct flashctx *flash, int offset) { chipaddr wrprotect = flash->virtual_registers + 2; static const uint8_t unlock_sector = 0x00; @@ -79,7 +79,7 @@ return 0; }
-int unlock_stm50flw0x0x(struct flashchip *flash) +int unlock_stm50flw0x0x(struct flashctx *flash) { int i;
@@ -94,7 +94,7 @@ }
/* This function is unused. */ -int erase_sector_stm50flw0x0x(struct flashchip *flash, unsigned int sector, unsigned int sectorsize) +int erase_sector_stm50flw0x0x(struct flashctx *flash, unsigned int sector, unsigned int sectorsize) { chipaddr bios = flash->virtual_memory + sector;
Index: flashrom-struct_flashctx/flashrom.c =================================================================== --- flashrom-struct_flashctx/flashrom.c (Revision 1472) +++ flashrom-struct_flashctx/flashrom.c (Arbeitskopie) @@ -268,7 +268,7 @@ */ static int may_register_shutdown = 0;
-static int check_block_eraser(const struct flashchip *flash, int k, int log); +static int check_block_eraser(const struct flashctx *flash, int k, int log);
/* Register a function to be executed on programmer shutdown. * The advantage over atexit() is that you can supply a void pointer which will @@ -404,7 +404,7 @@ programmer_table[programmer].delay(usecs); }
-void map_flash_registers(struct flashchip *flash) +void map_flash_registers(struct flashctx *flash) { size_t size = flash->total_size * 1024; /* Flash registers live 4 MByte below the flash. */ @@ -412,7 +412,7 @@ flash->virtual_registers = (chipaddr)programmer_map_flash_region("flash chip registers", (0xFFFFFFFF - 0x400000 - size + 1), size); }
-int read_memmapped(struct flashchip *flash, uint8_t *buf, unsigned int start, int unsigned len) +int read_memmapped(struct flashctx *flash, uint8_t *buf, unsigned int start, int unsigned len) { chip_readn(buf, flash->virtual_memory + start, len);
@@ -523,7 +523,7 @@ }
/* Returns the number of well-defined erasers for a chip. */ -static unsigned int count_usable_erasers(const struct flashchip *flash) +static unsigned int count_usable_erasers(const struct flashctx *flash) { unsigned int usable_erasefunctions = 0; int k; @@ -535,7 +535,7 @@ }
/* start is an offset to the base address of the flash chip */ -int check_erased_range(struct flashchip *flash, unsigned int start, unsigned int len) +int check_erased_range(struct flashctx *flash, unsigned int start, unsigned int len) { int ret; uint8_t *cmpbuf = malloc(len); @@ -558,7 +558,7 @@ * @message string to print in the "FAILED" message * @return 0 for success, -1 for failure */ -int verify_range(struct flashchip *flash, uint8_t *cmpbuf, unsigned int start, unsigned int len, +int verify_range(struct flashctx *flash, uint8_t *cmpbuf, unsigned int start, unsigned int len, const char *message) { unsigned int i; @@ -938,7 +938,7 @@ return 1; }
-int probe_flash(int startchip, struct flashchip *fill_flash, int force) +int probe_flash(int startchip, struct flashctx *fill_flash, int force) { const struct flashchip *flash; unsigned long base = 0; @@ -976,7 +976,7 @@ check_max_decode(buses_common, size);
/* Start filling in the dynamic data. */ - *fill_flash = *flash; + memcpy(fill_flash, flash, sizeof(struct flashchip));
base = flashbase ? flashbase : (0xffffffff - size + 1); fill_flash->virtual_memory = (chipaddr)programmer_map_flash_region("flash chip", base, size); @@ -1029,7 +1029,7 @@ return flash - flashchips; }
-int verify_flash(struct flashchip *flash, uint8_t *buf) +int verify_flash(struct flashctx *flash, uint8_t *buf) { int ret; unsigned int total_size = flash->total_size * 1024; @@ -1103,7 +1103,7 @@ return 0; }
-int read_flash_to_file(struct flashchip *flash, const char *filename) +int read_flash_to_file(struct flashctx *flash, const char *filename) { unsigned long size = flash->total_size * 1024; unsigned char *buf = calloc(size, sizeof(char)); @@ -1202,11 +1202,11 @@ return ret; }
-static int erase_and_write_block_helper(struct flashchip *flash, +static int erase_and_write_block_helper(struct flashctx *flash, unsigned int start, unsigned int len, uint8_t *curcontents, uint8_t *newcontents, - int (*erasefn) (struct flashchip *flash, + int (*erasefn) (struct flashctx *flash, unsigned int addr, unsigned int len)) { @@ -1253,14 +1253,14 @@ return ret; }
-static int walk_eraseregions(struct flashchip *flash, int erasefunction, - int (*do_something) (struct flashchip *flash, +static int walk_eraseregions(struct flashctx *flash, int erasefunction, + int (*do_something) (struct flashctx *flash, unsigned int addr, unsigned int len, uint8_t *param1, uint8_t *param2, int (*erasefn) ( - struct flashchip *flash, + struct flashctx *flash, unsigned int addr, unsigned int len)), void *param1, void *param2) @@ -1292,7 +1292,7 @@ return 0; }
-static int check_block_eraser(const struct flashchip *flash, int k, int log) +static int check_block_eraser(const struct flashctx *flash, int k, int log) { struct block_eraser eraser = flash->block_erasers[k];
@@ -1316,7 +1316,7 @@ return 0; }
-int erase_and_write_flash(struct flashchip *flash, uint8_t *oldcontents, +int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents) { int k, ret = 1; @@ -1534,6 +1534,13 @@ msg_gerr("Flashchips table miscompilation!\n"); ret = 1; } + /* Check that virtual_memory in struct flashctx is placed directly + * after the members copied from struct flashchip. + */ + if (sizeof(struct flashchip) != offsetof(struct flashctx, virtual_memory)) { + msg_gerr("struct flashctx broken!\n"); + ret = 1; + } for (flash = flashchips; flash && flash->name; flash++) if (selfcheck_eraseblocks(flash)) ret = 1; @@ -1559,7 +1566,7 @@ return ret; }
-void check_chip_supported(const struct flashchip *flash) +void check_chip_supported(const struct flashctx *flash) { if (TEST_OK_MASK != (flash->tested & TEST_OK_MASK)) { msg_cinfo("===\n"); @@ -1611,7 +1618,7 @@ /* FIXME: This function signature needs to be improved once doit() has a better * function signature. */ -int chip_safety_check(struct flashchip *flash, int force, int read_it, int write_it, int erase_it, int verify_it) +int chip_safety_check(struct flashctx *flash, int force, int read_it, int write_it, int erase_it, int verify_it) { if (!programmer_may_write && (write_it || erase_it)) { msg_perr("Write/erase is not working yet on your programmer in " @@ -1672,7 +1679,7 @@ * but right now it allows us to split off the CLI code. * Besides that, the function itself is a textbook example of abysmal code flow. */ -int doit(struct flashchip *flash, int force, const char *filename, int read_it, int write_it, int erase_it, int verify_it) +int doit(struct flashctx *flash, int force, const char *filename, int read_it, int write_it, int erase_it, int verify_it) { uint8_t *oldcontents; uint8_t *newcontents; Index: flashrom-struct_flashctx/programmer.h =================================================================== --- flashrom-struct_flashctx/programmer.h (Revision 1472) +++ flashrom-struct_flashctx/programmer.h (Arbeitskopie) @@ -24,7 +24,7 @@ #ifndef __PROGRAMMER_H__ #define __PROGRAMMER_H__ 1
-#include "flash.h" /* for chipaddr and flashchip */ +#include "flash.h" /* for chipaddr and flashctx */
enum programmer { #if CONFIG_INTERNAL == 1 @@ -513,7 +513,7 @@ extern struct decode_sizes max_rom_decode; extern int programmer_may_write; extern unsigned long flashbase; -void check_chip_supported(const struct flashchip *flash); +void check_chip_supported(const struct flashctx *flash); int check_max_decode(enum chipbustype buses, uint32_t size); char *extract_programmer_param(const char *param_name);
@@ -570,16 +570,16 @@ int (*multicommand)(struct spi_command *cmds);
/* Optimized functions for this programmer */ - int (*read)(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); - int (*write_256)(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); + int (*read)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); + int (*write_256)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); };
extern const struct spi_programmer *spi_programmer; int default_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); int default_spi_send_multicommand(struct spi_command *cmds); -int default_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); -int default_spi_write_256(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); +int default_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); +int default_spi_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); void register_spi_programmer(const struct spi_programmer *programmer);
/* ichspi.c */ @@ -624,10 +624,10 @@ int max_data_read; int max_data_write; /* Specific functions for this programmer */ - int (*probe) (struct flashchip *flash); - int (*read) (struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); - int (*write) (struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); - int (*erase) (struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen); + int (*probe) (struct flashctx *flash); + int (*read) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); + int (*write) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); + int (*erase) (struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen); }; extern const struct opaque_programmer *opaque_programmer; void register_opaque_programmer(const struct opaque_programmer *pgm); Index: flashrom-struct_flashctx/chipdrivers.h =================================================================== --- flashrom-struct_flashctx/chipdrivers.h (Revision 1472) +++ flashrom-struct_flashctx/chipdrivers.h (Arbeitskopie) @@ -19,79 +19,79 @@ * * Header file for flash chip drivers. Included from flash.h. * As a general rule, every function listed here should take a pointer to - * struct flashchip as first parameter. + * struct flashctx as first parameter. */
#ifndef __CHIPDRIVERS_H__ #define __CHIPDRIVERS_H__ 1
-#include "flash.h" /* for chipaddr and flashchip */ +#include "flash.h" /* for chipaddr and flashctx */
/* spi.c, should probably be in spi_chip.c */ -int probe_spi_rdid(struct flashchip *flash); -int probe_spi_rdid4(struct flashchip *flash); -int probe_spi_rems(struct flashchip *flash); -int probe_spi_res1(struct flashchip *flash); -int probe_spi_res2(struct flashchip *flash); +int probe_spi_rdid(struct flashctx *flash); +int probe_spi_rdid4(struct flashctx *flash); +int probe_spi_rems(struct flashctx *flash); +int probe_spi_res1(struct flashctx *flash); +int probe_spi_res2(struct flashctx *flash); int spi_write_enable(void); int spi_write_disable(void); -int spi_block_erase_20(struct flashchip *flash, unsigned int addr, unsigned int blocklen); -int spi_block_erase_52(struct flashchip *flash, unsigned int addr, unsigned int blocklen); -int spi_block_erase_d7(struct flashchip *flash, unsigned int addr, unsigned int blocklen); -int spi_block_erase_d8(struct flashchip *flash, unsigned int addr, unsigned int blocklen); -int spi_block_erase_60(struct flashchip *flash, unsigned int addr, unsigned int blocklen); -int spi_block_erase_c7(struct flashchip *flash, unsigned int addr, unsigned int blocklen); -int spi_chip_write_1(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); -int spi_chip_write_256(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); -int spi_chip_read(struct flashchip *flash, uint8_t *buf, unsigned int start, int unsigned len); +int spi_block_erase_20(struct flashctx *flash, unsigned int addr, unsigned int blocklen); +int spi_block_erase_52(struct flashctx *flash, unsigned int addr, unsigned int blocklen); +int spi_block_erase_d7(struct flashctx *flash, unsigned int addr, unsigned int blocklen); +int spi_block_erase_d8(struct flashctx *flash, unsigned int addr, unsigned int blocklen); +int spi_block_erase_60(struct flashctx *flash, unsigned int addr, unsigned int blocklen); +int spi_block_erase_c7(struct flashctx *flash, unsigned int addr, unsigned int blocklen); +int spi_chip_write_1(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); +int spi_chip_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); +int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, int unsigned len); uint8_t spi_read_status_register(void); -int spi_write_status_register(struct flashchip *flash, int status); +int spi_write_status_register(struct flashctx *flash, int status); void spi_prettyprint_status_register_bit(uint8_t status, int bit); void spi_prettyprint_status_register_bp3210(uint8_t status, int bp); void spi_prettyprint_status_register_welwip(uint8_t status); -int spi_prettyprint_status_register(struct flashchip *flash); -int spi_disable_blockprotect(struct flashchip *flash); +int spi_prettyprint_status_register(struct flashctx *flash); +int spi_disable_blockprotect(struct flashctx *flash); int spi_byte_program(unsigned int addr, uint8_t databyte); int spi_nbyte_program(unsigned int addr, uint8_t *bytes, unsigned int len); int spi_nbyte_read(unsigned int addr, uint8_t *bytes, unsigned int len); -int spi_read_chunked(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize); -int spi_write_chunked(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize); -int spi_aai_write(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); +int spi_read_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize); +int spi_write_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize); +int spi_aai_write(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
/* opaque.c */ -int probe_opaque(struct flashchip *flash); -int read_opaque(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); -int write_opaque(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); -int erase_opaque(struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen); +int probe_opaque(struct flashctx *flash); +int read_opaque(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); +int write_opaque(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); +int erase_opaque(struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen);
/* a25.c */ -int spi_prettyprint_status_register_amic_a25l05p(struct flashchip *flash); -int spi_prettyprint_status_register_amic_a25l40p(struct flashchip *flash); -int spi_prettyprint_status_register_amic_a25l032(struct flashchip *flash); -int spi_prettyprint_status_register_amic_a25lq032(struct flashchip *flash); +int spi_prettyprint_status_register_amic_a25l05p(struct flashctx *flash); +int spi_prettyprint_status_register_amic_a25l40p(struct flashctx *flash); +int spi_prettyprint_status_register_amic_a25l032(struct flashctx *flash); +int spi_prettyprint_status_register_amic_a25lq032(struct flashctx *flash);
/* at25.c */ -int spi_prettyprint_status_register_at25df(struct flashchip *flash); -int spi_prettyprint_status_register_at25df_sec(struct flashchip *flash); -int spi_prettyprint_status_register_at25f(struct flashchip *flash); -int spi_prettyprint_status_register_at25fs010(struct flashchip *flash); -int spi_prettyprint_status_register_at25fs040(struct flashchip *flash); -int spi_prettyprint_status_register_atmel_at26df081a(struct flashchip *flash); -int spi_disable_blockprotect_at25df(struct flashchip *flash); -int spi_disable_blockprotect_at25df_sec(struct flashchip *flash); -int spi_disable_blockprotect_at25f(struct flashchip *flash); -int spi_disable_blockprotect_at25fs010(struct flashchip *flash); -int spi_disable_blockprotect_at25fs040(struct flashchip *flash); +int spi_prettyprint_status_register_at25df(struct flashctx *flash); +int spi_prettyprint_status_register_at25df_sec(struct flashctx *flash); +int spi_prettyprint_status_register_at25f(struct flashctx *flash); +int spi_prettyprint_status_register_at25fs010(struct flashctx *flash); +int spi_prettyprint_status_register_at25fs040(struct flashctx *flash); +int spi_prettyprint_status_register_atmel_at26df081a(struct flashctx *flash); +int spi_disable_blockprotect_at25df(struct flashctx *flash); +int spi_disable_blockprotect_at25df_sec(struct flashctx *flash); +int spi_disable_blockprotect_at25f(struct flashctx *flash); +int spi_disable_blockprotect_at25fs010(struct flashctx *flash); +int spi_disable_blockprotect_at25fs040(struct flashctx *flash);
/* 82802ab.c */ -uint8_t wait_82802ab(struct flashchip *flash); -int probe_82802ab(struct flashchip *flash); -int erase_block_82802ab(struct flashchip *flash, unsigned int page, unsigned int pagesize); -int write_82802ab(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); +uint8_t wait_82802ab(struct flashctx *flash); +int probe_82802ab(struct flashctx *flash); +int erase_block_82802ab(struct flashctx *flash, unsigned int page, unsigned int pagesize); +int write_82802ab(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); void print_status_82802ab(uint8_t status); -int unlock_82802ab(struct flashchip *flash); -int unlock_28f004s5(struct flashchip *flash); -int unlock_lh28f008bjt(struct flashchip *flash); +int unlock_82802ab(struct flashctx *flash); +int unlock_28f004s5(struct flashctx *flash); +int unlock_lh28f008bjt(struct flashctx *flash);
/* jedec.c */ uint8_t oddparity(uint8_t val); @@ -99,58 +99,58 @@ void data_polling_jedec(chipaddr dst, uint8_t data); int write_byte_program_jedec(chipaddr bios, uint8_t *src, chipaddr dst); -int probe_jedec(struct flashchip *flash); -int write_jedec(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); -int write_jedec_1(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); -int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int pagesize); -int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize); -int erase_chip_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize); +int probe_jedec(struct flashctx *flash); +int write_jedec(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); +int write_jedec_1(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); +int erase_sector_jedec(struct flashctx *flash, unsigned int page, unsigned int pagesize); +int erase_block_jedec(struct flashctx *flash, unsigned int page, unsigned int blocksize); +int erase_chip_block_jedec(struct flashctx *flash, unsigned int page, unsigned int blocksize);
/* m29f400bt.c */ -int probe_m29f400bt(struct flashchip *flash); -int block_erase_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len); -int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len); -int write_m29f400bt(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); +int probe_m29f400bt(struct flashctx *flash); +int block_erase_m29f400bt(struct flashctx *flash, unsigned int start, unsigned int len); +int block_erase_chip_m29f400bt(struct flashctx *flash, unsigned int start, unsigned int len); +int write_m29f400bt(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); void protect_m29f400bt(chipaddr bios);
/* pm49fl00x.c */ -int unlock_49fl00x(struct flashchip *flash); -int lock_49fl00x(struct flashchip *flash); +int unlock_49fl00x(struct flashctx *flash); +int lock_49fl00x(struct flashctx *flash);
/* sst28sf040.c */ -int erase_chip_28sf040(struct flashchip *flash, unsigned int addr, unsigned int blocklen); -int erase_sector_28sf040(struct flashchip *flash, unsigned int address, unsigned int sector_size); -int write_28sf040(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); -int unprotect_28sf040(struct flashchip *flash); -int protect_28sf040(struct flashchip *flash); +int erase_chip_28sf040(struct flashctx *flash, unsigned int addr, unsigned int blocklen); +int erase_sector_28sf040(struct flashctx *flash, unsigned int address, unsigned int sector_size); +int write_28sf040(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); +int unprotect_28sf040(struct flashctx *flash); +int protect_28sf040(struct flashctx *flash);
/* sst49lfxxxc.c */ -int erase_sector_49lfxxxc(struct flashchip *flash, unsigned int address, unsigned int sector_size); -int unlock_49lfxxxc(struct flashchip *flash); +int erase_sector_49lfxxxc(struct flashctx *flash, unsigned int address, unsigned int sector_size); +int unlock_49lfxxxc(struct flashctx *flash);
/* sst_fwhub.c */ -int printlock_sst_fwhub(struct flashchip *flash); -int unlock_sst_fwhub(struct flashchip *flash); +int printlock_sst_fwhub(struct flashctx *flash); +int unlock_sst_fwhub(struct flashctx *flash);
/* w39.c */ -int printlock_w39l040(struct flashchip * flash); -int printlock_w39v040a(struct flashchip *flash); -int printlock_w39v040b(struct flashchip *flash); -int printlock_w39v040c(struct flashchip *flash); -int printlock_w39v040fa(struct flashchip *flash); -int printlock_w39v040fb(struct flashchip *flash); -int printlock_w39v040fc(struct flashchip *flash); -int printlock_w39v080a(struct flashchip *flash); -int printlock_w39v080fa(struct flashchip *flash); -int printlock_w39v080fa_dual(struct flashchip *flash); -int unlock_w39v040fb(struct flashchip *flash); -int unlock_w39v080fa(struct flashchip *flash); +int printlock_w39l040(struct flashctx * flash); +int printlock_w39v040a(struct flashctx *flash); +int printlock_w39v040b(struct flashctx *flash); +int printlock_w39v040c(struct flashctx *flash); +int printlock_w39v040fa(struct flashctx *flash); +int printlock_w39v040fb(struct flashctx *flash); +int printlock_w39v040fc(struct flashctx *flash); +int printlock_w39v080a(struct flashctx *flash); +int printlock_w39v080fa(struct flashctx *flash); +int printlock_w39v080fa_dual(struct flashctx *flash); +int unlock_w39v040fb(struct flashctx *flash); +int unlock_w39v080fa(struct flashctx *flash);
/* w29ee011.c */ -int probe_w29ee011(struct flashchip *flash); +int probe_w29ee011(struct flashctx *flash);
/* stm50flw0x0x.c */ -int erase_sector_stm50flw0x0x(struct flashchip *flash, unsigned int block, unsigned int blocksize); -int unlock_stm50flw0x0x(struct flashchip *flash); +int erase_sector_stm50flw0x0x(struct flashctx *flash, unsigned int block, unsigned int blocksize); +int unlock_stm50flw0x0x(struct flashctx *flash);
#endif /* !__CHIPDRIVERS_H__ */ Index: flashrom-struct_flashctx/m29f400bt.c =================================================================== --- flashrom-struct_flashctx/m29f400bt.c (Revision 1472) +++ flashrom-struct_flashctx/m29f400bt.c (Arbeitskopie) @@ -28,7 +28,7 @@ functions. */
/* chunksize is 1 */ -int write_m29f400bt(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) +int write_m29f400bt(struct flashctx *flash, uint8_t *src, unsigned int start, unsigned int len) { int i; chipaddr bios = flash->virtual_memory; @@ -55,7 +55,7 @@ return 0; }
-int probe_m29f400bt(struct flashchip *flash) +int probe_m29f400bt(struct flashctx *flash) { chipaddr bios = flash->virtual_memory; uint8_t id1, id2; @@ -86,7 +86,7 @@ return 0; }
-int erase_m29f400bt(struct flashchip *flash) +int erase_m29f400bt(struct flashctx *flash) { chipaddr bios = flash->virtual_memory;
@@ -105,7 +105,7 @@ return 0; }
-int block_erase_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len) +int block_erase_m29f400bt(struct flashctx *flash, unsigned int start, unsigned int len) { chipaddr bios = flash->virtual_memory; chipaddr dst = bios + start; @@ -125,7 +125,7 @@ return 0; }
-int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int address, unsigned int blocklen) +int block_erase_chip_m29f400bt(struct flashctx *flash, unsigned int address, unsigned int blocklen) { if ((address != 0) || (blocklen != flash->total_size * 1024)) { msg_cerr("%s called with incorrect arguments\n",