From f5fb51c4ba3dae5ed78a10fb9280efa096609de5 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Wed, 19 Aug 2009 15:19:18 +0000 Subject: 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 Acked-by: Stefan Reinauer --- layout.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'layout.c') 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; -- cgit v1.1