diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2011-09-18 22:42:18 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2011-09-18 22:42:18 +0000 |
commit | 8c35745fcf3ed6eb2769beda0c8b941df07f6175 (patch) | |
tree | 2f3c43a3589edc55e7143b39d40df4a0cd039183 | |
parent | e3185c0599d77c06b9665c9721649b96108c894f (diff) | |
download | flashrom-8c35745fcf3ed6eb2769beda0c8b941df07f6175.tar.gz flashrom-8c35745fcf3ed6eb2769beda0c8b941df07f6175.tar.bz2 flashrom-8c35745fcf3ed6eb2769beda0c8b941df07f6175.zip |
Revert "Unsignify lengths and addresses in chip functions and structs"
- probe_timing was changed to unsigned although we use negative values
for special cases
- some code was not changed along hence did no longer compile:
* dediprog's read and write functions
* linux_spi's read and write functions
- it introduced a number of new sign conversion warnings
(http://paste.flashrom.org/view.php?id=832)
To be safe this patch reverts all changes made in r1448, a corrected
patch will follow later.
Thanks to idwer for pointing out the problem first!
Corresponding to flashrom svn r1450.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
-rw-r--r-- | 82802ab.c | 2 | ||||
-rw-r--r-- | chipdrivers.h | 28 | ||||
-rw-r--r-- | dummyflasher.c | 4 | ||||
-rw-r--r-- | flash.h | 14 | ||||
-rw-r--r-- | flashrom.c | 4 | ||||
-rw-r--r-- | it87spi.c | 8 | ||||
-rw-r--r-- | jedec.c | 6 | ||||
-rw-r--r-- | m29f400bt.c | 2 | ||||
-rw-r--r-- | programmer.h | 14 | ||||
-rw-r--r-- | serprog.c | 2 | ||||
-rw-r--r-- | spi.c | 12 | ||||
-rw-r--r-- | spi25.c | 14 | ||||
-rw-r--r-- | sst28sf040.c | 2 | ||||
-rw-r--r-- | wbsio_spi.c | 4 |
14 files changed, 58 insertions, 58 deletions
@@ -141,7 +141,7 @@ int erase_block_82802ab(struct flashchip *flash, unsigned int page, } /* chunksize is 1 */ -int write_82802ab(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) +int write_82802ab(struct flashchip *flash, uint8_t *src, int start, int len) { int i; chipaddr dst = flash->virtual_memory + start; diff --git a/chipdrivers.h b/chipdrivers.h index 42df4c7ac..958c59ade 100644 --- a/chipdrivers.h +++ b/chipdrivers.h @@ -41,9 +41,9 @@ int spi_block_erase_d7(struct flashchip *flash, unsigned int addr, unsigned int 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_chip_write_1(struct flashchip *flash, uint8_t *buf, int start, int len); +int spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start, int len); +int spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len); uint8_t spi_read_status_register(void); int spi_write_status_register(struct flashchip *flash, int status); void spi_prettyprint_status_register_bit(uint8_t status, int bit); @@ -51,12 +51,12 @@ 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_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_byte_program(int addr, uint8_t databyte); +int spi_nbyte_program(int addr, uint8_t *bytes, int len); +int spi_nbyte_read(int addr, uint8_t *bytes, int len); +int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize); +int spi_write_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize); +int spi_aai_write(struct flashchip *flash, uint8_t *buf, int start, int len); /* a25.c */ int spi_prettyprint_status_register_amic_a25l05p(struct flashchip *flash); @@ -81,7 +81,7 @@ int spi_disable_blockprotect_at25fs040(struct flashchip *flash); 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); +int write_82802ab(struct flashchip *flash, uint8_t *buf, int start, int len); void print_status_82802ab(uint8_t status); int unlock_82802ab(struct flashchip *flash); int unlock_28f004s5(struct flashchip *flash); @@ -94,8 +94,8 @@ 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 write_jedec(struct flashchip *flash, uint8_t *buf, int start, int len); +int write_jedec_1(struct flashchip *flash, uint8_t *buf, int start, 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); @@ -104,7 +104,7 @@ int erase_chip_block_jedec(struct flashchip *flash, unsigned int page, unsigned 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 write_m29f400bt(struct flashchip *flash, uint8_t *buf, int start, int len); void protect_m29f400bt(chipaddr bios); /* pm49fl00x.c */ @@ -114,7 +114,7 @@ int lock_49fl00x(struct flashchip *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 write_28sf040(struct flashchip *flash, uint8_t *buf, int start, int len); int unprotect_28sf040(struct flashchip *flash); int protect_28sf040(struct flashchip *flash); diff --git a/dummyflasher.c b/dummyflasher.c index 84650e79b..be8f55211 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -63,7 +63,7 @@ static int spi_write_256_chunksize = 256; 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, - unsigned int start, unsigned int len); + int start, int len); static const struct spi_programmer spi_programmer_dummyflasher = { .type = SPI_CONTROLLER_DUMMY, @@ -528,7 +528,7 @@ static int dummy_spi_send_command(unsigned int writecnt, unsigned int readcnt, } static int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, - unsigned int start, unsigned int len) + int start, int len) { return spi_write_chunked(flash, buf, start, len, spi_write_256_chunksize); @@ -108,9 +108,9 @@ struct flashchip { uint32_t model_id; /* Total chip size in kilobytes */ - unsigned int total_size; + int total_size; /* Chip page size in bytes */ - unsigned int page_size; + int page_size; int feature_bits; /* @@ -122,7 +122,7 @@ struct flashchip { int (*probe) (struct flashchip *flash); /* Delay after "enter/exit ID mode" commands in microseconds. */ - unsigned int probe_timing; + int probe_timing; /* * Erase blocks and associated erase function. Any chip erase function @@ -143,8 +143,8 @@ struct flashchip { 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); + int (*write) (struct flashchip *flash, uint8_t *buf, int start, int len); + int (*read) (struct flashchip *flash, uint8_t *buf, int start, int len); struct { uint16_t min; uint16_t max; @@ -202,7 +202,7 @@ 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 read_memmapped(struct flashchip *flash, uint8_t *buf, int start, 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); @@ -210,7 +210,7 @@ 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 flashchip *flash, uint8_t *cmpbuf, int start, int len, const char *message); int need_erase(uint8_t *have, uint8_t *want, int len, enum write_granularity gran); char *strcat_realloc(char *dest, const char *src); void print_version(void); diff --git a/flashrom.c b/flashrom.c index e2afd4412..c565a4345 100644 --- a/flashrom.c +++ b/flashrom.c @@ -564,7 +564,7 @@ void map_flash_registers(struct flashchip *flash) 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 flashchip *flash, uint8_t *buf, int start, int len) { chip_readn(buf, flash->virtual_memory + start, len); @@ -710,7 +710,7 @@ int check_erased_range(struct flashchip *flash, int start, int len) * @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 flashchip *flash, uint8_t *cmpbuf, int start, int len, const char *message) { int i; @@ -106,9 +106,9 @@ void probe_superio_ite(void) 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, - unsigned int start, unsigned int len); + int start, int len); static int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, - unsigned int start, unsigned int len); + int start, int len); static const struct spi_programmer spi_programmer_it87xx = { .type = SPI_CONTROLLER_IT87XX, @@ -340,7 +340,7 @@ static int it8716f_spi_page_program(struct flashchip *flash, uint8_t *buf, * 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, - unsigned int start, unsigned int len) + int start, int len) { fast_spi = 0; @@ -358,7 +358,7 @@ static int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, } static int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, - unsigned int start, unsigned int len) + int start, int len) { /* * IT8716F only allows maximum of 512 kb SPI chip size for memory @@ -355,7 +355,7 @@ retry: } /* chunksize is 1 */ -int write_jedec_1(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) +int write_jedec_1(struct flashchip *flash, uint8_t *src, int start, int len) { int i, failed = 0; chipaddr dst = flash->virtual_memory + start; @@ -376,7 +376,7 @@ int write_jedec_1(struct flashchip *flash, uint8_t *src, unsigned int start, uns 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 flashchip *flash, uint8_t *src, int start, int page_size) { int i, tried = 0, failed; uint8_t *s = src; @@ -424,7 +424,7 @@ retry: * 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 flashchip *flash, uint8_t *buf, int start, int len) { int i, starthere, lenhere; /* FIXME: page_size is the wrong variable. We need max_writechunk_size diff --git a/m29f400bt.c b/m29f400bt.c index 61bfa2e4a..e0d41d4e5 100644 --- a/m29f400bt.c +++ b/m29f400bt.c @@ -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 flashchip *flash, uint8_t *src, int start, int len) { int i; chipaddr bios = flash->virtual_memory; diff --git a/programmer.h b/programmer.h index c92713aaa..73b94c155 100644 --- a/programmer.h +++ b/programmer.h @@ -556,23 +556,23 @@ extern const int spi_programmer_count; #define MAX_DATA_WRITE_UNLIMITED 256 struct spi_programmer { enum spi_controller type; - unsigned int max_data_read; - unsigned int max_data_write; + int max_data_read; + int max_data_write; int (*command)(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); 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 flashchip *flash, uint8_t *buf, int start, int len); + int (*write_256)(struct flashchip *flash, uint8_t *buf, int start, 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 flashchip *flash, uint8_t *buf, int start, int len); +int default_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len); void register_spi_programmer(const struct spi_programmer *programmer); /* ichspi.c */ @@ -610,7 +610,7 @@ void serprog_chip_readn(uint8_t *buf, const chipaddr addr, size_t len); void serprog_delay(int delay); int serprog_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); -int serprog_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); +int serprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len); #endif /* serial.c */ @@ -795,7 +795,7 @@ int serprog_spi_send_command(unsigned int writecnt, unsigned int readcnt, * 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. */ -int serprog_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int serprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len) { int i; int cur_len; @@ -97,9 +97,9 @@ int default_spi_send_multicommand(struct spi_command *cmds) return result; } -int default_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int default_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len) { - unsigned int max_data = spi_programmer->max_data_read; + int max_data = spi_programmer->max_data_read; if (max_data == MAX_DATA_UNSPECIFIED) { msg_perr("%s called, but SPI read chunk size not defined " "on this hardware. Please report a bug at " @@ -109,9 +109,9 @@ int default_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, 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 flashchip *flash, uint8_t *buf, int start, int len) { - unsigned int max_data = spi_programmer->max_data_write; + int max_data = spi_programmer->max_data_write; if (max_data == MAX_DATA_UNSPECIFIED) { msg_perr("%s called, but SPI write chunk size not defined " "on this hardware. Please report a bug at " @@ -121,7 +121,7 @@ int default_spi_write_256(struct flashchip *flash, uint8_t *buf, unsigned int st 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 flashchip *flash, uint8_t *buf, int start, int len) { int addrbase = 0; if (!spi_programmer->read) { @@ -160,7 +160,7 @@ int spi_chip_read(struct flashchip *flash, uint8_t *buf, unsigned int start, uns * .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 flashchip *flash, uint8_t *buf, int start, int len) { if (!spi_programmer->write_256) { msg_perr("%s called, but SPI page write is unsupported on this " @@ -844,7 +844,7 @@ int spi_write_status_register(struct flashchip *flash, int status) return ret; } -int spi_byte_program(unsigned int addr, uint8_t databyte) +int spi_byte_program(int addr, uint8_t databyte) { int result; struct spi_command cmds[] = { @@ -879,7 +879,7 @@ int spi_byte_program(unsigned int addr, uint8_t databyte) return result; } -int spi_nbyte_program(unsigned int addr, uint8_t *bytes, unsigned int len) +int spi_nbyte_program(int addr, uint8_t *bytes, int len) { int result; /* FIXME: Switch to malloc based on len unless that kills speed. */ @@ -954,7 +954,7 @@ int spi_disable_blockprotect(struct flashchip *flash) return 0; } -int spi_nbyte_read(unsigned int address, uint8_t *bytes, unsigned int len) +int spi_nbyte_read(int address, uint8_t *bytes, int len) { const unsigned char cmd[JEDEC_READ_OUTSIZE] = { JEDEC_READ, @@ -972,7 +972,7 @@ int spi_nbyte_read(unsigned int address, uint8_t *bytes, unsigned int len) * 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 flashchip *flash, uint8_t *buf, int start, int len, int chunksize) { int rc = 0; int i, j, starthere, lenhere; @@ -1012,7 +1012,7 @@ int spi_read_chunked(struct flashchip *flash, uint8_t *buf, unsigned int start, * 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 flashchip *flash, uint8_t *buf, int start, int len, int chunksize) { int rc = 0; int i, j, starthere, lenhere; @@ -1061,7 +1061,7 @@ int spi_write_chunked(struct flashchip *flash, uint8_t *buf, unsigned int start, * (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 flashchip *flash, uint8_t *buf, int start, int len) { int i, result = 0; @@ -1076,7 +1076,7 @@ int spi_chip_write_1(struct flashchip *flash, uint8_t *buf, unsigned int start, return 0; } -int spi_aai_write(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) +int spi_aai_write(struct flashchip *flash, uint8_t *buf, int start, int len) { uint32_t pos = start; int result; diff --git a/sst28sf040.c b/sst28sf040.c index 2038d537d..d621cc755 100644 --- a/sst28sf040.c +++ b/sst28sf040.c @@ -76,7 +76,7 @@ int erase_sector_28sf040(struct flashchip *flash, unsigned int address, unsigned } /* chunksize is 1 */ -int write_28sf040(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) +int write_28sf040(struct flashchip *flash, uint8_t *src, int start, int len) { int i; chipaddr bios = flash->virtual_memory; diff --git a/wbsio_spi.c b/wbsio_spi.c index bc31e990a..851c87f0c 100644 --- a/wbsio_spi.c +++ b/wbsio_spi.c @@ -62,7 +62,7 @@ done: 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 flashchip *flash, uint8_t *buf, int start, int len); static const struct spi_programmer spi_programmer_wbsio = { .type = SPI_CONTROLLER_WBSIO, @@ -194,7 +194,7 @@ static int wbsio_spi_send_command(unsigned int writecnt, unsigned int readcnt, 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 flashchip *flash, uint8_t *buf, int start, int len) { return read_memmapped(flash, buf, start, len); } |