From d4228fdc4793c900e3f5eb0d2db0576a6f36235d Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Fri, 28 Feb 2003 17:21:38 +0000 Subject: Made the ids always print in hex less verbose verify step Corresponding to coreboot v1 svn r752. --- 82802ab.c | 13 +++++++------ am29f040b.c | 2 +- flash_rom.c | 18 ++++++++++++------ jedec.c | 2 +- m29f400bt.c | 6 ++++-- sst28sf040.c | 2 +- sst39sf020.c | 3 ++- w49f002u.c | 3 ++- 8 files changed, 30 insertions(+), 19 deletions(-) diff --git a/82802ab.c b/82802ab.c index 71f2af765..b41efccfc 100644 --- a/82802ab.c +++ b/82802ab.c @@ -73,7 +73,8 @@ int probe_82802ab (struct flashchip * flash) #endif myusec_delay(10); - printf(__FUNCTION__ "id1 %d, id2 %d\n", id1, id2); + printf("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2); + if (id1 == flash->manufacture_id && id2 == flash->model_id) { size_t size = flash->total_size * 1024; // we need to mmap the write-protect space. @@ -129,12 +130,12 @@ int erase_82802ab_block(struct flashchip *flash, int offset) // clear status register *bios = 0x50; - printf("Erase at %p\n", bios); + //printf("Erase at %p\n", bios); // clear write protect - printf("write protect is at %p\n", (wrprotect)); - printf("write protect is 0x%x\n", *(wrprotect)); + //printf("write protect is at %p\n", (wrprotect)); + //printf("write protect is 0x%x\n", *(wrprotect)); *(wrprotect) = 0; - printf("write protect is 0x%x\n", *(wrprotect)); + //printf("write protect is 0x%x\n", *(wrprotect)); // now start it *(volatile unsigned char *) (bios) = 0x20; @@ -142,7 +143,7 @@ int erase_82802ab_block(struct flashchip *flash, int offset) myusec_delay(10); // now let's see what the register is status = wait_82802ab(flash->virt_addr); - print_82802ab_status(status); + //print_82802ab_status(status); printf("DONE BLOCK 0x%x\n", offset); } int erase_82802ab (struct flashchip * flash) diff --git a/am29f040b.c b/am29f040b.c index ceba046f0..3603bb994 100644 --- a/am29f040b.c +++ b/am29f040b.c @@ -78,7 +78,7 @@ int probe_29f040b (struct flashchip * flash) myusec_delay(10); - printf(__FUNCTION__ "id1 %d, id2 %d\n", id1, id2); + printf("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2); if (id1 == flash->manufacture_id && id2 == flash->model_id) return 1; diff --git a/flash_rom.c b/flash_rom.c index 94d4972a8..0ec1e0422 100644 --- a/flash_rom.c +++ b/flash_rom.c @@ -180,7 +180,7 @@ struct flashchip * probe_flash(struct flashchip * flash) return NULL; } -int verify_flash (struct flashchip * flash, char * buf) +int verify_flash (struct flashchip * flash, char * buf, int verbose) { int i = 0; int total_size = flash->total_size *1024; @@ -188,13 +188,19 @@ int verify_flash (struct flashchip * flash, char * buf) printf("Verifying address: "); while (i++ < total_size) { - printf("0x%08x", i); + if (verbose) + printf("0x%08x", i); if (*(bios+i) != *(buf+i)) { + printf("FAILED\n"); return 0; } - printf("\b\b\b\b\b\b\b\b\b\b"); + if (verbose) + printf("\b\b\b\b\b\b\b\b\b\b"); } - printf("\n"); + if (verbose) + printf("\n"); + else + printf("VERIFIED\n"); return 1; } @@ -211,7 +217,7 @@ myusec_calibrate_delay() struct timeval start, end; int ok = 0; - fprintf(stderr, "Setting up microsecond timing loop\n"); + printf("Setting up microsecond timing loop\n"); while (! ok) { //fprintf(stderr, "Try %d\n", count); gettimeofday(&start, 0); @@ -333,6 +339,6 @@ main (int argc, char * argv[]) printf("OK, calibrated, now do the deed\n"); flash->write (flash, buf); - verify_flash (flash, buf); + verify_flash (flash, buf, /* verbose = */ 0); return 0; } diff --git a/jedec.c b/jedec.c index f26659f96..e811959db 100644 --- a/jedec.c +++ b/jedec.c @@ -47,7 +47,7 @@ int probe_jedec (struct flashchip * flash) myusec_delay(10); - printf(__FUNCTION__ "id1 %d, id2 %d\n", id1, id2); + printf("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2); if (id1 == flash->manufacture_id && id2 == flash->model_id) return 1; diff --git a/m29f400bt.c b/m29f400bt.c index 2011ceb17..73f921360 100644 --- a/m29f400bt.c +++ b/m29f400bt.c @@ -46,8 +46,10 @@ int probe_m29f400bt (struct flashchip * flash) *(volatile char *) (bios + 0xAAA) = 0xF0; myusec_delay(10); - - printf(__FUNCTION__ " id1 %x, id2 %x\n", id1, id2); + + printf("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2); + + if (id1 == flash->manufacture_id && id2 == flash->model_id) return 1; diff --git a/sst28sf040.c b/sst28sf040.c index 4042e8bf9..d811988ca 100644 --- a/sst28sf040.c +++ b/sst28sf040.c @@ -113,7 +113,7 @@ int probe_28sf040 (struct flashchip * flash) *bios = RESET; myusec_delay(10); - printf(__FUNCTION__ "id1 %d, id2 %d\n", id1, id2); + printf("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__ , id1, id2); if (id1 == flash->manufacture_id && id2 == flash->model_id) return 1; diff --git a/sst39sf020.c b/sst39sf020.c index 48a1d596a..7e0853a06 100644 --- a/sst39sf020.c +++ b/sst39sf020.c @@ -128,7 +128,8 @@ int probe_39sf020 (struct flashchip * flash) myusec_delay(10); - printf(__FUNCTION__ "id1 %d, id2 %d\n", id1, id2); + printf("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2); + if (id1 == flash->manufacture_id && id2 == flash->model_id) return 1; diff --git a/w49f002u.c b/w49f002u.c index 887a15b35..65b540ca4 100644 --- a/w49f002u.c +++ b/w49f002u.c @@ -44,7 +44,8 @@ int probe_49f002 (struct flashchip * flash) myusec_delay(10); - printf(__FUNCTION__ "id1 %d, id2 %d\n", id1, id2); + printf("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2); + if (id1 == flash->manufacture_id && id2 == flash->model_id) return 1; -- cgit v1.2.3