[LinuxBIOS] flashrom: patch for jedec.c
Giampiero Giancipoli
gianci at email.it
Mon Nov 20 09:14:58 CET 2006
Fixed write_page_write_jedec() in jedec.c. Added a check-reprogram loop
in the same function, to come around the high page write failure rate on
some boards.
Signed-off-by: Giampiero Giancipoli <gianci at email.it>
--
-------------- next part --------------
Index: jedec.c
===================================================================
--- jedec.c (revision 2497)
+++ jedec.c (working copy)
@@ -134,23 +134,48 @@
int write_page_write_jedec(volatile uint8_t *bios, uint8_t *src,
volatile uint8_t *dst, int page_size)
{
- int i;
+ int i, tried = 0, start_index = 0, ok;
+ volatile uint8_t *d = dst;
+ uint8_t *s = src;
+retry:
/* Issue JEDEC Data Unprotect comand */
*(volatile uint8_t *) (bios + 0x5555) = 0xAA;
*(volatile uint8_t *) (bios + 0x2AAA) = 0x55;
*(volatile uint8_t *) (bios + 0x5555) = 0xA0;
/* transfer data from source to destination */
- for (i = 0; i < page_size; i++) {
+ for (i = start_index; i < page_size; i++) {
/* If the data is 0xFF, don't program it */
- if (*src == 0xFF)
- continue;
- *dst++ = *src++;
+ if (*src != 0xFF )
+ *dst = *src;
+ dst++;
+ src++;
}
toggle_ready_jedec(dst - 1);
+ dst = d;
+ src = s;
+ ok = 1;
+ for (i = 0; i < page_size; i++) {
+ if (*src != 0xFF)
+ if ( *dst != *src )
+ {
+ ok = 0;
+ break;
+ }
+ dst++;
+ src++;
+ }
+
+ if (!ok && tried++ < 0x10) {
+ start_index = i;
+ goto retry;
+ }
+ if (!ok) {
+ fprintf( stderr, " page %d failed!\n", (d-bios)/page_size );
+ }
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20061120/1b42a99a/attachment.sig>
More information about the coreboot
mailing list