From owner-svn-src-all@FreeBSD.ORG Fri Nov 16 19:39:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E2C8A9E0; Fri, 16 Nov 2012 19:39:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C90048FC08; Fri, 16 Nov 2012 19:39:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAGJdTfk050644; Fri, 16 Nov 2012 19:39:29 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAGJdTQa050642; Fri, 16 Nov 2012 19:39:29 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211161939.qAGJdTQa050642@svn.freebsd.org> From: Adrian Chadd Date: Fri, 16 Nov 2012 19:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243158 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Nov 2012 19:39:30 -0000 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 #include #include +#include #include @@ -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);