diff options
author | Stefan Reinauer <stepan@openbios.org> | 2006-03-16 16:57:41 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2006-03-16 16:57:41 +0000 |
commit | ccce5dd4909404594b3836414f657f0e4e3e0834 (patch) | |
tree | 9ad13df04d4512108e97c05382da4d1a476bdd18 /util/flashrom/flash_rom.c | |
parent | 9b107715f945ffab10c8e5c43b8f16bb13bb2ae2 (diff) | |
download | coreboot-ccce5dd4909404594b3836414f657f0e4e3e0834.tar.xz |
- speed up flash verification by only printing 1 of 4096 addresses
- support for flashing technologic system ts5300 SBC (needs -DTS5300 in
the makefile)
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2205 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/flashrom/flash_rom.c')
-rw-r--r-- | util/flashrom/flash_rom.c | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/util/flashrom/flash_rom.c b/util/flashrom/flash_rom.c index db3c2c9095..4245a8f92b 100644 --- a/util/flashrom/flash_rom.c +++ b/util/flashrom/flash_rom.c @@ -4,9 +4,10 @@ * Copyright 2000 Silicon Integrated System Corporation * Copyright 2004 Tyan Corp * yhlu yhlu@tyan.com add exclude start and end option - * Copyright 2005 coresystems GmbH - * Stefan Reinauer <stepan@core-systems.de> added rom layout - * support, and checking for suitable rom image + * Copyright 2005-2006 coresystems GmbH + * Stefan Reinauer <stepan@coresystems.de> added rom layout + * support, and checking for suitable rom image, various fixes + * support for flashing the Technologic Systems 5300. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -84,6 +85,26 @@ struct flashchip *probe_flash(struct flashchip *flash) return flash; } munmap((void *) bios, size); +#ifdef TS5300 + /* TS-5300 */ + bios = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED, + fd_mem, (off_t) (0x9400000)); + if (bios == MAP_FAILED) { + perror("Error MMAP /dev/mem"); + exit(1); + } + flash->virt_addr = bios; + flash->fd_mem = fd_mem; + + if (flash->probe(flash) == 1) { + printf("TS-5300 %s found at physical address: 0x%lx\n", + flash->name, 0x9400000UL); + return flash; + } + munmap((void *) bios, size); + /* TS-5300 */ +#endif + flash++; } return NULL; @@ -91,26 +112,34 @@ struct flashchip *probe_flash(struct flashchip *flash) int verify_flash(struct flashchip *flash, uint8_t *buf) { - int i; + int idx; int total_size = flash->total_size * 1024; volatile uint8_t *bios = flash->virt_addr; - printf("Verifying address: "); - for (i = 0; i < total_size; i++) { - if (verbose) - printf("0x%08x", i); - if (*(bios + i) != *(buf + i)) { - printf("FAILED\n"); - return 0; + printf("Verifying flash "); + + if(verbose) printf("address: 0x00000000\b\b\b\b\b\b\b\b\b\b"); + + for (idx = 0; idx < total_size; idx++) { + if (verbose && ( (idx & 0xfff) == 0xfff )) + printf("0x%08x", idx); + + if (*(bios + idx) != *(buf + idx)) { + if (verbose) { + printf("0x%08x ", idx); + } + printf("- FAILED\n"); + return 1; } - if (verbose) + + if (verbose && ( (idx & 0xfff) == 0xfff )) printf("\b\b\b\b\b\b\b\b\b\b"); } - if (verbose) - printf("\n"); - else - printf("VERIFIED\n"); - return 1; + if (verbose) + printf("\b\b\b\b\b\b\b\b\b\b "); + + printf("- VERIFIED \n"); + return 0; } |