From 3ac101c32bb8235a799b10482030d590d7623046 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Sat, 9 Jan 2010 04:32:23 +0000 Subject: Convert dummyflasher to msg_* and make good use of msg_pspew Rule of thumb: Diagnostic programmer init messages are msg_pdbg, all other debug stuff (except warnings, which should be pmsg_pinfo or msg_perr) is msg_pspew. This makes "flashrom -p dummy -V" output a whole lot more readable (try it!). In case someone wants the full barfed output, it is possible to specify -VV instead of -V. Corresponding to flashrom svn r842. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Sean Nelson --- dummyflasher.c | 58 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/dummyflasher.c b/dummyflasher.c index 903f88b..0f62d16 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -27,7 +27,7 @@ int dummy_init(void) { int i; - printf_debug("%s\n", __func__); + msg_pspew("%s\n", __func__); /* "all" is equivalent to specifying no type. */ if (programmer_param && (!strcmp(programmer_param, "all"))) { @@ -43,95 +43,95 @@ int dummy_init(void) buses_supported = CHIP_BUSTYPE_NONE; if (strstr(programmer_param, "parallel")) { buses_supported |= CHIP_BUSTYPE_PARALLEL; - printf_debug("Enabling support for %s flash.\n", "parallel"); + msg_pdbg("Enabling support for %s flash.\n", "parallel"); } if (strstr(programmer_param, "lpc")) { buses_supported |= CHIP_BUSTYPE_LPC; - printf_debug("Enabling support for %s flash.\n", "LPC"); + msg_pdbg("Enabling support for %s flash.\n", "LPC"); } if (strstr(programmer_param, "fwh")) { buses_supported |= CHIP_BUSTYPE_FWH; - printf_debug("Enabling support for %s flash.\n", "FWH"); + msg_pdbg("Enabling support for %s flash.\n", "FWH"); } if (strstr(programmer_param, "spi")) { buses_supported |= CHIP_BUSTYPE_SPI; spi_controller = SPI_CONTROLLER_DUMMY; - printf_debug("Enabling support for %s flash.\n", "SPI"); + msg_pdbg("Enabling support for %s flash.\n", "SPI"); } if (buses_supported == CHIP_BUSTYPE_NONE) - printf_debug("Support for all flash bus types disabled.\n"); + msg_pdbg("Support for all flash bus types disabled.\n"); free(programmer_param); return 0; } int dummy_shutdown(void) { - printf_debug("%s\n", __func__); + msg_pspew("%s\n", __func__); return 0; } void *dummy_map(const char *descr, unsigned long phys_addr, size_t len) { - printf_debug("%s: Mapping %s, 0x%lx bytes at 0x%08lx\n", - __func__, descr, (unsigned long)len, phys_addr); + msg_pspew("%s: Mapping %s, 0x%lx bytes at 0x%08lx\n", + __func__, descr, (unsigned long)len, phys_addr); return (void *)phys_addr; } void dummy_unmap(void *virt_addr, size_t len) { - printf_debug("%s: Unmapping 0x%lx bytes at %p\n", - __func__, (unsigned long)len, virt_addr); + msg_pspew("%s: Unmapping 0x%lx bytes at %p\n", + __func__, (unsigned long)len, virt_addr); } void dummy_chip_writeb(uint8_t val, chipaddr addr) { - printf_debug("%s: addr=0x%lx, val=0x%02x\n", __func__, addr, val); + msg_pspew("%s: addr=0x%lx, val=0x%02x\n", __func__, addr, val); } void dummy_chip_writew(uint16_t val, chipaddr addr) { - printf_debug("%s: addr=0x%lx, val=0x%04x\n", __func__, addr, val); + msg_pspew("%s: addr=0x%lx, val=0x%04x\n", __func__, addr, val); } void dummy_chip_writel(uint32_t val, chipaddr addr) { - printf_debug("%s: addr=0x%lx, val=0x%08x\n", __func__, addr, val); + msg_pspew("%s: addr=0x%lx, val=0x%08x\n", __func__, addr, val); } void dummy_chip_writen(uint8_t *buf, chipaddr addr, size_t len) { size_t i; - printf_debug("%s: addr=0x%lx, len=0x%08lx, writing data (hex):", - __func__, addr, (unsigned long)len); + msg_pspew("%s: addr=0x%lx, len=0x%08lx, writing data (hex):", + __func__, addr, (unsigned long)len); for (i = 0; i < len; i++) { if ((i % 16) == 0) - printf_debug("\n"); - printf_debug("%02x ", buf[i]) + msg_pspew("\n"); + msg_pspew("%02x ", buf[i]); } } uint8_t dummy_chip_readb(const chipaddr addr) { - printf_debug("%s: addr=0x%lx, returning 0xff\n", __func__, addr); + msg_pspew("%s: addr=0x%lx, returning 0xff\n", __func__, addr); return 0xff; } uint16_t dummy_chip_readw(const chipaddr addr) { - printf_debug("%s: addr=0x%lx, returning 0xffff\n", __func__, addr); + msg_pspew("%s: addr=0x%lx, returning 0xffff\n", __func__, addr); return 0xffff; } uint32_t dummy_chip_readl(const chipaddr addr) { - printf_debug("%s: addr=0x%lx, returning 0xffffffff\n", __func__, addr); + msg_pspew("%s: addr=0x%lx, returning 0xffffffff\n", __func__, addr); return 0xffffffff; } void dummy_chip_readn(uint8_t *buf, const chipaddr addr, size_t len) { - printf_debug("%s: addr=0x%lx, len=0x%lx, returning array of 0xff\n", - __func__, addr, (unsigned long)len); + msg_pspew("%s: addr=0x%lx, len=0x%lx, returning array of 0xff\n", + __func__, addr, (unsigned long)len); memset(buf, 0xff, len); return; } @@ -141,18 +141,18 @@ int dummy_spi_send_command(unsigned int writecnt, unsigned int readcnt, { int i; - printf_debug("%s:", __func__); + msg_pspew("%s:", __func__); - printf_debug(" writing %u bytes:", writecnt); + msg_pspew(" writing %u bytes:", writecnt); for (i = 0; i < writecnt; i++) - printf_debug(" 0x%02x", writearr[i]); + msg_pspew(" 0x%02x", writearr[i]); - printf_debug(" reading %u bytes:", readcnt); + msg_pspew(" reading %u bytes:", readcnt); for (i = 0; i < readcnt; i++) { - printf_debug(" 0xff"); + msg_pspew(" 0xff"); readarr[i] = 0xff; } - printf_debug("\n"); + msg_pspew("\n"); return 0; } -- cgit v1.1