mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 07:02:34 +02:00
Retry correct range in write_page_write_jedec()
The automatic retry in write_page_write_jedec didn't retry flashing the correct range, essentially rendering the functionality useless. This patch simplifies the code and fixes the bug. Thanks to Luke Dashjr for testing. Mark Winbond W29C040P as supported. Corresponding to flashrom svn r757. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Luke Dashjr <luke_coreboot@dashjr.org>
This commit is contained in:
parent
11c9e687b4
commit
8a8a226add
@ -3060,7 +3060,7 @@ struct flashchip flashchips[] = {
|
||||
.model_id = W_29C040P,
|
||||
.total_size = 512,
|
||||
.page_size = 256,
|
||||
.tested = TEST_UNTESTED,
|
||||
.tested = TEST_OK_PREW,
|
||||
.probe = probe_jedec,
|
||||
.probe_timing = 10,
|
||||
.erase = erase_chip_jedec,
|
||||
|
6
jedec.c
6
jedec.c
@ -262,7 +262,7 @@ int erase_chip_jedec(struct flashchip *flash)
|
||||
int write_page_write_jedec(struct flashchip *flash, uint8_t *src,
|
||||
int start, int page_size)
|
||||
{
|
||||
int i, tried = 0, start_index = 0, ok;
|
||||
int i, tried = 0, ok;
|
||||
uint8_t *s = src;
|
||||
chipaddr bios = flash->virtual_memory;
|
||||
chipaddr dst = bios + start;
|
||||
@ -275,7 +275,7 @@ retry:
|
||||
chip_writeb(0xA0, bios + 0x5555);
|
||||
|
||||
/* transfer data from source to destination */
|
||||
for (i = start_index; i < page_size; i++) {
|
||||
for (i = 0; i < page_size; i++) {
|
||||
/* If the data is 0xFF, don't program it */
|
||||
if (*src != 0xFF)
|
||||
chip_writeb(*src, dst);
|
||||
@ -290,7 +290,7 @@ retry:
|
||||
ok = !verify_range(flash, src, start, page_size, NULL);
|
||||
|
||||
if (!ok && tried++ < MAX_REFLASH_TRIES) {
|
||||
start_index = i;
|
||||
fprintf(stderr, "retrying.\n");
|
||||
goto retry;
|
||||
}
|
||||
if (!ok) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user