summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-08-19 15:19:18 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-08-19 15:19:18 +0000
commitf5fb51c4ba3dae5ed78a10fb9280efa096609de5 (patch)
tree922fc8b531c599c54ac765c03eabdb4bfb0e99e1
parent664e7ad995a86663e12fc0785ffd3cdc939b9311 (diff)
downloadast2050-flashrom-f5fb51c4ba3dae5ed78a10fb9280efa096609de5.zip
ast2050-flashrom-f5fb51c4ba3dae5ed78a10fb9280efa096609de5.tar.gz
Adept layout handling to new programmer infrastructure and fix off-by-one error
Flashrom has the ability to use layout files with romentries, but this feature was not adapted to the programmer infrastructure and had undefined behaviour for flasher!=internal. The romentry handling had an off-by-one error which caused all copies to end up one byte short. Fix these issues. Corresponding to flashrom svn r694. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Reinauer <stepan@coresystems.de>
-rw-r--r--flash.h2
-rw-r--r--flashrom.c3
-rw-r--r--layout.c11
3 files changed, 7 insertions, 9 deletions
diff --git a/flash.h b/flash.h
index c5234dc..d3e2e30 100644
--- a/flash.h
+++ b/flash.h
@@ -422,7 +422,7 @@ char *strcat_realloc(char *dest, const char *src);
int show_id(uint8_t *bios, int size, int force);
int read_romlayout(char *name);
int find_romentry(char *name);
-int handle_romentries(uint8_t *buffer, uint8_t *content);
+int handle_romentries(uint8_t *buffer, struct flashchip *flash);
/* cbtable.c */
int coreboot_init(void);
diff --git a/flashrom.c b/flashrom.c
index b531699..fc80301 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -930,8 +930,7 @@ int main(int argc, char *argv[])
// This should be moved into each flash part's code to do it
// cleanly. This does the job.
- /* FIXME: Adapt to the external flasher infrastructure. */
- handle_romentries(buf, (uint8_t *) flash->virtual_memory);
+ handle_romentries(buf, flash);
// ////////////////////////////////////////////////////////////
diff --git a/layout.c b/layout.c
index 68684a7..c432ebe 100644
--- a/layout.c
+++ b/layout.c
@@ -196,11 +196,11 @@ int find_romentry(char *name)
return -1;
}
-int handle_romentries(uint8_t *buffer, uint8_t *content)
+int handle_romentries(uint8_t *buffer, struct flashchip *flash)
{
int i;
- // This function does not safe flash write cycles.
+ // This function does not save flash write cycles.
//
// Also it does not cope with overlapping rom layout
// sections.
@@ -220,10 +220,9 @@ int handle_romentries(uint8_t *buffer, uint8_t *content)
if (rom_entries[i].included)
continue;
- /* FIXME: Adapt to the external flasher infrastructure. */
- memcpy(buffer + rom_entries[i].start,
- content + rom_entries[i].start,
- rom_entries[i].end - rom_entries[i].start);
+ flash->read(flash, buffer + rom_entries[i].start,
+ rom_entries[i].start,
+ rom_entries[i].end - rom_entries[i].start + 1);
}
return 0;
OpenPOWER on IntegriCloud