- 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
This commit is contained in:
Stefan Reinauer 2006-03-16 16:57:41 +00:00
parent 9b107715f9
commit ccce5dd490
1 changed files with 46 additions and 17 deletions

View File

@ -4,9 +4,10 @@
* Copyright 2000 Silicon Integrated System Corporation * Copyright 2000 Silicon Integrated System Corporation
* Copyright 2004 Tyan Corp * Copyright 2004 Tyan Corp
* yhlu yhlu@tyan.com add exclude start and end option * yhlu yhlu@tyan.com add exclude start and end option
* Copyright 2005 coresystems GmbH * Copyright 2005-2006 coresystems GmbH
* Stefan Reinauer <stepan@core-systems.de> added rom layout * Stefan Reinauer <stepan@coresystems.de> added rom layout
* support, and checking for suitable rom image * 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 * 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 * 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; return flash;
} }
munmap((void *) bios, size); 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++; flash++;
} }
return NULL; return NULL;
@ -91,26 +112,34 @@ struct flashchip *probe_flash(struct flashchip *flash)
int verify_flash(struct flashchip *flash, uint8_t *buf) int verify_flash(struct flashchip *flash, uint8_t *buf)
{ {
int i; int idx;
int total_size = flash->total_size * 1024; int total_size = flash->total_size * 1024;
volatile uint8_t *bios = flash->virt_addr; volatile uint8_t *bios = flash->virt_addr;
printf("Verifying address: "); printf("Verifying flash ");
for (i = 0; i < total_size; i++) {
if (verbose) if(verbose) printf("address: 0x00000000\b\b\b\b\b\b\b\b\b\b");
printf("0x%08x", i);
if (*(bios + i) != *(buf + i)) { for (idx = 0; idx < total_size; idx++) {
printf("FAILED\n"); if (verbose && ( (idx & 0xfff) == 0xfff ))
return 0; printf("0x%08x", idx);
if (*(bios + idx) != *(buf + idx)) {
if (verbose) {
printf("0x%08x ", idx);
} }
if (verbose) printf("- FAILED\n");
return 1;
}
if (verbose && ( (idx & 0xfff) == 0xfff ))
printf("\b\b\b\b\b\b\b\b\b\b"); printf("\b\b\b\b\b\b\b\b\b\b");
} }
if (verbose) if (verbose)
printf("\n"); printf("\b\b\b\b\b\b\b\b\b\b ");
else
printf("VERIFIED\n"); printf("- VERIFIED \n");
return 1; return 0;
} }