mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
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>
This commit is contained in:
parent
664e7ad995
commit
f5fb51c4ba
2
flash.h
2
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 show_id(uint8_t *bios, int size, int force);
|
||||||
int read_romlayout(char *name);
|
int read_romlayout(char *name);
|
||||||
int find_romentry(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 */
|
/* cbtable.c */
|
||||||
int coreboot_init(void);
|
int coreboot_init(void);
|
||||||
|
@ -930,8 +930,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// This should be moved into each flash part's code to do it
|
// This should be moved into each flash part's code to do it
|
||||||
// cleanly. This does the job.
|
// cleanly. This does the job.
|
||||||
/* FIXME: Adapt to the external flasher infrastructure. */
|
handle_romentries(buf, flash);
|
||||||
handle_romentries(buf, (uint8_t *) flash->virtual_memory);
|
|
||||||
|
|
||||||
// ////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
11
layout.c
11
layout.c
@ -196,11 +196,11 @@ int find_romentry(char *name)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int handle_romentries(uint8_t *buffer, uint8_t *content)
|
int handle_romentries(uint8_t *buffer, struct flashchip *flash)
|
||||||
{
|
{
|
||||||
int i;
|
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
|
// Also it does not cope with overlapping rom layout
|
||||||
// sections.
|
// sections.
|
||||||
@ -220,10 +220,9 @@ int handle_romentries(uint8_t *buffer, uint8_t *content)
|
|||||||
if (rom_entries[i].included)
|
if (rom_entries[i].included)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* FIXME: Adapt to the external flasher infrastructure. */
|
flash->read(flash, buffer + rom_entries[i].start,
|
||||||
memcpy(buffer + rom_entries[i].start,
|
rom_entries[i].start,
|
||||||
content + rom_entries[i].start,
|
rom_entries[i].end - rom_entries[i].start + 1);
|
||||||
rom_entries[i].end - rom_entries[i].start);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user