Changeset 842 for trunk/dummyflasher.c


Ignore:
Timestamp:
Jan 9, 2010, 5:32:23 AM (5 years ago)
Author:
hailfinger
Message:

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.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>
Acked-by: Sean Nelson <audiohacked@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dummyflasher.c

    r679 r842  
    2828{ 
    2929        int i; 
    30         printf_debug("%s\n", __func__); 
     30        msg_pspew("%s\n", __func__); 
    3131 
    3232        /* "all" is equivalent to specifying no type. */ 
     
    4444        if (strstr(programmer_param, "parallel")) { 
    4545                buses_supported |= CHIP_BUSTYPE_PARALLEL; 
    46                 printf_debug("Enabling support for %s flash.\n", "parallel"); 
     46                msg_pdbg("Enabling support for %s flash.\n", "parallel"); 
    4747        } 
    4848        if (strstr(programmer_param, "lpc")) { 
    4949                buses_supported |= CHIP_BUSTYPE_LPC; 
    50                 printf_debug("Enabling support for %s flash.\n", "LPC"); 
     50                msg_pdbg("Enabling support for %s flash.\n", "LPC"); 
    5151        } 
    5252        if (strstr(programmer_param, "fwh")) { 
    5353                buses_supported |= CHIP_BUSTYPE_FWH; 
    54                 printf_debug("Enabling support for %s flash.\n", "FWH"); 
     54                msg_pdbg("Enabling support for %s flash.\n", "FWH"); 
    5555        } 
    5656        if (strstr(programmer_param, "spi")) { 
    5757                buses_supported |= CHIP_BUSTYPE_SPI; 
    5858                spi_controller = SPI_CONTROLLER_DUMMY; 
    59                 printf_debug("Enabling support for %s flash.\n", "SPI"); 
     59                msg_pdbg("Enabling support for %s flash.\n", "SPI"); 
    6060        } 
    6161        if (buses_supported == CHIP_BUSTYPE_NONE) 
    62                 printf_debug("Support for all flash bus types disabled.\n"); 
     62                msg_pdbg("Support for all flash bus types disabled.\n"); 
    6363        free(programmer_param); 
    6464        return 0; 
     
    6767int dummy_shutdown(void) 
    6868{ 
    69         printf_debug("%s\n", __func__); 
     69        msg_pspew("%s\n", __func__); 
    7070        return 0; 
    7171} 
     
    7373void *dummy_map(const char *descr, unsigned long phys_addr, size_t len) 
    7474{ 
    75         printf_debug("%s: Mapping %s, 0x%lx bytes at 0x%08lx\n", 
    76                 __func__, descr, (unsigned long)len, phys_addr); 
     75        msg_pspew("%s: Mapping %s, 0x%lx bytes at 0x%08lx\n", 
     76                  __func__, descr, (unsigned long)len, phys_addr); 
    7777        return (void *)phys_addr; 
    7878} 
     
    8080void dummy_unmap(void *virt_addr, size_t len) 
    8181{ 
    82         printf_debug("%s: Unmapping 0x%lx bytes at %p\n", 
    83                 __func__, (unsigned long)len, virt_addr); 
     82        msg_pspew("%s: Unmapping 0x%lx bytes at %p\n", 
     83                  __func__, (unsigned long)len, virt_addr); 
    8484} 
    8585 
    8686void dummy_chip_writeb(uint8_t val, chipaddr addr) 
    8787{ 
    88         printf_debug("%s: addr=0x%lx, val=0x%02x\n", __func__, addr, val); 
     88        msg_pspew("%s: addr=0x%lx, val=0x%02x\n", __func__, addr, val); 
    8989} 
    9090 
    9191void dummy_chip_writew(uint16_t val, chipaddr addr) 
    9292{ 
    93         printf_debug("%s: addr=0x%lx, val=0x%04x\n", __func__, addr, val); 
     93        msg_pspew("%s: addr=0x%lx, val=0x%04x\n", __func__, addr, val); 
    9494} 
    9595 
    9696void dummy_chip_writel(uint32_t val, chipaddr addr) 
    9797{ 
    98         printf_debug("%s: addr=0x%lx, val=0x%08x\n", __func__, addr, val); 
     98        msg_pspew("%s: addr=0x%lx, val=0x%08x\n", __func__, addr, val); 
    9999} 
    100100 
     
    102102{ 
    103103        size_t i; 
    104         printf_debug("%s: addr=0x%lx, len=0x%08lx, writing data (hex):", 
    105                      __func__, addr, (unsigned long)len); 
     104        msg_pspew("%s: addr=0x%lx, len=0x%08lx, writing data (hex):", 
     105                  __func__, addr, (unsigned long)len); 
    106106        for (i = 0; i < len; i++) { 
    107107                if ((i % 16) == 0) 
    108                         printf_debug("\n"); 
    109                 printf_debug("%02x ", buf[i]) 
     108                        msg_pspew("\n"); 
     109                msg_pspew("%02x ", buf[i]); 
    110110        } 
    111111} 
     
    113113uint8_t dummy_chip_readb(const chipaddr addr) 
    114114{ 
    115         printf_debug("%s:  addr=0x%lx, returning 0xff\n", __func__, addr); 
     115        msg_pspew("%s:  addr=0x%lx, returning 0xff\n", __func__, addr); 
    116116        return 0xff; 
    117117} 
     
    119119uint16_t dummy_chip_readw(const chipaddr addr) 
    120120{ 
    121         printf_debug("%s:  addr=0x%lx, returning 0xffff\n", __func__, addr); 
     121        msg_pspew("%s:  addr=0x%lx, returning 0xffff\n", __func__, addr); 
    122122        return 0xffff; 
    123123} 
     
    125125uint32_t dummy_chip_readl(const chipaddr addr) 
    126126{ 
    127         printf_debug("%s:  addr=0x%lx, returning 0xffffffff\n", __func__, addr); 
     127        msg_pspew("%s:  addr=0x%lx, returning 0xffffffff\n", __func__, addr); 
    128128        return 0xffffffff; 
    129129} 
     
    131131void dummy_chip_readn(uint8_t *buf, const chipaddr addr, size_t len) 
    132132{ 
    133         printf_debug("%s:  addr=0x%lx, len=0x%lx, returning array of 0xff\n", 
    134                      __func__, addr, (unsigned long)len); 
     133        msg_pspew("%s:  addr=0x%lx, len=0x%lx, returning array of 0xff\n", 
     134                  __func__, addr, (unsigned long)len); 
    135135        memset(buf, 0xff, len); 
    136136        return; 
     
    142142        int i; 
    143143 
    144         printf_debug("%s:", __func__); 
     144        msg_pspew("%s:", __func__); 
    145145 
    146         printf_debug(" writing %u bytes:", writecnt); 
     146        msg_pspew(" writing %u bytes:", writecnt); 
    147147        for (i = 0; i < writecnt; i++) 
    148                 printf_debug(" 0x%02x", writearr[i]); 
     148                msg_pspew(" 0x%02x", writearr[i]); 
    149149 
    150         printf_debug(" reading %u bytes:", readcnt); 
     150        msg_pspew(" reading %u bytes:", readcnt); 
    151151        for (i = 0; i < readcnt; i++) { 
    152                 printf_debug(" 0xff"); 
     152                msg_pspew(" 0xff"); 
    153153                readarr[i] = 0xff; 
    154154        } 
    155155 
    156         printf_debug("\n"); 
     156        msg_pspew("\n"); 
    157157        return 0; 
    158158} 
Note: See TracChangeset for help on using the changeset viewer.