summaryrefslogtreecommitdiffstats
path: root/flashrom.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2008-01-22 15:19:01 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2008-01-22 15:19:01 +0000
commitd7b5bf3f1234200c8fd19c03e72cd65ba3db13f8 (patch)
treeb8be63a7e75329430d9ed8a60649fa2f3a8e67b2 /flashrom.c
parentd3568adfe118776d8157434f7bec102542959544 (diff)
downloadast2050-flashrom-d7b5bf3f1234200c8fd19c03e72cd65ba3db13f8.zip
ast2050-flashrom-d7b5bf3f1234200c8fd19c03e72cd65ba3db13f8.tar.gz
Flashrom did not use the read function for verifying, it used direct memory access instead
That fails if the flash chip is not mapped completely. If the read function is set in struct flashchip, use it for verification as well. This fixes verification of all SPI flash chips >512 kByte behind an IT8716F flash translation chip. "MX25L8005 found at physical address 0xfff00000. Flash part is MX25L8005 (1024 KB). Flash image seems to be a legacy BIOS. Disabling checks. Verifying flash... VERIFIED." Corresponding to flashrom svn r185 and coreboot v2 svn r3070. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Harald Gutmann <harald.gutmann@gmx.net>
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/flashrom.c b/flashrom.c
index 5446fc5..abcd3d2 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -159,7 +159,11 @@ int verify_flash(struct flashchip *flash, uint8_t *buf)
{
int idx;
int total_size = flash->total_size * 1024;
- volatile uint8_t *bios = flash->virtual_memory;
+ uint8_t *buf2 = (uint8_t *) calloc(total_size, sizeof(char));
+ if (flash->read == NULL)
+ memcpy(buf2, (const char *)flash->virtual_memory, total_size);
+ else
+ flash->read(flash, buf2);
printf("Verifying flash... ");
@@ -170,7 +174,7 @@ int verify_flash(struct flashchip *flash, uint8_t *buf)
if (verbose && ((idx & 0xfff) == 0xfff))
printf("0x%08x", idx);
- if (*(bios + idx) != *(buf + idx)) {
+ if (*(buf2 + idx) != *(buf + idx)) {
if (verbose) {
printf("0x%08x ", idx);
}
OpenPOWER on IntegriCloud