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!
This commit is contained in:
parent
17aa08aca9
commit
f8cb5a0056
@ -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>
|
||||
|
||||
@ -76,6 +77,18 @@ if_ath_alq_init(struct if_ath_alq *alq, const char *devname)
|
||||
alq->sc_alq_qsize = (64*1024);
|
||||
}
|
||||
|
||||
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, uint16_t op, uint16_t len,
|
||||
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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user