Module Name:src
Committed By: martin
Date: Fri Mar 3 17:04:17 UTC 2023
Modified Files:
src/sys/arch/arm/ti [netbsd-9]: if_cpsw.c
Log Message:
Pull up following revision(s) (requested by sekiya in ticket #1609):
sys/arch/arm/ti/if_cpsw.c: revision 1.17
Uncomment and protect sanity checks that would drop into the debugger with a
CPSW_DEBUG_DMA define.
This handles a condition where checking for DMA_RXEOQ in the received packet
results in the console being spammed with "rxeoq" messages, which soon results
in a kernel panic. The corresponding Debugger() call for this check was
commented out.
The TI documentation ("AM335x and AMIC110 Sitara(TM) Processors Technical
Reference Manual") documents the EOQ bit thus:
(14.3.2.4.1.2.4) This bit is set by the EMAC when the EMAC identifies
that a descriptor is the last for a given packet received (also sets
the EOP flag), and there are no more descriptors in the receive list
(next descriptor pointer is NULL). The software application can use
this bit to detect when the EMAC receiver for the corresponding channel
has halted. This is useful when the application appends additional free
buffer descriptors to an active receive queue. Note that this flag is
valid on EOP descriptors only.
Moving this check (and the offending printf() ) into a debug #ifdef results in
the BeagleBone Green surviving the nightly checks; it would always drop into
the debugger before this change.
To generate a diff of this commit:
cvs rdiff -u -r1.6.2.3 -r1.6.2.4 src/sys/arch/arm/ti/if_cpsw.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/ti/if_cpsw.c
diff -u src/sys/arch/arm/ti/if_cpsw.c:1.6.2.3 src/sys/arch/arm/ti/if_cpsw.c:1.6.2.4
--- src/sys/arch/arm/ti/if_cpsw.c:1.6.2.3 Thu Feb 20 14:36:38 2020
+++ src/sys/arch/arm/ti/if_cpsw.c Fri Mar 3 17:04:17 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cpsw.c,v 1.6.2.3 2020/02/20 14:36:38 martin Exp $ */
+/* $NetBSD: if_cpsw.c,v 1.6.2.4 2023/03/03 17:04:17 martin Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
*/
#include
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.3 2020/02/20 14:36:38 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.4 2023/03/03 17:04:17 martin Exp $");
#include
#include
@@ -95,6 +95,8 @@ __KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v
CTASSERT(powerof2(CPSW_NTXDESCS));
CTASSERT(powerof2(CPSW_NRXDESCS));
+#undef CPSW_DEBUG_DMA /* define this for DMA debugging */
+
#define CPSW_PAD_LEN (ETHER_MIN_LEN - ETHER_CRC_LEN)
#define TXDESC_NEXT(x) cpsw_txdesc_adjust((x), 1)
@@ -1159,10 +1161,12 @@ cpsw_rxintr(void *arg)
return 1;
}
+#if defined(CPSW_DEBUG_DMA)
if ((dw[3] & (CPDMA_BD_SOP | CPDMA_BD_EOP)) !=
(CPDMA_BD_SOP | CPDMA_BD_EOP)) {
- //Debugger();
+ Debugger();
}
+#endif
bus_dmamap_sync(sc->sc_bdt, dm, 0, dm->dm_mapsize,
BUS_DMASYNC_POSTREAD);
@@ -1197,10 +1201,12 @@ next:
cpsw_rxdesc_paddr(sc, i));
}
+#if defined(CPSW_DEBUG_DMA)
if (sc->sc_rxeoq) {
device_printf(sc->sc_dev, "rxeoq\n");
- //Debugger();
+ Debugger();
}
+#endif
cpsw_write_4(sc, CPSW_CPDMA_CPDMA_EOI_VECTOR, CPSW_INTROFF_RX);
@@ -1247,9 +1253,11 @@ cpsw_txintr(void *arg)
cpsw_get_txdesc(sc, sc->sc_txhead, &bd);
+#if defined(CPSW_DEBUG_DMA)
if (dw[2] == 0) {
//Debugger();
}
+#endif
if (ISSET(dw[3], CPDMA_BD_SOP) == 0)
goto next;