diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-06-16 08:55:44 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-06-16 08:55:44 +0000 |
commit | cbf563cbde925dae6971c7df305493a638de51c6 (patch) | |
tree | 29b0a806979474c3d8dcbc6acfa7022728ca4a15 /flashrom.c | |
parent | 30f7cb2f3c570c99b61bd5df72621f44f1bdd0d0 (diff) | |
download | flashrom-cbf563cbde925dae6971c7df305493a638de51c6.tar.gz flashrom-cbf563cbde925dae6971c7df305493a638de51c6.tar.bz2 flashrom-cbf563cbde925dae6971c7df305493a638de51c6.zip |
Support reads of arbitrary range
That means you can tell flashrom to read exactly bytes 12345-56789
(start 12345, length 44445) and it will not fetch a single byte more.
Uwe tested this on one LPC, one SPI, and one parallel flash board.
Corresponding to flashrom svn r596.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Diffstat (limited to 'flashrom.c')
-rw-r--r-- | flashrom.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -194,9 +194,9 @@ 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) +int read_memmapped(struct flashchip *flash, uint8_t *buf, int start, int len) { - chip_readn(buf, flash->virtual_memory, flash->total_size * 1024); + chip_readn(buf, flash->virtual_memory + start, len); return 0; } @@ -393,7 +393,7 @@ int verify_flash(struct flashchip *flash, uint8_t *buf) fprintf(stderr, "ERROR: flashrom has no read function for this flash chip.\n"); return 1; } else - flash->read(flash, buf2); + flash->read(flash, buf2, 0, total_size); printf("Verifying flash... "); @@ -446,7 +446,7 @@ int read_flash(struct flashchip *flash, char *filename, unsigned int exclude_sta fprintf(stderr, "ERROR: flashrom has no read function for this flash chip.\n"); return 1; } else - flash->read(flash, buf); + flash->read(flash, buf, 0, size); if (exclude_end_position - exclude_start_position > 0) memset(buf + exclude_start_position, 0, @@ -482,7 +482,7 @@ int erase_flash(struct flashchip *flash) fprintf(stderr, "ERROR: flashrom has no read function for this flash chip.\n"); return 1; } else - flash->read(flash, buf); + flash->read(flash, buf, 0, size); for (erasedbytes = 0; erasedbytes < size; erasedbytes++) if (0xff != buf[erasedbytes]) { @@ -915,6 +915,7 @@ int main(int argc, char *argv[]) * completely once all flash chips can do rom layouts. stepan */ + /* FIXME: This code is totally broken. It treats exclude ranges as include ranges. */ // //////////////////////////////////////////////////////////// if (exclude_end_position - exclude_start_position > 0) chip_readn(buf + exclude_start_position, |