Convert chips' message printing to msg_c* Fixed suggestions by Carl-Daniel
Corresponding to flashrom svn r982.
Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
diff --git a/82802ab.c b/82802ab.c
index b6bd689..aa7e45e 100644
--- a/82802ab.c
+++ b/82802ab.c
@@ -34,13 +34,13 @@
// I need that Berkeley bit-map printer
void print_status_82802ab(uint8_t status)
{
- printf_debug("%s", status & 0x80 ? "Ready:" : "Busy:");
- printf_debug("%s", status & 0x40 ? "BE SUSPEND:" : "BE RUN/FINISH:");
- printf_debug("%s", status & 0x20 ? "BE ERROR:" : "BE OK:");
- printf_debug("%s", status & 0x10 ? "PROG ERR:" : "PROG OK:");
- printf_debug("%s", status & 0x8 ? "VP ERR:" : "VPP OK:");
- printf_debug("%s", status & 0x4 ? "PROG SUSPEND:" : "PROG RUN/FINISH:");
- printf_debug("%s", status & 0x2 ? "WP|TBL#|WP#,ABORT:" : "UNLOCK:");
+ msg_cdbg("%s", status & 0x80 ? "Ready:" : "Busy:");
+ msg_cdbg("%s", status & 0x40 ? "BE SUSPEND:" : "BE RUN/FINISH:");
+ msg_cdbg("%s", status & 0x20 ? "BE ERROR:" : "BE OK:");
+ msg_cdbg("%s", status & 0x10 ? "PROG ERR:" : "PROG OK:");
+ msg_cdbg("%s", status & 0x8 ? "VP ERR:" : "VPP OK:");
+ msg_cdbg("%s", status & 0x4 ? "PROG SUSPEND:" : "PROG RUN/FINISH:");
+ msg_cdbg("%s", status & 0x2 ? "WP|TBL#|WP#,ABORT:" : "UNLOCK:");
}
int probe_82802ab(struct flashchip *flash)
@@ -65,21 +65,21 @@
programmer_delay(10);
- printf_debug("%s: id1 0x%02x, id2 0x%02x", __func__, id1, id2);
+ msg_cdbg("%s: id1 0x%02x, id2 0x%02x", __func__, id1, id2);
if (!oddparity(id1))
- printf_debug(", id1 parity violation");
+ msg_cdbg(", id1 parity violation");
/* Read the product ID location again. We should now see normal flash contents. */
flashcontent1 = chip_readb(bios);
flashcontent2 = chip_readb(bios + 0x01);
if (id1 == flashcontent1)
- printf_debug(", id1 is normal flash content");
+ msg_cdbg(", id1 is normal flash content");
if (id2 == flashcontent2)
- printf_debug(", id2 is normal flash content");
+ msg_cdbg(", id2 is normal flash content");
- printf_debug("\n");
+ msg_cdbg("\n");
if (id1 != flash->manufacture_id || id2 != flash->model_id)
return 0;
@@ -137,10 +137,10 @@
print_status_82802ab(status);
if (check_erased_range(flash, page, pagesize)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
- printf("DONE BLOCK 0x%x\n", page);
+ msg_cinfo("DONE BLOCK 0x%x\n", page);
return 0;
}
@@ -150,14 +150,14 @@
int i;
unsigned int total_size = flash->total_size * 1024;
- printf("total_size is %d; flash->page_size is %d\n",
+ msg_cspew("total_size is %d; flash->page_size is %d\n",
total_size, flash->page_size);
for (i = 0; i < total_size; i += flash->page_size)
if (erase_block_82802ab(flash, i, flash->page_size)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
- printf("DONE ERASE\n");
+ msg_cinfo("DONE ERASE\n");
return 0;
}
@@ -184,14 +184,13 @@
uint8_t *tmpbuf = malloc(page_size);
if (!tmpbuf) {
- printf("Could not allocate memory!\n");
+ msg_cerr("Could not allocate memory!\n");
exit(1);
}
- printf("Programming page: \n");
+ msg_cinfo("Programming page: \n");
for (i = 0; i < total_size / page_size; i++) {
- printf
- ("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
- printf("%04d at address: 0x%08x", i, i * page_size);
+ msg_cinfo("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ msg_cinfo("%04d at address: 0x%08x", i, i * page_size);
/* Auto Skip Blocks, which already contain the desired data
* Faster, because we only write, what has changed
@@ -202,19 +201,19 @@
*/
chip_readn(tmpbuf, bios + i * page_size, page_size);
if (!memcmp((void *)(buf + i * page_size), tmpbuf, page_size)) {
- printf("SKIPPED\n");
+ msg_cdbg("SKIPPED\n");
continue;
}
/* erase block by block and write block by block; this is the most secure way */
if (erase_block_82802ab(flash, i * page_size, page_size)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
write_page_82802ab(bios, buf + i * page_size,
bios + i * page_size, page_size);
}
- printf("\n");
+ msg_cinfo("DONE!\n");
free(tmpbuf);
return 0;
@@ -234,7 +233,7 @@
/* Read master lock-bit */
mcfg = chip_readb(bios + 0x3);
- msg_cinfo("master lock is ");
+ msg_cdbg("master lock is ");
if (mcfg) {
msg_cdbg("locked!\n");
} else {
@@ -256,9 +255,11 @@
/* Unlock: clear block lock-bits, if needed */
if (can_unlock && need_unlock) {
+ msg_cdbg("Unlock: ");
chip_writeb(0x60, bios);
chip_writeb(0xD0, bios);
chip_writeb(0xFF, bios);
+ msg_cdbg("Done!\n");
}
/* Error: master locked or a block is locked */
diff --git a/jedec.c b/jedec.c
index fee7302..fcaea96 100644
--- a/jedec.c
+++ b/jedec.c
@@ -55,7 +55,7 @@
tmp1 = tmp2;
}
if (i > 0x100000)
- printf_debug("%s: excessive loops, i=0x%x\n", __func__, i);
+ msg_cdbg("%s: excessive loops, i=0x%x\n", __func__, i);
}
void toggle_ready_jedec(chipaddr dst)
@@ -89,7 +89,7 @@
}
}
if (i > 0x100000)
- printf_debug("%s: excessive loops, i=0x%x\n", __func__, i);
+ msg_cdbg("%s: excessive loops, i=0x%x\n", __func__, i);
}
void start_program_jedec_common(struct flashchip *flash, unsigned int mask)
@@ -113,12 +113,12 @@
else if (flash->probe_timing == TIMING_ZERO) { /* No delay. */
probe_timing_enter = probe_timing_exit = 0;
} else if (flash->probe_timing == TIMING_FIXME) { /* == _IGNORED */
- printf_debug("Chip lacks correct probe timing information, "
+ msg_cdbg("Chip lacks correct probe timing information, "
"using default 10mS/40uS. ");
probe_timing_enter = 10000;
probe_timing_exit = 40;
} else {
- printf("Chip has negative value in probe_timing, failing "
+ msg_cerr("Chip has negative value in probe_timing, failing "
"without chip access\n");
return 0;
}
@@ -166,9 +166,9 @@
if (probe_timing_exit)
programmer_delay(probe_timing_exit);
- printf_debug("%s: id1 0x%02x, id2 0x%02x", __func__, largeid1, largeid2);
+ msg_cdbg("%s: id1 0x%02x, id2 0x%02x", __func__, largeid1, largeid2);
if (!oddparity(id1))
- printf_debug(", id1 parity violation");
+ msg_cdbg(", id1 parity violation");
/* Read the product ID location again. We should now see normal flash contents. */
flashcontent1 = chip_readb(bios);
@@ -185,11 +185,11 @@
}
if (largeid1 == flashcontent1)
- printf_debug(", id1 is normal flash content");
+ msg_cdbg(", id1 is normal flash content");
if (largeid2 == flashcontent2)
- printf_debug(", id2 is normal flash content");
+ msg_cdbg(", id2 is normal flash content");
- printf_debug("\n");
+ msg_cdbg("\n");
if (largeid1 != flash->manufacture_id || largeid2 != flash->model_id)
return 0;
@@ -223,7 +223,7 @@
toggle_ready_jedec_slow(bios);
if (check_erased_range(flash, page, pagesize)) {
- fprintf(stderr,"ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -253,7 +253,7 @@
toggle_ready_jedec_slow(bios);
if (check_erased_range(flash, block, blocksize)) {
- fprintf(stderr,"ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -282,7 +282,7 @@
toggle_ready_jedec_slow(bios);
if (check_erased_range(flash, 0, total_size)) {
- fprintf(stderr,"ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -330,7 +330,7 @@
dst++, src++;
}
if (failed)
- fprintf(stderr, " writing sector at 0x%lx failed!\n", olddst);
+ msg_cerr(" writing sector at 0x%lx failed!\n", olddst);
return failed;
}
@@ -364,11 +364,11 @@
failed = verify_range(flash, src, start, page_size, NULL);
if (failed && tried++ < MAX_REFLASH_TRIES) {
- fprintf(stderr, "retrying.\n");
+ msg_cerr("retrying.\n");
goto retry;
}
if (failed) {
- fprintf(stderr, " page 0x%lx failed!\n",
+ msg_cerr(" page 0x%lx failed!\n",
(d - bios) / page_size);
}
return failed;
@@ -387,7 +387,7 @@
return MASK_AAA;
break;
default:
- fprintf(stderr, "%s called with unknown mask\n", __func__);
+ msg_cerr("%s called with unknown mask\n", __func__);
return 0;
break;
}
@@ -403,19 +403,19 @@
mask = getaddrmask(flash);
if (erase_chip_jedec(flash)) {
- fprintf(stderr,"ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
- printf("Programming page: ");
+ msg_cinfo("Programming page: ");
for (i = 0; i < total_size / page_size; i++) {
- printf("%04d at address: 0x%08x", i, i * page_size);
+ msg_cinfo("%04d at address: 0x%08x", i, i * page_size);
if (write_page_write_jedec_common(flash, buf + i * page_size,
i * page_size, page_size, mask))
failed = 1;
- printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ msg_cinfo("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
- printf("\n");
+ msg_cinfo("DONE!\n");
return failed;
}
@@ -431,22 +431,22 @@
programmer_delay(10);
if (erase_flash(flash)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
- printf("Programming page: ");
+ msg_cinfo("Programming page: ");
for (i = 0; i < flash->total_size; i++) {
if ((i & 0x3) == 0)
- printf("address: 0x%08lx", (unsigned long)i * 1024);
+ msg_cinfo("address: 0x%08lx", (unsigned long)i * 1024);
write_sector_jedec_common(flash, buf + i * 1024, dst + i * 1024, 1024, mask);
if ((i & 0x3) == 0)
- printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ msg_cinfo("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
- printf("\n");
+ msg_cinfo("DONE!\n");
return 0;
}
@@ -458,7 +458,7 @@
mask = getaddrmask(flash);
if ((addr != 0) || (blocksize != flash->total_size * 1024)) {
- fprintf(stderr, "%s called with incorrect arguments\n",
+ msg_cerr("%s called with incorrect arguments\n",
__func__);
return -1;
}
diff --git a/m29f400bt.c b/m29f400bt.c
index c394074..c8ed5d8 100644
--- a/m29f400bt.c
+++ b/m29f400bt.c
@@ -42,8 +42,7 @@
//chip_writeb(0xF0, bios);
//programmer_delay(5);
toggle_ready_jedec(dst);
- printf
- ("Value in the flash at address 0x%lx = %#x, want %#x\n",
+ msg_cerr("Value in the flash at address 0x%lx = %#x, want %#x\n",
(dst - bios), chip_readb(dst), *src);
dst++;
src++;
@@ -73,7 +72,7 @@
programmer_delay(10);
- printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
+ msg_cdbg("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
if (id1 == flash->manufacture_id && id2 == flash->model_id)
return 1;
@@ -97,7 +96,7 @@
toggle_ready_jedec(bios);
if (check_erased_range(flash, 0, flash->total_size * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -121,7 +120,7 @@
toggle_ready_jedec(bios);
if (check_erased_range(flash, start, len)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -130,7 +129,7 @@
int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int address, unsigned int blocklen)
{
if ((address != 0) || (blocklen != flash->total_size * 1024)) {
- fprintf(stderr, "%s called with incorrect arguments\n",
+ msg_cerr("%s called with incorrect arguments\n",
__func__);
return -1;
}
@@ -145,7 +144,7 @@
chipaddr bios = flash->virtual_memory;
//erase_m29f400bt (flash);
- printf("Programming page:\n ");
+ msg_cinfo("Programming page:\n ");
/*********************************
*Pages for M29F400BT:
* 16 0x7c000 0x7ffff TOP
@@ -161,47 +160,47 @@
* 64 0x10000 0x1ffff
* 64 0x00000 0x0ffff BOTTOM
*********************************/
- printf("total_size/page_size = %d\n", total_size / page_size);
+ msg_cinfo("total_size/page_size = %d\n", total_size / page_size);
for (i = 0; i < (total_size / page_size) - 1; i++) {
- printf("%04d at address: 0x%08x\n", i, i * page_size);
+ msg_cinfo("%04d at address: 0x%08x\n", i, i * page_size);
if (block_erase_m29f400bt(flash, i * page_size, page_size)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
write_page_m29f400bt(bios, buf + i * page_size,
bios + i * page_size, page_size);
- printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ msg_cinfo("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
- printf("%04d at address: 0x%08x\n", 7, 0x70000);
+ msg_cinfo("%04d at address: 0x%08x\n", 7, 0x70000);
if (block_erase_m29f400bt(flash, 0x70000, 32 * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
write_page_m29f400bt(bios, buf + 0x70000, bios + 0x70000, 32 * 1024);
- printf("%04d at address: 0x%08x\n", 8, 0x78000);
+ msg_cinfo("%04d at address: 0x%08x\n", 8, 0x78000);
if (block_erase_m29f400bt(flash, 0x78000, 8 * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
write_page_m29f400bt(bios, buf + 0x78000, bios + 0x78000, 8 * 1024);
- printf("%04d at address: 0x%08x\n", 9, 0x7a000);
+ msg_cinfo("%04d at address: 0x%08x\n", 9, 0x7a000);
if (block_erase_m29f400bt(flash, 0x7a000, 8 * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
write_page_m29f400bt(bios, buf + 0x7a000, bios + 0x7a000, 8 * 1024);
- printf("%04d at address: 0x%08x\n", 10, 0x7c000);
+ msg_cinfo("%04d at address: 0x%08x\n", 10, 0x7c000);
if (block_erase_m29f400bt(flash, 0x7c000, 16 * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
write_page_m29f400bt(bios, buf + 0x7c000, bios + 0x7c000, 16 * 1024);
- printf("\n");
+ msg_cinfo("\n");
return 0;
}
@@ -210,7 +209,7 @@
{
chipaddr bios = flash->virtual_memory;
- printf("Programming page:\n ");
+ msg_cinfo("Programming page:\n ");
/*********************************
*Pages for M29F400BT:
* 16 0x7c000 0x7ffff TOP
@@ -226,35 +225,35 @@
* 64 0x10000 0x1ffff
* 64 0x00000 0x0ffff BOTTOM
*********************************/
- printf("%04d at address: 0x%08x\n", 7, 0x00000);
+ msg_cinfo("%04d at address: 0x%08x\n", 7, 0x00000);
if (block_erase_m29f400bt(flash, 0x00000, 64 * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
write_page_m29f400bt(bios, buf + 0x00000, bios + 0x00000, 64 * 1024);
- printf("%04d at address: 0x%08x\n", 7, 0x10000);
+ msg_cinfo("%04d at address: 0x%08x\n", 7, 0x10000);
if (block_erase_m29f400bt(flash, 0x10000, 64 * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
write_page_m29f400bt(bios, buf + 0x10000, bios + 0x10000, 64 * 1024);
- printf("%04d at address: 0x%08x\n", 7, 0x20000);
+ msg_cinfo("%04d at address: 0x%08x\n", 7, 0x20000);
if (block_erase_m29f400bt(flash, 0x20000, 64 * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
write_page_m29f400bt(bios, buf + 0x20000, bios + 0x20000, 64 * 1024);
- printf("%04d at address: 0x%08x\n", 7, 0x30000);
+ msg_cinfo("%04d at address: 0x%08x\n", 7, 0x30000);
if (block_erase_m29f400bt(flash, 0x30000, 64 * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
write_page_m29f400bt(bios, buf + 0x30000, bios + 0x30000, 64 * 1024);
- printf("\n");
+ msg_cinfo("\n");
return 0;
}
diff --git a/sharplhf00l04.c b/sharplhf00l04.c
index 3f5cf3d..70b8135 100644
--- a/sharplhf00l04.c
+++ b/sharplhf00l04.c
@@ -34,14 +34,14 @@
// clear status register
chip_writeb(0x50, bios);
- printf("Erase at 0x%lx\n", bios);
+ msg_cdbg("Erase at 0x%lx\n", bios);
status = wait_82802ab(flash->virtual_memory);
print_status_82802ab(status);
// clear write protect
- printf("write protect is at 0x%lx\n", (wrprotect));
- printf("write protect is 0x%x\n", chip_readb(wrprotect));
+ msg_cspew("write protect is at 0x%lx\n", (wrprotect));
+ msg_cspew("write protect is 0x%x\n", chip_readb(wrprotect));
chip_writeb(0, wrprotect);
- printf("write protect is 0x%x\n", chip_readb(wrprotect));
+ msg_cspew("write protect is 0x%x\n", chip_readb(wrprotect));
// now start it
chip_writeb(0x20, bios);
@@ -50,10 +50,10 @@
// now let's see what the register is
status = wait_82802ab(flash->virtual_memory);
print_status_82802ab(status);
- printf("DONE BLOCK 0x%x\n", blockaddr);
+ msg_cinfo("DONE BLOCK 0x%x\n", blockaddr);
if (check_erased_range(flash, blockaddr, blocklen)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -67,17 +67,17 @@
chipaddr bios = flash->virtual_memory;
if (erase_flash(flash)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
- printf("Programming page: ");
+ msg_cinfo("Programming page: ");
for (i = 0; i < total_size / page_size; i++) {
- printf("%04d at address: 0x%08x", i, i * page_size);
+ msg_cinfo("%04d at address: 0x%08x", i, i * page_size);
write_page_82802ab(bios, buf + i * page_size,
bios + i * page_size, page_size);
- printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ msg_cinfo("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
- printf("\n");
+ msg_cinfo("\n");
return 0;
}
diff --git a/spi25.c b/spi25.c
index 54121b0..c6d1b65 100644
--- a/spi25.c
+++ b/spi25.c
@@ -39,10 +39,10 @@
ret = spi_send_command(sizeof(cmd), bytes, cmd, readarr);
if (ret)
return ret;
- printf_debug("RDID returned");
+ msg_cspew("RDID returned");
for (i = 0; i < bytes; i++)
- printf_debug(" 0x%02x", readarr[i]);
- printf_debug(". ");
+ msg_cspew(" 0x%02x", readarr[i]);
+ msg_cspew(". ");
return 0;
}
@@ -63,7 +63,7 @@
}
if (ret)
return ret;
- printf_debug("REMS returned %02x %02x. ", readarr[0], readarr[1]);
+ msg_cspew("REMS returned %02x %02x. ", readarr[0], readarr[1]);
return 0;
}
@@ -84,7 +84,7 @@
}
if (ret)
return ret;
- printf_debug("RES returned %02x. ", readarr[0]);
+ msg_cspew("RES returned %02x. ", readarr[0]);
return 0;
}
@@ -97,7 +97,7 @@
result = spi_send_command(sizeof(cmd), 0, cmd, NULL);
if (result)
- fprintf(stderr, "%s failed\n", __func__);
+ msg_cerr("%s failed\n", __func__);
return result;
}
@@ -120,12 +120,12 @@
return 0;
if (!oddparity(readarr[0]))
- printf_debug("RDID byte 0 parity violation. ");
+ msg_cdbg("RDID byte 0 parity violation. ");
/* Check if this is a continuation vendor ID */
if (readarr[0] == 0x7f) {
if (!oddparity(readarr[1]))
- printf_debug("RDID byte 1 parity violation. ");
+ msg_cdbg("RDID byte 1 parity violation. ");
id1 = (readarr[0] << 8) | readarr[1];
id2 = readarr[2];
if (bytes > 3) {
@@ -137,7 +137,7 @@
id2 = (readarr[1] << 8) | readarr[2];
}
- printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
+ msg_cdbg("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
if (id1 == flash->manufacture_id && id2 == flash->model_id) {
/* Print the status register to tell the
@@ -192,7 +192,7 @@
#endif
return probe_spi_rdid_generic(flash, 4);
default:
- printf_debug("4b ID not supported on this SPI controller\n");
+ msg_cinfo("4b ID not supported on this SPI controller\n");
}
return 0;
@@ -209,7 +209,7 @@
id1 = readarr[0];
id2 = readarr[1];
- printf_debug("%s: id1 0x%x, id2 0x%x\n", __func__, id1, id2);
+ msg_cdbg("%s: id1 0x%x, id2 0x%x\n", __func__, id1, id2);
if (id1 == flash->manufacture_id && id2 == flash->model_id) {
/* Print the status register to tell the
@@ -262,7 +262,7 @@
/* FIXME: Handle the case where RES gives a 2-byte response. */
id2 = readarr[0];
- printf_debug("%s: id 0x%x\n", __func__, id2);
+ msg_cdbg("%s: id 0x%x\n", __func__, id2);
if (id2 != flash->model_id)
return 0;
@@ -283,7 +283,7 @@
/* Read Status Register */
ret = spi_send_command(sizeof(cmd), sizeof(readarr), cmd, readarr);
if (ret)
- fprintf(stderr, "RDSR failed!\n");
+ msg_cerr("RDSR failed!\n");
return readarr[0];
}
@@ -291,17 +291,17 @@
/* Prettyprint the status register. Common definitions. */
void spi_prettyprint_status_register_common(uint8_t status)
{
- printf_debug("Chip status register: Bit 5 / Block Protect 3 (BP3) is "
+ msg_cdbg("Chip status register: Bit 5 / Block Protect 3 (BP3) is "
"%sset\n", (status & (1 << 5)) ? "" : "not ");
- printf_debug("Chip status register: Bit 4 / Block Protect 2 (BP2) is "
+ msg_cdbg("Chip status register: Bit 4 / Block Protect 2 (BP2) is "
"%sset\n", (status & (1 << 4)) ? "" : "not ");
- printf_debug("Chip status register: Bit 3 / Block Protect 1 (BP1) is "
+ msg_cdbg("Chip status register: Bit 3 / Block Protect 1 (BP1) is "
"%sset\n", (status & (1 << 3)) ? "" : "not ");
- printf_debug("Chip status register: Bit 2 / Block Protect 0 (BP0) is "
+ msg_cdbg("Chip status register: Bit 2 / Block Protect 0 (BP0) is "
"%sset\n", (status & (1 << 2)) ? "" : "not ");
- printf_debug("Chip status register: Write Enable Latch (WEL) is "
+ msg_cdbg("Chip status register: Write Enable Latch (WEL) is "
"%sset\n", (status & (1 << 1)) ? "" : "not ");
- printf_debug("Chip status register: Write In Progress (WIP/BUSY) is "
+ msg_cdbg("Chip status register: Write In Progress (WIP/BUSY) is "
"%sset\n", (status & (1 << 0)) ? "" : "not ");
}
@@ -311,18 +311,18 @@
*/
void spi_prettyprint_status_register_st_m25p(uint8_t status)
{
- printf_debug("Chip status register: Status Register Write Disable "
+ msg_cdbg("Chip status register: Status Register Write Disable "
"(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not ");
- printf_debug("Chip status register: Bit 6 is "
+ msg_cdbg("Chip status register: Bit 6 is "
"%sset\n", (status & (1 << 6)) ? "" : "not ");
spi_prettyprint_status_register_common(status);
}
void spi_prettyprint_status_register_sst25(uint8_t status)
{
- printf_debug("Chip status register: Block Protect Write Disable "
+ msg_cdbg("Chip status register: Block Protect Write Disable "
"(BPL) is %sset\n", (status & (1 << 7)) ? "" : "not ");
- printf_debug("Chip status register: Auto Address Increment Programming "
+ msg_cdbg("Chip status register: Auto Address Increment Programming "
"(AAI) is %sset\n", (status & (1 << 6)) ? "" : "not ");
spi_prettyprint_status_register_common(status);
}
@@ -342,7 +342,7 @@
"all", "all"
};
spi_prettyprint_status_register_sst25(status);
- printf_debug("Resulting block protection : %s\n",
+ msg_cdbg("Resulting block protection : %s\n",
bpt[(status & 0x1c) >> 2]);
}
@@ -356,7 +356,7 @@
"all blocks", "all blocks", "all blocks", "all blocks"
};
spi_prettyprint_status_register_sst25(status);
- printf_debug("Resulting block protection : %s\n",
+ msg_cdbg("Resulting block protection : %s\n",
bpt[(status & 0x1c) >> 2]);
}
@@ -365,7 +365,7 @@
uint8_t status;
status = spi_read_status_register();
- printf_debug("Chip status register is %02x\n", status);
+ msg_cdbg("Chip status register is %02x\n", status);
switch (flash->manufacture_id) {
case ST_ID:
if (((flash->model_id & 0xff00) == 0x2000) ||
@@ -416,13 +416,13 @@
result = spi_disable_blockprotect();
if (result) {
- fprintf(stderr, "spi_disable_blockprotect failed\n");
+ msg_cerr("spi_disable_blockprotect failed\n");
return result;
}
result = spi_send_multicommand(cmds);
if (result) {
- fprintf(stderr, "%s failed during command execution\n",
+ msg_cerr("%s failed during command execution\n",
__func__);
return result;
}
@@ -433,7 +433,7 @@
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
programmer_delay(1000 * 1000);
if (check_erased_range(flash, 0, flash->total_size * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -462,13 +462,13 @@
result = spi_disable_blockprotect();
if (result) {
- fprintf(stderr, "spi_disable_blockprotect failed\n");
+ msg_cerr("spi_disable_blockprotect failed\n");
return result;
}
result = spi_send_multicommand(cmds);
if (result) {
- fprintf(stderr, "%s failed during command execution\n", __func__);
+ msg_cerr("%s failed during command execution\n", __func__);
return result;
}
/* Wait until the Write-In-Progress bit is cleared.
@@ -478,23 +478,12 @@
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
programmer_delay(1000 * 1000);
if (check_erased_range(flash, 0, flash->total_size * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
}
-int spi_chip_erase_60_c7(struct flashchip *flash)
-{
- int result;
- result = spi_chip_erase_60(flash);
- if (result) {
- printf_debug("spi_chip_erase_60 failed, trying c7\n");
- result = spi_chip_erase_c7(flash);
- }
- return result;
-}
-
int spi_block_erase_52(struct flashchip *flash, unsigned int addr, unsigned int blocklen)
{
int result;
@@ -523,7 +512,7 @@
result = spi_send_multicommand(cmds);
if (result) {
- fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+ msg_cerr("%s failed during command execution at address 0x%x\n",
__func__, addr);
return result;
}
@@ -533,7 +522,7 @@
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
programmer_delay(100 * 1000);
if (check_erased_range(flash, addr, blocklen)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -572,7 +561,7 @@
result = spi_send_multicommand(cmds);
if (result) {
- fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+ msg_cerr("%s failed during command execution at address 0x%x\n",
__func__, addr);
return result;
}
@@ -582,7 +571,7 @@
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
programmer_delay(100 * 1000);
if (check_erased_range(flash, addr, blocklen)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -619,7 +608,7 @@
result = spi_send_multicommand(cmds);
if (result) {
- fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+ msg_cerr("%s failed during command execution at address 0x%x\n",
__func__, addr);
return result;
}
@@ -629,7 +618,7 @@
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
programmer_delay(100 * 1000);
if (check_erased_range(flash, addr, blocklen)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -643,17 +632,17 @@
spi_disable_blockprotect();
- printf("Erasing chip: \n");
+ msg_cinfo("Erasing chip: \n");
for (i = 0; i < total_size / erase_size; i++) {
rc = spi_block_erase_d8(flash, i * erase_size, erase_size);
if (rc) {
- fprintf(stderr, "Error erasing block at 0x%x\n", i);
+ msg_cerr("Error erasing block at 0x%x\n", i);
break;
}
}
- printf("\n");
+ msg_cinfo("\n");
return rc;
}
@@ -687,7 +676,7 @@
result = spi_send_multicommand(cmds);
if (result) {
- fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+ msg_cerr("%s failed during command execution at address 0x%x\n",
__func__, addr);
return result;
}
@@ -697,7 +686,7 @@
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
programmer_delay(10 * 1000);
if (check_erased_range(flash, addr, blocklen)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -706,7 +695,7 @@
int spi_block_erase_60(struct flashchip *flash, unsigned int addr, unsigned int blocklen)
{
if ((addr != 0) || (blocklen != flash->total_size * 1024)) {
- fprintf(stderr, "%s called with incorrect arguments\n",
+ msg_cerr("%s called with incorrect arguments\n",
__func__);
return -1;
}
@@ -716,7 +705,7 @@
int spi_block_erase_c7(struct flashchip *flash, unsigned int addr, unsigned int blocklen)
{
if ((addr != 0) || (blocklen != flash->total_size * 1024)) {
- fprintf(stderr, "%s called with incorrect arguments\n",
+ msg_cerr("%s called with incorrect arguments\n",
__func__);
return -1;
}
@@ -732,7 +721,7 @@
result = spi_send_command(sizeof(cmd), JEDEC_EWSR_INSIZE, cmd, NULL);
if (result)
- fprintf(stderr, "%s failed\n", __func__);
+ msg_cerr("%s failed\n", __func__);
return result;
}
@@ -765,7 +754,7 @@
result = spi_send_multicommand(cmds);
if (result) {
- fprintf(stderr, "%s failed during command execution\n",
+ msg_cerr("%s failed during command execution\n",
__func__);
}
return result;
@@ -800,7 +789,7 @@
result = spi_send_multicommand(cmds);
if (result) {
- fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+ msg_cerr("%s failed during command execution at address 0x%x\n",
__func__, addr);
}
return result;
@@ -835,11 +824,11 @@
}};
if (!len) {
- fprintf(stderr, "%s called for zero-length write\n", __func__);
+ msg_cerr("%s called for zero-length write\n", __func__);
return 1;
}
if (len > 256) {
- fprintf(stderr, "%s called for too long a write\n", __func__);
+ msg_cerr("%s called for too long a write\n", __func__);
return 1;
}
@@ -847,7 +836,7 @@
result = spi_send_multicommand(cmds);
if (result) {
- fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+ msg_cerr("%s failed during command execution at address 0x%x\n",
__func__, addr);
}
return result;
@@ -861,10 +850,10 @@
status = spi_read_status_register();
/* If there is block protection in effect, unprotect it first. */
if ((status & 0x3c) != 0) {
- printf_debug("Some block protection in effect, disabling\n");
+ msg_cdbg("Some block protection in effect, disabling\n");
result = spi_write_status_register(status & ~0x3c);
if (result) {
- fprintf(stderr, "spi_write_status_register failed\n");
+ msg_cerr("spi_write_status_register failed\n");
return result;
}
}
@@ -936,12 +925,12 @@
spi_disable_blockprotect();
/* Erase first */
- printf("Erasing flash before programming... ");
+ msg_cinfo("Erasing flash before programming... ");
if (erase_flash(flash)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
- printf("done.\n");
+ msg_cinfo("done.\n");
for (i = 0; i < total_size; i++) {
result = spi_byte_program(i, buf[i]);
if (result)
@@ -962,7 +951,7 @@
switch (spi_controller) {
#if INTERNAL_SUPPORT == 1
case SPI_CONTROLLER_WBSIO:
- fprintf(stderr, "%s: impossible with Winbond SPI masters,"
+ msg_cerr("%s: impossible with Winbond SPI masters,"
" degrading to byte program\n", __func__);
return spi_chip_write_1(flash, buf);
#endif
@@ -970,7 +959,7 @@
break;
}
if (erase_flash(flash)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
/* FIXME: This will fail on ICH/VIA SPI. */
diff --git a/sst28sf040.c b/sst28sf040.c
index 0c90526..b9e33ab 100644
--- a/sst28sf040.c
+++ b/sst28sf040.c
@@ -63,7 +63,7 @@
toggle_ready_jedec(bios);
if (check_erased_range(flash, address, sector_size)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -105,7 +105,7 @@
toggle_ready_jedec(bios);
if (check_erased_range(flash, 0, flash->total_size * 1024)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -120,21 +120,21 @@
unprotect_28sf040(bios);
- printf("Programming page: ");
+ msg_cinfo("Programming page: ");
for (i = 0; i < total_size / page_size; i++) {
/* erase the page before programming */
if (erase_sector_28sf040(flash, i * page_size, page_size)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
/* write to the sector */
- printf("%04d at address: 0x%08x", i, i * page_size);
+ msg_cinfo("%04d at address: 0x%08x", i, i * page_size);
write_sector_28sf040(bios, buf + i * page_size,
bios + i * page_size, page_size);
- printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ msg_cinfo("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
- printf("\n");
+ msg_cinfo("\n");
protect_28sf040(bios);
@@ -144,7 +144,7 @@
int erase_chip_28sf040(struct flashchip *flash, unsigned int addr, unsigned int blocklen)
{
if ((addr != 0) || (blocklen != flash->total_size * 1024)) {
- fprintf(stderr, "%s called with incorrect arguments\n",
+ msg_cerr("%s called with incorrect arguments\n",
__func__);
return -1;
}
diff --git a/sst49lfxxxc.c b/sst49lfxxxc.c
index e7e5b61..1331cda 100644
--- a/sst49lfxxxc.c
+++ b/sst49lfxxxc.c
@@ -27,7 +27,7 @@
int unlock_block_49lfxxxc(struct flashchip *flash, unsigned long address, unsigned char bits)
{
unsigned long lock = flash->virtual_registers + address + 2;
- printf_debug("lockbits at address=0x%08lx is 0x%01x\n", lock, chip_readb(lock));
+ msg_cdbg("lockbits at address=0x%08lx is 0x%01x\n", lock, chip_readb(lock));
chip_writeb(bits, lock);
return 0;
@@ -39,30 +39,30 @@
int i, left = flash->total_size * 1024;
unsigned long address;
- printf_debug("\nbios=0x%08lx\n", registers);
+ msg_cdbg("\nbios=0x%08lx\n", registers);
for (i = 0; left > 65536; i++, left -= 65536) {
- printf_debug("lockbits at address=0x%08lx is 0x%01x\n",
+ msg_cdbg("lockbits at address=0x%08lx is 0x%01x\n",
registers + (i * 65536) + 2,
chip_readb(registers + (i * 65536) + 2));
chip_writeb(bits, registers + (i * 65536) + 2);
}
address = i * 65536;
- printf_debug("lockbits at address=0x%08lx is 0x%01x\n",
+ msg_cdbg("lockbits at address=0x%08lx is 0x%01x\n",
registers + address + 2,
chip_readb(registers + address + 2));
chip_writeb(bits, registers + address + 2);
address += 32768;
- printf_debug("lockbits at address=0x%08lx is 0x%01x\n",
+ msg_cdbg("lockbits at address=0x%08lx is 0x%01x\n",
registers + address + 2,
chip_readb(registers + address + 2));
chip_writeb(bits, registers + address + 2);
address += 8192;
- printf_debug("lockbits at address=0x%08lx is 0x%01x\n",
+ msg_cdbg("lockbits at address=0x%08lx is 0x%01x\n",
registers + address + 2,
chip_readb(registers + address + 2));
chip_writeb(bits, registers + address + 2);
address += 8192;
- printf_debug("lockbits at address=0x%08lx is 0x%01x\n",
+ msg_cdbg("lockbits at address=0x%08lx is 0x%01x\n",
registers + address + 2,
chip_readb(registers + address + 2));
chip_writeb(bits, registers + address + 2);
@@ -86,7 +86,7 @@
status = wait_82802ab(bios);
if (check_erased_range(flash, address, sector_size)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
return 0;
@@ -100,21 +100,21 @@
chipaddr bios = flash->virtual_memory;
write_lockbits_49lfxxxc(flash, 0);
- printf("Programming page: ");
+ msg_cinfo("Programming page: ");
for (i = 0; i < total_size / page_size; i++) {
/* erase the page before programming */
if (erase_sector_49lfxxxc(flash, i * page_size, flash->page_size)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
/* write to the sector */
- printf("%04d at address: 0x%08x", i, i * page_size);
+ msg_cinfo("%04d at address: 0x%08x", i, i * page_size);
write_page_82802ab(bios, buf + i * page_size,
bios + i * page_size, page_size);
- printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ msg_cinfo("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
- printf("\n");
+ msg_cinfo("\n");
chip_writeb(0xFF, bios);
diff --git a/sst_fwhub.c b/sst_fwhub.c
index 328d39a..2b867c8 100644
--- a/sst_fwhub.c
+++ b/sst_fwhub.c
@@ -33,20 +33,20 @@
uint8_t blockstatus;
blockstatus = chip_readb(registers + offset + 2);
- printf_debug("Lock status for 0x%06x (size 0x%06x) is %02x, ",
+ msg_cdbg("Lock status for 0x%06x (size 0x%06x) is %02x, ",
offset, flash->page_size, blockstatus);
switch (blockstatus & 0x3) {
case 0x0:
- printf_debug("full access\n");
+ msg_cdbg("full access\n");
break;
case 0x1:
- printf_debug("write locked\n");
+ msg_cdbg("write locked\n");
break;
case 0x2:
- printf_debug("locked open\n");
+ msg_cdbg("locked open\n");
break;
case 0x3:
- printf_debug("write locked down\n");
+ msg_cdbg("write locked down\n");
break;
}
/* Return content of the write_locked bit */
@@ -61,11 +61,11 @@
blockstatus = check_sst_fwhub_block_lock(flash, offset);
if (blockstatus) {
- printf_debug("Trying to clear lock for 0x%06x... ", offset)
+ msg_cdbg("Trying to clear lock for 0x%06x... ", offset);
chip_writeb(0, registers + offset + 2);
blockstatus = check_sst_fwhub_block_lock(flash, offset);
- printf_debug("%s\n", (blockstatus) ? "failed" : "OK");
+ msg_cdbg("%s\n", (blockstatus) ? "failed" : "OK");
}
return blockstatus;
diff --git a/stm50flw0x0x.c b/stm50flw0x0x.c
index 3300969..8a00308 100644
--- a/stm50flw0x0x.c
+++ b/stm50flw0x0x.c
@@ -61,19 +61,19 @@
// unlock each 4k-sector
for (j = 0; j < 0x10000; j += 0x1000) {
- printf_debug("unlocking at 0x%x\n", offset + j);
+ msg_cdbg("unlocking at 0x%x\n", offset + j);
chip_writeb(unlock_sector, wrprotect + offset + j);
if (chip_readb(wrprotect + offset + j) != unlock_sector) {
- printf("Cannot unlock sector @ 0x%x\n",
+ msg_cerr("Cannot unlock sector @ 0x%x\n",
offset + j);
return -1;
}
}
} else {
- printf_debug("unlocking at 0x%x\n", offset);
+ msg_cdbg("unlocking at 0x%x\n", offset);
chip_writeb(unlock_sector, wrprotect + offset);
if (chip_readb(wrprotect + offset) != unlock_sector) {
- printf("Cannot unlock sector @ 0x%x\n", offset);
+ msg_cerr("Cannot unlock sector @ 0x%x\n", offset);
return -1;
}
}
@@ -87,7 +87,7 @@
for (i = 0; i < flash->total_size * 1024; i+= flash->page_size) {
if(unlock_block_stm50flw0x0x(flash, i)) {
- fprintf(stderr, "UNLOCK FAILED!\n");
+ msg_cerr("UNLOCK FAILED!\n");
return -1;
}
}
@@ -101,7 +101,7 @@
// clear status register
chip_writeb(0x50, bios);
- printf_debug("Erase at 0x%lx\n", bios);
+ msg_cdbg("Erase at 0x%lx\n", bios);
// now start it
chip_writeb(0x32, bios);
chip_writeb(0xd0, bios);
@@ -110,10 +110,10 @@
wait_82802ab(flash->virtual_memory);
if (check_erased_range(flash, sector, sectorsize)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
- printf("DONE BLOCK 0x%x\n", sector);
+ msg_cinfo("DONE BLOCK 0x%x\n", sector);
return 0;
}
@@ -130,21 +130,20 @@
return -1;
}
- printf("Erasing page:\n");
+ msg_cinfo("Erasing page:\n");
for (i = 0; i < total_size / page_size; i++) {
- printf
- ("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
- printf("%04d at address: 0x%08x ", i, i * page_size);
+ msg_cinfo("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ msg_cinfo("%04d at address: 0x%08x ", i, i * page_size);
//if (unlock_block_stm50flw0x0x(flash, i * page_size)) {
- // fprintf(stderr, "UNLOCK FAILED!\n");
+ // msg_cerr("UNLOCK FAILED!\n");
// return -1;
//}
if (erase_block_82802ab(flash, i * page_size, page_size)) {
- fprintf(stderr, "ERASE FAILED!\n");
+ msg_cerr("ERASE FAILED!\n");
return -1;
}
}
- printf("\n");
+ msg_cinfo("\n");
return 0;
}
diff --git a/w29ee011.c b/w29ee011.c
index 63cf4fc..6b88a1c 100644
--- a/w29ee011.c
+++ b/w29ee011.c
@@ -29,7 +29,7 @@
extern char *chip_to_probe;
if (!chip_to_probe || strcmp(chip_to_probe, "W29EE011")) {
- printf_debug("Probing disabled for Winbond W29EE011 because "
+ msg_cdbg("Probing disabled for Winbond W29EE011 because "
"the probing sequence puts the AMIC A49LF040A in "
"a funky state. Use 'flashrom -c W29EE011' if you "
"have a board with this chip.\n");
@@ -62,7 +62,7 @@
chip_writeb(0xF0, bios + 0x5555);
programmer_delay(10);
- printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
+ msg_cdbg("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
if (id1 == flash->manufacture_id && id2 == flash->model_id)
return 1;
diff --git a/w39v040c.c b/w39v040c.c
index 74cd1e2..dc4de1c 100644
--- a/w39v040c.c
+++ b/w39v040c.c
@@ -42,7 +42,7 @@
chip_writeb(0xF0, bios + 0x5555);
programmer_delay(40);
- printf("%s: Boot block #TBL is %slocked, rest of chip #WP is %slocked.\n",
+ msg_cdbg("%s: Boot block #TBL is %slocked, rest of chip #WP is %slocked.\n",
__func__, lock & 0x4 ? "" : "un", lock & 0x8 ? "" : "un");
return 0;
}
diff --git a/w39v080fa.c b/w39v080fa.c
index 047f86b..62c55f4 100644
--- a/w39v080fa.c
+++ b/w39v080fa.c
@@ -26,37 +26,37 @@
chipaddr wrprotect = flash->virtual_registers + offset + 2;
uint8_t locking;
- printf_debug("Trying to unlock block @0x%08x = 0x%02x\n", offset,
+ msg_cdbg("Trying to unlock block @0x%08x = 0x%02x\n", offset,
chip_readb(wrprotect));
locking = chip_readb(wrprotect);
switch (locking & 0x7) {
case 0:
- printf_debug("Full Access.\n");
+ msg_cdbg("Full Access.\n");
return 0;
case 1:
- printf_debug("Write Lock (Default State).\n");
+ msg_cdbg("Write Lock (Default State).\n");
chip_writeb(0, wrprotect);
return 0;
case 2:
- printf_debug("Locked Open (Full Access, Lock Down).\n");
+ msg_cdbg("Locked Open (Full Access, Lock Down).\n");
return 0;
case 3:
- fprintf(stderr, "Error: Write Lock, Locked Down.\n");
+ msg_cerr("Error: Write Lock, Locked Down.\n");
return -1;
case 4:
- printf_debug("Read Lock.\n");
+ msg_cdbg("Read Lock.\n");
chip_writeb(0, wrprotect);
return 0;
case 5:
- printf_debug("Read/Write Lock.\n");
+ msg_cdbg("Read/Write Lock.\n");
chip_writeb(0, wrprotect);
return 0;
case 6:
- fprintf(stderr, "Error: Read Lock, Locked Down.\n");
+ msg_cerr("Error: Read Lock, Locked Down.\n");
return -1;
case 7:
- fprintf(stderr, "Error: Read/Write Lock, Locked Down.\n");
+ msg_cerr("Error: Read/Write Lock, Locked Down.\n");
return -1;
}
@@ -89,17 +89,17 @@
chip_writeb(0xF0, bios + 0x5555);
programmer_delay(10);
- printf_debug("Lockout bits:\n");
+ msg_cdbg("Lockout bits:\n");
if (locking & (1 << 2))
- fprintf(stderr, "Error: hardware bootblock locking (#TBL).\n");
+ msg_cerr("Error: hardware bootblock locking (#TBL).\n");
else
- printf_debug("No hardware bootblock locking (good!)\n");
+ msg_cdbg("No hardware bootblock locking (good!)\n");
if (locking & (1 << 3))
- fprintf(stderr, "Error: hardware block locking (#WP).\n");
+ msg_cerr("Error: hardware block locking (#WP).\n");
else
- printf_debug("No hardware block locking (good!)\n");
+ msg_cdbg("No hardware block locking (good!)\n");
if (locking & ((1 << 2) | (1 << 3)))
return -1;