Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Nov 2012 19:39:29 +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: r243158 - head/sys/dev/ath
Message-ID:  <201211161939.qAGJdTQa050642@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Fri Nov 16 19:39:29 2012
New Revision: 243158
URL: http://svnweb.freebsd.org/changeset/base/243158

Log:
  ath(4) ALQ logging improvements.
  
  * Add a new method which allows the driver to push the MAC/phy/hal info
    into the logging stream.
  * Add a new ALQ logging entry which logs the mac/phy/hal information.
  * Modify the ALQ startup path to log the MAC/phy/hal information
    so the decoder knows which HAL/chip is generating this information.
  * Convert the header and mac/phy/hal information to use be32, rather than
    host order.  I'd like to make this stuff endian-agnostic so I can
    decode MIPS generated logs on a PC.
  
  This requires some further driver modifications to correctly log the
  right initial chip information.
  
  Also - although noone bar me is currently using this, I've shifted the
  debug bitmask around a bit.  Consider yourself warned!

Modified:
  head/sys/dev/ath/if_ath_alq.c
  head/sys/dev/ath/if_ath_alq.h

Modified: head/sys/dev/ath/if_ath_alq.c
==============================================================================
--- head/sys/dev/ath/if_ath_alq.c	Fri Nov 16 19:39:10 2012	(r243157)
+++ head/sys/dev/ath/if_ath_alq.c	Fri Nov 16 19:39:29 2012	(r243158)
@@ -43,6 +43,7 @@
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/alq.h>
+#include <sys/endian.h>
 
 #include <dev/ath/if_ath_alq.h>
 
@@ -77,6 +78,18 @@ if_ath_alq_init(struct if_ath_alq *alq, 
 }
 
 void
+if_ath_alq_setcfg(struct if_ath_alq *alq, uint32_t macVer,
+    uint32_t macRev, uint32_t phyRev, uint32_t halMagic)
+{
+
+	/* Store these in network order */
+	alq->sc_alq_cfg.sc_mac_version = htobe32(macVer);
+	alq->sc_alq_cfg.sc_mac_revision = htobe32(macRev);
+	alq->sc_alq_cfg.sc_phy_rev = htobe32(phyRev);
+	alq->sc_alq_cfg.sc_hal_magic = htobe32(halMagic);
+}
+
+void
 if_ath_alq_tidyup(struct if_ath_alq *alq)
 {
 
@@ -106,6 +119,9 @@ if_ath_alq_start(struct if_ath_alq *alq)
 	} else {
 		printf("%s (%s): opened\n", __func__, alq->sc_alq_devname);
 		alq->sc_alq_isactive = 1;
+		if_ath_alq_post(alq, ATH_ALQ_INIT_STATE,
+		    sizeof (struct if_ath_alq_init_state),
+		    (char *) &alq->sc_alq_cfg);
 	}
 	return (error);
 }
@@ -155,17 +171,17 @@ if_ath_alq_post(struct if_ath_alq *alq, 
 		return;
 
 	ap = (struct if_ath_alq_hdr *) ale->ae_data;
-	ap->threadid = (uint64_t) curthread->td_tid;
-	ap->tstamp = (uint32_t) ticks;
-	ap->op = op;
-	ap->len = len;
+	ap->threadid = htobe64((uint64_t) curthread->td_tid);
+	ap->tstamp = htobe32((uint32_t) ticks);
+	ap->op = htobe16(op);
+	ap->len = htobe16(len);
 
 	/*
 	 * Copy the payload _after_ the header field.
 	 */
 	memcpy(((char *) ap) + sizeof(struct if_ath_alq_hdr),
 	    buf,
-	    ap->len);
+	    len);
 
 	alq_post(alq->sc_alq_alq, ale);
 }

Modified: head/sys/dev/ath/if_ath_alq.h
==============================================================================
--- head/sys/dev/ath/if_ath_alq.h	Fri Nov 16 19:39:10 2012	(r243157)
+++ head/sys/dev/ath/if_ath_alq.h	Fri Nov 16 19:39:29 2012	(r243158)
@@ -31,6 +31,23 @@
 #ifndef	__IF_ATH_ALQ_H__
 #define	__IF_ATH_ALQ_H__
 
+#define	ATH_ALQ_INIT_STATE		1
+struct if_ath_alq_init_state {
+	uint32_t	sc_mac_version;
+	uint32_t	sc_mac_revision;
+	uint32_t	sc_phy_rev;
+	uint32_t	sc_hal_magic;
+};
+
+#define	ATH_ALQ_EDMA_TXSTATUS		2
+#define	ATH_ALQ_EDMA_RXSTATUS		3
+#define	ATH_ALQ_EDMA_TXDESC		4
+
+/*
+ * These will always be logged, regardless.
+ */
+#define	ATH_ALQ_LOG_ALWAYS_MASK		0x00000001
+
 #define	ATH_ALQ_FILENAME_LEN	128
 #define	ATH_ALQ_DEVNAME_LEN	32
 
@@ -42,12 +59,9 @@ struct if_ath_alq {
 	int		sc_alq_isactive;
 	char		sc_alq_devname[ATH_ALQ_DEVNAME_LEN];
 	char		sc_alq_filename[ATH_ALQ_FILENAME_LEN];
+	struct if_ath_alq_init_state sc_alq_cfg;
 };
 
-#define	ATH_ALQ_EDMA_TXSTATUS		1
-#define	ATH_ALQ_EDMA_RXSTATUS		2
-#define	ATH_ALQ_EDMA_TXDESC		3
-
 /* 128 bytes in total */
 #define	ATH_ALQ_PAYLOAD_LEN		112
 
@@ -68,10 +82,13 @@ static inline int
 if_ath_alq_checkdebug(struct if_ath_alq *alq, uint16_t op)
 {
 
-	return (alq->sc_alq_debug & (1 << (op - 1)));
+	return ((alq->sc_alq_debug | ATH_ALQ_LOG_ALWAYS_MASK)
+	    & (1 << (op - 1)));
 }
 
 extern	void if_ath_alq_init(struct if_ath_alq *alq, const char *devname);
+extern	void if_ath_alq_setcfg(struct if_ath_alq *alq, uint32_t macVer,
+	    uint32_t macRev, uint32_t phyRev, uint32_t halMagic);
 extern	void if_ath_alq_tidyup(struct if_ath_alq *alq);
 extern	int if_ath_alq_start(struct if_ath_alq *alq);
 extern	int if_ath_alq_stop(struct if_ath_alq *alq);



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