diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2010-01-07 03:32:17 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2010-01-07 03:32:17 +0000 |
commit | b218b5aa7931379c1165ff1c371164bec55b31fc (patch) | |
tree | ff145bc4ed987c3c81870ddb6e7ce6a929ca9b47 /sb600spi.c | |
parent | 1912e057c355e71915013fcdf1a04146874ca7ed (diff) | |
download | flashrom-b218b5aa7931379c1165ff1c371164bec55b31fc.zip flashrom-b218b5aa7931379c1165ff1c371164bec55b31fc.tar.gz |
Programmer debug messages during programmer init/shutdown are useful because they print hardware settings and desired configuration
They help in getting a quick overview of hardware and software state on
startup and shutdown. Programmer debug messages during flash chip access are
mostly a distraction in logs and should only be enabled if someone is having
problems which are suspected to stem from a programmer hardware or programmer
software bug. Disable those messages by default, they can be reenabled by
#define COMM_DEBUG in the affected programmer file. An added benefit is a
tremendous size reduction in verbose probe/read/write/erase logs because only
flash chip driver messages remain. In some cases, logs will shrink from 65
MB to 10 kB or less. The right(tm) fix would be two different debug levels
(DEBUG and SPEW) and the ability to differentiate between programmer debug
messages and flash chip debug messages. Until the design for the message
printing infrastructure is finished, this is the best stop-gap measure
we can get.
Corresponding to flashrom svn r834.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audioahcked@gmail.com>
Diffstat (limited to 'sb600spi.c')
-rw-r--r-- | sb600spi.c | 25 |
1 files changed, 18 insertions, 7 deletions
@@ -24,6 +24,17 @@ #include "flash.h" #include "spi.h" +/* Change this to #define if you want lowlevel debugging of commands + * sent to the SB600/SB700 SPI controller. + */ +#undef COMM_DEBUG + +#ifdef COMM_DEBUG +#define msg_comm_debug printf_debug +#else +#define msg_comm_debug(...) do {} while (0) +#endif + /* This struct is unused, but helps visualize the SB600 SPI BAR layout. *struct sb600_spi_controller { * unsigned int spi_cntrl0; / * 00h * / @@ -105,7 +116,7 @@ int sb600_spi_send_command(unsigned int writecnt, unsigned int readcnt, writecnt--; - printf_debug("%s, cmd=%x, writecnt=%x, readcnt=%x\n", + msg_comm_debug("%s, cmd=%x, writecnt=%x, readcnt=%x\n", __func__, cmd, writecnt, readcnt); if (readcnt > 8) { @@ -135,10 +146,10 @@ int sb600_spi_send_command(unsigned int writecnt, unsigned int readcnt, /* Send the write byte to FIFO. */ for (count = 0; count < writecnt; count++, writearr++) { - printf_debug(" [%x]", *writearr); + msg_comm_debug(" [%x]", *writearr); mmio_writeb(*writearr, sb600_spibar + 0xC); } - printf_debug("\n"); + msg_comm_debug("\n"); /* * We should send the data by sequence, which means we need to reset @@ -164,16 +175,16 @@ int sb600_spi_send_command(unsigned int writecnt, unsigned int readcnt, /* Skip the bytes we sent. */ for (count = 0; count < writecnt; count++) { cmd = mmio_readb(sb600_spibar + 0xC); - printf_debug("[ %2x]", cmd); + msg_comm_debug("[ %2x]", cmd); } - printf_debug("The FIFO pointer after skipping is %d.\n", + msg_comm_debug("The FIFO pointer after skipping is %d.\n", mmio_readb(sb600_spibar + 0xd) & 0x07); for (count = 0; count < readcnt; count++, readarr++) { *readarr = mmio_readb(sb600_spibar + 0xC); - printf_debug("[%02x]", *readarr); + msg_comm_debug("[%02x]", *readarr); } - printf_debug("\n"); + msg_comm_debug("\n"); return 0; } |