xref: /onnv-gate/usr/src/uts/common/io/ath/ath_impl.h (revision 8033:142c11860489)
11000Sxc151355 /*
26235Sxc151355  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
31000Sxc151355  * Use is subject to license terms.
41000Sxc151355  */
51000Sxc151355 
61000Sxc151355 /*
71000Sxc151355  * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
81000Sxc151355  * All rights reserved.
91000Sxc151355  *
101000Sxc151355  * Redistribution and use in source and binary forms, with or without
111000Sxc151355  * modification, are permitted provided that the following conditions
121000Sxc151355  * are met:
131000Sxc151355  * 1. Redistributions of source code must retain the above copyright
141000Sxc151355  *    notice, this list of conditions and the following disclaimer,
151000Sxc151355  *    without modification.
161000Sxc151355  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
171000Sxc151355  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
181000Sxc151355  *    redistribution must be conditioned upon including a substantially
191000Sxc151355  *    similar Disclaimer requirement for further binary redistribution.
201000Sxc151355  * 3. Neither the names of the above-listed copyright holders nor the names
211000Sxc151355  *    of any contributors may be used to endorse or promote products derived
221000Sxc151355  *    from this software without specific prior written permission.
231000Sxc151355  *
241000Sxc151355  * NO WARRANTY
251000Sxc151355  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
261000Sxc151355  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
271000Sxc151355  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
281000Sxc151355  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
291000Sxc151355  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
301000Sxc151355  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
311000Sxc151355  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
321000Sxc151355  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
331000Sxc151355  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
341000Sxc151355  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
351000Sxc151355  * THE POSSIBILITY OF SUCH DAMAGES.
361000Sxc151355  *
371000Sxc151355  */
381000Sxc151355 
391000Sxc151355 /*
401000Sxc151355  * ath_impl.h is a bridge between the HAL and the driver. It
411000Sxc151355  * defines some data structures encapsulating the HAL interface
421000Sxc151355  * and communicating with the IEEE80211 MAC layer and other
431000Sxc151355  * driver components.
441000Sxc151355  */
451000Sxc151355 
461000Sxc151355 #ifndef	_ATH_IMPL_H
471000Sxc151355 #define	_ATH_IMPL_H
481000Sxc151355 
491000Sxc151355 #ifdef __cplusplus
501000Sxc151355 extern "C" {
511000Sxc151355 #endif
521000Sxc151355 
531000Sxc151355 /*
541000Sxc151355  * Defintions for the Atheros Wireless LAN controller driver.
551000Sxc151355  */
561000Sxc151355 
573147Sxc151355 #include <sys/note.h>
581000Sxc151355 #include <sys/list.h>
593147Sxc151355 #include <sys/net80211.h>
601000Sxc151355 #include "ath_hal.h"
611000Sxc151355 
624126Szf162725 /* Bit map related macros. */
634126Szf162725 #define	setbit(a, i)		((a)[(i)/NBBY] |= (1 << ((i)%NBBY)))
644126Szf162725 #define	clrbit(a, i)		((a)[(i)/NBBY] &= ~(1 << ((i)%NBBY)))
654126Szf162725 #define	isset(a, i)		((a)[(i)/NBBY] & (1 << ((i)%NBBY)))
664126Szf162725 #define	isclr(a, i)		(!((a)[(i)/NBBY] & (1 << ((i)%NBBY))))
674126Szf162725 
681000Sxc151355 /*
691000Sxc151355  * Bit flags in the ath_dbg_flags
701000Sxc151355  */
711000Sxc151355 #define	ATH_DBG_INIT		0x00000001	/* initialisation	*/
721000Sxc151355 #define	ATH_DBG_GLD		0x00000002	/* GLD entry points	*/
731000Sxc151355 #define	ATH_DBG_HAL		0x00000004	/* HAL related code	*/
741000Sxc151355 #define	ATH_DBG_INT		0x00000008	/* interrupt handler	*/
751000Sxc151355 #define	ATH_DBG_RECV		0x00000010	/* receive-side code	*/
761000Sxc151355 #define	ATH_DBG_SEND		0x00000020	/* packet-send code	*/
771000Sxc151355 #define	ATH_DBG_80211		0x00000040	/* 80211 state machine	*/
781000Sxc151355 #define	ATH_DBG_IOCTL		0x00000080	/* ioctl code		*/
791000Sxc151355 #define	ATH_DBG_STATS		0x00000100	/* statistics		*/
801000Sxc151355 #define	ATH_DBG_RATE		0x00000200	/* rate control		*/
811000Sxc151355 #define	ATH_DBG_AUX		0x00000400	/* for ath_aux.c	*/
821000Sxc151355 #define	ATH_DBG_WIFICFG		0x00000800	/* wificonfig		*/
831000Sxc151355 #define	ATH_DBG_OSDEP		0x00001000	/* osdep		*/
841000Sxc151355 #define	ATH_DBG_ATTACH		0x00002000	/* attach		*/
851000Sxc151355 #define	ATH_DBG_DETACH		0x00004000	/* detach		*/
866797Sxc151355 #define	ATH_DBG_SUSPEND		0x00008000	/* suspend/resume	*/
876797Sxc151355 #define	ATH_DBG_ALL		0x0000ffff	/* all			*/
881000Sxc151355 
891000Sxc151355 #ifdef DEBUG
901000Sxc151355 #define	ATH_DDB(command)	do {				\
911000Sxc151355 					{ command; }		\
921000Sxc151355 					_NOTE(CONSTANTCONDITION)\
931000Sxc151355 				} while (0)
941000Sxc151355 #else
951000Sxc151355 #define	ATH_DDB(command)
961000Sxc151355 #endif /* DEBUG */
971000Sxc151355 
981000Sxc151355 /*
991000Sxc151355  * Node type of wifi device
1001000Sxc151355  */
1011000Sxc151355 #ifndef DDI_NT_NET_WIFI
1021000Sxc151355 #define	DDI_NT_NET_WIFI	"ddi_network:wifi"
1031000Sxc151355 #endif
1041000Sxc151355 #define	ATH_NODENAME	"ath"
1051000Sxc151355 
1061000Sxc151355 #define	ATH_DEBUG(args)		ATH_DDB(ath_dbg args)
1071000Sxc151355 
1081000Sxc151355 #define	list_empty(a) ((a)->list_head.list_next == &(a)->list_head)
1091000Sxc151355 #define	ATH_LE_READ_4(p)						\
1101000Sxc151355 	((uint32_t)							\
1111000Sxc151355 	((((uint8_t *)(p))[0]) | (((uint8_t *)(p))[1] <<  8) |		\
1121000Sxc151355 	(((uint8_t *)(p))[2] << 16) | (((uint8_t *)(p))[3] << 24)))
1131000Sxc151355 #define	ATH_N(a)	(sizeof (a) / sizeof (a[0]))
1141000Sxc151355 #define	ATH_TXQ_SETUP(asc, i)	((asc)->asc_txqsetup & (1<<i))
1151000Sxc151355 #define	ATH_PA2DESC(_asc, _pa) \
1161000Sxc151355 	((struct ath_desc *)((caddr_t)(_asc)->asc_desc + \
1171000Sxc151355 	((_pa) - (_asc)->asc_desc_dma.cookie.dmac_address)))
1181000Sxc151355 /*
1191000Sxc151355  * Sync a DMA area described by a dma_area_t
1201000Sxc151355  */
1211000Sxc151355 #define	ATH_DMA_SYNC(area, flag)    ((void) ddi_dma_sync((area).dma_hdl,    \
1221000Sxc151355 				(area).offset, (area).alength, (flag)))
1231000Sxc151355 
1241000Sxc151355 #define	ATH_TXINTR_PERIOD 5
1251000Sxc151355 #define	ATH_TIMEOUT	1000
1261000Sxc151355 #define	ATH_RXBUF	80		/* number of RX buffers */
1271000Sxc151355 #define	ATH_TXBUF	200		/* number of TX buffers */
1281000Sxc151355 #define	ATH_TXDESC	1		/* number of descriptors per buffer */
1291000Sxc151355 #define	ATH_TXMAXTRY	11		/* max number of transmit attempts */
1306235Sxc151355 #define	ATH_MCHASH	64		/* multicast hash table size */
1311000Sxc151355 
1325420Sxc151355 #define	ATH_DEF_CACHE_BYTES	32	/* default cache line size */
1335420Sxc151355 
1341000Sxc151355 /* driver-specific node state */
1351000Sxc151355 struct ath_node {
1361000Sxc151355 	struct ieee80211_node an_node;	/* base class */
1371000Sxc151355 	uint32_t	an_tx_times;	/* rate ctl times on one rate */
1381000Sxc151355 	uint32_t	an_tx_ok;	/* tx ok pkt */
1391000Sxc151355 	uint32_t	an_tx_err;	/* tx !ok pkt */
1401000Sxc151355 	uint32_t	an_tx_retr;	/* tx retry count */
1411000Sxc151355 	int32_t		an_tx_upper;	/* tx upper rate req cnt */
1421000Sxc151355 	uint32_t	an_tx_antenna;	/* antenna for last good frame */
1431000Sxc151355 	uint8_t		an_tx_rix0;	/* series 0 rate index */
1441000Sxc151355 	uint8_t		an_tx_try0;	/* series 0 try count */
1451000Sxc151355 	uint8_t		an_tx_mgtrate;	/* h/w rate for management/ctl frames */
1461000Sxc151355 	uint8_t		an_tx_mgtratesp; /* short preamble h/w rate for " " */
1471000Sxc151355 	uint8_t		an_tx_rate0;	/* series 0 h/w rate */
1481000Sxc151355 	uint8_t		an_tx_rate1;	/* series 1 h/w rate */
1491000Sxc151355 	uint8_t		an_tx_rate2;	/* series 2 h/w rate */
1501000Sxc151355 	uint8_t		an_tx_rate3;	/* series 3 h/w rate */
1511000Sxc151355 	uint8_t		an_tx_rate0sp;	/* series 0 short preamble h/w rate */
1521000Sxc151355 	uint8_t		an_tx_rate1sp;	/* series 1 short preamble h/w rate */
1531000Sxc151355 	uint8_t		an_tx_rate2sp;	/* series 2 short preamble h/w rate */
1541000Sxc151355 	uint8_t		an_tx_rate3sp;	/* series 3 short preamble h/w rate */
1551000Sxc151355 };
1561000Sxc151355 #define	ATH_NODE(_n)	((struct ath_node *)(_n))
1571000Sxc151355 
1581000Sxc151355 
1591000Sxc151355 struct ath_stats {
1601000Sxc151355 	uint32_t	ast_hardware;	/* fatal hardware error interrupts */
1611000Sxc151355 	uint32_t	ast_rxorn;	/* rx overrun interrupts */
1621000Sxc151355 	uint32_t	ast_rxeol;	/* rx eol interrupts */
1631000Sxc151355 	uint32_t	ast_txurn;	/* tx underrun interrupts */
1641000Sxc151355 	uint32_t	ast_tx_mgmt;	/* management frames transmitted */
1651000Sxc151355 	uint32_t	ast_tx_discard;	/* frames discarded prior to assoc */
1661000Sxc151355 	uint32_t	ast_tx_invalid; /* frames discarded 'cuz device gone */
1671000Sxc151355 	uint32_t	ast_tx_qstop;	/* tx queue stopped 'cuz full */
1681000Sxc151355 	uint32_t	ast_tx_nobuf;	/* tx failed 'cuz no tx buffer (data) */
1691000Sxc151355 	uint32_t	ast_tx_nobufmgt; /* tx failed 'cuz no tx buffer(mgmt) */
1701000Sxc151355 	uint32_t	ast_tx_xretries; /* tx failed 'cuz too many retries */
1711000Sxc151355 	uint32_t	ast_tx_fifoerr;	/* tx failed 'cuz FIFO underrun */
1721000Sxc151355 	uint32_t	ast_tx_filtered; /* tx failed 'cuz xmit filtered */
1731000Sxc151355 	uint32_t	ast_tx_shortretry; /* tx on-chip retries (short) */
1741000Sxc151355 	uint32_t	ast_tx_longretry; /* tx on-chip retries (long) */
1751000Sxc151355 	uint32_t	ast_tx_noack;	/* tx frames with no ack marked */
1761000Sxc151355 	uint32_t	ast_tx_rts;	/* tx frames with rts enabled */
1771000Sxc151355 	uint32_t	ast_tx_shortpre; /* tx frames with short preamble */
1781000Sxc151355 	uint32_t	ast_tx_altrate;	/* tx frames with alternate rate */
179*8033SWang.Lin@Sun.COM 	uint32_t	ast_tx_protect;	/* tx frames with protection */
1801000Sxc151355 	int16_t		ast_tx_rssi;	/* tx rssi of last ack */
1811000Sxc151355 	int16_t		ast_tx_rssidelta; /* tx rssi delta */
1821000Sxc151355 	uint32_t	ast_rx_crcerr;	/* rx failed 'cuz of bad CRC */
1831000Sxc151355 	uint32_t	ast_rx_fifoerr;	/* rx failed 'cuz of FIFO overrun */
1841000Sxc151355 	uint32_t	ast_rx_badcrypt; /* rx failed 'cuz decryption */
1851000Sxc151355 	uint32_t	ast_rx_phyerr;	/* rx PHY error summary count */
1861000Sxc151355 	uint32_t	ast_rx_phy[32];	/* rx PHY error per-code counts */
1871000Sxc151355 	uint32_t	ast_rx_tooshort; /* rx discarded 'cuz frame too short */
1881000Sxc151355 	uint32_t	ast_per_cal;	/* periodic calibration calls */
1891000Sxc151355 	uint32_t	ast_per_calfail; /* periodic calibration failed */
1901000Sxc151355 	uint32_t	ast_per_rfgain;	/* periodic calibration rfgain reset */
1911000Sxc151355 	uint32_t	ast_rate_calls;	/* rate control checks */
1921000Sxc151355 	uint32_t	ast_rate_raise;	/* rate control raised xmit rate */
1931000Sxc151355 	uint32_t	ast_rate_drop;	/* rate control dropped xmit rate */
1941000Sxc151355 };
1951000Sxc151355 
1961000Sxc151355 
1971000Sxc151355 /*
1981000Sxc151355  * Describes one chunk of allocated DMA-able memory
1991000Sxc151355  *
2001000Sxc151355  * In some cases, this is a single chunk as allocated from the system;
2011000Sxc151355  * but we also use this structure to represent slices carved off such
2021000Sxc151355  * a chunk.  Even when we don't really need all the information, we
2031000Sxc151355  * use this structure as a convenient way of correlating the various
2041000Sxc151355  * ways of looking at a piece of memory (kernel VA, IO space DVMA,
2051000Sxc151355  * handle+offset, etc).
2061000Sxc151355  */
2071000Sxc151355 struct dma_area {
2081000Sxc151355 	ddi_acc_handle_t	acc_hdl;	/* handle for memory */
2091000Sxc151355 	caddr_t			mem_va;		/* CPU VA of memory */
2101000Sxc151355 	uint32_t		nslots;		/* number of slots */
2111000Sxc151355 	uint32_t		size;		/* size per slot */
2121000Sxc151355 	size_t			alength;	/* allocated size */
2131000Sxc151355 						/* >= product of above */
2141000Sxc151355 
2151000Sxc151355 	ddi_dma_handle_t	dma_hdl;	/* DMA handle */
2161000Sxc151355 	offset_t		offset;		/* relative to handle */
2171000Sxc151355 	ddi_dma_cookie_t	cookie;		/* associated cookie */
2181000Sxc151355 	uint32_t		ncookies;	/* must be 1 */
2191000Sxc151355 	uint32_t		token;		/* arbitrary identifier */
2201000Sxc151355 };						/* 0x50 (80) bytes */
2211000Sxc151355 typedef struct dma_area dma_area_t;
2221000Sxc151355 
2231000Sxc151355 struct ath_buf {
2243147Sxc151355 	int			bf_flags;	/* tx descriptor flags */
2251000Sxc151355 	struct ath_desc		*bf_desc;	/* virtual addr of desc */
226*8033SWang.Lin@Sun.COM 	struct ath_desc_status	bf_status;	/* tx/rx status */
2271000Sxc151355 	uint32_t		bf_daddr;	/* physical addr of desc */
2281000Sxc151355 	dma_area_t		bf_dma;		/* dma area for buf */
229*8033SWang.Lin@Sun.COM 	mblk_t			*bf_m;		/* message for buf */
2301000Sxc151355 	struct ieee80211_node	*bf_in;		/* pointer to the node */
2311000Sxc151355 
2321000Sxc151355 	/* we're in list of asc->asc_txbuf_list or asc->asc_rxbuf_list */
2331000Sxc151355 	list_node_t		bf_node;
2341000Sxc151355 };
2351000Sxc151355 
2361000Sxc151355 
2371000Sxc151355 /*
2381000Sxc151355  * Data transmit queue state.  One of these exists for each
2391000Sxc151355  * hardware transmit queue.  Packets sent to us from above
2401000Sxc151355  * are assigned to queues based on their priority.  Not all
2411000Sxc151355  * devices support a complete set of hardware transmit queues.
2421000Sxc151355  * For those devices the array sc_ac2q will map multiple
2431000Sxc151355  * priorities to fewer hardware queues (typically all to one
2441000Sxc151355  * hardware queue).
2451000Sxc151355  */
2461000Sxc151355 struct ath_txq {
2471000Sxc151355 	uint_t		axq_qnum;	/* hardware q number */
2481000Sxc151355 	uint_t		axq_depth;	/* queue depth (stat only) */
2491000Sxc151355 	uint_t		axq_intrcnt;	/* interrupt count */
2501000Sxc151355 	uint32_t	*axq_link;	/* link ptr in last TX desc */
2511000Sxc151355 	list_t		axq_list;	/* transmit queue */
2521000Sxc151355 	kmutex_t	axq_lock;	/* lock on q and link */
2531000Sxc151355 };
2541000Sxc151355 
2551000Sxc151355 
2561000Sxc151355 /*
2571000Sxc151355  * asc_isc must be the first element, for convience of
2581000Sxc151355  * casting between iee80211com and ath
2591000Sxc151355  */
2601000Sxc151355 typedef struct ath {
2611000Sxc151355 	ieee80211com_t		asc_isc;	/* IEEE 802.11 common */
2621000Sxc151355 	dev_info_t		*asc_dev;	/* back pointer to dev_info_t */
263*8033SWang.Lin@Sun.COM 	ddi_taskq_t		*asc_tq;	/* private task queue */
2641000Sxc151355 	struct ath_hal		*asc_ah;	/* Atheros HAL */
2651000Sxc151355 	uint32_t		asc_invalid : 1, /* being detached */
2666797Sxc151355 				asc_isrunning : 1, /* device is operational */
2671000Sxc151355 				asc_mrretry : 1, /* multi-rate retry support */
2681000Sxc151355 				asc_have11g : 1, /* have 11g support */
2693147Sxc151355 				asc_splitmic : 1, /* Split TKIP mic keys */
2703147Sxc151355 				asc_hasclrkey: 1; /* CLR key supported */
2711000Sxc151355 	const HAL_RATE_TABLE	*asc_rates[IEEE80211_MODE_MAX]; /* h/w rate */
272*8033SWang.Lin@Sun.COM 	uint8_t			asc_protrix;	/* protect rate index */
273*8033SWang.Lin@Sun.COM 	uint8_t			asc_mcastantenna; /* Multicast antenna number */
2741000Sxc151355 
2751000Sxc151355 	ddi_acc_handle_t	asc_cfg_handle;	/* DDI I/O handle */
2761000Sxc151355 	ddi_acc_handle_t	asc_io_handle;	/* DDI I/O handle */
2771000Sxc151355 	uint16_t		asc_cachelsz;	/* cache line size */
2781000Sxc151355 	ddi_iblock_cookie_t	asc_iblock;
2791000Sxc151355 	ddi_softintr_t		asc_softint_id;
2801000Sxc151355 
2811000Sxc151355 	struct ath_desc		*asc_desc;	/* TX/RX descriptors */
2821000Sxc151355 	dma_area_t		asc_desc_dma;	/* descriptor structure */
2831000Sxc151355 	/* pointer to the first "struct ath_buf" */
2841000Sxc151355 	struct ath_buf		*asc_vbufptr;
2851000Sxc151355 	/* length of all allocated "struct ath_buf" */
2861000Sxc151355 	uint32_t		asc_vbuflen;
2871000Sxc151355 	/* size of one DMA TX/RX buffer based on 802.11 MTU */
2881000Sxc151355 	int32_t			asc_dmabuf_size;
2891000Sxc151355 
2901000Sxc151355 	list_t			asc_rxbuf_list;
2911000Sxc151355 	kmutex_t		asc_rxbuflock;	/* recv lock for above data */
2921000Sxc151355 	uint32_t		*asc_rxlink;	/* link ptr in last RX desc */
2931000Sxc151355 	uint32_t		asc_rx_pend;
294*8033SWang.Lin@Sun.COM 	uint64_t		asc_lastrx;	/* tsf at last rx'd frame */
2951000Sxc151355 
2961000Sxc151355 	list_t			asc_txbuf_list;
2971000Sxc151355 	kmutex_t		asc_txbuflock;	/* txbuf lock */
2981000Sxc151355 
2991000Sxc151355 	uint_t			asc_txqsetup;	/* h/w queues setup */
3001000Sxc151355 	struct ath_txq		asc_txq[HAL_NUM_TX_QUEUES]; /* tx queues */
3011000Sxc151355 	struct ath_txq		*asc_ac2q[5];	/* WME AC -> h/w qnum */
3021000Sxc151355 
3031000Sxc151355 	const HAL_RATE_TABLE	*asc_currates;	/* current rate table */
3041000Sxc151355 	enum ieee80211_phymode	asc_curmode;	/* current phy mode */
3053147Sxc151355 	HAL_CHANNEL		asc_curchan;	/* current h/w channel */
3061000Sxc151355 	uint8_t			asc_rixmap[256]; /* IEEE to h/w rate table ix */
3071000Sxc151355 	HAL_INT			asc_imask;	/* interrupt mask copy */
3081000Sxc151355 	struct ath_stats	asc_stats;	/* interface statistics */
3096235Sxc151355 	boolean_t		asc_promisc;	/* Promiscuous mode enabled */
3106235Sxc151355 	uint8_t			asc_mcast_refs[ATH_MCHASH]; /* refer count */
3116235Sxc151355 	uint32_t		asc_mcast_hash[2]; /* multicast hash table */
3121000Sxc151355 	kmutex_t		asc_genlock;
3131000Sxc151355 
3143147Sxc151355 	boolean_t		asc_resched_needed;
3153147Sxc151355 	kmutex_t		asc_resched_lock;
3163147Sxc151355 
3174126Szf162725 	uint32_t		asc_keymax;	/* size of key cache */
3184126Szf162725 	uint8_t			asc_keymap[16];	/* bit map of key cache use */
3194126Szf162725 
3203147Sxc151355 	timeout_id_t		asc_scan_timer;
3213147Sxc151355 	int			(*asc_newstate)(ieee80211com_t *,
3223147Sxc151355 					enum ieee80211_state, int);
3231000Sxc151355 } ath_t;
3241000Sxc151355 
3251000Sxc151355 #define	ATH_STATE(macinfo)	((ath_t *)((macinfo)->gldm_private))
3261000Sxc151355 
3273147Sxc151355 #define	ATH_LOCK(_asc)		mutex_enter(&(_asc)->asc_genlock)
3283147Sxc151355 #define	ATH_UNLOCK(_asc)	mutex_exit(&(_asc)->asc_genlock)
3293147Sxc151355 #define	ATH_LOCK_ASSERT(_asc)	ASSERT(mutex_owned(&(_asc)->asc_genlock))
3303147Sxc151355 
3316797Sxc151355 #define	ATH_IS_RUNNING(_asc)	\
3326797Sxc151355 	(((_asc)->asc_invalid == 0) && ((_asc)->asc_isrunning == 1))
3333147Sxc151355 
3341000Sxc151355 /* Debug and log functions */
3351000Sxc151355 void ath_dbg(uint32_t dbg_flags, const char *fmt, ...);	/* debug function */
3361000Sxc151355 void ath_log(const char *fmt, ...);	/* event log function */
3371000Sxc151355 void ath_problem(const char *fmt, ...);	/* run-time problem function */
3381000Sxc151355 
3391000Sxc151355 #ifdef __cplusplus
3401000Sxc151355 }
3411000Sxc151355 #endif
3421000Sxc151355 
3431000Sxc151355 #endif /* _ATH_IMPL_H */
344