+#ifdef BCMDBG
+static void
+dma32_dumpring (dma_info_t * di, struct bcmstrbuf *b, dma32dd_t * ring,
+ uint start, uint end, uint max_num)
+{
+ uint i;
+
+ for (i = start; i != end; i = XXD ((i + 1), max_num))
+ {
+ /* in the format of high->low 8 bytes */
+ bcm_bprintf (b, "ring index %d: 0x%x %x\n", i, ring[i].addr,
+ ring[i].ctrl);
+ }
+}
+
+static void
+dma32_dumptx (dma_info_t * di, struct bcmstrbuf *b, bool dumpring)
+{
+ if (di->ntxd == 0)
+ return;
+
+ bcm_bprintf (b, "DMA32: txd32 %p txdpa 0x%lx txp %p txin %d txout %d "
+ "txavail %d\n", di->txd32, di->txdpa, di->txp, di->txin,
+ di->txout, di->hnddma.txavail);
+
+ bcm_bprintf (b, "xmtcontrol 0x%x xmtaddr 0x%x xmtptr 0x%x xmtstatus 0x%x\n",
+ R_REG (di->osh, &di->d32txregs->control),
+ R_REG (di->osh, &di->d32txregs->addr),
+ R_REG (di->osh, &di->d32txregs->ptr),
+ R_REG (di->osh, &di->d32txregs->status));
+
+ if (dumpring && di->txd32)
+ dma32_dumpring (di, b, di->txd32, di->txin, di->txout, di->ntxd);
+}
+
+static void
+dma32_dumprx (dma_info_t * di, struct bcmstrbuf *b, bool dumpring)
+{
+ if (di->nrxd == 0)
+ return;
+
+ bcm_bprintf (b, "DMA32: rxd32 %p rxdpa 0x%lx rxp %p rxin %d rxout %d\n",
+ di->rxd32, di->rxdpa, di->rxp, di->rxin, di->rxout);
+
+ bcm_bprintf (b, "rcvcontrol 0x%x rcvaddr 0x%x rcvptr 0x%x rcvstatus 0x%x\n",
+ R_REG (di->osh, &di->d32rxregs->control),
+ R_REG (di->osh, &di->d32rxregs->addr),
+ R_REG (di->osh, &di->d32rxregs->ptr),
+ R_REG (di->osh, &di->d32rxregs->status));
+ if (di->rxd32 && dumpring)
+ dma32_dumpring (di, b, di->rxd32, di->rxin, di->rxout, di->nrxd);
+}
+
+static void
+dma32_dump (dma_info_t * di, struct bcmstrbuf *b, bool dumpring)
+{
+ dma32_dumptx (di, b, dumpring);
+ dma32_dumprx (di, b, dumpring);
+}
+
+static void
+dma64_dumpring (dma_info_t * di, struct bcmstrbuf *b, dma64dd_t * ring,
+ uint start, uint end, uint max_num)
+{
+ uint i;
+
+ for (i = start; i != end; i = XXD ((i + 1), max_num))
+ {
+ /* in the format of high->low 16 bytes */
+ bcm_bprintf (b, "ring index %d: 0x%x %x %x %x\n",
+ i, ring[i].addrhigh, ring[i].addrlow, ring[i].ctrl2,
+ ring[i].ctrl1);
+ }
+}
+
+static void
+dma64_dumptx (dma_info_t * di, struct bcmstrbuf *b, bool dumpring)
+{
+ if (di->ntxd == 0)
+ return;
+
+ bcm_bprintf (b, "DMA64: txd64 %p txdpa 0x%lx txp %p txin %d txout %d "
+ "txavail %d\n", di->txd64, di->txdpa, di->txp, di->txin,
+ di->txout, di->hnddma.txavail);
+
+ bcm_bprintf (b, "xmtcontrol 0x%x xmtaddrlow 0x%x xmtaddrhigh 0x%x "
+ "xmtptr 0x%x xmtstatus0 0x%x xmtstatus1 0x%x\n",
+ R_REG (di->osh, &di->d64txregs->control),
+ R_REG (di->osh, &di->d64txregs->addrlow),
+ R_REG (di->osh, &di->d64txregs->addrhigh),
+ R_REG (di->osh, &di->d64txregs->ptr),
+ R_REG (di->osh, &di->d64txregs->status0),
+ R_REG (di->osh, &di->d64txregs->status1));
+
+ if (dumpring && di->txd64)
+ {
+ dma64_dumpring (di, b, di->txd64, di->txin, di->txout, di->ntxd);
+ }
+}
+
+static void
+dma64_dumprx (dma_info_t * di, struct bcmstrbuf *b, bool dumpring)
+{
+ if (di->nrxd == 0)
+ return;
+
+ bcm_bprintf (b, "DMA64: rxd64 %p rxdpa 0x%lx rxp %p rxin %d rxout %d\n",
+ di->rxd64, di->rxdpa, di->rxp, di->rxin, di->rxout);
+
+ bcm_bprintf (b, "rcvcontrol 0x%x rcvaddrlow 0x%x rcvaddrhigh 0x%x rcvptr "
+ "0x%x rcvstatus0 0x%x rcvstatus1 0x%x\n",
+ R_REG (di->osh, &di->d64rxregs->control),
+ R_REG (di->osh, &di->d64rxregs->addrlow),
+ R_REG (di->osh, &di->d64rxregs->addrhigh),
+ R_REG (di->osh, &di->d64rxregs->ptr),
+ R_REG (di->osh, &di->d64rxregs->status0),
+ R_REG (di->osh, &di->d64rxregs->status1));
+ if (di->rxd64 && dumpring)
+ {
+ dma64_dumpring (di, b, di->rxd64, di->rxin, di->rxout, di->nrxd);
+ }
+}
+
+static void
+dma64_dump (dma_info_t * di, struct bcmstrbuf *b, bool dumpring)
+{
+ dma64_dumptx (di, b, dumpring);
+ dma64_dumprx (di, b, dumpring);
+}
+
+#endif /* BCMDBG */