xref: /onnv-gate/usr/src/uts/common/io/ath/ath_hal.h (revision 8033:142c11860489)
11000Sxc151355 /*
2*8033SWang.Lin@Sun.COM  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting, Atheros
31000Sxc151355  * Communications, Inc.  All rights reserved.
41000Sxc151355  *
51000Sxc151355  * Use is subject to license terms.
61000Sxc151355  *
71000Sxc151355  * Redistribution and use in source and binary forms are permitted
81000Sxc151355  * provided that the following conditions are met:
91000Sxc151355  * 1. The materials contained herein are unmodified and are used
101000Sxc151355  * unmodified.
111000Sxc151355  * 2. Redistributions of source code must retain the above copyright
121000Sxc151355  * notice, this list of conditions and the following NO
131000Sxc151355  * ''WARRANTY'' disclaimer below (''Disclaimer''), without
141000Sxc151355  * modification.
151000Sxc151355  * 3. Redistributions in binary form must reproduce at minimum a
161000Sxc151355  * disclaimer similar to the Disclaimer below and any redistribution
171000Sxc151355  * must be conditioned upon including a substantially similar
181000Sxc151355  * Disclaimer requirement for further binary redistribution.
191000Sxc151355  * 4. Neither the names of the above-listed copyright holders nor the
201000Sxc151355  * names of any contributors may be used to endorse or promote
211000Sxc151355  * product derived from this software without specific prior written
221000Sxc151355  * 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,
281000Sxc151355  * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
291000Sxc151355  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
301000Sxc151355  * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
311000Sxc151355  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
321000Sxc151355  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
331000Sxc151355  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
341000Sxc151355  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
351000Sxc151355  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361000Sxc151355  * SUCH DAMAGES.
371000Sxc151355  *
381000Sxc151355  */
391000Sxc151355 
401000Sxc151355 #ifndef _ATH_HAL_H
411000Sxc151355 #define	_ATH_HAL_H
421000Sxc151355 
431000Sxc151355 /*
441000Sxc151355  * ath_hal.h is released by Atheros and used to describe the Atheros
451000Sxc151355  * Hardware Access Layer(HAL) interface. All kinds of data structures,
461000Sxc151355  * constant definition, APIs declaration are defined here.Clients of
471000Sxc151355  * the HAL call ath_hal_attach() to obtain a reference to an ath_hal
481000Sxc151355  * structure for use with the device. Hardware-related operations that
491000Sxc151355  * follow must call back into the HAL through interface, supplying the
501000Sxc151355  * reference as the first parameter.
511000Sxc151355  */
521000Sxc151355 
531000Sxc151355 #ifdef __cplusplus
541000Sxc151355 extern "C" {
551000Sxc151355 #endif
561000Sxc151355 
571000Sxc151355 /* HAL version of this release */
58*8033SWang.Lin@Sun.COM #define	HAL_ABI_VERSION	0x08052700	/* YYMMDDnn */
591000Sxc151355 
601000Sxc151355 /* HAL data type definition */
613147Sxc151355 typedef void *		HAL_SOFTC;	/* pointer to driver/OS state */
623147Sxc151355 typedef void *		HAL_BUS_TAG;	/* opaque bus i/o id tag */
633147Sxc151355 typedef void *		HAL_BUS_HANDLE;	/* opaque bus i/o handle */
641000Sxc151355 typedef uint32_t 	HAL_BUS_ADDR;
651000Sxc151355 typedef uint16_t 	HAL_CTRY_CODE;	/* country code */
661000Sxc151355 typedef uint16_t 	HAL_REG_DOMAIN;	/* regulatory domain code */
671000Sxc151355 
681000Sxc151355 #define	HAL_NUM_TX_QUEUES	10		/* max number of tx queues */
691000Sxc151355 
701000Sxc151355 #define	HAL_BEACON_PERIOD	0x0000ffff	/* beacon interval period */
711000Sxc151355 #define	HAL_BEACON_ENA		0x00800000	/* beacon xmit enable */
721000Sxc151355 #define	HAL_BEACON_RESET_TSF	0x01000000	/* clear TSF */
731000Sxc151355 
74*8033SWang.Lin@Sun.COM #define	CHANNEL_RAD_INT	0x00001	/* Radar interference detected on channel */
75*8033SWang.Lin@Sun.COM #define	CHANNEL_CW_INT	0x00002	/* CW interference detected on channel */
76*8033SWang.Lin@Sun.COM #define	CHANNEL_BUSY	0x00004	/* Busy, occupied or overlap with adjoin chan */
77*8033SWang.Lin@Sun.COM #define	CHANNEL_TURBO	0x00010	/* Turbo Channel */
78*8033SWang.Lin@Sun.COM #define	CHANNEL_CCK	0x00020	/* CCK channel */
79*8033SWang.Lin@Sun.COM #define	CHANNEL_OFDM	0x00040	/* OFDM channel */
80*8033SWang.Lin@Sun.COM #define	CHANNEL_2GHZ	0x00080	/* 2 GHz spectrum channel. */
81*8033SWang.Lin@Sun.COM #define	CHANNEL_5GHZ	0x00100	/* 5 GHz spectrum channel */
82*8033SWang.Lin@Sun.COM #define	CHANNEL_PASSIVE	0x00200	/* Only passive scan allowed in the channel */
83*8033SWang.Lin@Sun.COM #define	CHANNEL_DYN	0x00400	/* dynamic CCK-OFDM channel */
84*8033SWang.Lin@Sun.COM #define	CHANNEL_XR	0x00800	/* XR channel */
85*8033SWang.Lin@Sun.COM #define	CHANNEL_STURBO	0x02000	/* Static turbo, no 11a-only usage */
86*8033SWang.Lin@Sun.COM #define	CHANNEL_HALF	0x04000 /* Half rate channel */
87*8033SWang.Lin@Sun.COM #define	CHANNEL_QUARTER	0x08000 /* Quarter rate channel */
88*8033SWang.Lin@Sun.COM #define	CHANNEL_HT20	0x10000	/* 11n 20MHZ channel */
89*8033SWang.Lin@Sun.COM #define	CHANNEL_HT40PLUS	0x20000	/* 11n 40MHZ chan w/ ext chan above */
90*8033SWang.Lin@Sun.COM #define	CHANNEL_HT40MINUS	0x40000	/* 11n 40MHZ chan w/ ext chan below */
911000Sxc151355 
921000Sxc151355 #define	CHANNEL_A	(CHANNEL_5GHZ|CHANNEL_OFDM)
931000Sxc151355 #define	CHANNEL_B	(CHANNEL_2GHZ|CHANNEL_CCK)
941000Sxc151355 #define	CHANNEL_PUREG	(CHANNEL_2GHZ|CHANNEL_OFDM)
951000Sxc151355 #define	CHANNEL_G	(CHANNEL_2GHZ|CHANNEL_OFDM)
961000Sxc151355 #define	CHANNEL_T	(CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
973147Sxc151355 #define	CHANNEL_ST	(CHANNEL_T|CHANNEL_STURBO)
981000Sxc151355 #define	CHANNEL_108G	(CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
993147Sxc151355 #define	CHANNEL_108A	CHANNEL_T
1001000Sxc151355 #define	CHANNEL_X	(CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_XR)
101*8033SWang.Lin@Sun.COM #define	CHANNEL_G_HT20	(CHANNEL_G|CHANNEL_HT20)
102*8033SWang.Lin@Sun.COM #define	CHANNEL_A_HT20	(CHANNEL_A|CHANNEL_HT20)
103*8033SWang.Lin@Sun.COM #define	CHANNEL_G_HT40PLUS	(CHANNEL_G_HT20|CHANNEL_HT40PLUS)
104*8033SWang.Lin@Sun.COM #define	CHANNEL_A_HT40PLUS	(CHANNEL_A_HT20|CHANNEL_HT40PLUS)
105*8033SWang.Lin@Sun.COM #define	CHANNEL_A_HT40MINUS	(CHANNEL_A_HT20|CHANNEL_HT40MINUS)
1061000Sxc151355 #define	CHANNEL_ALL \
107*8033SWang.Lin@Sun.COM 	(CHANNEL_OFDM|CHANNEL_CCK|CHANNEL_5GHZ|CHANNEL_2GHZ| \
108*8033SWang.Lin@Sun.COM 	CHANNEL_TURBO|CHANNEL_HT20|CHANNEL_HT40PLUS|CHANNEL_HT40MINUS)
1091000Sxc151355 #define	CHANNEL_ALL_NOTURBO 	(CHANNEL_ALL &~ CHANNEL_TURBO)
1101000Sxc151355 
1113147Sxc151355 #define	CHANNEL_COMPAT	(CHANNEL_ALL_NOTURBO | CHANNEL_PASSIVE)
1123147Sxc151355 
1133147Sxc151355 /* privFlags */
1143147Sxc151355 /*
1153147Sxc151355  * Software use: channel interference used for AR as well as RADAR
1163147Sxc151355  * interference detection
1173147Sxc151355  */
1183147Sxc151355 #define	CHANNEL_INTERFERENCE	0x01
1193147Sxc151355 #define	CHANNEL_DFS		0x02	/* DFS required on channel */
1203147Sxc151355 #define	CHANNEL_4MS_LIMIT	0x04	/* 4msec packet limit on this channel */
1213147Sxc151355 #define	CHANNEL_DFS_CLEAR	0x08	/* if channel has been checked DFS */
1223147Sxc151355 
1231000Sxc151355 #define	HAL_RSSI_EP_MULTIPLIER	(1<<7)	/* pow2 to optimize out * and / */
1241000Sxc151355 
1251000Sxc151355 /* flags passed to tx descriptor setup methods */
1261000Sxc151355 #define	HAL_TXDESC_CLRDMASK	0x0001	/* clear destination filter mask */
1271000Sxc151355 #define	HAL_TXDESC_NOACK	0x0002	/* don't wait for ACK */
1281000Sxc151355 #define	HAL_TXDESC_RTSENA	0x0004	/* enable RTS */
1291000Sxc151355 #define	HAL_TXDESC_CTSENA	0x0008	/* enable CTS */
1301000Sxc151355 #define	HAL_TXDESC_INTREQ	0x0010	/* enable per-descriptor interrupt */
1311000Sxc151355 #define	HAL_TXDESC_VEOL		0x0020	/* mark virtual EOL */
1323147Sxc151355 /* NB: this only affects frame, not any RTS/CTS */
1333147Sxc151355 #define	HAL_TXDESC_DURENA	0x0040	/* enable h/w write of duration field */
134*8033SWang.Lin@Sun.COM #define	HAL_TXDESC_EXT_ONLY	0x0080	/* send on ext channel only (11n) */
135*8033SWang.Lin@Sun.COM #define	HAL_TXDESC_EXT_AND_CTL	0x0100	/* send on ext + ctl channels (11n) */
136*8033SWang.Lin@Sun.COM #define	HAL_TXDESC_VMF		0x0200	/* virtual more frag */
1371000Sxc151355 
1381000Sxc151355 /* flags passed to rx descriptor setup methods */
1391000Sxc151355 #define	HAL_RXDESC_INTREQ	0x0020	/* enable per-descriptor interrupt */
1401000Sxc151355 
1411000Sxc151355 /* tx error flags */
1421000Sxc151355 #define	HAL_TXERR_XRETRY	0x01	/* excessive retries */
1431000Sxc151355 #define	HAL_TXERR_FILT		0x02	/* blocked by tx filtering */
1441000Sxc151355 #define	HAL_TXERR_FIFO		0x04	/* fifo underrun */
145*8033SWang.Lin@Sun.COM #define	HAL_TXERR_XTXOP		0x08	/* txop exceeded */
146*8033SWang.Lin@Sun.COM #define	HAL_TXERR_DESC_CFG_ERR	0x10	/* Error in 20/40 desc config */
147*8033SWang.Lin@Sun.COM #define	HAL_TXERR_DATA_UNDERRUN	0x20	/* Tx buffer underrun */
148*8033SWang.Lin@Sun.COM #define	HAL_TXERR_DELIM_UNDERRUN 0x40	/* Tx delimiter underrun */
1491000Sxc151355 #define	HAL_TXSTAT_ALTRATE	0x80	/* alternate xmit rate used */
1501000Sxc151355 
151*8033SWang.Lin@Sun.COM /* bits found in ts_flags */
152*8033SWang.Lin@Sun.COM #define	HAL_TX_BA		0x01	/* Block Ack seen */
153*8033SWang.Lin@Sun.COM #define	HAL_TX_AGGR		0x02	/* Aggregate */
154*8033SWang.Lin@Sun.COM 
1551000Sxc151355 /* rx error flags */
1561000Sxc151355 #define	HAL_RXERR_CRC		0x01	/* CRC error on frame */
1571000Sxc151355 #define	HAL_RXERR_PHY		0x02	/* PHY error, rs_phyerr is valid */
1581000Sxc151355 #define	HAL_RXERR_FIFO		0x04	/* fifo overrun */
1591000Sxc151355 #define	HAL_RXERR_DECRYPT	0x08	/* non-Michael decrypt error */
1601000Sxc151355 #define	HAL_RXERR_MIC		0x10	/* Michael MIC decrypt error */
1611000Sxc151355 
162*8033SWang.Lin@Sun.COM /* bits found in rs_flags */
163*8033SWang.Lin@Sun.COM #define	HAL_RX_MORE		0x01	/* more descriptors follow */
164*8033SWang.Lin@Sun.COM #define	HAL_RX_MORE_AGGR	0x02	/* more frames in aggr */
165*8033SWang.Lin@Sun.COM #define	HAL_RX_GI		0x04	/* full gi */
166*8033SWang.Lin@Sun.COM #define	HAL_RX_2040		0x08	/* 40 Mhz */
167*8033SWang.Lin@Sun.COM #define	HAL_RX_DELIM_CRC_PRE	0x10	/* crc error in delimiter pre */
168*8033SWang.Lin@Sun.COM #define	HAL_RX_DELIM_CRC_POST	0x20	/* crc error in delim after */
169*8033SWang.Lin@Sun.COM #define	HAL_RX_DECRYPT_BUSY	0x40	/* decrypt was too slow */
170*8033SWang.Lin@Sun.COM #define	HAL_RX_DUP_FRAME	0x80	/* Dup frame rx'd on control channel */
171*8033SWang.Lin@Sun.COM 
1721000Sxc151355 /* value found in rs_keyix to mark invalid entries */
1731000Sxc151355 #define	HAL_RXKEYIX_INVALID	((uint8_t)-1)
1741000Sxc151355 
1751000Sxc151355 /* value used to specify no encryption key for xmit */
1761000Sxc151355 #define	HAL_TXKEYIX_INVALID	((uint32_t)-1)
1771000Sxc151355 
1783147Sxc151355 /* compression definitions */
1793147Sxc151355 #define	HAL_COMP_BUF_MAX_SIZE	9216	/* 9k */
1803147Sxc151355 #define	HAL_COMP_BUF_ALIGN_SIZE	512
1813147Sxc151355 
1823147Sxc151355 #define	HAL_ANTENNA_MIN_MODE	0
1833147Sxc151355 #define	HAL_ANTENNA_FIXED_A	1
1843147Sxc151355 #define	HAL_ANTENNA_FIXED_B	2
1853147Sxc151355 #define	HAL_ANTENNA_MAX_MODE	3
1863147Sxc151355 
1871000Sxc151355 /*
1881000Sxc151355  * Status codes that may be returned by the HAL.  Note that
1891000Sxc151355  * interfaces that return a status code set it only when an
1901000Sxc151355  * error occurs--i.e. you cannot check it for success.
1911000Sxc151355  */
1921000Sxc151355 typedef enum {
1931000Sxc151355 	HAL_OK		= 0,	/* No error */
1941000Sxc151355 	HAL_ENXIO	= 1,	/* No hardware present */
1951000Sxc151355 	HAL_ENOMEM	= 2,	/* Memory allocation failed */
1961000Sxc151355 	HAL_EIO		= 3,	/* Hardware didn't respond as expected */
1971000Sxc151355 	HAL_EEMAGIC	= 4,	/* EEPROM magic number invalid */
1981000Sxc151355 	HAL_EEVERSION	= 5,	/* EEPROM version invalid */
1991000Sxc151355 	HAL_EELOCKED	= 6,	/* EEPROM unreadable */
2001000Sxc151355 	HAL_EEBADSUM	= 7,	/* EEPROM checksum invalid */
2011000Sxc151355 	HAL_EEREAD	= 8,	/* EEPROM read problem */
2021000Sxc151355 	HAL_EEBADMAC	= 9,	/* EEPROM mac address invalid */
2031000Sxc151355 	HAL_EESIZE	= 10,	/* EEPROM size not supported */
2041000Sxc151355 	HAL_EEWRITE	= 11,	/* Attempt to change write-locked EEPROM */
2051000Sxc151355 	HAL_EINVAL	= 12,	/* Invalid parameter to function */
2061000Sxc151355 	HAL_ENOTSUPP	= 13,	/* Hardware revision not supported */
2071000Sxc151355 	HAL_ESELFTEST	= 14,	/* Hardware self-test failed */
2081000Sxc151355 	HAL_EINPROGRESS	= 15	/* Operation incomplete */
2091000Sxc151355 } HAL_STATUS;
2101000Sxc151355 
2111000Sxc151355 typedef enum {
2121000Sxc151355 	AH_FALSE = 0,		/* NB: lots of code assumes false is zero */
2131000Sxc151355 	AH_TRUE  = 1
2141000Sxc151355 } HAL_BOOL;
2151000Sxc151355 
2161000Sxc151355 typedef enum {
2171000Sxc151355 	HAL_CAP_REG_DMN		= 0,	/* current regulatory domain */
2181000Sxc151355 	HAL_CAP_CIPHER		= 1,	/* hardware supports cipher */
2191000Sxc151355 	HAL_CAP_TKIP_MIC	= 2,	/* handle TKIP MIC in hardware */
2201000Sxc151355 	HAL_CAP_TKIP_SPLIT	= 3,	/* hardware TKIP uses split keys */
2211000Sxc151355 	HAL_CAP_PHYCOUNTERS	= 4,	/* hardware PHY error counters */
2221000Sxc151355 	HAL_CAP_DIVERSITY	= 5,	/* hardware supports fast diversity */
2231000Sxc151355 	HAL_CAP_KEYCACHE_SIZE	= 6,	/* number of entries in key cache */
2241000Sxc151355 	HAL_CAP_NUM_TXQUEUES	= 7,	/* number of hardware xmit queues */
2251000Sxc151355 	HAL_CAP_VEOL		= 9,	/* hardware supports virtual EOL */
2261000Sxc151355 	HAL_CAP_PSPOLL		= 10,	/* hardware has working PS-Poll */
2271000Sxc151355 					/* support */
2281000Sxc151355 	HAL_CAP_DIAG		= 11,	/* hardware diagnostic support */
2291000Sxc151355 	HAL_CAP_COMPRESSION	= 12,	/* hardware supports compression */
2301000Sxc151355 	HAL_CAP_BURST		= 13,	/* hardware supports packet bursting */
2311000Sxc151355 	HAL_CAP_FASTFRAME	= 14,	/* hardware supoprts fast frames */
2321000Sxc151355 	HAL_CAP_TXPOW		= 15,	/* global tx power limit  */
2333147Sxc151355 	HAL_CAP_TPC		= 16,	/* per-packet tx power control  */
2343147Sxc151355 	HAL_CAP_PHYDIAG		= 17,	/* hardware phy error diagnostic */
2353147Sxc151355 	HAL_CAP_BSSIDMASK	= 18,	/* hardware supports bssid mask */
2363147Sxc151355 	HAL_CAP_MCAST_KEYSRCH	= 19,	/* hardware has multicast key search */
2373147Sxc151355 	HAL_CAP_TSF_ADJUST	= 20,	/* hardware has beacon tsf adjust */
2383147Sxc151355 	HAL_CAP_XR		= 21,	/* hardware has XR support  */
2393147Sxc151355 	/* hardware can support TKIP MIC when WMM is turned on */
2403147Sxc151355 	HAL_CAP_WME_TKIPMIC	= 22,
2413147Sxc151355 	/* hardware can support half rate channels */
2423147Sxc151355 	HAL_CAP_CHAN_HALFRATE	= 23,
2433147Sxc151355 	/* hardware can support quarter rate channels */
2443147Sxc151355 	HAL_CAP_CHAN_QUARTERRATE = 24,
2453147Sxc151355 	HAL_CAP_RFSILENT	= 25,	/* hardware has rfsilent support  */
2463147Sxc151355 	HAL_CAP_TPC_ACK		= 26,	/* ack txpower with per-packet tpc */
2473147Sxc151355 	HAL_CAP_TPC_CTS		= 27,	/* cts txpower with per-packet tpc */
2483147Sxc151355 	HAL_CAP_11D		= 28,	/* 11d beacon support for changing cc */
249*8033SWang.Lin@Sun.COM 	HAL_CAP_INTMIT		= 29,	/* interference mitigation */
250*8033SWang.Lin@Sun.COM 	HAL_CAP_RXORN_FATAL	= 30,	/* HAL_INT_RXORN treated as fatal */
251*8033SWang.Lin@Sun.COM 	HAL_CAP_HT		= 31,	/* hardware can support HT */
252*8033SWang.Lin@Sun.COM 	HAL_CAP_NUMTXCHAIN	= 32,	/* TX chains supported */
253*8033SWang.Lin@Sun.COM 	HAL_CAP_NUMRXCHAIN	= 33,	/* RX chains supported */
254*8033SWang.Lin@Sun.COM 	HAL_CAP_RXTSTAMP_PREC	= 34	/* rx desc tstamp precision (bits) */
2551000Sxc151355 } HAL_CAPABILITY_TYPE;
2561000Sxc151355 
2571000Sxc151355 /*
2581000Sxc151355  * "States" for setting the LED.  These correspond to
2591000Sxc151355  * the possible 802.11 operational states and there may
2601000Sxc151355  * be a many-to-one mapping between these states and the
2611000Sxc151355  * actual hardware states for the LED's (i.e. the hardware
2621000Sxc151355  * may have fewer states).
2631000Sxc151355  */
2641000Sxc151355 typedef enum {
2651000Sxc151355 	HAL_LED_INIT	= 0,
2661000Sxc151355 	HAL_LED_SCAN	= 1,
2671000Sxc151355 	HAL_LED_AUTH	= 2,
2681000Sxc151355 	HAL_LED_ASSOC	= 3,
2691000Sxc151355 	HAL_LED_RUN	= 4
2701000Sxc151355 } HAL_LED_STATE;
2711000Sxc151355 
2721000Sxc151355 /*
2731000Sxc151355  * Transmit queue types/numbers.  These are used to tag
2741000Sxc151355  * each transmit queue in the hardware and to identify a set
2751000Sxc151355  * of transmit queues for operations such as start/stop dma.
2761000Sxc151355  */
2771000Sxc151355 typedef enum {
2781000Sxc151355 	HAL_TX_QUEUE_INACTIVE	= 0,	/* queue is inactive/unused */
2791000Sxc151355 	HAL_TX_QUEUE_DATA	= 1,	/* data xmit q's */
2801000Sxc151355 	HAL_TX_QUEUE_BEACON	= 2,	/* beacon xmit q */
2811000Sxc151355 	HAL_TX_QUEUE_CAB	= 3,	/* "crap after beacon" xmit q */
2823147Sxc151355 	HAL_TX_QUEUE_UAPSD	= 4	/* u-apsd power save xmit q */
2831000Sxc151355 } HAL_TX_QUEUE;
2841000Sxc151355 
2851000Sxc151355 
2861000Sxc151355 /*
2871000Sxc151355  * Transmit queue subtype.  These map directly to
2881000Sxc151355  * WME Access Categories (except for UPSD).  Refer
2891000Sxc151355  * to Table 5 of the WME spec.
2901000Sxc151355  */
2911000Sxc151355 typedef enum {
2921000Sxc151355 	HAL_WME_AC_BK	= 0,		/* background access category */
2931000Sxc151355 	HAL_WME_AC_BE	= 1, 		/* best effort access category */
2941000Sxc151355 	HAL_WME_AC_VI	= 2,		/* video access category */
2951000Sxc151355 	HAL_WME_AC_VO	= 3,		/* voice access category */
2963147Sxc151355 	HAL_WME_UPSD	= 4,		/* uplink power save */
2973147Sxc151355 	HAL_XR_DATA	= 5		/* entended range data */
2981000Sxc151355 } HAL_TX_QUEUE_SUBTYPE;
2991000Sxc151355 
3001000Sxc151355 /*
3011000Sxc151355  * Transmit queue flags that control various
3021000Sxc151355  * operational parameters.
3031000Sxc151355  */
3041000Sxc151355 typedef enum {
3053147Sxc151355 	/*
3063147Sxc151355 	 * Per queue interrupt enables.  When set the associated
3073147Sxc151355 	 * interrupt may be delivered for packets sent through
3083147Sxc151355 	 * the queue.  Without these enabled no interrupts will
3093147Sxc151355 	 * be delivered for transmits through the queue.
3103147Sxc151355 	 *
3113147Sxc151355 	 * When 0x0001 is set, both TXQ_TXOKINT and TXQ_TXERRINT
3123147Sxc151355 	 * will be enabled.
3133147Sxc151355 	 */
3143147Sxc151355 	HAL_TXQ_TXOKINT_ENABLE	   = 0x0001,	/* enable TXOK interrupt */
3153147Sxc151355 	HAL_TXQ_TXERRINT_ENABLE    = 0x0001,	/* enable TXERR interrupt */
3163147Sxc151355 	HAL_TXQ_TXDESCINT_ENABLE   = 0x0002,	/* enable TXDESC interrupt */
3173147Sxc151355 	HAL_TXQ_TXEOLINT_ENABLE    = 0x0004,	/* enable TXEOL interrupt */
3183147Sxc151355 	HAL_TXQ_TXURNINT_ENABLE    = 0x0008,	/* enable TXURN interrupt */
3193147Sxc151355 	/*
3203147Sxc151355 	 * Enable hardware compression for packets sent through
3213147Sxc151355 	 * the queue.  The compression buffer must be setup and
3223147Sxc151355 	 * packets must have a key entry marked in the tx descriptor.
3233147Sxc151355 	 */
3243147Sxc151355 	HAL_TXQ_COMPRESSION_ENABLE = 0x0010,	/* enable h/w compression */
3253147Sxc151355 	/*
3263147Sxc151355 	 * Disable queue when veol is hit or ready time expires.
3273147Sxc151355 	 * By default the queue is disabled only on reaching the
3283147Sxc151355 	 * physical end of queue (i.e. a null link ptr in the
3293147Sxc151355 	 * descriptor chain).
3303147Sxc151355 	 */
3313147Sxc151355 	HAL_TXQ_RDYTIME_EXP_POLICY_ENABLE = 0x0020,
3323147Sxc151355 	/*
3333147Sxc151355 	 * Schedule frames on delivery of a DBA (DMA Beacon Alert)
3343147Sxc151355 	 * event.  Frames will be transmitted only when this timer
3353147Sxc151355 	 * fires, e.g to transmit a beacon in ap or adhoc modes.
3363147Sxc151355 	 */
3373147Sxc151355 	HAL_TXQ_DBA_GATED	   = 0x0040,	/* schedule based on DBA */
3383147Sxc151355 	/*
3393147Sxc151355 	 * Each transmit queue has a counter that is incremented
3403147Sxc151355 	 * each time the queue is enabled and decremented when
3413147Sxc151355 	 * the list of frames to transmit is traversed (or when
3423147Sxc151355 	 * the ready time for the queue expires).  This counter
3433147Sxc151355 	 * must be non-zero for frames to be scheduled for
3443147Sxc151355 	 * transmission.  The following controls disable bumping
3453147Sxc151355 	 * this counter under certain conditions.  Typically this
3463147Sxc151355 	 * is used to gate frames based on the contents of another
3473147Sxc151355 	 * queue (e.g. CAB traffic may only follow a beacon frame).
3483147Sxc151355 	 * These are meaningful only when frames are scheduled
3493147Sxc151355 	 * with a non-ASAP policy (e.g. DBA-gated).
3503147Sxc151355 	 */
3513147Sxc151355 	HAL_TXQ_CBR_DIS_QEMPTY	   = 0x0080,	/* disable on this q empty */
3523147Sxc151355 	HAL_TXQ_CBR_DIS_BEMPTY	   = 0x0100,	/* disable on beacon q empty */
3533147Sxc151355 
3543147Sxc151355 	/*
3553147Sxc151355 	 * Fragment burst backoff policy.   Normally no backoff
3563147Sxc151355 	 * is done after a successful transmission, the next fragment
3573147Sxc151355 	 * is sent at SIFS.  If this flag is set backoff is done
3583147Sxc151355 	 * after each fragment, regardless whether it was ack'd or
3593147Sxc151355 	 * not, after the backoff count reaches zero a normal channel
3603147Sxc151355 	 * access procedure is done before the next transmit (i.e.
3613147Sxc151355 	 * wait AIFS instead of SIFS).
3623147Sxc151355 	 */
3633147Sxc151355 	HAL_TXQ_FRAG_BURST_BACKOFF_ENABLE = 0x00800000,
3643147Sxc151355 	/*
3653147Sxc151355 	 * Disable post-tx backoff following each frame.
3663147Sxc151355 	 */
3673147Sxc151355 	HAL_TXQ_BACKOFF_DISABLE    =  0x00010000, /* disable post backoff  */
3683147Sxc151355 	/*
3693147Sxc151355 	 * DCU arbiter lockout control.  This controls how
3703147Sxc151355 	 * lower priority tx queues are handled with respect
3713147Sxc151355 	 * to a specific queue when multiple queues have frames
3723147Sxc151355 	 * to send.  No lockout means lower priority queues arbitrate
3733147Sxc151355 	 * concurrently with this queue.  Intra-frame lockout
3743147Sxc151355 	 * means lower priority queues are locked out until the
3753147Sxc151355 	 * current frame transmits (e.g. including backoffs and bursting).
3763147Sxc151355 	 * Global lockout means nothing lower can arbitrary so
3773147Sxc151355 	 * long as there is traffic activity on this queue (frames,
3783147Sxc151355 	 * backoff, etc).
3793147Sxc151355 	 */
3803147Sxc151355 	HAL_TXQ_ARB_LOCKOUT_INTRA  = 0x00020000, /* intra-frame lockout */
3813147Sxc151355 	HAL_TXQ_ARB_LOCKOUT_GLOBAL = 0x00040000, /* full lockout s */
3823147Sxc151355 
3833147Sxc151355 	HAL_TXQ_IGNORE_VIRTCOL	   = 0x00080000, /* ignore virt collisions */
3843147Sxc151355 	HAL_TXQ_SEQNUM_INC_DIS	   = 0x00100000  /* disable seqnum increment */
3851000Sxc151355 } HAL_TX_QUEUE_FLAGS;
3861000Sxc151355 
3871000Sxc151355 typedef struct {
3881000Sxc151355 	uint32_t	tqi_ver;		/* hal TXQ version */
3891000Sxc151355 	HAL_TX_QUEUE_SUBTYPE tqi_subtype;	/* subtype if applicable */
3901000Sxc151355 	HAL_TX_QUEUE_FLAGS tqi_qflags;		/* flags (see above) */
3911000Sxc151355 	uint32_t	tqi_priority;		/* (not used) */
3921000Sxc151355 	uint32_t	tqi_aifs;		/* AIFS shift */
3931000Sxc151355 	int32_t		tqi_cwmin;		/* cwMin shift */
3941000Sxc151355 	int32_t		tqi_cwmax;		/* cwMax shift */
3951000Sxc151355 	uint16_t	tqi_shretry;		/* rts retry limit */
3961000Sxc151355 	uint16_t	tqi_lgretry;		/* long retry limit(not used) */
3971000Sxc151355 	uint32_t	tqi_cbrPeriod;
3981000Sxc151355 	uint32_t	tqi_cbrOverflowLimit;
3991000Sxc151355 	uint32_t	tqi_burstTime;
4001000Sxc151355 	uint32_t	tqi_readyTime;
4013147Sxc151355 	uint32_t	tqi_compBuf;		/* compress buffer phys addr */
4021000Sxc151355 } HAL_TXQ_INFO;
4031000Sxc151355 
4043147Sxc151355 #define	HAL_TQI_NONVAL		0xffff
4053147Sxc151355 
4061000Sxc151355 /* token to use for aifs, cwmin, cwmax */
4071000Sxc151355 #define	HAL_TXQ_USEDEFAULT	((uint32_t)-1)
4081000Sxc151355 
4091000Sxc151355 /*
4101000Sxc151355  * Transmit packet types.  This belongs in ah_desc.h, but
4111000Sxc151355  * is here so we can give a proper type to various parameters
4121000Sxc151355  * (and not require everyone include the file).
4131000Sxc151355  *
4141000Sxc151355  * NB: These values are intentionally assigned for
4151000Sxc151355  *     direct use when setting up h/w descriptors.
4161000Sxc151355  */
4171000Sxc151355 typedef enum {
4181000Sxc151355 	HAL_PKT_TYPE_NORMAL	= 0,
4191000Sxc151355 	HAL_PKT_TYPE_ATIM	= 1,
4201000Sxc151355 	HAL_PKT_TYPE_PSPOLL	= 2,
4211000Sxc151355 	HAL_PKT_TYPE_BEACON	= 3,
4223147Sxc151355 	HAL_PKT_TYPE_PROBE_RESP	= 4,
4233147Sxc151355 	HAL_PKT_TYPE_CHIRP	= 5,
424*8033SWang.Lin@Sun.COM 	HAL_PKT_TYPE_GRP_POLL	= 6,
425*8033SWang.Lin@Sun.COM 	HAL_PKT_TYPE_AMPDU	= 7
4261000Sxc151355 } HAL_PKT_TYPE;
4271000Sxc151355 
4281000Sxc151355 /* Rx Filter Frame Types */
4291000Sxc151355 typedef enum {
4301000Sxc151355 	HAL_RX_FILTER_UCAST	= 0x00000001,	/* Allow unicast frames */
4311000Sxc151355 	HAL_RX_FILTER_MCAST	= 0x00000002,	/* Allow multicast frames */
4321000Sxc151355 	HAL_RX_FILTER_BCAST	= 0x00000004,	/* Allow broadcast frames */
4331000Sxc151355 	HAL_RX_FILTER_CONTROL	= 0x00000008,	/* Allow control frames */
4341000Sxc151355 	HAL_RX_FILTER_BEACON	= 0x00000010,	/* Allow beacon frames */
4351000Sxc151355 	HAL_RX_FILTER_PROM	= 0x00000020,	/* Promiscuous mode */
4363147Sxc151355 	HAL_RX_FILTER_XRPOLL	= 0x00000040,	/* Allow XR poll frmae */
4371000Sxc151355 	HAL_RX_FILTER_PROBEREQ	= 0x00000080,	/* Allow probe request frames */
4381000Sxc151355 	HAL_RX_FILTER_PHYERR	= 0x00000100,	/* Allow phy errors */
4391000Sxc151355 	HAL_RX_FILTER_PHYRADAR	= 0x00000200	/* Allow phy radar errors */
4401000Sxc151355 } HAL_RX_FILTER;
4411000Sxc151355 
4421000Sxc151355 typedef enum {
4433147Sxc151355 	HAL_PM_AWAKE		= 0,
4443147Sxc151355 	HAL_PM_FULL_SLEEP	= 1,
4453147Sxc151355 	HAL_PM_NETWORK_SLEEP	= 2,
4463147Sxc151355 	HAL_PM_UNDEFINED	= 3
4471000Sxc151355 } HAL_POWER_MODE;
4481000Sxc151355 
4491000Sxc151355 /*
4501000Sxc151355  * NOTE WELL:
4511000Sxc151355  * These are mapped to take advantage of the common locations for many of
4521000Sxc151355  * the bits on all of the currently supported MAC chips. This is to make
4531000Sxc151355  * the ISR as efficient as possible, while still abstracting HW differences.
4541000Sxc151355  * When new hardware breaks this commonality this enumerated type, as well
4551000Sxc151355  * as the HAL functions using it, must be modified. All values are directly
4561000Sxc151355  * mapped unless commented otherwise.
4571000Sxc151355  */
4581000Sxc151355 typedef enum {
4591000Sxc151355 	HAL_INT_RX	= 0x00000001,	/* Non-common mapping */
4601000Sxc151355 	HAL_INT_RXDESC	= 0x00000002,
4611000Sxc151355 	HAL_INT_RXNOFRM	= 0x00000008,
4621000Sxc151355 	HAL_INT_RXEOL	= 0x00000010,
4631000Sxc151355 	HAL_INT_RXORN	= 0x00000020,
4641000Sxc151355 	HAL_INT_TX	= 0x00000040,	/* Non-common mapping */
4651000Sxc151355 	HAL_INT_TXDESC	= 0x00000080,
4661000Sxc151355 	HAL_INT_TXURN	= 0x00000800,
4671000Sxc151355 	HAL_INT_MIB	= 0x00001000,
4681000Sxc151355 	HAL_INT_RXPHY	= 0x00004000,
4691000Sxc151355 	HAL_INT_RXKCM	= 0x00008000,
4701000Sxc151355 	HAL_INT_SWBA	= 0x00010000,
4711000Sxc151355 	HAL_INT_BMISS	= 0x00040000,
4721000Sxc151355 	HAL_INT_BNR	= 0x00100000,	/* Non-common mapping */
4733147Sxc151355 	HAL_INT_TIM	= 0x00200000,	/* Non-common mapping */
4743147Sxc151355 	HAL_INT_DTIM	= 0x00400000,	/* Non-common mapping */
4753147Sxc151355 	HAL_INT_DTIMSYNC = 0x00800000,	/* Non-common mapping */
4761000Sxc151355 	HAL_INT_GPIO	= 0x01000000,
4773147Sxc151355 	HAL_INT_CABEND	= 0x02000000,	/* Non-common mapping */
478*8033SWang.Lin@Sun.COM 	HAL_INT_CST	= 0x10000000,	/* Non-common mapping */
479*8033SWang.Lin@Sun.COM 	HAL_INT_GTT	= 0x20000000,	/* Non-common mapping */
4801000Sxc151355 	HAL_INT_FATAL	= 0x40000000,	/* Non-common mapping */
4811000Sxc151355 	HAL_INT_GLOBAL	= INT_MIN,	/* Set/clear IER */
4823147Sxc151355 	HAL_INT_BMISC	= HAL_INT_TIM
4833147Sxc151355 			| HAL_INT_DTIM
4843147Sxc151355 			| HAL_INT_DTIMSYNC
4853147Sxc151355 			| HAL_INT_CABEND,
4861000Sxc151355 
4871000Sxc151355 	/* Interrupt bits that map directly to ISR/IMR bits */
4881000Sxc151355 	HAL_INT_COMMON  = HAL_INT_RXNOFRM
4891000Sxc151355 			| HAL_INT_RXDESC
4901000Sxc151355 			| HAL_INT_RXEOL
4911000Sxc151355 			| HAL_INT_RXORN
4921000Sxc151355 			| HAL_INT_TXURN
4931000Sxc151355 			| HAL_INT_TXDESC
4941000Sxc151355 			| HAL_INT_MIB
4951000Sxc151355 			| HAL_INT_RXPHY
4961000Sxc151355 			| HAL_INT_RXKCM
4971000Sxc151355 			| HAL_INT_SWBA
4981000Sxc151355 			| HAL_INT_BMISS
4991000Sxc151355 			| HAL_INT_GPIO,
5001000Sxc151355 } HAL_INT;
5011000Sxc151355 
5021000Sxc151355 typedef enum {
5031000Sxc151355 	HAL_RFGAIN_INACTIVE		= 0,
5041000Sxc151355 	HAL_RFGAIN_READ_REQUESTED	= 1,
5051000Sxc151355 	HAL_RFGAIN_NEED_CHANGE		= 2
5061000Sxc151355 } HAL_RFGAIN;
5071000Sxc151355 
5081000Sxc151355 typedef enum {
5091000Sxc151355 	HAL_PHYERR_UNDERRUN		= 0,	/* Transmit underrun */
5101000Sxc151355 	HAL_PHYERR_TIMING		= 1,	/* Timing error */
5111000Sxc151355 	HAL_PHYERR_PARITY		= 2,	/* Illegal parity */
5121000Sxc151355 	HAL_PHYERR_RATE			= 3,	/* Illegal rate */
5131000Sxc151355 	HAL_PHYERR_LENGTH		= 4,	/* Illegal length */
5141000Sxc151355 	HAL_PHYERR_RADAR		= 5,	/* Radar detect */
5151000Sxc151355 	HAL_PHYERR_SERVICE		= 6,	/* Illegal service */
5161000Sxc151355 	HAL_PHYERR_TOR			= 7,	/* Transmit override receive */
5171000Sxc151355 	/* NB: these are specific to the 5212 */
5181000Sxc151355 	HAL_PHYERR_OFDM_TIMING		= 17,	/* */
5191000Sxc151355 	HAL_PHYERR_OFDM_SIGNAL_PARITY	= 18,	/* */
5201000Sxc151355 	HAL_PHYERR_OFDM_RATE_ILLEGAL	= 19,	/* */
5211000Sxc151355 	HAL_PHYERR_OFDM_LENGTH_ILLEGAL	= 20,	/* */
5221000Sxc151355 	HAL_PHYERR_OFDM_POWER_DROP	= 21,	/* */
5231000Sxc151355 	HAL_PHYERR_OFDM_SERVICE		= 22,	/* */
5241000Sxc151355 	HAL_PHYERR_OFDM_RESTART		= 23,	/* */
5251000Sxc151355 	HAL_PHYERR_CCK_TIMING		= 25,	/* */
5261000Sxc151355 	HAL_PHYERR_CCK_HEADER_CRC	= 26,	/* */
5271000Sxc151355 	HAL_PHYERR_CCK_RATE_ILLEGAL	= 27,	/* */
5281000Sxc151355 	HAL_PHYERR_CCK_SERVICE		= 30,	/* */
5291000Sxc151355 	HAL_PHYERR_CCK_RESTART		= 31	/* */
5301000Sxc151355 }HAL_PHYERR;
5311000Sxc151355 
5321000Sxc151355 /*
5331000Sxc151355  * Channels are specified by frequency.
5341000Sxc151355  */
5351000Sxc151355 typedef struct {
536*8033SWang.Lin@Sun.COM 	uint32_t	channelFlags;
5371000Sxc151355 	uint16_t	channel;	/* setting in Mhz */
5383147Sxc151355 	uint8_t		privFlags;
5393147Sxc151355 	int8_t		maxRegTxPower;	/* max regulatory tx power in dBm */
5403147Sxc151355 	int8_t		maxTxPower;	/* max true tx power in 0.5 dBm */
5413147Sxc151355 	int8_t		minTxPower;	/* min true tx power in 0.5 dBm */
5421000Sxc151355 } HAL_CHANNEL;
5431000Sxc151355 
5441000Sxc151355 
5451000Sxc151355 typedef struct {
5461000Sxc151355 	uint32_t	ackrcv_bad;
5471000Sxc151355 	uint32_t	rts_bad;
5481000Sxc151355 	uint32_t	rts_good;
5491000Sxc151355 	uint32_t	fcs_bad;
5501000Sxc151355 	uint32_t	beacons;
5511000Sxc151355 } HAL_MIB_STATS;
5521000Sxc151355 
5531000Sxc151355 
5541000Sxc151355 enum {
5551000Sxc151355 	CTRY_DEBUG	= 0x1ff,		/* debug country code */
5561000Sxc151355 	CTRY_DEFAULT	= 0			/* default country code */
5571000Sxc151355 };
5581000Sxc151355 
5591000Sxc151355 enum {
5603147Sxc151355 	HAL_MODE_11A	= 0x001,	/* 11a channels */
5613147Sxc151355 	HAL_MODE_TURBO	= 0x002,	/* 11a turbo-only channels */
5623147Sxc151355 	HAL_MODE_11B	= 0x004,	/* 11b channels */
5633147Sxc151355 	HAL_MODE_PUREG	= 0x008,	/* 11g channels (OFDM only) */
5643147Sxc151355 	HAL_MODE_11G	= 0x008,	/* XXX historical */
5653147Sxc151355 	HAL_MODE_108G	= 0x020,	/* 11g+Turbo channels */
5663147Sxc151355 	HAL_MODE_108A	= 0x040,	/* 11a+Turbo channels */
5673147Sxc151355 	HAL_MODE_XR	= 0x100,	/* XR channels */
5683147Sxc151355 	HAL_MODE_11A_HALF_RATE = 0x200,	/* 11A half rate channels */
5693147Sxc151355 	HAL_MODE_11A_QUARTER_RATE = 0x400,	/* 11A quarter rate channels */
570*8033SWang.Lin@Sun.COM 	HAL_MODE_11NG_HT20	= 0x8000,
571*8033SWang.Lin@Sun.COM 	HAL_MODE_11NA_HT20	= 0x10000,
572*8033SWang.Lin@Sun.COM 	HAL_MODE_11NG_HT40PLUS	= 0x20000,
573*8033SWang.Lin@Sun.COM 	HAL_MODE_11NG_HT40MINUS	= 0x40000,
574*8033SWang.Lin@Sun.COM 	HAL_MODE_11NA_HT40PLUS	= 0x80000,
575*8033SWang.Lin@Sun.COM 	HAL_MODE_11NA_HT40MINUS	= 0x100000,
576*8033SWang.Lin@Sun.COM 	HAL_MODE_ALL	= 0xffffff
5771000Sxc151355 };
5781000Sxc151355 
5791000Sxc151355 typedef struct {
5801000Sxc151355 	int		rateCount;		/* NB: for proper padding */
581*8033SWang.Lin@Sun.COM 	uint8_t	rateCodeToIndex[144];	/* back mapping */
5821000Sxc151355 	struct {
5831000Sxc151355 		uint8_t	valid;		/* valid for rate control use */
5841000Sxc151355 		uint8_t	phy;		/* CCK/OFDM/XR */
585*8033SWang.Lin@Sun.COM 		uint32_t rateKbps;	/* transfer rate in kbs */
5861000Sxc151355 		uint8_t	rateCode;	/* rate for h/w descriptors */
5871000Sxc151355 		/* mask for enabling short preamble in CCK rate code */
5881000Sxc151355 		uint8_t	shortPreamble;
5891000Sxc151355 		/* value for supported rates info element of MLME */
5901000Sxc151355 		uint8_t	dot11Rate;
5911000Sxc151355 		/* index of next lower basic rate; used for dur. calcs */
5921000Sxc151355 		uint8_t	controlRate;
5931000Sxc151355 		uint16_t lpAckDuration;	/* long preamble ACK duration */
5941000Sxc151355 		uint16_t spAckDuration;	/* short preamble ACK duration */
5951000Sxc151355 	} info[32];
5961000Sxc151355 } HAL_RATE_TABLE;
5971000Sxc151355 
5981000Sxc151355 typedef struct {
5991000Sxc151355 	uint32_t	rs_count;	/* number of valid entries */
6001000Sxc151355 	uint8_t	rs_rates[32];		/* rates */
6011000Sxc151355 } HAL_RATE_SET;
6021000Sxc151355 
6033147Sxc151355 /*
604*8033SWang.Lin@Sun.COM  * 802.11n specific structures and enums
605*8033SWang.Lin@Sun.COM  */
606*8033SWang.Lin@Sun.COM typedef enum {
607*8033SWang.Lin@Sun.COM 	HAL_CHAINTYPE_TX	= 1,	/* Tx chain type */
608*8033SWang.Lin@Sun.COM 	HAL_CHAINTYPE_RX	= 2,	/* RX chain type */
609*8033SWang.Lin@Sun.COM } HAL_CHAIN_TYPE;
610*8033SWang.Lin@Sun.COM 
611*8033SWang.Lin@Sun.COM typedef struct {
612*8033SWang.Lin@Sun.COM 	uint_t	Tries;
613*8033SWang.Lin@Sun.COM 	uint_t	Rate;
614*8033SWang.Lin@Sun.COM 	uint_t	PktDuration;
615*8033SWang.Lin@Sun.COM 	uint_t	ChSel;
616*8033SWang.Lin@Sun.COM 	uint_t	RateFlags;
617*8033SWang.Lin@Sun.COM #define	HAL_RATESERIES_RTS_CTS	0x0001	/* use rts/cts w/this series */
618*8033SWang.Lin@Sun.COM #define	HAL_RATESERIES_2040	0x0002	/* use ext channel for series */
619*8033SWang.Lin@Sun.COM #define	HAL_RATESERIES_HALFGI	0x0004	/* use half-gi for series */
620*8033SWang.Lin@Sun.COM } HAL_11N_RATE_SERIES;
621*8033SWang.Lin@Sun.COM 
622*8033SWang.Lin@Sun.COM typedef enum {
623*8033SWang.Lin@Sun.COM 	HAL_HT_MACMODE_20	= 0,	/* 20 MHz operation */
624*8033SWang.Lin@Sun.COM 	HAL_HT_MACMODE_2040	= 1	/* 20/40 MHz operation */
625*8033SWang.Lin@Sun.COM } HAL_HT_MACMODE;
626*8033SWang.Lin@Sun.COM 
627*8033SWang.Lin@Sun.COM typedef enum {
628*8033SWang.Lin@Sun.COM 	HAL_HT_PHYMODE_20	= 0,	/* 20 MHz operation */
629*8033SWang.Lin@Sun.COM 	HAL_HT_PHYMODE_2040	= 1	/* 20/40 MHz operation */
630*8033SWang.Lin@Sun.COM } HAL_HT_PHYMODE;
631*8033SWang.Lin@Sun.COM 
632*8033SWang.Lin@Sun.COM typedef enum {
633*8033SWang.Lin@Sun.COM 	HAL_HT_EXTPROTSPACING_20 = 0,	/* 20 MHz spacing */
634*8033SWang.Lin@Sun.COM 	HAL_HT_EXTPROTSPACING_25 = 1	/* 25 MHz spacing */
635*8033SWang.Lin@Sun.COM } HAL_HT_EXTPROTSPACING;
636*8033SWang.Lin@Sun.COM 
637*8033SWang.Lin@Sun.COM typedef enum {
638*8033SWang.Lin@Sun.COM 	HAL_RX_CLEAR_CTL_LOW	= 1,	/* force control chan to appear busy */
639*8033SWang.Lin@Sun.COM 	HAL_RX_CLEAR_EXT_LOW	= 2	/* force ext chan to appear busy */
640*8033SWang.Lin@Sun.COM } HAL_HT_RXCLEAR;
641*8033SWang.Lin@Sun.COM 
642*8033SWang.Lin@Sun.COM /*
6433147Sxc151355  * Antenna switch control.  By default antenna selection
6443147Sxc151355  * enables multiple (2) antenna use.  To force use of the
6453147Sxc151355  * A or B antenna only specify a fixed setting.  Fixing
6463147Sxc151355  * the antenna will also disable any diversity support.
6473147Sxc151355  */
6481000Sxc151355 typedef enum {
6491000Sxc151355 	HAL_ANT_VARIABLE = 0,		/* variable by programming */
6503147Sxc151355 	HAL_ANT_FIXED_A	 = 1,		/* fixed antenna A */
6513147Sxc151355 	HAL_ANT_FIXED_B	 = 2		/* fixed antenna B */
6521000Sxc151355 } HAL_ANT_SETTING;
6531000Sxc151355 
6541000Sxc151355 typedef enum {
6551000Sxc151355 	HAL_M_STA	= 1,		/* infrastructure station */
6561000Sxc151355 	HAL_M_IBSS	= 0,		/* IBSS (adhoc) station */
6571000Sxc151355 	HAL_M_HOSTAP	= 6,		/* Software Access Point */
6581000Sxc151355 	HAL_M_MONITOR	= 8		/* Monitor mode */
6591000Sxc151355 } HAL_OPMODE;
6601000Sxc151355 
6611000Sxc151355 typedef struct {
6621000Sxc151355 	uint8_t	kv_type;		/* one of HAL_CIPHER */
6631000Sxc151355 	uint8_t	kv_pad;
6641000Sxc151355 	uint16_t	kv_len;		/* length in bits */
6651000Sxc151355 	uint8_t	kv_val[16];		/* enough for 128-bit keys */
6661000Sxc151355 	uint8_t	kv_mic[8];		/* TKIP MIC key */
667*8033SWang.Lin@Sun.COM 	uint8_t	kv_txmic[8];		/* TKIP TX MIC key (optional) */
6681000Sxc151355 } HAL_KEYVAL;
6691000Sxc151355 
6701000Sxc151355 typedef enum {
6711000Sxc151355 	HAL_CIPHER_WEP		= 0,
6721000Sxc151355 	HAL_CIPHER_AES_OCB	= 1,
6731000Sxc151355 	HAL_CIPHER_AES_CCM	= 2,
6741000Sxc151355 	HAL_CIPHER_CKIP		= 3,
6751000Sxc151355 	HAL_CIPHER_TKIP		= 4,
6761000Sxc151355 	HAL_CIPHER_CLR		= 5,	/* no encryption */
6771000Sxc151355 
6781000Sxc151355 	HAL_CIPHER_MIC		= 127	/* TKIP-MIC, not a cipher */
6791000Sxc151355 } HAL_CIPHER;
6801000Sxc151355 
6811000Sxc151355 enum {
6823147Sxc151355 	HAL_SLOT_TIME_6  = 6,		/* NB: for turbo mode */
6831000Sxc151355 	HAL_SLOT_TIME_9	 = 9,
6841000Sxc151355 	HAL_SLOT_TIME_20 = 20
6851000Sxc151355 };
6861000Sxc151355 
6871000Sxc151355 /*
6881000Sxc151355  * Per-station beacon timer state.  Note that the specified
6891000Sxc151355  * beacon interval (given in TU's) can also include flags
6901000Sxc151355  * to force a TSF reset and to enable the beacon xmit logic.
6911000Sxc151355  * If bs_cfpmaxduration is non-zero the hardware is setup to
6921000Sxc151355  * coexist with a PCF-capable AP.
6931000Sxc151355  */
6941000Sxc151355 typedef struct {
6951000Sxc151355 	uint32_t	bs_nexttbtt;		/* next beacon in TU */
6961000Sxc151355 	uint32_t	bs_nextdtim;		/* next DTIM in TU */
6971000Sxc151355 	uint32_t	bs_intval;		/* beacon interval+flags */
6981000Sxc151355 	uint32_t	bs_dtimperiod;
6991000Sxc151355 	uint16_t	bs_cfpperiod;		/* CFP period in TU */
7001000Sxc151355 	uint16_t	bs_cfpmaxduration;	/* max CFP duration in TU */
7011000Sxc151355 	uint32_t	bs_cfpnext;		/* next CFP in TU */
7021000Sxc151355 	uint16_t	bs_timoffset;		/* byte offset to TIM bitmap */
7031000Sxc151355 	uint16_t	bs_bmissthreshold;	/* beacon miss threshold */
7041000Sxc151355 	uint32_t	bs_sleepduration;	/* max sleep duration */
7051000Sxc151355 } HAL_BEACON_STATE;
7061000Sxc151355 
7071000Sxc151355 /*
7083147Sxc151355  * Like HAL_BEACON_STATE but for non-station mode setup.
7093147Sxc151355  * NB: see above flag definitions
7103147Sxc151355  */
7113147Sxc151355 typedef struct {
7123147Sxc151355 	uint32_t	bt_intval;		/* beacon interval+flags */
7133147Sxc151355 	uint32_t	bt_nexttbtt;		/* next beacon in TU */
7143147Sxc151355 	uint32_t	bt_nextatim;		/* next ATIM in TU */
7153147Sxc151355 	uint32_t	bt_nextdba;		/* next DBA in 1/8th TU */
7163147Sxc151355 	uint32_t	bt_nextswba;		/* next SWBA in 1/8th TU */
717*8033SWang.Lin@Sun.COM 	uint32_t	bt_flags;		/* timer enables */
718*8033SWang.Lin@Sun.COM #define	HAL_BEACON_TBTT_EN	0x00000001
719*8033SWang.Lin@Sun.COM #define	HAL_BEACON_DBA_EN	0x00000002
720*8033SWang.Lin@Sun.COM #define	HAL_BEACON_SWBA_EN	0x00000004
7213147Sxc151355 } HAL_BEACON_TIMERS;
7223147Sxc151355 
7233147Sxc151355 /*
7241000Sxc151355  * Per-node statistics maintained by the driver for use in
7251000Sxc151355  * optimizing signal quality and other operational aspects.
7261000Sxc151355  */
7271000Sxc151355 typedef struct {
7281000Sxc151355 	uint32_t	ns_avgbrssi;	/* average beacon rssi */
7291000Sxc151355 	uint32_t	ns_avgrssi;	/* average data rssi */
7301000Sxc151355 	uint32_t	ns_avgtxrssi;	/* average tx rssi */
7311000Sxc151355 } HAL_NODE_STATS;
7321000Sxc151355 
7331000Sxc151355 /*
7341000Sxc151355  * Transmit descriptor status.  This structure is filled
7351000Sxc151355  * in only after the tx descriptor process method finds a
7361000Sxc151355  * ``done'' descriptor; at which point it returns something
7371000Sxc151355  * other than HAL_EINPROGRESS.
7381000Sxc151355  *
7391000Sxc151355  * Note that ts_antenna may not be valid for all h/w.  It
7401000Sxc151355  * should be used only if non-zero.
7411000Sxc151355  */
7421000Sxc151355 struct ath_tx_status {
7431000Sxc151355 	uint16_t	ts_seqnum;	/* h/w assigned sequence number */
7441000Sxc151355 	uint16_t	ts_tstamp;	/* h/w assigned timestamp */
7451000Sxc151355 	uint8_t		ts_status;	/* frame status, 0 => xmit ok */
7461000Sxc151355 	uint8_t		ts_rate;	/* h/w transmit rate index */
7471000Sxc151355 	int8_t		ts_rssi;	/* tx ack RSSI */
7481000Sxc151355 	uint8_t		ts_shortretry;	/* # short retries */
7491000Sxc151355 	uint8_t		ts_longretry;	/* # long retries */
7501000Sxc151355 	uint8_t		ts_virtcol;	/* virtual collision count */
7511000Sxc151355 	uint8_t		ts_antenna;	/* antenna information */
752*8033SWang.Lin@Sun.COM 	uint8_t		ts_finaltsi;	/* final transmit series index */
753*8033SWang.Lin@Sun.COM 	/* AH_SUPPORT_AR5416 */		/* 802.11n status */
754*8033SWang.Lin@Sun.COM 	uint8_t		ts_flags;	/* misc flags */
755*8033SWang.Lin@Sun.COM 	int8_t		ts_rssi_ctl[3];	/* tx ack RSSI [ctl, chain 0-2] */
756*8033SWang.Lin@Sun.COM 	int8_t		ts_rssi_ext[3];	/* tx ack RSSI [ext, chain 0-2] */
757*8033SWang.Lin@Sun.COM 	uint32_t	ts_ba_low;	/* blockack bitmap low */
758*8033SWang.Lin@Sun.COM 	uint32_t	ts_ba_high;	/* blockack bitmap high */
759*8033SWang.Lin@Sun.COM 	uint32_t	ts_evm0;	/* evm bytes */
760*8033SWang.Lin@Sun.COM 	uint32_t	ts_evm1;
761*8033SWang.Lin@Sun.COM 	uint32_t	ts_evm2;
7621000Sxc151355 };
7631000Sxc151355 
7641000Sxc151355 
7651000Sxc151355 /*
7661000Sxc151355  * Receive descriptor status.  This structure is filled
7671000Sxc151355  * in only after the rx descriptor process method finds a
7681000Sxc151355  * ``done'' descriptor; at which point it returns something
7691000Sxc151355  * other than HAL_EINPROGRESS.
7701000Sxc151355  *
7711000Sxc151355  * If rx_status is zero, then the frame was received ok;
7721000Sxc151355  * otherwise the error information is indicated and rs_phyerr
7731000Sxc151355  * contains a phy error code if HAL_RXERR_PHY is set.  In general
7741000Sxc151355  * the frame contents is undefined when an error occurred thought
7751000Sxc151355  * for some errors (e.g. a decryption error), it may be meaningful.
7761000Sxc151355  *
7771000Sxc151355  * Note that the receive timestamp is expanded using the TSF to
778*8033SWang.Lin@Sun.COM  * at least 15 bits (regardless of what the h/w provides directly).
779*8033SWang.Lin@Sun.COM  * Newer hardware supports a full 32-bits; use HAL_CAP_32TSTAMP to
780*8033SWang.Lin@Sun.COM  * find out if the hardware is capable.
7811000Sxc151355  *
7821000Sxc151355  * rx_rssi is in units of dbm above the noise floor.  This value
7831000Sxc151355  * is measured during the preamble and PLCP; i.e. with the initial
7841000Sxc151355  * 4us of detection.  The noise floor is typically a consistent
7851000Sxc151355  * -96dBm absolute power in a 20MHz channel.
7861000Sxc151355  */
7871000Sxc151355 struct ath_rx_status {
7881000Sxc151355 	uint16_t	rs_datalen;	/* rx frame length */
7891000Sxc151355 	uint8_t		rs_status;	/* rx status, 0 => recv ok */
7901000Sxc151355 	uint8_t		rs_phyerr;	/* phy error code */
791*8033SWang.Lin@Sun.COM 	int8_t		rs_rssi;	/* rx frame RSSI (xombined for 11n) */
7921000Sxc151355 	uint8_t		rs_keyix;	/* key cache index */
7931000Sxc151355 	uint8_t		rs_rate;	/* h/w receive rate index */
7941000Sxc151355 	uint8_t		rs_more;	/* see HAL_RXERR_XXX definition */
795*8033SWang.Lin@Sun.COM 	uint32_t	rs_tstamp;	/* h/w assigned timestamp */
796*8033SWang.Lin@Sun.COM 	uint32_t	rs_antenna;	/* antenna information */
797*8033SWang.Lin@Sun.COM 	/* AH_SUPPORT_AR5416 */		/* 802.11n status */
798*8033SWang.Lin@Sun.COM 	int8_t		rs_rssi_ctl[3];	/* rx frame RSSI [ctl, chain 0-2] */
799*8033SWang.Lin@Sun.COM 	int8_t		rs_rssi_ext[3];	/* rx frame RSSI [ext, chain 0-2] */
800*8033SWang.Lin@Sun.COM 	uint8_t		rs_isaggr;	/* is part of the aggregate */
801*8033SWang.Lin@Sun.COM 	uint8_t		rs_moreaggr;	/* more frames in aggr to follow */
802*8033SWang.Lin@Sun.COM 	uint8_t		rs_num_delims;	/* number of delims in aggr */
803*8033SWang.Lin@Sun.COM 	uint8_t		rs_flags;	/* misc flags */
804*8033SWang.Lin@Sun.COM 	uint32_t	rs_evm0;	/* evm bytes */
805*8033SWang.Lin@Sun.COM 	uint32_t	rs_evm1;
806*8033SWang.Lin@Sun.COM 	uint32_t	rs_evm2;
8071000Sxc151355 };
8081000Sxc151355 
8091000Sxc151355 /*
8101000Sxc151355  * Definitions for the software frame/packet descriptors used by
8111000Sxc151355  * the Atheros HAL.  This definition obscures hardware-specific
8121000Sxc151355  * details from the driver.  Drivers are expected to fillin the
8131000Sxc151355  * portions of a descriptor that are not opaque then use HAL calls
8141000Sxc151355  * to complete the work.  Status for completed frames is returned
8151000Sxc151355  * in a device-independent format.
8161000Sxc151355  */
817*8033SWang.Lin@Sun.COM /* AH_SUPPORT_AR5416 */
818*8033SWang.Lin@Sun.COM #define	HAL_DESC_HW_SIZE	20
819*8033SWang.Lin@Sun.COM 
8201000Sxc151355 #pragma pack(1)
8211000Sxc151355 struct ath_desc {
8221000Sxc151355 	/*
8231000Sxc151355 	 * The following definitions are passed directly
8241000Sxc151355 	 * the hardware and managed by the HAL.  Drivers
8251000Sxc151355 	 * should not touch those elements marked opaque.
8261000Sxc151355 	 */
8271000Sxc151355 	uint32_t	ds_link;	/* phys address of next descriptor */
8281000Sxc151355 	uint32_t	ds_data;	/* phys address of data buffer */
8291000Sxc151355 	uint32_t	ds_ctl0;	/* opaque DMA control 0 */
8301000Sxc151355 	uint32_t	ds_ctl1;	/* opaque DMA control 1 */
831*8033SWang.Lin@Sun.COM 	uint32_t	ds_hw[HAL_DESC_HW_SIZE]; /* opaque h/w region */
832*8033SWang.Lin@Sun.COM };
833*8033SWang.Lin@Sun.COM 
834*8033SWang.Lin@Sun.COM struct ath_desc_status {
8351000Sxc151355 	union {
8361000Sxc151355 		struct ath_tx_status tx; /* xmit status */
8371000Sxc151355 		struct ath_rx_status rx; /* recv status */
8381000Sxc151355 	} ds_us;
8391000Sxc151355 };
8401000Sxc151355 #pragma pack()
8411000Sxc151355 
8421000Sxc151355 #define	ds_txstat	ds_us.tx
8431000Sxc151355 #define	ds_rxstat	ds_us.rx
8441000Sxc151355 
8451000Sxc151355 /*
8461000Sxc151355  * Hardware Access Layer (HAL) API.
8471000Sxc151355  *
8481000Sxc151355  * Clients of the HAL call ath_hal_attach to obtain a reference to an
8491000Sxc151355  * ath_hal structure for use with the device.  Hardware-related operations
8501000Sxc151355  * that follow must call back into the HAL through interface, supplying
8511000Sxc151355  * the reference as the first parameter.  Note that before using the
8521000Sxc151355  * reference returned by ath_hal_attach the caller should verify the
8531000Sxc151355  * ABI version number.
8541000Sxc151355  */
8551000Sxc151355 struct ath_hal {
8561000Sxc151355 	uint32_t	ah_magic;	/* consistency check magic number */
8571000Sxc151355 	uint32_t	ah_abi;		/* HAL ABI version */
8581000Sxc151355 	uint16_t	ah_devid;	/* PCI device ID */
8591000Sxc151355 	uint16_t	ah_subvendorid;	/* PCI subvendor ID */
8601000Sxc151355 	HAL_SOFTC	ah_sc;		/* back pointer to driver/os state */
8611000Sxc151355 	HAL_BUS_TAG	ah_st;		/* params for register r+w */
8621000Sxc151355 	HAL_BUS_HANDLE	ah_sh;
8631000Sxc151355 	HAL_CTRY_CODE	ah_countryCode;
8641000Sxc151355 
8651000Sxc151355 	uint32_t	ah_macVersion;	/* MAC version id */
8661000Sxc151355 	uint16_t	ah_macRev;	/* MAC revision */
8671000Sxc151355 	uint16_t	ah_phyRev;	/* PHY revision */
8683147Sxc151355 	/* NB: when only one radio is present the rev is in 5Ghz */
8693147Sxc151355 	uint16_t	ah_analog5GhzRev; /* 5GHz radio revision */
8703147Sxc151355 	uint16_t	ah_analog2GhzRev; /* 2GHz radio revision */
8711000Sxc151355 
8721000Sxc151355 	const HAL_RATE_TABLE *(*ah_getRateTable)(struct ath_hal *,
8731000Sxc151355 				uint32_t mode);
8741000Sxc151355 	void	  (*ah_detach) (struct ath_hal *);
8751000Sxc151355 
8761000Sxc151355 	/* Reset functions */
8771000Sxc151355 	HAL_BOOL  (*ah_reset) (struct ath_hal *, HAL_OPMODE,
8781000Sxc151355 				HAL_CHANNEL *, HAL_BOOL bChannelChange,
8791000Sxc151355 				HAL_STATUS *status);
8803147Sxc151355 	HAL_BOOL  (*ah_phyDisable) (struct ath_hal *);
8813147Sxc151355 	HAL_BOOL  (*ah_disable) (struct ath_hal *);
8823147Sxc151355 	void	  (*ah_setPCUConfig) (struct ath_hal *);
8833147Sxc151355 	HAL_BOOL  (*ah_perCalibration) (struct ath_hal *, HAL_CHANNEL *,
8843147Sxc151355 				HAL_BOOL *);
8851000Sxc151355 	HAL_BOOL  (*ah_setTxPowerLimit)(struct ath_hal *, uint32_t);
8861000Sxc151355 
887*8033SWang.Lin@Sun.COM 	/* DFS support */
8883147Sxc151355 	HAL_BOOL  (*ah_radarWait)(struct ath_hal *, HAL_CHANNEL *);
8893147Sxc151355 
8901000Sxc151355 	/* Transmit functions */
8911000Sxc151355 	HAL_BOOL  (*ah_updateTxTrigLevel) (struct ath_hal *,
8921000Sxc151355 				HAL_BOOL incTrigLevel);
8931000Sxc151355 	int	  (*ah_setupTxQueue) (struct ath_hal *, HAL_TX_QUEUE,
8941000Sxc151355 				const HAL_TXQ_INFO *qInfo);
8951000Sxc151355 	HAL_BOOL  (*ah_setTxQueueProps) (struct ath_hal *, int q,
8961000Sxc151355 				const HAL_TXQ_INFO *qInfo);
8971000Sxc151355 	HAL_BOOL  (*ah_getTxQueueProps)(struct ath_hal *, int q,
8981000Sxc151355 				HAL_TXQ_INFO *qInfo);
8991000Sxc151355 	HAL_BOOL  (*ah_releaseTxQueue) (struct ath_hal *ah, uint32_t q);
9001000Sxc151355 	HAL_BOOL  (*ah_resetTxQueue) (struct ath_hal *ah, uint32_t q);
9011000Sxc151355 	uint32_t (*ah_getTxDP) (struct ath_hal *, uint32_t);
9021000Sxc151355 	HAL_BOOL  (*ah_setTxDP) (struct ath_hal *, uint32_t, uint32_t txdp);
9031000Sxc151355 	uint32_t (*ah_numTxPending)(struct ath_hal *, uint32_t q);
9041000Sxc151355 	HAL_BOOL  (*ah_startTxDma) (struct ath_hal *, uint32_t);
9051000Sxc151355 	HAL_BOOL  (*ah_stopTxDma) (struct ath_hal *, uint32_t);
9061000Sxc151355 	HAL_BOOL  (*ah_setupTxDesc) (struct ath_hal *, struct ath_desc *,
9071000Sxc151355 				uint32_t pktLen, uint32_t hdrLen,
9081000Sxc151355 				HAL_PKT_TYPE type, uint32_t txPower,
9091000Sxc151355 				uint32_t txRate0, uint32_t txTries0,
9101000Sxc151355 				uint32_t keyIx, uint32_t antMode,
9111000Sxc151355 				uint32_t flags, uint32_t rtsctsRate,
9123147Sxc151355 				uint32_t rtsctsDuration,
9133147Sxc151355 				uint32_t compicvLen, uint32_t compivLen,
9143147Sxc151355 				uint32_t comp);
9151000Sxc151355 	HAL_BOOL  (*ah_setupXTxDesc) (struct ath_hal *, struct ath_desc *,
9161000Sxc151355 				uint32_t txRate1, uint32_t txTries1,
9171000Sxc151355 				uint32_t txRate2, uint32_t txTries2,
9181000Sxc151355 				uint32_t txRate3, uint32_t txTries3);
9191000Sxc151355 	HAL_BOOL  (*ah_fillTxDesc) (struct ath_hal *, struct ath_desc *,
9201000Sxc151355 				uint32_t segLen, HAL_BOOL firstSeg,
9211000Sxc151355 				HAL_BOOL lastSeg, const struct ath_desc *);
922*8033SWang.Lin@Sun.COM 	HAL_STATUS (*ah_procTxDesc)(struct ath_hal *, struct ath_desc *,
923*8033SWang.Lin@Sun.COM 				struct ath_tx_status *);
9241000Sxc151355 	void	   (*ah_getTxIntrQueue)(struct ath_hal *, uint32_t *);
9253147Sxc151355 	void	   (*ah_reqTxIntrDesc)(struct ath_hal *, struct ath_desc *);
9261000Sxc151355 
9271000Sxc151355 	/* Receive Functions */
9281000Sxc151355 	uint32_t (*ah_getRxDP) (struct ath_hal *);
9291000Sxc151355 	void	  (*ah_setRxDP) (struct ath_hal *, uint32_t rxdp);
9301000Sxc151355 	void	  (*ah_enableReceive) (struct ath_hal *);
9311000Sxc151355 	HAL_BOOL  (*ah_stopDmaReceive) (struct ath_hal *);
9321000Sxc151355 	void	  (*ah_startPcuReceive) (struct ath_hal *);
9331000Sxc151355 	void	  (*ah_stopPcuReceive) (struct ath_hal *);
9341000Sxc151355 	void	  (*ah_setMulticastFilter) (struct ath_hal *,
9351000Sxc151355 				uint32_t filter0, uint32_t filter1);
9361000Sxc151355 	HAL_BOOL  (*ah_setMulticastFilterIndex) (struct ath_hal *,
9371000Sxc151355 				uint32_t index);
9381000Sxc151355 	HAL_BOOL  (*ah_clrMulticastFilterIndex) (struct ath_hal *,
9391000Sxc151355 				uint32_t index);
9401000Sxc151355 	uint32_t (*ah_getRxFilter) (struct ath_hal *);
9411000Sxc151355 	void	  (*ah_setRxFilter) (struct ath_hal *, uint32_t);
9421000Sxc151355 	HAL_BOOL  (*ah_setupRxDesc) (struct ath_hal *, struct ath_desc *,
9431000Sxc151355 				uint32_t size, uint32_t flags);
9441000Sxc151355 	HAL_STATUS (*ah_procRxDesc) (struct ath_hal *, struct ath_desc *,
9453147Sxc151355 				uint32_t phyAddr, struct ath_desc *next,
946*8033SWang.Lin@Sun.COM 				uint64_t tsf, struct ath_rx_status *);
9471000Sxc151355 	void	  (*ah_rxMonitor) (struct ath_hal *,
9483147Sxc151355 				const HAL_NODE_STATS *, HAL_CHANNEL *);
9491000Sxc151355 	void	  (*ah_procMibEvent) (struct ath_hal *,
9501000Sxc151355 				const HAL_NODE_STATS *);
9511000Sxc151355 
9521000Sxc151355 	/* Misc Functions */
9531000Sxc151355 	HAL_STATUS  (*ah_getCapability) (struct ath_hal *,
9541000Sxc151355 				HAL_CAPABILITY_TYPE, uint32_t capability,
9551000Sxc151355 				uint32_t *result);
9561000Sxc151355 	HAL_BOOL    (*ah_setCapability) (struct ath_hal *,
9571000Sxc151355 				HAL_CAPABILITY_TYPE, uint32_t capability,
9581000Sxc151355 				uint32_t setting, HAL_STATUS *);
9591000Sxc151355 	HAL_BOOL    (*ah_getDiagState) (struct ath_hal *, int request,
9601000Sxc151355 				const void *args, uint32_t argsize,
9611000Sxc151355 				void **result, uint32_t *resultsize);
9621000Sxc151355 	void	  (*ah_getMacAddress) (struct ath_hal *, uint8_t *);
9631000Sxc151355 	HAL_BOOL  (*ah_setMacAddress) (struct ath_hal *, const uint8_t *);
9643147Sxc151355 	void	  (*ah_getBssIdMask)(struct ath_hal *, uint8_t *);
9653147Sxc151355 	HAL_BOOL  (*ah_setBssIdMask)(struct ath_hal *, const uint8_t *);
9661000Sxc151355 	HAL_BOOL  (*ah_setRegulatoryDomain) (struct ath_hal *,
9671000Sxc151355 				uint16_t, HAL_STATUS *);
9681000Sxc151355 	void	  (*ah_setLedState) (struct ath_hal *, HAL_LED_STATE);
9691000Sxc151355 	void	  (*ah_writeAssocid) (struct ath_hal *,
9701000Sxc151355 				const uint8_t *bssid, uint16_t assocId);
9711000Sxc151355 	HAL_BOOL  (*ah_gpioCfgOutput) (struct ath_hal *, uint32_t gpio);
9721000Sxc151355 	HAL_BOOL  (*ah_gpioCfgInput) (struct ath_hal *, uint32_t gpio);
9731000Sxc151355 	uint32_t (*ah_gpioGet) (struct ath_hal *, uint32_t gpio);
9741000Sxc151355 	HAL_BOOL  (*ah_gpioSet) (struct ath_hal *,
9751000Sxc151355 				uint32_t gpio, uint32_t val);
9761000Sxc151355 	void	  (*ah_gpioSetIntr) (struct ath_hal *, uint32_t, uint32_t);
9771000Sxc151355 	uint32_t (*ah_getTsf32) (struct ath_hal *);
9781000Sxc151355 	uint64_t (*ah_getTsf64) (struct ath_hal *);
9791000Sxc151355 	void	  (*ah_resetTsf) (struct ath_hal *);
9801000Sxc151355 	HAL_BOOL  (*ah_detectCardPresent) (struct ath_hal *);
9811000Sxc151355 	void	  (*ah_updateMibCounters) (struct ath_hal *, HAL_MIB_STATS *);
9821000Sxc151355 	HAL_RFGAIN (*ah_getRfGain) (struct ath_hal *);
9831000Sxc151355 	uint32_t  (*ah_getDefAntenna) (struct ath_hal *);
9841000Sxc151355 	void	  (*ah_setDefAntenna) (struct ath_hal *, uint32_t);
9853147Sxc151355 	HAL_ANT_SETTING (*ah_getAntennaSwitch) (struct ath_hal *);
9863147Sxc151355 	HAL_BOOL  (*ah_setAntennaSwitch) (struct ath_hal *, HAL_ANT_SETTING);
987*8033SWang.Lin@Sun.COM 	HAL_BOOL  (*ah_setSifsTime) (struct ath_hal *, uint32_t);
988*8033SWang.Lin@Sun.COM 	uint32_t  (*ah_getSifsTime) (struct ath_hal *);
9891000Sxc151355 	HAL_BOOL  (*ah_setSlotTime) (struct ath_hal *, uint32_t);
9901000Sxc151355 	uint32_t  (*ah_getSlotTime) (struct ath_hal *);
9911000Sxc151355 	HAL_BOOL  (*ah_setAckTimeout) (struct ath_hal *, uint32_t);
9921000Sxc151355 	uint32_t  (*ah_getAckTimeout) (struct ath_hal *);
9933147Sxc151355 	HAL_BOOL  (*ah_setAckCTSRate) (struct ath_hal *, uint32_t);
9943147Sxc151355 	uint32_t  (*ah_getAckCTSRate) (struct ath_hal *);
9951000Sxc151355 	HAL_BOOL  (*ah_setCTSTimeout) (struct ath_hal *, uint32_t);
9961000Sxc151355 	uint32_t  (*ah_getCTSTimeout) (struct ath_hal *);
9973147Sxc151355 	HAL_BOOL  (*ah_setDecompMask)(struct ath_hal *, uint16_t, int);
9983147Sxc151355 	void	  (*ah_setCoverageClass)(struct ath_hal *, uint8_t, int);
9991000Sxc151355 	/* Key Cache Functions */
10001000Sxc151355 	uint32_t (*ah_getKeyCacheSize) (struct ath_hal *);
10011000Sxc151355 	HAL_BOOL  (*ah_resetKeyCacheEntry) (struct ath_hal *, uint16_t);
10021000Sxc151355 	HAL_BOOL  (*ah_isKeyCacheEntryValid) (struct ath_hal *, uint16_t);
10031000Sxc151355 	HAL_BOOL  (*ah_setKeyCacheEntry) (struct ath_hal *,
10041000Sxc151355 				uint16_t, const HAL_KEYVAL *,
10051000Sxc151355 				const uint8_t *, int);
10061000Sxc151355 	HAL_BOOL  (*ah_setKeyCacheEntryMac) (struct ath_hal *,
10071000Sxc151355 				uint16_t, const uint8_t *);
10081000Sxc151355 
10091000Sxc151355 	/* Power Management Functions */
10101000Sxc151355 	HAL_BOOL  (*ah_setPowerMode) (struct ath_hal *,
10113147Sxc151355 				HAL_POWER_MODE mode, int setChip);
10121000Sxc151355 	HAL_POWER_MODE (*ah_getPowerMode) (struct ath_hal *);
10133147Sxc151355 	int16_t   (*ah_getChanNoise)(struct ath_hal *, HAL_CHANNEL *);
10141000Sxc151355 
10151000Sxc151355 	/* Beacon Management Functions */
10163147Sxc151355 	void	  (*ah_setBeaconTimers) (struct ath_hal *,
10173147Sxc151355 				const HAL_BEACON_TIMERS *);
10183147Sxc151355 	/* NB: deprecated, use ah_setBeaconTimers instead */
10191000Sxc151355 	void	  (*ah_beaconInit) (struct ath_hal *,
10201000Sxc151355 				uint32_t nexttbtt, uint32_t intval);
10211000Sxc151355 	void	  (*ah_setStationBeaconTimers) (struct ath_hal *,
10221000Sxc151355 				const HAL_BEACON_STATE *);
10231000Sxc151355 	void	  (*ah_resetStationBeaconTimers) (struct ath_hal *);
10241000Sxc151355 
10251000Sxc151355 	/* Interrupt functions */
10261000Sxc151355 	HAL_BOOL  (*ah_isInterruptPending) (struct ath_hal *);
10271000Sxc151355 	HAL_BOOL  (*ah_getPendingInterrupts) (struct ath_hal *, HAL_INT *);
10281000Sxc151355 	HAL_INT	  (*ah_getInterrupts) (struct ath_hal *);
10291000Sxc151355 	HAL_INT	  (*ah_setInterrupts) (struct ath_hal *, HAL_INT);
10301000Sxc151355 };
10311000Sxc151355 
10321000Sxc151355 /*
10331000Sxc151355  * Check the PCI vendor ID and device ID against Atheros' values
10341000Sxc151355  * and return a printable description for any Atheros hardware.
10351000Sxc151355  * AH_NULL is returned if the ID's do not describe Atheros hardware.
10361000Sxc151355  */
10371000Sxc151355 extern	const char *ath_hal_probe(uint16_t vendorid, uint16_t devid);
10381000Sxc151355 
10391000Sxc151355 /*
10401000Sxc151355  * Attach the HAL for use with the specified device.  The device is
10411000Sxc151355  * defined by the PCI device ID.  The caller provides an opaque pointer
10421000Sxc151355  * to an upper-layer data structure (HAL_SOFTC) that is stored in the
10431000Sxc151355  * HAL state block for later use.  Hardware register accesses are done
10441000Sxc151355  * using the specified bus tag and handle.  On successful return a
10451000Sxc151355  * reference to a state block is returned that must be supplied in all
10461000Sxc151355  * subsequent HAL calls.  Storage associated with this reference is
10471000Sxc151355  * dynamically allocated and must be freed by calling the ah_detach
10481000Sxc151355  * method when the client is done.  If the attach operation fails a
10491000Sxc151355  * null (AH_NULL) reference will be returned and a status code will
10501000Sxc151355  * be returned if the status parameter is non-zero.
10511000Sxc151355  */
10521000Sxc151355 extern	struct ath_hal *ath_hal_attach(uint16_t devid, HAL_SOFTC,
10531000Sxc151355 		HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS *status);
10541000Sxc151355 
10551000Sxc151355 /*
10563147Sxc151355  * Set the Vendor ID for Vendor SKU's which can modify the
10573147Sxc151355  * channel properties returned by ath_hal_init_channels.
10583147Sxc151355  * Return AH_TRUE if set succeeds
10593147Sxc151355  */
10603147Sxc151355 extern  HAL_BOOL ath_hal_setvendor(struct ath_hal *, uint32_t);
10613147Sxc151355 
10623147Sxc151355 /*
10631000Sxc151355  * Return a list of channels available for use with the hardware.
10641000Sxc151355  * The list is based on what the hardware is capable of, the specified
10651000Sxc151355  * country code, the modeSelect mask, and whether or not outdoor
10661000Sxc151355  * channels are to be permitted.
10671000Sxc151355  *
10681000Sxc151355  * The channel list is returned in the supplied array.  maxchans
10691000Sxc151355  * defines the maximum size of this array.  nchans contains the actual
10701000Sxc151355  * number of channels returned.  If a problem occurred or there were
10711000Sxc151355  * no channels that met the criteria then AH_FALSE is returned.
10721000Sxc151355  */
10731000Sxc151355 extern	HAL_BOOL  ath_hal_init_channels(struct ath_hal *,
10741000Sxc151355 		HAL_CHANNEL *chans, uint32_t maxchans, uint32_t *nchans,
10753147Sxc151355 		uint8_t *regclassids, uint32_t maxregids, uint32_t *nregids,
1076*8033SWang.Lin@Sun.COM 		HAL_CTRY_CODE cc, uint_t modeSelect,
10771000Sxc151355 		HAL_BOOL enableOutdoor, HAL_BOOL enableExtendedChannels);
10781000Sxc151355 
10791000Sxc151355 /*
10803147Sxc151355  * Calibrate noise floor data following a channel scan or similar.
10813147Sxc151355  *  This must be called prior retrieving noise floor data.
10823147Sxc151355  */
10833147Sxc151355 extern void ath_hal_process_noisefloor(struct ath_hal *ah);
10843147Sxc151355 
10853147Sxc151355 /*
10861000Sxc151355  * Return bit mask of wireless modes supported by the hardware.
10871000Sxc151355  */
10881000Sxc151355 extern	uint32_t  ath_hal_getwirelessmodes(struct ath_hal *, HAL_CTRY_CODE);
10891000Sxc151355 
10901000Sxc151355 /*
10911000Sxc151355  * Calculate the transmit duration of a frame.
10921000Sxc151355  */
10931000Sxc151355 extern uint16_t  ath_hal_computetxtime(struct ath_hal *,
10941000Sxc151355 		const HAL_RATE_TABLE *rates, uint32_t frameLen,
10951000Sxc151355 		uint16_t rateix, HAL_BOOL shortPreamble);
10961000Sxc151355 
10971000Sxc151355 /*
10983147Sxc151355  * Return if device is public safety.
10993147Sxc151355  */
11003147Sxc151355 extern HAL_BOOL ath_hal_ispublicsafetysku(struct ath_hal *);
11013147Sxc151355 
11023147Sxc151355 /*
1103*8033SWang.Lin@Sun.COM  * Return if device is operating in 900 MHz band.
1104*8033SWang.Lin@Sun.COM  */
1105*8033SWang.Lin@Sun.COM extern HAL_BOOL ath_hal_isgsmsku(struct ath_hal *);
1106*8033SWang.Lin@Sun.COM 
1107*8033SWang.Lin@Sun.COM /*
11081000Sxc151355  * Convert between IEEE channel number and channel frequency
11091000Sxc151355  * using the specified channel flags; e.g. CHANNEL_2GHZ.
11101000Sxc151355  */
11113147Sxc151355 extern	int  ath_hal_mhz2ieee(struct ath_hal *, uint32_t mhz, uint32_t flags);
11121000Sxc151355 
11131000Sxc151355 /*
11141000Sxc151355  * Return a version string for the HAL release.
11151000Sxc151355  */
11161000Sxc151355 extern	char ath_hal_version[];
11171000Sxc151355 
11181000Sxc151355 /*
11191000Sxc151355  * Return a NULL-terminated array of build/configuration options.
11201000Sxc151355  */
11211000Sxc151355 extern	const char *ath_hal_buildopts[];
11221000Sxc151355 
11231000Sxc151355 /*
11241000Sxc151355  * Macros to encapsulated HAL functions.
11251000Sxc151355  */
11261000Sxc151355 #define	ATH_HAL_RESET(_ah, _opmode, _chan, _outdoor, _pstatus) \
11271000Sxc151355 	((*(_ah)->ah_reset)((_ah), (_opmode), (_chan), (_outdoor), (_pstatus)))
11283147Sxc151355 #define	ATH_HAL_PHYDISABLE(_ah)	\
11293147Sxc151355 	((*(_ah)->ah_phyDisable)((_ah)))
11301000Sxc151355 #define	ATH_HAL_GETCAPABILITY(_ah, _cap, _param, _result) \
11311000Sxc151355 	((*(_ah)->ah_getCapability)((_ah), (_cap), (_param), (_result)))
11323147Sxc151355 #define	ATH_HAL_SETCAPABILITY(_ah, _type, _cap, _param, _status) \
1133*8033SWang.Lin@Sun.COM 	((*(_ah)->ah_setCapability)((_ah), (_type), (_cap), (_param), \
1134*8033SWang.Lin@Sun.COM 	(_status)))
11351000Sxc151355 #define	ATH_HAL_GETREGDOMAIN(_ah, _prd) \
11361000Sxc151355 	ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_REG_DMN, 0, (_prd))
11371000Sxc151355 #define	ATH_HAL_GETCOUNTRYCODE(_ah, _pcc) \
11381000Sxc151355 	(*(_pcc) = (_ah)->ah_countryCode)
11391000Sxc151355 #define	ATH_HAL_GETRATETABLE(_ah, _mode) \
11401000Sxc151355 	((*(_ah)->ah_getRateTable)((_ah), (_mode)))
11411000Sxc151355 #define	ATH_HAL_GETMAC(_ah, _mac) \
11421000Sxc151355 	((*(_ah)->ah_getMacAddress)((_ah), (_mac)))
11431000Sxc151355 #define	ATH_HAL_SETMAC(_ah, _mac) \
11441000Sxc151355 	((*(_ah)->ah_setMacAddress)((_ah), (_mac)))
11451000Sxc151355 #define	ATH_HAL_INTRSET(_ah, _mask) \
11461000Sxc151355 	((*(_ah)->ah_setInterrupts)((_ah), (_mask)))
11471000Sxc151355 #define	ATH_HAL_INTRGET(_ah) \
11481000Sxc151355 	((*(_ah)->ah_getInterrupts)((_ah)))
11491000Sxc151355 #define	ATH_HAL_INTRPEND(_ah) \
11501000Sxc151355 	((*(_ah)->ah_isInterruptPending)((_ah)))
11511000Sxc151355 #define	ATH_HAL_GETISR(_ah, _pmask) \
11521000Sxc151355 	((*(_ah)->ah_getPendingInterrupts)((_ah), (_pmask)))
11531000Sxc151355 #define	ATH_HAL_UPDATETXTRIGLEVEL(_ah, _inc) \
11541000Sxc151355 	((*(_ah)->ah_updateTxTrigLevel)((_ah), (_inc)))
11553147Sxc151355 #define	ATH_HAL_SETPOWER(_ah, _mode) \
11563147Sxc151355 	((*(_ah)->ah_setPowerMode)((_ah), (_mode), AH_TRUE))
11571000Sxc151355 #define	ATH_HAL_KEYRESET(_ah, _ix) \
11581000Sxc151355 	((*(_ah)->ah_resetKeyCacheEntry)((_ah), (_ix)))
11593147Sxc151355 #define	ATH_HAL_KEYSET(_ah, _ix, _pk, _mac) \
11603147Sxc151355 	((*(_ah)->ah_setKeyCacheEntry)((_ah), (_ix), (_pk), (_mac), AH_FALSE))
11611000Sxc151355 #define	ATH_HAL_KEYISVALID(_ah, _ix) \
11621000Sxc151355 	(((*(_ah)->ah_isKeyCacheEntryValid)((_ah), (_ix))))
11631000Sxc151355 #define	ATH_HAL_KEYSETMAC(_ah, _ix, _mac) \
11641000Sxc151355 	((*(_ah)->ah_setKeyCacheEntryMac)((_ah), (_ix), (_mac)))
11651000Sxc151355 #define	ATH_HAL_KEYCACHESIZE(_ah) \
11661000Sxc151355 	((*(_ah)->ah_getKeyCacheSize)((_ah)))
11671000Sxc151355 #define	ATH_HAL_GETRXFILTER(_ah) \
11681000Sxc151355 	((*(_ah)->ah_getRxFilter)((_ah)))
11691000Sxc151355 #define	ATH_HAL_SETRXFILTER(_ah, _filter) \
11701000Sxc151355 	((*(_ah)->ah_setRxFilter)((_ah), (_filter)))
11711000Sxc151355 #define	ATH_HAL_SETMCASTFILTER(_ah, _mfilt0, _mfilt1) \
11721000Sxc151355 	((*(_ah)->ah_setMulticastFilter)((_ah), (_mfilt0), (_mfilt1)))
11731000Sxc151355 #define	ATH_HAL_WAITFORBEACON(_ah, _bf) \
11741000Sxc151355 	((*(_ah)->ah_waitForBeaconDone)((_ah), (_bf)->bf_daddr))
11751000Sxc151355 #define	ATH_HAL_PUTRXBUF(_ah, _bufaddr) \
11761000Sxc151355 	((*(_ah)->ah_setRxDP)((_ah), (_bufaddr)))
11771000Sxc151355 #define	ATH_HAL_GETTSF32(_ah) \
11781000Sxc151355 	((*(_ah)->ah_getTsf32)((_ah)))
11791000Sxc151355 #define	ATH_HAL_GETTSF64(_ah) \
11801000Sxc151355 	((*(_ah)->ah_getTsf64)((_ah)))
11811000Sxc151355 #define	ATH_HAL_RESETTSF(_ah) \
11821000Sxc151355 	((*(_ah)->ah_resetTsf)((_ah)))
11831000Sxc151355 #define	ATH_HAL_RXENA(_ah) \
11841000Sxc151355 	((*(_ah)->ah_enableReceive)((_ah)))
11851000Sxc151355 #define	ATH_HAL_PUTTXBUF(_ah, _q, _bufaddr) \
11861000Sxc151355 	((*(_ah)->ah_setTxDP)((_ah), (_q), (_bufaddr)))
11871000Sxc151355 #define	ATH_HAL_GETTXBUF(_ah, _q) \
11881000Sxc151355 	((*(_ah)->ah_getTxDP)((_ah), (_q)))
11891000Sxc151355 #define	ATH_HAL_GETRXBUF(_ah) \
11901000Sxc151355 	((*(_ah)->ah_getRxDP)((_ah)))
11911000Sxc151355 #define	ATH_HAL_TXSTART(_ah, _q) \
11921000Sxc151355 	((*(_ah)->ah_startTxDma)((_ah), (_q)))
11931000Sxc151355 #define	ATH_HAL_SETCHANNEL(_ah, _chan) \
11941000Sxc151355 	((*(_ah)->ah_setChannel)((_ah), (_chan)))
11953147Sxc151355 #define	ATH_HAL_CALIBRATE(_ah, _chan, _iqcal) \
11963147Sxc151355 	((*(_ah)->ah_perCalibration)((_ah), (_chan), (_iqcal)))
11971000Sxc151355 #define	ATH_HAL_SETLEDSTATE(_ah, _state) \
11981000Sxc151355 	((*(_ah)->ah_setLedState)((_ah), (_state)))
11991000Sxc151355 #define	ATH_HAL_BEACONINIT(_ah, _nextb, _bperiod) \
12001000Sxc151355 	((*(_ah)->ah_beaconInit)((_ah), (_nextb), (_bperiod)))
12011000Sxc151355 #define	ATH_HAL_BEACONRESET(_ah) \
12021000Sxc151355 	((*(_ah)->ah_resetStationBeaconTimers)((_ah)))
12031000Sxc151355 #define	ATH_HAL_BEACONTIMERS(_ah, _beacon_state) \
12041000Sxc151355 	((*(_ah)->ah_setStationBeaconTimers)((_ah), (_beacon_state)))
12051000Sxc151355 #define	ATH_HAL_SETASSOCID(_ah, _bss, _associd) \
12061000Sxc151355 	((*(_ah)->ah_writeAssocid)((_ah), (_bss), (_associd)))
12071000Sxc151355 #define	ATH_HAL_SETOPMODE(_ah) \
12081000Sxc151355 	((*(_ah)->ah_setPCUConfig)((_ah)))
12091000Sxc151355 #define	ATH_HAL_STOPTXDMA(_ah, _qnum) \
12101000Sxc151355 	((*(_ah)->ah_stopTxDma)((_ah), (_qnum)))
12111000Sxc151355 #define	ATH_HAL_STOPPCURECV(_ah) \
12121000Sxc151355 	((*(_ah)->ah_stopPcuReceive)((_ah)))
12131000Sxc151355 #define	ATH_HAL_STARTPCURECV(_ah) \
12141000Sxc151355 	((*(_ah)->ah_startPcuReceive)((_ah)))
12151000Sxc151355 #define	ATH_HAL_STOPDMARECV(_ah) \
12161000Sxc151355 	((*(_ah)->ah_stopDmaReceive)((_ah)))
12171000Sxc151355 #define	ATH_HAL_DUMPSTATE(_ah) \
12181000Sxc151355 	((*(_ah)->ah_dumpState)((_ah)))
12191000Sxc151355 #define	ATH_HAL_DUMPEEPROM(_ah) \
12201000Sxc151355 	((*(_ah)->ah_dumpEeprom)((_ah)))
12211000Sxc151355 #define	ATH_HAL_DUMPRFGAIN(_ah) \
12221000Sxc151355 	((*(_ah)->ah_dumpRfGain)((_ah)))
12231000Sxc151355 #define	ATH_HAL_DUMPANI(_ah) \
12241000Sxc151355 	((*(_ah)->ah_dumpAni)((_ah)))
12251000Sxc151355 #define	ATH_HAL_SETUPTXQUEUE(_ah, _type, _irq) \
12261000Sxc151355 	((*(_ah)->ah_setupTxQueue)((_ah), (_type), (_irq)))
12271000Sxc151355 #define	ATH_HAL_RESETTXQUEUE(_ah, _q) \
12281000Sxc151355 	((*(_ah)->ah_resetTxQueue)((_ah), (_q)))
12291000Sxc151355 #define	ATH_HAL_RELEASETXQUEUE(_ah, _q) \
12301000Sxc151355 	((*(_ah)->ah_releaseTxQueue)((_ah), (_q)))
1231*8033SWang.Lin@Sun.COM #define	ATH_HAL_GETTXQUEUEPROPS(_ah, _q, _qi) \
1232*8033SWang.Lin@Sun.COM 	((*(_ah)->ah_getTxQueueProps)((_ah), (_q), (_qi)))
1233*8033SWang.Lin@Sun.COM #define	ATH_HAL_SETTXQUEUEPROPS(_ah, _q, _qi) \
1234*8033SWang.Lin@Sun.COM 	((*(_ah)->ah_setTxQueueProps)((_ah), (_q), (_qi)))
1235*8033SWang.Lin@Sun.COM #define	ATH_HAL_HASVEOL(_ah) \
1236*8033SWang.Lin@Sun.COM 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_VEOL, 0, NULL) == HAL_OK)
12371000Sxc151355 #define	ATH_HAL_GETRFGAIN(_ah) \
12381000Sxc151355 	((*(_ah)->ah_getRfGain)((_ah)))
12393147Sxc151355 #define	ATH_HAL_RXMONITOR(_ah, _arg, _chan) \
12403147Sxc151355 	((*(_ah)->ah_rxMonitor)((_ah), (_arg), (_chan)))
12413147Sxc151355 #define	ATH_HAL_SETSLOTTIME(_ah, _us) \
12423147Sxc151355 	((*(_ah)->ah_setSlotTime)((_ah), (_us)))
12431000Sxc151355 #define	ATH_HAL_SETUPBEACONDESC(_ah, _ds, _opmode, _flen, _hlen, \
12441000Sxc151355 		_rate, _antmode) \
12451000Sxc151355 	((*(_ah)->ah_setupBeaconDesc)((_ah), (_ds), (_opmode), \
12461000Sxc151355 		(_flen), (_hlen), (_rate), (_antmode)))
12471000Sxc151355 #define	ATH_HAL_SETUPRXDESC(_ah, _ds, _size, _intreq) \
12481000Sxc151355 	((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq)))
1249*8033SWang.Lin@Sun.COM #define	ATH_HAL_RXPROCDESC(_ah, _ds, _dspa, _dsnext, _rs) \
1250*8033SWang.Lin@Sun.COM 	((*(_ah)->ah_procRxDesc)((_ah), (_ds), (_dspa), (_dsnext), 0, (_rs)))
12511000Sxc151355 #define	ATH_HAL_SETUPTXDESC(_ah, _ds, _plen, _hlen, _atype, _txpow, \
12521000Sxc151355 		_txr0, _txtr0, _keyix, _ant, _flags, \
12531000Sxc151355 		_rtsrate, _rtsdura) \
12541000Sxc151355 	((*(_ah)->ah_setupTxDesc)((_ah), (_ds), (_plen), (_hlen), (_atype), \
12551000Sxc151355 		(_txpow), (_txr0), (_txtr0), (_keyix), (_ant), \
12563147Sxc151355 		(_flags), (_rtsrate), (_rtsdura), 0, 0, 0))
12571000Sxc151355 #define	ATH_HAL_SETUPXTXDESC(_ah, _ds, \
12581000Sxc151355 		_txr1, _txtr1, _txr2, _txtr2, _txr3, _txtr3) \
12591000Sxc151355 	((*(_ah)->ah_setupXTxDesc)((_ah), (_ds), \
12601000Sxc151355 		(_txr1), (_txtr1), (_txr2), (_txtr2), (_txr3), (_txtr3)))
12611000Sxc151355 #define	ATH_HAL_FILLTXDESC(_ah, _ds, _l, _first, _last, _ath_desc) \
12621000Sxc151355 	((*(_ah)->ah_fillTxDesc)((_ah), (_ds), (_l), (_first), (_last), \
12631000Sxc151355 	(_ath_desc)))
1264*8033SWang.Lin@Sun.COM #define	ATH_HAL_TXPROCDESC(_ah, _ds, _ts) \
1265*8033SWang.Lin@Sun.COM 	((*(_ah)->ah_procTxDesc)((_ah), (_ds), (_ts)))
12661000Sxc151355 #define	ATH_HAL_CIPHERSUPPORTED(_ah, _cipher) \
12671000Sxc151355 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_CIPHER, _cipher, NULL) == HAL_OK)
1268*8033SWang.Lin@Sun.COM #define	ATH_HAL_HASTKIPSPLIT(_ah) \
12691000Sxc151355 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_TKIP_SPLIT, 0, NULL) == HAL_OK)
1270*8033SWang.Lin@Sun.COM #define	ATH_HAL_GETTKIPSPLIT(_ah) \
1271*8033SWang.Lin@Sun.COM 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_TKIP_SPLIT, 1, NULL) == HAL_OK)
1272*8033SWang.Lin@Sun.COM #define	ATH_HAL_SETTKIPSPLIT(_ah, _v) \
1273*8033SWang.Lin@Sun.COM 	(ATH_HAL_SETCAPABILITY(_ah, HAL_CAP_TKIP_SPLIT, 1, _v, NULL))
12743147Sxc151355 #define	ATH_HAL_HASRFSILENT(ah) \
12753147Sxc151355 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_RFSILENT, 0, NULL) == HAL_OK)
12763147Sxc151355 #define	ATH_HAL_GETRFKILL(_ah) \
12773147Sxc151355 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_RFSILENT, 1, NULL) == HAL_OK)
12783147Sxc151355 #define	ATH_HAL_SETRFKILL(_ah, _onoff) \
12793147Sxc151355 	(ATH_HAL_SETCAPABILITY(_ah, HAL_CAP_RFSILENT, 1, _onoff, NULL))
12803147Sxc151355 #define	ATH_HAL_GETRFSILENT(_ah, _prfsilent) \
12813147Sxc151355 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_RFSILENT, 2, _prfsilent) == HAL_OK)
12823147Sxc151355 #define	ATH_HAL_SETRFSILENT(_ah, _rfsilent) \
12833147Sxc151355 	(ATH_HAL_SETCAPABILITY(_ah, HAL_CAP_RFSILENT, 2, _rfsilent, NULL))
12843147Sxc151355 
12853147Sxc151355 #if HAL_ABI_VERSION < 0x05120700
12863147Sxc151355 #define	ATH_HAL_PROCESS_NOISEFLOOR(_ah)
12873147Sxc151355 #define	ATH_HAL_GETCHANNOISE(_ah, _c)	(-96)
12883147Sxc151355 #define	HAL_CAP_TPC_ACK	100
12893147Sxc151355 #define	HAL_CAP_TPC_CTS	101
12903147Sxc151355 #else
12913147Sxc151355 #define	ATH_HAL_GETCHANNOISE(_ah, _c)	\
12923147Sxc151355 	((*(_ah)->ah_getChanNoise)((_ah), (_c)))
12933147Sxc151355 #endif
12943147Sxc151355 
12953147Sxc151355 #if HAL_ABI_VERSION < 0x05122200
12963147Sxc151355 #define	HAL_TXQ_TXOKINT_ENABLE	TXQ_FLAG_TXOKINT_ENABLE
12973147Sxc151355 #define	HAL_TXQ_TXERRINT_ENABLE	TXQ_FLAG_TXERRINT_ENABLE
12983147Sxc151355 #define	HAL_TXQ_TXDESCINT_ENABLE	TXQ_FLAG_TXDESCINT_ENABLE
12993147Sxc151355 #define	HAL_TXQ_TXEOLINT_ENABLE	TXQ_FLAG_TXEOLINT_ENABLE
13003147Sxc151355 #define	HAL_TXQ_TXURNINT_ENABLE	TXQ_FLAG_TXURNINT_ENABLE
13013147Sxc151355 #endif
13021000Sxc151355 
13031000Sxc151355 #ifdef __cplusplus
13041000Sxc151355 }
13051000Sxc151355 #endif
13061000Sxc151355 
13071000Sxc151355 #endif /* _ATH_HAL_H */
1308