summaryrefslogtreecommitdiff
path: root/layout.c
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-08-19 15:19:18 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-08-19 15:19:18 +0000
commitb22112506145cc4851b0bbd33036ce8b752588a0 (patch)
tree922fc8b531c599c54ac765c03eabdb4bfb0e99e1 /layout.c
parentf230e450695c715fd1e18a3aed5502fd90bc0f64 (diff)
downloadflashrom-b22112506145cc4851b0bbd33036ce8b752588a0.tar.gz
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. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@694 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'layout.c')
-rw-r--r--layout.c11
1 files changed, 5 insertions, 6 deletions
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;