Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Aug 2012 02:22:16 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239381 - in head/sys/dev/ath: . ath_hal
Message-ID:  <201208190222.q7J2MGJU013624@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sun Aug 19 02:22:16 2012
New Revision: 239381
URL: http://svn.freebsd.org/changeset/base/239381

Log:
  Extend the TX descriptor debug printing to be properly aware of
  EDMA code.
  
  * create a new TX EDMA descriptor struct to represent TX EDMA descriptors
    when doing debugging;
  * implement an EDMA printing function which:
    + hardcodes the TX map size to 4 for now;
    + correctly prints out the number of segments - there's one descriptor
      for up to 4 buffers (segments), not one for each segment;
    + print out 4 DS buffer and len pointers;
    + print out the correct number of DWORDs in the TX descriptor.
  
  TODO:
  
  * Remove all of the hard-coded stuff. Ew.

Modified:
  head/sys/dev/ath/ath_hal/ah_desc.h
  head/sys/dev/ath/if_ath_debug.c

Modified: head/sys/dev/ath/ath_hal/ah_desc.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_desc.h	Sun Aug 19 02:16:22 2012	(r239380)
+++ head/sys/dev/ath/ath_hal/ah_desc.h	Sun Aug 19 02:22:16 2012	(r239381)
@@ -223,6 +223,12 @@ struct ath_desc {
 	uint32_t	ds_hw[HAL_DESC_HW_SIZE];	/* opaque h/w region */
 };
 
+struct ath_desc_txedma {
+	uint32_t	ds_info;
+	uint32_t	ds_link;
+	uint32_t	ds_hw[21];	/* includes buf/len */
+};
+
 struct ath_desc_status {
 	union {
 		struct ath_tx_status tx;/* xmit status */

Modified: head/sys/dev/ath/if_ath_debug.c
==============================================================================
--- head/sys/dev/ath/if_ath_debug.c	Sun Aug 19 02:16:22 2012	(r239380)
+++ head/sys/dev/ath/if_ath_debug.c	Sun Aug 19 02:22:16 2012	(r239381)
@@ -132,8 +132,72 @@ ath_printrxbuf(struct ath_softc *sc, con
 	}
 }
 
-void
-ath_printtxbuf(struct ath_softc *sc, const struct ath_buf *first_bf,
+static void
+ath_printtxbuf_edma(struct ath_softc *sc, const struct ath_buf *first_bf,
+	u_int qnum, u_int ix, int done)
+{
+	const struct ath_tx_status *ts =
+	    &first_bf->bf_last->bf_status.ds_txstat;
+	const struct ath_buf *bf = first_bf;
+	const char *ds;
+	const struct ath_desc_txedma *eds;
+	int i, n;
+
+	/*
+	 * Assume the TX map size is 4 for now and only walk
+	 * the appropriate number of segments.
+	 */
+	n = bf->bf_nseg / 4;
+	if (n == 0)
+		n = 1;
+
+	printf("Q%u[%3u]", qnum, ix);
+	while (bf != NULL) {
+		/*
+		 * XXX For now, assume the txmap size is 4.
+		 */
+		for (i = 0, ds = (const char *) bf->bf_desc;
+		    i < n;
+		    i ++, ds += sc->sc_tx_desclen) {
+			eds = (const struct ath_desc_txedma *) ds;
+			printf(" (DS.V:%p DS.P:%p) I: %08x L:%08x F:%04x%s\n",
+			    eds, (const struct ath_desc *)bf->bf_daddr + i,
+			    eds->ds_info, eds->ds_link,
+			    bf->bf_state.bfs_txflags,
+			    !done ? "" : (ts->ts_status == 0) ? " *" : " !");
+			printf(" (D[0] = %08x(%08x), D[1] = %08x(%08x)\n",
+			    eds->ds_hw[0], eds->ds_hw[1],
+			    eds->ds_hw[2], eds->ds_hw[3]);
+			printf(" (D[2] = %08x(%08x), D[3] = %08x(%08x)\n",
+			    eds->ds_hw[4], eds->ds_hw[5],
+			    eds->ds_hw[6], eds->ds_hw[7]);
+			printf("        Seq: %d swtry: %d ADDBAW?: %d DOBAW?: %d\n",
+			    bf->bf_state.bfs_seqno,
+			    bf->bf_state.bfs_retries,
+			    bf->bf_state.bfs_addedbaw,
+			    bf->bf_state.bfs_dobaw);
+			printf("        %08x %08x %08x %08x %08x %08x\n",
+			    eds->ds_hw[8], eds->ds_hw[9],
+			    eds->ds_hw[10], eds->ds_hw[11],
+			    eds->ds_hw[12], eds->ds_hw[13]);
+			printf("        %08x %08x %08x %08x %08x %08x %08x %08x\n",
+			    eds->ds_hw[14], eds->ds_hw[15], eds->ds_hw[16],
+			    eds->ds_hw[17], eds->ds_hw[18], eds->ds_hw[19],
+			    eds->ds_hw[20], eds->ds_hw[21]);
+#if 0
+			printf("        %08x %08x %08x %08x %08x %08x %08x %08x\n",
+			    ds->ds_hw[22],ds->ds_hw[23],ds->ds_hw[24],
+			    ds->ds_hw[25],ds->ds_hw[26],ds->ds_hw[27],
+			    ds->ds_hw[28], ds->ds_hw[29]);
+#endif
+		}
+		printf("  [end]\n");
+		bf = bf->bf_next;
+	}
+}
+
+static void
+ath_printtxbuf_legacy(struct ath_softc *sc, const struct ath_buf *first_bf,
 	u_int qnum, u_int ix, int done)
 {
 	const struct ath_tx_status *ts = &first_bf->bf_last->bf_status.ds_txstat;
@@ -158,8 +222,7 @@ ath_printtxbuf(struct ath_softc *sc, con
 			    ds->ds_ctl0, ds->ds_ctl1,
 			    ds->ds_hw[0], ds->ds_hw[1],
 			    ds->ds_hw[2], ds->ds_hw[3]);
-			if (ah->ah_magic == 0x20065416 ||
-			    ah->ah_magic == 0x19741014) {
+			if (ah->ah_magic == 0x20065416) {
 				printf("        %08x %08x %08x %08x %08x %08x %08x %08x\n",
 				    ds->ds_hw[4], ds->ds_hw[5], ds->ds_hw[6],
 				    ds->ds_hw[7], ds->ds_hw[8], ds->ds_hw[9],
@@ -175,4 +238,14 @@ ath_printtxbuf(struct ath_softc *sc, con
 	}
 }
 
+void
+ath_printtxbuf(struct ath_softc *sc, const struct ath_buf *first_bf,
+	u_int qnum, u_int ix, int done)
+{
+	if (sc->sc_ah->ah_magic == 0x19741014)
+		ath_printtxbuf_edma(sc, first_bf, qnum, ix, done);
+	else
+		ath_printtxbuf_legacy(sc, first_bf, qnum, ix, done);
+}
+
 #endif	/* ATH_DEBUG */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208190222.q7J2MGJU013624>