1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +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:
Carl-Daniel Hailfinger 2009-11-14 03:48:33 +00:00
parent 11c9e687b4
commit 8a8a226add
2 changed files with 4 additions and 4 deletions

View File

@ -3060,7 +3060,7 @@ struct flashchip flashchips[] = {
.model_id = W_29C040P, .model_id = W_29C040P,
.total_size = 512, .total_size = 512,
.page_size = 256, .page_size = 256,
.tested = TEST_UNTESTED, .tested = TEST_OK_PREW,
.probe = probe_jedec, .probe = probe_jedec,
.probe_timing = 10, .probe_timing = 10,
.erase = erase_chip_jedec, .erase = erase_chip_jedec,

View File

@ -262,7 +262,7 @@ int erase_chip_jedec(struct flashchip *flash)
int write_page_write_jedec(struct flashchip *flash, uint8_t *src, int write_page_write_jedec(struct flashchip *flash, uint8_t *src,
int start, int page_size) int start, int page_size)
{ {
int i, tried = 0, start_index = 0, ok; int i, tried = 0, ok;
uint8_t *s = src; uint8_t *s = src;
chipaddr bios = flash->virtual_memory; chipaddr bios = flash->virtual_memory;
chipaddr dst = bios + start; chipaddr dst = bios + start;
@ -275,7 +275,7 @@ retry:
chip_writeb(0xA0, bios + 0x5555); chip_writeb(0xA0, bios + 0x5555);
/* transfer data from source to destination */ /* 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 the data is 0xFF, don't program it */
if (*src != 0xFF) if (*src != 0xFF)
chip_writeb(*src, dst); chip_writeb(*src, dst);
@ -290,7 +290,7 @@ retry:
ok = !verify_range(flash, src, start, page_size, NULL); ok = !verify_range(flash, src, start, page_size, NULL);
if (!ok && tried++ < MAX_REFLASH_TRIES) { if (!ok && tried++ < MAX_REFLASH_TRIES) {
start_index = i; fprintf(stderr, "retrying.\n");
goto retry; goto retry;
} }
if (!ok) { if (!ok) {