xref: /illumos-gate/usr/src/uts/common/io/ath/ath_hal.h (revision 129d67ac)
17a1306a7Sxc /*
2*129d67acSlin wang - Sun Microsystems - Beijing China  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting, Atheros
37a1306a7Sxc  * Communications, Inc.  All rights reserved.
47a1306a7Sxc  *
57a1306a7Sxc  * Use is subject to license terms.
67a1306a7Sxc  *
77a1306a7Sxc  * Redistribution and use in source and binary forms are permitted
87a1306a7Sxc  * provided that the following conditions are met:
97a1306a7Sxc  * 1. The materials contained herein are unmodified and are used
107a1306a7Sxc  * unmodified.
117a1306a7Sxc  * 2. Redistributions of source code must retain the above copyright
127a1306a7Sxc  * notice, this list of conditions and the following NO
137a1306a7Sxc  * ''WARRANTY'' disclaimer below (''Disclaimer''), without
147a1306a7Sxc  * modification.
157a1306a7Sxc  * 3. Redistributions in binary form must reproduce at minimum a
167a1306a7Sxc  * disclaimer similar to the Disclaimer below and any redistribution
177a1306a7Sxc  * must be conditioned upon including a substantially similar
187a1306a7Sxc  * Disclaimer requirement for further binary redistribution.
197a1306a7Sxc  * 4. Neither the names of the above-listed copyright holders nor the
207a1306a7Sxc  * names of any contributors may be used to endorse or promote
217a1306a7Sxc  * product derived from this software without specific prior written
227a1306a7Sxc  * permission.
237a1306a7Sxc  *
247a1306a7Sxc  * NO WARRANTY
257a1306a7Sxc  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
267a1306a7Sxc  * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
277a1306a7Sxc  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
287a1306a7Sxc  * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
297a1306a7Sxc  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
307a1306a7Sxc  * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
317a1306a7Sxc  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
327a1306a7Sxc  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
337a1306a7Sxc  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
347a1306a7Sxc  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
357a1306a7Sxc  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
367a1306a7Sxc  * SUCH DAMAGES.
377a1306a7Sxc  *
387a1306a7Sxc  */
397a1306a7Sxc 
407a1306a7Sxc #ifndef _ATH_HAL_H
417a1306a7Sxc #define	_ATH_HAL_H
427a1306a7Sxc 
437a1306a7Sxc /*
447a1306a7Sxc  * ath_hal.h is released by Atheros and used to describe the Atheros
457a1306a7Sxc  * Hardware Access Layer(HAL) interface. All kinds of data structures,
467a1306a7Sxc  * constant definition, APIs declaration are defined here.Clients of
477a1306a7Sxc  * the HAL call ath_hal_attach() to obtain a reference to an ath_hal
487a1306a7Sxc  * structure for use with the device. Hardware-related operations that
497a1306a7Sxc  * follow must call back into the HAL through interface, supplying the
507a1306a7Sxc  * reference as the first parameter.
517a1306a7Sxc  */
527a1306a7Sxc 
537a1306a7Sxc #ifdef __cplusplus
547a1306a7Sxc extern "C" {
557a1306a7Sxc #endif
567a1306a7Sxc 
577a1306a7Sxc /* HAL version of this release */
58*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_ABI_VERSION	0x08052700	/* YYMMDDnn */
597a1306a7Sxc 
607a1306a7Sxc /* HAL data type definition */
610ba2cbe9Sxc typedef void *		HAL_SOFTC;	/* pointer to driver/OS state */
620ba2cbe9Sxc typedef void *		HAL_BUS_TAG;	/* opaque bus i/o id tag */
630ba2cbe9Sxc typedef void *		HAL_BUS_HANDLE;	/* opaque bus i/o handle */
647a1306a7Sxc typedef uint32_t 	HAL_BUS_ADDR;
657a1306a7Sxc typedef uint16_t 	HAL_CTRY_CODE;	/* country code */
667a1306a7Sxc typedef uint16_t 	HAL_REG_DOMAIN;	/* regulatory domain code */
677a1306a7Sxc 
687a1306a7Sxc #define	HAL_NUM_TX_QUEUES	10		/* max number of tx queues */
697a1306a7Sxc 
707a1306a7Sxc #define	HAL_BEACON_PERIOD	0x0000ffff	/* beacon interval period */
717a1306a7Sxc #define	HAL_BEACON_ENA		0x00800000	/* beacon xmit enable */
727a1306a7Sxc #define	HAL_BEACON_RESET_TSF	0x01000000	/* clear TSF */
737a1306a7Sxc 
74*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_RAD_INT	0x00001	/* Radar interference detected on channel */
75*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_CW_INT	0x00002	/* CW interference detected on channel */
76*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_BUSY	0x00004	/* Busy, occupied or overlap with adjoin chan */
77*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_TURBO	0x00010	/* Turbo Channel */
78*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_CCK	0x00020	/* CCK channel */
79*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_OFDM	0x00040	/* OFDM channel */
80*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_2GHZ	0x00080	/* 2 GHz spectrum channel. */
81*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_5GHZ	0x00100	/* 5 GHz spectrum channel */
82*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_PASSIVE	0x00200	/* Only passive scan allowed in the channel */
83*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_DYN	0x00400	/* dynamic CCK-OFDM channel */
84*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_XR	0x00800	/* XR channel */
85*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_STURBO	0x02000	/* Static turbo, no 11a-only usage */
86*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_HALF	0x04000 /* Half rate channel */
87*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_QUARTER	0x08000 /* Quarter rate channel */
88*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_HT20	0x10000	/* 11n 20MHZ channel */
89*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_HT40PLUS	0x20000	/* 11n 40MHZ chan w/ ext chan above */
90*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_HT40MINUS	0x40000	/* 11n 40MHZ chan w/ ext chan below */
917a1306a7Sxc 
927a1306a7Sxc #define	CHANNEL_A	(CHANNEL_5GHZ|CHANNEL_OFDM)
937a1306a7Sxc #define	CHANNEL_B	(CHANNEL_2GHZ|CHANNEL_CCK)
947a1306a7Sxc #define	CHANNEL_PUREG	(CHANNEL_2GHZ|CHANNEL_OFDM)
957a1306a7Sxc #define	CHANNEL_G	(CHANNEL_2GHZ|CHANNEL_OFDM)
967a1306a7Sxc #define	CHANNEL_T	(CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
970ba2cbe9Sxc #define	CHANNEL_ST	(CHANNEL_T|CHANNEL_STURBO)
987a1306a7Sxc #define	CHANNEL_108G	(CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
990ba2cbe9Sxc #define	CHANNEL_108A	CHANNEL_T
1007a1306a7Sxc #define	CHANNEL_X	(CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_XR)
101*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_G_HT20	(CHANNEL_G|CHANNEL_HT20)
102*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_A_HT20	(CHANNEL_A|CHANNEL_HT20)
103*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_G_HT40PLUS	(CHANNEL_G_HT20|CHANNEL_HT40PLUS)
104*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_A_HT40PLUS	(CHANNEL_A_HT20|CHANNEL_HT40PLUS)
105*129d67acSlin wang - Sun Microsystems - Beijing China #define	CHANNEL_A_HT40MINUS	(CHANNEL_A_HT20|CHANNEL_HT40MINUS)
1067a1306a7Sxc #define	CHANNEL_ALL \
107*129d67acSlin wang - Sun Microsystems - Beijing China 	(CHANNEL_OFDM|CHANNEL_CCK|CHANNEL_5GHZ|CHANNEL_2GHZ| \
108*129d67acSlin wang - Sun Microsystems - Beijing China 	CHANNEL_TURBO|CHANNEL_HT20|CHANNEL_HT40PLUS|CHANNEL_HT40MINUS)
1097a1306a7Sxc #define	CHANNEL_ALL_NOTURBO 	(CHANNEL_ALL &~ CHANNEL_TURBO)
1107a1306a7Sxc 
1110ba2cbe9Sxc #define	CHANNEL_COMPAT	(CHANNEL_ALL_NOTURBO | CHANNEL_PASSIVE)
1120ba2cbe9Sxc 
1130ba2cbe9Sxc /* privFlags */
1140ba2cbe9Sxc /*
1150ba2cbe9Sxc  * Software use: channel interference used for AR as well as RADAR
1160ba2cbe9Sxc  * interference detection
1170ba2cbe9Sxc  */
1180ba2cbe9Sxc #define	CHANNEL_INTERFERENCE	0x01
1190ba2cbe9Sxc #define	CHANNEL_DFS		0x02	/* DFS required on channel */
1200ba2cbe9Sxc #define	CHANNEL_4MS_LIMIT	0x04	/* 4msec packet limit on this channel */
1210ba2cbe9Sxc #define	CHANNEL_DFS_CLEAR	0x08	/* if channel has been checked DFS */
1220ba2cbe9Sxc 
1237a1306a7Sxc #define	HAL_RSSI_EP_MULTIPLIER	(1<<7)	/* pow2 to optimize out * and / */
1247a1306a7Sxc 
1257a1306a7Sxc /* flags passed to tx descriptor setup methods */
1267a1306a7Sxc #define	HAL_TXDESC_CLRDMASK	0x0001	/* clear destination filter mask */
1277a1306a7Sxc #define	HAL_TXDESC_NOACK	0x0002	/* don't wait for ACK */
1287a1306a7Sxc #define	HAL_TXDESC_RTSENA	0x0004	/* enable RTS */
1297a1306a7Sxc #define	HAL_TXDESC_CTSENA	0x0008	/* enable CTS */
1307a1306a7Sxc #define	HAL_TXDESC_INTREQ	0x0010	/* enable per-descriptor interrupt */
1317a1306a7Sxc #define	HAL_TXDESC_VEOL		0x0020	/* mark virtual EOL */
1320ba2cbe9Sxc /* NB: this only affects frame, not any RTS/CTS */
1330ba2cbe9Sxc #define	HAL_TXDESC_DURENA	0x0040	/* enable h/w write of duration field */
134*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_TXDESC_EXT_ONLY	0x0080	/* send on ext channel only (11n) */
135*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_TXDESC_EXT_AND_CTL	0x0100	/* send on ext + ctl channels (11n) */
136*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_TXDESC_VMF		0x0200	/* virtual more frag */
1377a1306a7Sxc 
1387a1306a7Sxc /* flags passed to rx descriptor setup methods */
1397a1306a7Sxc #define	HAL_RXDESC_INTREQ	0x0020	/* enable per-descriptor interrupt */
1407a1306a7Sxc 
1417a1306a7Sxc /* tx error flags */
1427a1306a7Sxc #define	HAL_TXERR_XRETRY	0x01	/* excessive retries */
1437a1306a7Sxc #define	HAL_TXERR_FILT		0x02	/* blocked by tx filtering */
1447a1306a7Sxc #define	HAL_TXERR_FIFO		0x04	/* fifo underrun */
145*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_TXERR_XTXOP		0x08	/* txop exceeded */
146*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_TXERR_DESC_CFG_ERR	0x10	/* Error in 20/40 desc config */
147*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_TXERR_DATA_UNDERRUN	0x20	/* Tx buffer underrun */
148*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_TXERR_DELIM_UNDERRUN 0x40	/* Tx delimiter underrun */
1497a1306a7Sxc #define	HAL_TXSTAT_ALTRATE	0x80	/* alternate xmit rate used */
1507a1306a7Sxc 
151*129d67acSlin wang - Sun Microsystems - Beijing China /* bits found in ts_flags */
152*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_TX_BA		0x01	/* Block Ack seen */
153*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_TX_AGGR		0x02	/* Aggregate */
154*129d67acSlin wang - Sun Microsystems - Beijing China 
1557a1306a7Sxc /* rx error flags */
1567a1306a7Sxc #define	HAL_RXERR_CRC		0x01	/* CRC error on frame */
1577a1306a7Sxc #define	HAL_RXERR_PHY		0x02	/* PHY error, rs_phyerr is valid */
1587a1306a7Sxc #define	HAL_RXERR_FIFO		0x04	/* fifo overrun */
1597a1306a7Sxc #define	HAL_RXERR_DECRYPT	0x08	/* non-Michael decrypt error */
1607a1306a7Sxc #define	HAL_RXERR_MIC		0x10	/* Michael MIC decrypt error */
1617a1306a7Sxc 
162*129d67acSlin wang - Sun Microsystems - Beijing China /* bits found in rs_flags */
163*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RX_MORE		0x01	/* more descriptors follow */
164*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RX_MORE_AGGR	0x02	/* more frames in aggr */
165*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RX_GI		0x04	/* full gi */
166*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RX_2040		0x08	/* 40 Mhz */
167*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RX_DELIM_CRC_PRE	0x10	/* crc error in delimiter pre */
168*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RX_DELIM_CRC_POST	0x20	/* crc error in delim after */
169*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RX_DECRYPT_BUSY	0x40	/* decrypt was too slow */
170*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RX_DUP_FRAME	0x80	/* Dup frame rx'd on control channel */
171*129d67acSlin wang - Sun Microsystems - Beijing China 
1727a1306a7Sxc /* value found in rs_keyix to mark invalid entries */
1737a1306a7Sxc #define	HAL_RXKEYIX_INVALID	((uint8_t)-1)
1747a1306a7Sxc 
1757a1306a7Sxc /* value used to specify no encryption key for xmit */
1767a1306a7Sxc #define	HAL_TXKEYIX_INVALID	((uint32_t)-1)
1777a1306a7Sxc 
1780ba2cbe9Sxc /* compression definitions */
1790ba2cbe9Sxc #define	HAL_COMP_BUF_MAX_SIZE	9216	/* 9k */
1800ba2cbe9Sxc #define	HAL_COMP_BUF_ALIGN_SIZE	512
1810ba2cbe9Sxc 
1820ba2cbe9Sxc #define	HAL_ANTENNA_MIN_MODE	0
1830ba2cbe9Sxc #define	HAL_ANTENNA_FIXED_A	1
1840ba2cbe9Sxc #define	HAL_ANTENNA_FIXED_B	2
1850ba2cbe9Sxc #define	HAL_ANTENNA_MAX_MODE	3
1860ba2cbe9Sxc 
1877a1306a7Sxc /*
1887a1306a7Sxc  * Status codes that may be returned by the HAL.  Note that
1897a1306a7Sxc  * interfaces that return a status code set it only when an
1907a1306a7Sxc  * error occurs--i.e. you cannot check it for success.
1917a1306a7Sxc  */
1927a1306a7Sxc typedef enum {
1937a1306a7Sxc 	HAL_OK		= 0,	/* No error */
1947a1306a7Sxc 	HAL_ENXIO	= 1,	/* No hardware present */
1957a1306a7Sxc 	HAL_ENOMEM	= 2,	/* Memory allocation failed */
1967a1306a7Sxc 	HAL_EIO		= 3,	/* Hardware didn't respond as expected */
1977a1306a7Sxc 	HAL_EEMAGIC	= 4,	/* EEPROM magic number invalid */
1987a1306a7Sxc 	HAL_EEVERSION	= 5,	/* EEPROM version invalid */
1997a1306a7Sxc 	HAL_EELOCKED	= 6,	/* EEPROM unreadable */
2007a1306a7Sxc 	HAL_EEBADSUM	= 7,	/* EEPROM checksum invalid */
2017a1306a7Sxc 	HAL_EEREAD	= 8,	/* EEPROM read problem */
2027a1306a7Sxc 	HAL_EEBADMAC	= 9,	/* EEPROM mac address invalid */
2037a1306a7Sxc 	HAL_EESIZE	= 10,	/* EEPROM size not supported */
2047a1306a7Sxc 	HAL_EEWRITE	= 11,	/* Attempt to change write-locked EEPROM */
2057a1306a7Sxc 	HAL_EINVAL	= 12,	/* Invalid parameter to function */
2067a1306a7Sxc 	HAL_ENOTSUPP	= 13,	/* Hardware revision not supported */
2077a1306a7Sxc 	HAL_ESELFTEST	= 14,	/* Hardware self-test failed */
2087a1306a7Sxc 	HAL_EINPROGRESS	= 15	/* Operation incomplete */
2097a1306a7Sxc } HAL_STATUS;
2107a1306a7Sxc 
2117a1306a7Sxc typedef enum {
2127a1306a7Sxc 	AH_FALSE = 0,		/* NB: lots of code assumes false is zero */
2137a1306a7Sxc 	AH_TRUE  = 1
2147a1306a7Sxc } HAL_BOOL;
2157a1306a7Sxc 
2167a1306a7Sxc typedef enum {
2177a1306a7Sxc 	HAL_CAP_REG_DMN		= 0,	/* current regulatory domain */
2187a1306a7Sxc 	HAL_CAP_CIPHER		= 1,	/* hardware supports cipher */
2197a1306a7Sxc 	HAL_CAP_TKIP_MIC	= 2,	/* handle TKIP MIC in hardware */
2207a1306a7Sxc 	HAL_CAP_TKIP_SPLIT	= 3,	/* hardware TKIP uses split keys */
2217a1306a7Sxc 	HAL_CAP_PHYCOUNTERS	= 4,	/* hardware PHY error counters */
2227a1306a7Sxc 	HAL_CAP_DIVERSITY	= 5,	/* hardware supports fast diversity */
2237a1306a7Sxc 	HAL_CAP_KEYCACHE_SIZE	= 6,	/* number of entries in key cache */
2247a1306a7Sxc 	HAL_CAP_NUM_TXQUEUES	= 7,	/* number of hardware xmit queues */
2257a1306a7Sxc 	HAL_CAP_VEOL		= 9,	/* hardware supports virtual EOL */
2267a1306a7Sxc 	HAL_CAP_PSPOLL		= 10,	/* hardware has working PS-Poll */
2277a1306a7Sxc 					/* support */
2287a1306a7Sxc 	HAL_CAP_DIAG		= 11,	/* hardware diagnostic support */
2297a1306a7Sxc 	HAL_CAP_COMPRESSION	= 12,	/* hardware supports compression */
2307a1306a7Sxc 	HAL_CAP_BURST		= 13,	/* hardware supports packet bursting */
2317a1306a7Sxc 	HAL_CAP_FASTFRAME	= 14,	/* hardware supoprts fast frames */
2327a1306a7Sxc 	HAL_CAP_TXPOW		= 15,	/* global tx power limit  */
2330ba2cbe9Sxc 	HAL_CAP_TPC		= 16,	/* per-packet tx power control  */
2340ba2cbe9Sxc 	HAL_CAP_PHYDIAG		= 17,	/* hardware phy error diagnostic */
2350ba2cbe9Sxc 	HAL_CAP_BSSIDMASK	= 18,	/* hardware supports bssid mask */
2360ba2cbe9Sxc 	HAL_CAP_MCAST_KEYSRCH	= 19,	/* hardware has multicast key search */
2370ba2cbe9Sxc 	HAL_CAP_TSF_ADJUST	= 20,	/* hardware has beacon tsf adjust */
2380ba2cbe9Sxc 	HAL_CAP_XR		= 21,	/* hardware has XR support  */
2390ba2cbe9Sxc 	/* hardware can support TKIP MIC when WMM is turned on */
2400ba2cbe9Sxc 	HAL_CAP_WME_TKIPMIC	= 22,
2410ba2cbe9Sxc 	/* hardware can support half rate channels */
2420ba2cbe9Sxc 	HAL_CAP_CHAN_HALFRATE	= 23,
2430ba2cbe9Sxc 	/* hardware can support quarter rate channels */
2440ba2cbe9Sxc 	HAL_CAP_CHAN_QUARTERRATE = 24,
2450ba2cbe9Sxc 	HAL_CAP_RFSILENT	= 25,	/* hardware has rfsilent support  */
2460ba2cbe9Sxc 	HAL_CAP_TPC_ACK		= 26,	/* ack txpower with per-packet tpc */
2470ba2cbe9Sxc 	HAL_CAP_TPC_CTS		= 27,	/* cts txpower with per-packet tpc */
2480ba2cbe9Sxc 	HAL_CAP_11D		= 28,	/* 11d beacon support for changing cc */
249*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_CAP_INTMIT		= 29,	/* interference mitigation */
250*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_CAP_RXORN_FATAL	= 30,	/* HAL_INT_RXORN treated as fatal */
251*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_CAP_HT		= 31,	/* hardware can support HT */
252*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_CAP_NUMTXCHAIN	= 32,	/* TX chains supported */
253*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_CAP_NUMRXCHAIN	= 33,	/* RX chains supported */
254*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_CAP_RXTSTAMP_PREC	= 34	/* rx desc tstamp precision (bits) */
2557a1306a7Sxc } HAL_CAPABILITY_TYPE;
2567a1306a7Sxc 
2577a1306a7Sxc /*
2587a1306a7Sxc  * "States" for setting the LED.  These correspond to
2597a1306a7Sxc  * the possible 802.11 operational states and there may
2607a1306a7Sxc  * be a many-to-one mapping between these states and the
2617a1306a7Sxc  * actual hardware states for the LED's (i.e. the hardware
2627a1306a7Sxc  * may have fewer states).
2637a1306a7Sxc  */
2647a1306a7Sxc typedef enum {
2657a1306a7Sxc 	HAL_LED_INIT	= 0,
2667a1306a7Sxc 	HAL_LED_SCAN	= 1,
2677a1306a7Sxc 	HAL_LED_AUTH	= 2,
2687a1306a7Sxc 	HAL_LED_ASSOC	= 3,
2697a1306a7Sxc 	HAL_LED_RUN	= 4
2707a1306a7Sxc } HAL_LED_STATE;
2717a1306a7Sxc 
2727a1306a7Sxc /*
2737a1306a7Sxc  * Transmit queue types/numbers.  These are used to tag
2747a1306a7Sxc  * each transmit queue in the hardware and to identify a set
2757a1306a7Sxc  * of transmit queues for operations such as start/stop dma.
2767a1306a7Sxc  */
2777a1306a7Sxc typedef enum {
2787a1306a7Sxc 	HAL_TX_QUEUE_INACTIVE	= 0,	/* queue is inactive/unused */
2797a1306a7Sxc 	HAL_TX_QUEUE_DATA	= 1,	/* data xmit q's */
2807a1306a7Sxc 	HAL_TX_QUEUE_BEACON	= 2,	/* beacon xmit q */
2817a1306a7Sxc 	HAL_TX_QUEUE_CAB	= 3,	/* "crap after beacon" xmit q */
2820ba2cbe9Sxc 	HAL_TX_QUEUE_UAPSD	= 4	/* u-apsd power save xmit q */
2837a1306a7Sxc } HAL_TX_QUEUE;
2847a1306a7Sxc 
2857a1306a7Sxc 
2867a1306a7Sxc /*
2877a1306a7Sxc  * Transmit queue subtype.  These map directly to
2887a1306a7Sxc  * WME Access Categories (except for UPSD).  Refer
2897a1306a7Sxc  * to Table 5 of the WME spec.
2907a1306a7Sxc  */
2917a1306a7Sxc typedef enum {
2927a1306a7Sxc 	HAL_WME_AC_BK	= 0,		/* background access category */
2937a1306a7Sxc 	HAL_WME_AC_BE	= 1, 		/* best effort access category */
2947a1306a7Sxc 	HAL_WME_AC_VI	= 2,		/* video access category */
2957a1306a7Sxc 	HAL_WME_AC_VO	= 3,		/* voice access category */
2960ba2cbe9Sxc 	HAL_WME_UPSD	= 4,		/* uplink power save */
2970ba2cbe9Sxc 	HAL_XR_DATA	= 5		/* entended range data */
2987a1306a7Sxc } HAL_TX_QUEUE_SUBTYPE;
2997a1306a7Sxc 
3007a1306a7Sxc /*
3017a1306a7Sxc  * Transmit queue flags that control various
3027a1306a7Sxc  * operational parameters.
3037a1306a7Sxc  */
3047a1306a7Sxc typedef enum {
3050ba2cbe9Sxc 	/*
3060ba2cbe9Sxc 	 * Per queue interrupt enables.  When set the associated
3070ba2cbe9Sxc 	 * interrupt may be delivered for packets sent through
3080ba2cbe9Sxc 	 * the queue.  Without these enabled no interrupts will
3090ba2cbe9Sxc 	 * be delivered for transmits through the queue.
3100ba2cbe9Sxc 	 *
3110ba2cbe9Sxc 	 * When 0x0001 is set, both TXQ_TXOKINT and TXQ_TXERRINT
3120ba2cbe9Sxc 	 * will be enabled.
3130ba2cbe9Sxc 	 */
3140ba2cbe9Sxc 	HAL_TXQ_TXOKINT_ENABLE	   = 0x0001,	/* enable TXOK interrupt */
3150ba2cbe9Sxc 	HAL_TXQ_TXERRINT_ENABLE    = 0x0001,	/* enable TXERR interrupt */
3160ba2cbe9Sxc 	HAL_TXQ_TXDESCINT_ENABLE   = 0x0002,	/* enable TXDESC interrupt */
3170ba2cbe9Sxc 	HAL_TXQ_TXEOLINT_ENABLE    = 0x0004,	/* enable TXEOL interrupt */
3180ba2cbe9Sxc 	HAL_TXQ_TXURNINT_ENABLE    = 0x0008,	/* enable TXURN interrupt */
3190ba2cbe9Sxc 	/*
3200ba2cbe9Sxc 	 * Enable hardware compression for packets sent through
3210ba2cbe9Sxc 	 * the queue.  The compression buffer must be setup and
3220ba2cbe9Sxc 	 * packets must have a key entry marked in the tx descriptor.
3230ba2cbe9Sxc 	 */
3240ba2cbe9Sxc 	HAL_TXQ_COMPRESSION_ENABLE = 0x0010,	/* enable h/w compression */
3250ba2cbe9Sxc 	/*
3260ba2cbe9Sxc 	 * Disable queue when veol is hit or ready time expires.
3270ba2cbe9Sxc 	 * By default the queue is disabled only on reaching the
3280ba2cbe9Sxc 	 * physical end of queue (i.e. a null link ptr in the
3290ba2cbe9Sxc 	 * descriptor chain).
3300ba2cbe9Sxc 	 */
3310ba2cbe9Sxc 	HAL_TXQ_RDYTIME_EXP_POLICY_ENABLE = 0x0020,
3320ba2cbe9Sxc 	/*
3330ba2cbe9Sxc 	 * Schedule frames on delivery of a DBA (DMA Beacon Alert)
3340ba2cbe9Sxc 	 * event.  Frames will be transmitted only when this timer
3350ba2cbe9Sxc 	 * fires, e.g to transmit a beacon in ap or adhoc modes.
3360ba2cbe9Sxc 	 */
3370ba2cbe9Sxc 	HAL_TXQ_DBA_GATED	   = 0x0040,	/* schedule based on DBA */
3380ba2cbe9Sxc 	/*
3390ba2cbe9Sxc 	 * Each transmit queue has a counter that is incremented
3400ba2cbe9Sxc 	 * each time the queue is enabled and decremented when
3410ba2cbe9Sxc 	 * the list of frames to transmit is traversed (or when
3420ba2cbe9Sxc 	 * the ready time for the queue expires).  This counter
3430ba2cbe9Sxc 	 * must be non-zero for frames to be scheduled for
3440ba2cbe9Sxc 	 * transmission.  The following controls disable bumping
3450ba2cbe9Sxc 	 * this counter under certain conditions.  Typically this
3460ba2cbe9Sxc 	 * is used to gate frames based on the contents of another
3470ba2cbe9Sxc 	 * queue (e.g. CAB traffic may only follow a beacon frame).
3480ba2cbe9Sxc 	 * These are meaningful only when frames are scheduled
3490ba2cbe9Sxc 	 * with a non-ASAP policy (e.g. DBA-gated).
3500ba2cbe9Sxc 	 */
3510ba2cbe9Sxc 	HAL_TXQ_CBR_DIS_QEMPTY	   = 0x0080,	/* disable on this q empty */
3520ba2cbe9Sxc 	HAL_TXQ_CBR_DIS_BEMPTY	   = 0x0100,	/* disable on beacon q empty */
3530ba2cbe9Sxc 
3540ba2cbe9Sxc 	/*
3550ba2cbe9Sxc 	 * Fragment burst backoff policy.   Normally no backoff
3560ba2cbe9Sxc 	 * is done after a successful transmission, the next fragment
3570ba2cbe9Sxc 	 * is sent at SIFS.  If this flag is set backoff is done
3580ba2cbe9Sxc 	 * after each fragment, regardless whether it was ack'd or
3590ba2cbe9Sxc 	 * not, after the backoff count reaches zero a normal channel
3600ba2cbe9Sxc 	 * access procedure is done before the next transmit (i.e.
3610ba2cbe9Sxc 	 * wait AIFS instead of SIFS).
3620ba2cbe9Sxc 	 */
3630ba2cbe9Sxc 	HAL_TXQ_FRAG_BURST_BACKOFF_ENABLE = 0x00800000,
3640ba2cbe9Sxc 	/*
3650ba2cbe9Sxc 	 * Disable post-tx backoff following each frame.
3660ba2cbe9Sxc 	 */
3670ba2cbe9Sxc 	HAL_TXQ_BACKOFF_DISABLE    =  0x00010000, /* disable post backoff  */
3680ba2cbe9Sxc 	/*
3690ba2cbe9Sxc 	 * DCU arbiter lockout control.  This controls how
3700ba2cbe9Sxc 	 * lower priority tx queues are handled with respect
3710ba2cbe9Sxc 	 * to a specific queue when multiple queues have frames
3720ba2cbe9Sxc 	 * to send.  No lockout means lower priority queues arbitrate
3730ba2cbe9Sxc 	 * concurrently with this queue.  Intra-frame lockout
3740ba2cbe9Sxc 	 * means lower priority queues are locked out until the
3750ba2cbe9Sxc 	 * current frame transmits (e.g. including backoffs and bursting).
3760ba2cbe9Sxc 	 * Global lockout means nothing lower can arbitrary so
3770ba2cbe9Sxc 	 * long as there is traffic activity on this queue (frames,
3780ba2cbe9Sxc 	 * backoff, etc).
3790ba2cbe9Sxc 	 */
3800ba2cbe9Sxc 	HAL_TXQ_ARB_LOCKOUT_INTRA  = 0x00020000, /* intra-frame lockout */
3810ba2cbe9Sxc 	HAL_TXQ_ARB_LOCKOUT_GLOBAL = 0x00040000, /* full lockout s */
3820ba2cbe9Sxc 
3830ba2cbe9Sxc 	HAL_TXQ_IGNORE_VIRTCOL	   = 0x00080000, /* ignore virt collisions */
3840ba2cbe9Sxc 	HAL_TXQ_SEQNUM_INC_DIS	   = 0x00100000  /* disable seqnum increment */
3857a1306a7Sxc } HAL_TX_QUEUE_FLAGS;
3867a1306a7Sxc 
3877a1306a7Sxc typedef struct {
3887a1306a7Sxc 	uint32_t	tqi_ver;		/* hal TXQ version */
3897a1306a7Sxc 	HAL_TX_QUEUE_SUBTYPE tqi_subtype;	/* subtype if applicable */
3907a1306a7Sxc 	HAL_TX_QUEUE_FLAGS tqi_qflags;		/* flags (see above) */
3917a1306a7Sxc 	uint32_t	tqi_priority;		/* (not used) */
3927a1306a7Sxc 	uint32_t	tqi_aifs;		/* AIFS shift */
3937a1306a7Sxc 	int32_t		tqi_cwmin;		/* cwMin shift */
3947a1306a7Sxc 	int32_t		tqi_cwmax;		/* cwMax shift */
3957a1306a7Sxc 	uint16_t	tqi_shretry;		/* rts retry limit */
3967a1306a7Sxc 	uint16_t	tqi_lgretry;		/* long retry limit(not used) */
3977a1306a7Sxc 	uint32_t	tqi_cbrPeriod;
3987a1306a7Sxc 	uint32_t	tqi_cbrOverflowLimit;
3997a1306a7Sxc 	uint32_t	tqi_burstTime;
4007a1306a7Sxc 	uint32_t	tqi_readyTime;
4010ba2cbe9Sxc 	uint32_t	tqi_compBuf;		/* compress buffer phys addr */
4027a1306a7Sxc } HAL_TXQ_INFO;
4037a1306a7Sxc 
4040ba2cbe9Sxc #define	HAL_TQI_NONVAL		0xffff
4050ba2cbe9Sxc 
4067a1306a7Sxc /* token to use for aifs, cwmin, cwmax */
4077a1306a7Sxc #define	HAL_TXQ_USEDEFAULT	((uint32_t)-1)
4087a1306a7Sxc 
4097a1306a7Sxc /*
4107a1306a7Sxc  * Transmit packet types.  This belongs in ah_desc.h, but
4117a1306a7Sxc  * is here so we can give a proper type to various parameters
4127a1306a7Sxc  * (and not require everyone include the file).
4137a1306a7Sxc  *
4147a1306a7Sxc  * NB: These values are intentionally assigned for
4157a1306a7Sxc  *     direct use when setting up h/w descriptors.
4167a1306a7Sxc  */
4177a1306a7Sxc typedef enum {
4187a1306a7Sxc 	HAL_PKT_TYPE_NORMAL	= 0,
4197a1306a7Sxc 	HAL_PKT_TYPE_ATIM	= 1,
4207a1306a7Sxc 	HAL_PKT_TYPE_PSPOLL	= 2,
4217a1306a7Sxc 	HAL_PKT_TYPE_BEACON	= 3,
4220ba2cbe9Sxc 	HAL_PKT_TYPE_PROBE_RESP	= 4,
4230ba2cbe9Sxc 	HAL_PKT_TYPE_CHIRP	= 5,
424*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_PKT_TYPE_GRP_POLL	= 6,
425*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_PKT_TYPE_AMPDU	= 7
4267a1306a7Sxc } HAL_PKT_TYPE;
4277a1306a7Sxc 
4287a1306a7Sxc /* Rx Filter Frame Types */
4297a1306a7Sxc typedef enum {
4307a1306a7Sxc 	HAL_RX_FILTER_UCAST	= 0x00000001,	/* Allow unicast frames */
4317a1306a7Sxc 	HAL_RX_FILTER_MCAST	= 0x00000002,	/* Allow multicast frames */
4327a1306a7Sxc 	HAL_RX_FILTER_BCAST	= 0x00000004,	/* Allow broadcast frames */
4337a1306a7Sxc 	HAL_RX_FILTER_CONTROL	= 0x00000008,	/* Allow control frames */
4347a1306a7Sxc 	HAL_RX_FILTER_BEACON	= 0x00000010,	/* Allow beacon frames */
4357a1306a7Sxc 	HAL_RX_FILTER_PROM	= 0x00000020,	/* Promiscuous mode */
4360ba2cbe9Sxc 	HAL_RX_FILTER_XRPOLL	= 0x00000040,	/* Allow XR poll frmae */
4377a1306a7Sxc 	HAL_RX_FILTER_PROBEREQ	= 0x00000080,	/* Allow probe request frames */
4387a1306a7Sxc 	HAL_RX_FILTER_PHYERR	= 0x00000100,	/* Allow phy errors */
4397a1306a7Sxc 	HAL_RX_FILTER_PHYRADAR	= 0x00000200	/* Allow phy radar errors */
4407a1306a7Sxc } HAL_RX_FILTER;
4417a1306a7Sxc 
4427a1306a7Sxc typedef enum {
4430ba2cbe9Sxc 	HAL_PM_AWAKE		= 0,
4440ba2cbe9Sxc 	HAL_PM_FULL_SLEEP	= 1,
4450ba2cbe9Sxc 	HAL_PM_NETWORK_SLEEP	= 2,
4460ba2cbe9Sxc 	HAL_PM_UNDEFINED	= 3
4477a1306a7Sxc } HAL_POWER_MODE;
4487a1306a7Sxc 
4497a1306a7Sxc /*
4507a1306a7Sxc  * NOTE WELL:
4517a1306a7Sxc  * These are mapped to take advantage of the common locations for many of
4527a1306a7Sxc  * the bits on all of the currently supported MAC chips. This is to make
4537a1306a7Sxc  * the ISR as efficient as possible, while still abstracting HW differences.
4547a1306a7Sxc  * When new hardware breaks this commonality this enumerated type, as well
4557a1306a7Sxc  * as the HAL functions using it, must be modified. All values are directly
4567a1306a7Sxc  * mapped unless commented otherwise.
4577a1306a7Sxc  */
4587a1306a7Sxc typedef enum {
4597a1306a7Sxc 	HAL_INT_RX	= 0x00000001,	/* Non-common mapping */
4607a1306a7Sxc 	HAL_INT_RXDESC	= 0x00000002,
4617a1306a7Sxc 	HAL_INT_RXNOFRM	= 0x00000008,
4627a1306a7Sxc 	HAL_INT_RXEOL	= 0x00000010,
4637a1306a7Sxc 	HAL_INT_RXORN	= 0x00000020,
4647a1306a7Sxc 	HAL_INT_TX	= 0x00000040,	/* Non-common mapping */
4657a1306a7Sxc 	HAL_INT_TXDESC	= 0x00000080,
4667a1306a7Sxc 	HAL_INT_TXURN	= 0x00000800,
4677a1306a7Sxc 	HAL_INT_MIB	= 0x00001000,
4687a1306a7Sxc 	HAL_INT_RXPHY	= 0x00004000,
4697a1306a7Sxc 	HAL_INT_RXKCM	= 0x00008000,
4707a1306a7Sxc 	HAL_INT_SWBA	= 0x00010000,
4717a1306a7Sxc 	HAL_INT_BMISS	= 0x00040000,
4727a1306a7Sxc 	HAL_INT_BNR	= 0x00100000,	/* Non-common mapping */
4730ba2cbe9Sxc 	HAL_INT_TIM	= 0x00200000,	/* Non-common mapping */
4740ba2cbe9Sxc 	HAL_INT_DTIM	= 0x00400000,	/* Non-common mapping */
4750ba2cbe9Sxc 	HAL_INT_DTIMSYNC = 0x00800000,	/* Non-common mapping */
4767a1306a7Sxc 	HAL_INT_GPIO	= 0x01000000,
4770ba2cbe9Sxc 	HAL_INT_CABEND	= 0x02000000,	/* Non-common mapping */
478*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_INT_CST	= 0x10000000,	/* Non-common mapping */
479*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_INT_GTT	= 0x20000000,	/* Non-common mapping */
4807a1306a7Sxc 	HAL_INT_FATAL	= 0x40000000,	/* Non-common mapping */
4817a1306a7Sxc 	HAL_INT_GLOBAL	= INT_MIN,	/* Set/clear IER */
4820ba2cbe9Sxc 	HAL_INT_BMISC	= HAL_INT_TIM
4830ba2cbe9Sxc 			| HAL_INT_DTIM
4840ba2cbe9Sxc 			| HAL_INT_DTIMSYNC
4850ba2cbe9Sxc 			| HAL_INT_CABEND,
4867a1306a7Sxc 
4877a1306a7Sxc 	/* Interrupt bits that map directly to ISR/IMR bits */
4887a1306a7Sxc 	HAL_INT_COMMON  = HAL_INT_RXNOFRM
4897a1306a7Sxc 			| HAL_INT_RXDESC
4907a1306a7Sxc 			| HAL_INT_RXEOL
4917a1306a7Sxc 			| HAL_INT_RXORN
4927a1306a7Sxc 			| HAL_INT_TXURN
4937a1306a7Sxc 			| HAL_INT_TXDESC
4947a1306a7Sxc 			| HAL_INT_MIB
4957a1306a7Sxc 			| HAL_INT_RXPHY
4967a1306a7Sxc 			| HAL_INT_RXKCM
4977a1306a7Sxc 			| HAL_INT_SWBA
4987a1306a7Sxc 			| HAL_INT_BMISS
4997a1306a7Sxc 			| HAL_INT_GPIO,
5007a1306a7Sxc } HAL_INT;
5017a1306a7Sxc 
5027a1306a7Sxc typedef enum {
5037a1306a7Sxc 	HAL_RFGAIN_INACTIVE		= 0,
5047a1306a7Sxc 	HAL_RFGAIN_READ_REQUESTED	= 1,
5057a1306a7Sxc 	HAL_RFGAIN_NEED_CHANGE		= 2
5067a1306a7Sxc } HAL_RFGAIN;
5077a1306a7Sxc 
5087a1306a7Sxc typedef enum {
5097a1306a7Sxc 	HAL_PHYERR_UNDERRUN		= 0,	/* Transmit underrun */
5107a1306a7Sxc 	HAL_PHYERR_TIMING		= 1,	/* Timing error */
5117a1306a7Sxc 	HAL_PHYERR_PARITY		= 2,	/* Illegal parity */
5127a1306a7Sxc 	HAL_PHYERR_RATE			= 3,	/* Illegal rate */
5137a1306a7Sxc 	HAL_PHYERR_LENGTH		= 4,	/* Illegal length */
5147a1306a7Sxc 	HAL_PHYERR_RADAR		= 5,	/* Radar detect */
5157a1306a7Sxc 	HAL_PHYERR_SERVICE		= 6,	/* Illegal service */
5167a1306a7Sxc 	HAL_PHYERR_TOR			= 7,	/* Transmit override receive */
5177a1306a7Sxc 	/* NB: these are specific to the 5212 */
5187a1306a7Sxc 	HAL_PHYERR_OFDM_TIMING		= 17,	/* */
5197a1306a7Sxc 	HAL_PHYERR_OFDM_SIGNAL_PARITY	= 18,	/* */
5207a1306a7Sxc 	HAL_PHYERR_OFDM_RATE_ILLEGAL	= 19,	/* */
5217a1306a7Sxc 	HAL_PHYERR_OFDM_LENGTH_ILLEGAL	= 20,	/* */
5227a1306a7Sxc 	HAL_PHYERR_OFDM_POWER_DROP	= 21,	/* */
5237a1306a7Sxc 	HAL_PHYERR_OFDM_SERVICE		= 22,	/* */
5247a1306a7Sxc 	HAL_PHYERR_OFDM_RESTART		= 23,	/* */
5257a1306a7Sxc 	HAL_PHYERR_CCK_TIMING		= 25,	/* */
5267a1306a7Sxc 	HAL_PHYERR_CCK_HEADER_CRC	= 26,	/* */
5277a1306a7Sxc 	HAL_PHYERR_CCK_RATE_ILLEGAL	= 27,	/* */
5287a1306a7Sxc 	HAL_PHYERR_CCK_SERVICE		= 30,	/* */
5297a1306a7Sxc 	HAL_PHYERR_CCK_RESTART		= 31	/* */
5307a1306a7Sxc }HAL_PHYERR;
5317a1306a7Sxc 
5327a1306a7Sxc /*
5337a1306a7Sxc  * Channels are specified by frequency.
5347a1306a7Sxc  */
5357a1306a7Sxc typedef struct {
536*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	channelFlags;
5377a1306a7Sxc 	uint16_t	channel;	/* setting in Mhz */
5380ba2cbe9Sxc 	uint8_t		privFlags;
5390ba2cbe9Sxc 	int8_t		maxRegTxPower;	/* max regulatory tx power in dBm */
5400ba2cbe9Sxc 	int8_t		maxTxPower;	/* max true tx power in 0.5 dBm */
5410ba2cbe9Sxc 	int8_t		minTxPower;	/* min true tx power in 0.5 dBm */
5427a1306a7Sxc } HAL_CHANNEL;
5437a1306a7Sxc 
5447a1306a7Sxc 
5457a1306a7Sxc typedef struct {
5467a1306a7Sxc 	uint32_t	ackrcv_bad;
5477a1306a7Sxc 	uint32_t	rts_bad;
5487a1306a7Sxc 	uint32_t	rts_good;
5497a1306a7Sxc 	uint32_t	fcs_bad;
5507a1306a7Sxc 	uint32_t	beacons;
5517a1306a7Sxc } HAL_MIB_STATS;
5527a1306a7Sxc 
5537a1306a7Sxc 
5547a1306a7Sxc enum {
5557a1306a7Sxc 	CTRY_DEBUG	= 0x1ff,		/* debug country code */
5567a1306a7Sxc 	CTRY_DEFAULT	= 0			/* default country code */
5577a1306a7Sxc };
5587a1306a7Sxc 
5597a1306a7Sxc enum {
5600ba2cbe9Sxc 	HAL_MODE_11A	= 0x001,	/* 11a channels */
5610ba2cbe9Sxc 	HAL_MODE_TURBO	= 0x002,	/* 11a turbo-only channels */
5620ba2cbe9Sxc 	HAL_MODE_11B	= 0x004,	/* 11b channels */
5630ba2cbe9Sxc 	HAL_MODE_PUREG	= 0x008,	/* 11g channels (OFDM only) */
5640ba2cbe9Sxc 	HAL_MODE_11G	= 0x008,	/* XXX historical */
5650ba2cbe9Sxc 	HAL_MODE_108G	= 0x020,	/* 11g+Turbo channels */
5660ba2cbe9Sxc 	HAL_MODE_108A	= 0x040,	/* 11a+Turbo channels */
5670ba2cbe9Sxc 	HAL_MODE_XR	= 0x100,	/* XR channels */
5680ba2cbe9Sxc 	HAL_MODE_11A_HALF_RATE = 0x200,	/* 11A half rate channels */
5690ba2cbe9Sxc 	HAL_MODE_11A_QUARTER_RATE = 0x400,	/* 11A quarter rate channels */
570*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_MODE_11NG_HT20	= 0x8000,
571*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_MODE_11NA_HT20	= 0x10000,
572*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_MODE_11NG_HT40PLUS	= 0x20000,
573*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_MODE_11NG_HT40MINUS	= 0x40000,
574*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_MODE_11NA_HT40PLUS	= 0x80000,
575*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_MODE_11NA_HT40MINUS	= 0x100000,
576*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_MODE_ALL	= 0xffffff
5777a1306a7Sxc };
5787a1306a7Sxc 
5797a1306a7Sxc typedef struct {
5807a1306a7Sxc 	int		rateCount;		/* NB: for proper padding */
581*129d67acSlin wang - Sun Microsystems - Beijing China 	uint8_t	rateCodeToIndex[144];	/* back mapping */
5827a1306a7Sxc 	struct {
5837a1306a7Sxc 		uint8_t	valid;		/* valid for rate control use */
5847a1306a7Sxc 		uint8_t	phy;		/* CCK/OFDM/XR */
585*129d67acSlin wang - Sun Microsystems - Beijing China 		uint32_t rateKbps;	/* transfer rate in kbs */
5867a1306a7Sxc 		uint8_t	rateCode;	/* rate for h/w descriptors */
5877a1306a7Sxc 		/* mask for enabling short preamble in CCK rate code */
5887a1306a7Sxc 		uint8_t	shortPreamble;
5897a1306a7Sxc 		/* value for supported rates info element of MLME */
5907a1306a7Sxc 		uint8_t	dot11Rate;
5917a1306a7Sxc 		/* index of next lower basic rate; used for dur. calcs */
5927a1306a7Sxc 		uint8_t	controlRate;
5937a1306a7Sxc 		uint16_t lpAckDuration;	/* long preamble ACK duration */
5947a1306a7Sxc 		uint16_t spAckDuration;	/* short preamble ACK duration */
5957a1306a7Sxc 	} info[32];
5967a1306a7Sxc } HAL_RATE_TABLE;
5977a1306a7Sxc 
5987a1306a7Sxc typedef struct {
5997a1306a7Sxc 	uint32_t	rs_count;	/* number of valid entries */
6007a1306a7Sxc 	uint8_t	rs_rates[32];		/* rates */
6017a1306a7Sxc } HAL_RATE_SET;
6027a1306a7Sxc 
603*129d67acSlin wang - Sun Microsystems - Beijing China /*
604*129d67acSlin wang - Sun Microsystems - Beijing China  * 802.11n specific structures and enums
605*129d67acSlin wang - Sun Microsystems - Beijing China  */
606*129d67acSlin wang - Sun Microsystems - Beijing China typedef enum {
607*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_CHAINTYPE_TX	= 1,	/* Tx chain type */
608*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_CHAINTYPE_RX	= 2,	/* RX chain type */
609*129d67acSlin wang - Sun Microsystems - Beijing China } HAL_CHAIN_TYPE;
610*129d67acSlin wang - Sun Microsystems - Beijing China 
611*129d67acSlin wang - Sun Microsystems - Beijing China typedef struct {
612*129d67acSlin wang - Sun Microsystems - Beijing China 	uint_t	Tries;
613*129d67acSlin wang - Sun Microsystems - Beijing China 	uint_t	Rate;
614*129d67acSlin wang - Sun Microsystems - Beijing China 	uint_t	PktDuration;
615*129d67acSlin wang - Sun Microsystems - Beijing China 	uint_t	ChSel;
616*129d67acSlin wang - Sun Microsystems - Beijing China 	uint_t	RateFlags;
617*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RATESERIES_RTS_CTS	0x0001	/* use rts/cts w/this series */
618*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RATESERIES_2040	0x0002	/* use ext channel for series */
619*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_RATESERIES_HALFGI	0x0004	/* use half-gi for series */
620*129d67acSlin wang - Sun Microsystems - Beijing China } HAL_11N_RATE_SERIES;
621*129d67acSlin wang - Sun Microsystems - Beijing China 
622*129d67acSlin wang - Sun Microsystems - Beijing China typedef enum {
623*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_HT_MACMODE_20	= 0,	/* 20 MHz operation */
624*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_HT_MACMODE_2040	= 1	/* 20/40 MHz operation */
625*129d67acSlin wang - Sun Microsystems - Beijing China } HAL_HT_MACMODE;
626*129d67acSlin wang - Sun Microsystems - Beijing China 
627*129d67acSlin wang - Sun Microsystems - Beijing China typedef enum {
628*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_HT_PHYMODE_20	= 0,	/* 20 MHz operation */
629*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_HT_PHYMODE_2040	= 1	/* 20/40 MHz operation */
630*129d67acSlin wang - Sun Microsystems - Beijing China } HAL_HT_PHYMODE;
631*129d67acSlin wang - Sun Microsystems - Beijing China 
632*129d67acSlin wang - Sun Microsystems - Beijing China typedef enum {
633*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_HT_EXTPROTSPACING_20 = 0,	/* 20 MHz spacing */
634*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_HT_EXTPROTSPACING_25 = 1	/* 25 MHz spacing */
635*129d67acSlin wang - Sun Microsystems - Beijing China } HAL_HT_EXTPROTSPACING;
636*129d67acSlin wang - Sun Microsystems - Beijing China 
637*129d67acSlin wang - Sun Microsystems - Beijing China typedef enum {
638*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_RX_CLEAR_CTL_LOW	= 1,	/* force control chan to appear busy */
639*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_RX_CLEAR_EXT_LOW	= 2	/* force ext chan to appear busy */
640*129d67acSlin wang - Sun Microsystems - Beijing China } HAL_HT_RXCLEAR;
641*129d67acSlin wang - Sun Microsystems - Beijing China 
6420ba2cbe9Sxc /*
6430ba2cbe9Sxc  * Antenna switch control.  By default antenna selection
6440ba2cbe9Sxc  * enables multiple (2) antenna use.  To force use of the
6450ba2cbe9Sxc  * A or B antenna only specify a fixed setting.  Fixing
6460ba2cbe9Sxc  * the antenna will also disable any diversity support.
6470ba2cbe9Sxc  */
6487a1306a7Sxc typedef enum {
6497a1306a7Sxc 	HAL_ANT_VARIABLE = 0,		/* variable by programming */
6500ba2cbe9Sxc 	HAL_ANT_FIXED_A	 = 1,		/* fixed antenna A */
6510ba2cbe9Sxc 	HAL_ANT_FIXED_B	 = 2		/* fixed antenna B */
6527a1306a7Sxc } HAL_ANT_SETTING;
6537a1306a7Sxc 
6547a1306a7Sxc typedef enum {
6557a1306a7Sxc 	HAL_M_STA	= 1,		/* infrastructure station */
6567a1306a7Sxc 	HAL_M_IBSS	= 0,		/* IBSS (adhoc) station */
6577a1306a7Sxc 	HAL_M_HOSTAP	= 6,		/* Software Access Point */
6587a1306a7Sxc 	HAL_M_MONITOR	= 8		/* Monitor mode */
6597a1306a7Sxc } HAL_OPMODE;
6607a1306a7Sxc 
6617a1306a7Sxc typedef struct {
6627a1306a7Sxc 	uint8_t	kv_type;		/* one of HAL_CIPHER */
6637a1306a7Sxc 	uint8_t	kv_pad;
6647a1306a7Sxc 	uint16_t	kv_len;		/* length in bits */
6657a1306a7Sxc 	uint8_t	kv_val[16];		/* enough for 128-bit keys */
6667a1306a7Sxc 	uint8_t	kv_mic[8];		/* TKIP MIC key */
667*129d67acSlin wang - Sun Microsystems - Beijing China 	uint8_t	kv_txmic[8];		/* TKIP TX MIC key (optional) */
6687a1306a7Sxc } HAL_KEYVAL;
6697a1306a7Sxc 
6707a1306a7Sxc typedef enum {
6717a1306a7Sxc 	HAL_CIPHER_WEP		= 0,
6727a1306a7Sxc 	HAL_CIPHER_AES_OCB	= 1,
6737a1306a7Sxc 	HAL_CIPHER_AES_CCM	= 2,
6747a1306a7Sxc 	HAL_CIPHER_CKIP		= 3,
6757a1306a7Sxc 	HAL_CIPHER_TKIP		= 4,
6767a1306a7Sxc 	HAL_CIPHER_CLR		= 5,	/* no encryption */
6777a1306a7Sxc 
6787a1306a7Sxc 	HAL_CIPHER_MIC		= 127	/* TKIP-MIC, not a cipher */
6797a1306a7Sxc } HAL_CIPHER;
6807a1306a7Sxc 
6817a1306a7Sxc enum {
6820ba2cbe9Sxc 	HAL_SLOT_TIME_6  = 6,		/* NB: for turbo mode */
6837a1306a7Sxc 	HAL_SLOT_TIME_9	 = 9,
6847a1306a7Sxc 	HAL_SLOT_TIME_20 = 20
6857a1306a7Sxc };
6867a1306a7Sxc 
6877a1306a7Sxc /*
6887a1306a7Sxc  * Per-station beacon timer state.  Note that the specified
6897a1306a7Sxc  * beacon interval (given in TU's) can also include flags
6907a1306a7Sxc  * to force a TSF reset and to enable the beacon xmit logic.
6917a1306a7Sxc  * If bs_cfpmaxduration is non-zero the hardware is setup to
6927a1306a7Sxc  * coexist with a PCF-capable AP.
6937a1306a7Sxc  */
6947a1306a7Sxc typedef struct {
6957a1306a7Sxc 	uint32_t	bs_nexttbtt;		/* next beacon in TU */
6967a1306a7Sxc 	uint32_t	bs_nextdtim;		/* next DTIM in TU */
6977a1306a7Sxc 	uint32_t	bs_intval;		/* beacon interval+flags */
6987a1306a7Sxc 	uint32_t	bs_dtimperiod;
6997a1306a7Sxc 	uint16_t	bs_cfpperiod;		/* CFP period in TU */
7007a1306a7Sxc 	uint16_t	bs_cfpmaxduration;	/* max CFP duration in TU */
7017a1306a7Sxc 	uint32_t	bs_cfpnext;		/* next CFP in TU */
7027a1306a7Sxc 	uint16_t	bs_timoffset;		/* byte offset to TIM bitmap */
7037a1306a7Sxc 	uint16_t	bs_bmissthreshold;	/* beacon miss threshold */
7047a1306a7Sxc 	uint32_t	bs_sleepduration;	/* max sleep duration */
7057a1306a7Sxc } HAL_BEACON_STATE;
7067a1306a7Sxc 
7070ba2cbe9Sxc /*
7080ba2cbe9Sxc  * Like HAL_BEACON_STATE but for non-station mode setup.
7090ba2cbe9Sxc  * NB: see above flag definitions
7100ba2cbe9Sxc  */
7110ba2cbe9Sxc typedef struct {
7120ba2cbe9Sxc 	uint32_t	bt_intval;		/* beacon interval+flags */
7130ba2cbe9Sxc 	uint32_t	bt_nexttbtt;		/* next beacon in TU */
7140ba2cbe9Sxc 	uint32_t	bt_nextatim;		/* next ATIM in TU */
7150ba2cbe9Sxc 	uint32_t	bt_nextdba;		/* next DBA in 1/8th TU */
7160ba2cbe9Sxc 	uint32_t	bt_nextswba;		/* next SWBA in 1/8th TU */
717*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	bt_flags;		/* timer enables */
718*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_BEACON_TBTT_EN	0x00000001
719*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_BEACON_DBA_EN	0x00000002
720*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_BEACON_SWBA_EN	0x00000004
7210ba2cbe9Sxc } HAL_BEACON_TIMERS;
7220ba2cbe9Sxc 
7237a1306a7Sxc /*
7247a1306a7Sxc  * Per-node statistics maintained by the driver for use in
7257a1306a7Sxc  * optimizing signal quality and other operational aspects.
7267a1306a7Sxc  */
7277a1306a7Sxc typedef struct {
7287a1306a7Sxc 	uint32_t	ns_avgbrssi;	/* average beacon rssi */
7297a1306a7Sxc 	uint32_t	ns_avgrssi;	/* average data rssi */
7307a1306a7Sxc 	uint32_t	ns_avgtxrssi;	/* average tx rssi */
7317a1306a7Sxc } HAL_NODE_STATS;
7327a1306a7Sxc 
7337a1306a7Sxc /*
7347a1306a7Sxc  * Transmit descriptor status.  This structure is filled
7357a1306a7Sxc  * in only after the tx descriptor process method finds a
7367a1306a7Sxc  * ``done'' descriptor; at which point it returns something
7377a1306a7Sxc  * other than HAL_EINPROGRESS.
7387a1306a7Sxc  *
7397a1306a7Sxc  * Note that ts_antenna may not be valid for all h/w.  It
7407a1306a7Sxc  * should be used only if non-zero.
7417a1306a7Sxc  */
7427a1306a7Sxc struct ath_tx_status {
7437a1306a7Sxc 	uint16_t	ts_seqnum;	/* h/w assigned sequence number */
7447a1306a7Sxc 	uint16_t	ts_tstamp;	/* h/w assigned timestamp */
7457a1306a7Sxc 	uint8_t		ts_status;	/* frame status, 0 => xmit ok */
7467a1306a7Sxc 	uint8_t		ts_rate;	/* h/w transmit rate index */
7477a1306a7Sxc 	int8_t		ts_rssi;	/* tx ack RSSI */
7487a1306a7Sxc 	uint8_t		ts_shortretry;	/* # short retries */
7497a1306a7Sxc 	uint8_t		ts_longretry;	/* # long retries */
7507a1306a7Sxc 	uint8_t		ts_virtcol;	/* virtual collision count */
7517a1306a7Sxc 	uint8_t		ts_antenna;	/* antenna information */
752*129d67acSlin wang - Sun Microsystems - Beijing China 	uint8_t		ts_finaltsi;	/* final transmit series index */
753*129d67acSlin wang - Sun Microsystems - Beijing China 	/* AH_SUPPORT_AR5416 */		/* 802.11n status */
754*129d67acSlin wang - Sun Microsystems - Beijing China 	uint8_t		ts_flags;	/* misc flags */
755*129d67acSlin wang - Sun Microsystems - Beijing China 	int8_t		ts_rssi_ctl[3];	/* tx ack RSSI [ctl, chain 0-2] */
756*129d67acSlin wang - Sun Microsystems - Beijing China 	int8_t		ts_rssi_ext[3];	/* tx ack RSSI [ext, chain 0-2] */
757*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	ts_ba_low;	/* blockack bitmap low */
758*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	ts_ba_high;	/* blockack bitmap high */
759*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	ts_evm0;	/* evm bytes */
760*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	ts_evm1;
761*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	ts_evm2;
7627a1306a7Sxc };
7637a1306a7Sxc 
7647a1306a7Sxc 
7657a1306a7Sxc /*
7667a1306a7Sxc  * Receive descriptor status.  This structure is filled
7677a1306a7Sxc  * in only after the rx descriptor process method finds a
7687a1306a7Sxc  * ``done'' descriptor; at which point it returns something
7697a1306a7Sxc  * other than HAL_EINPROGRESS.
7707a1306a7Sxc  *
7717a1306a7Sxc  * If rx_status is zero, then the frame was received ok;
7727a1306a7Sxc  * otherwise the error information is indicated and rs_phyerr
7737a1306a7Sxc  * contains a phy error code if HAL_RXERR_PHY is set.  In general
7747a1306a7Sxc  * the frame contents is undefined when an error occurred thought
7757a1306a7Sxc  * for some errors (e.g. a decryption error), it may be meaningful.
7767a1306a7Sxc  *
7777a1306a7Sxc  * Note that the receive timestamp is expanded using the TSF to
778*129d67acSlin wang - Sun Microsystems - Beijing China  * at least 15 bits (regardless of what the h/w provides directly).
779*129d67acSlin wang - Sun Microsystems - Beijing China  * Newer hardware supports a full 32-bits; use HAL_CAP_32TSTAMP to
780*129d67acSlin wang - Sun Microsystems - Beijing China  * find out if the hardware is capable.
7817a1306a7Sxc  *
7827a1306a7Sxc  * rx_rssi is in units of dbm above the noise floor.  This value
7837a1306a7Sxc  * is measured during the preamble and PLCP; i.e. with the initial
7847a1306a7Sxc  * 4us of detection.  The noise floor is typically a consistent
7857a1306a7Sxc  * -96dBm absolute power in a 20MHz channel.
7867a1306a7Sxc  */
7877a1306a7Sxc struct ath_rx_status {
7887a1306a7Sxc 	uint16_t	rs_datalen;	/* rx frame length */
7897a1306a7Sxc 	uint8_t		rs_status;	/* rx status, 0 => recv ok */
7907a1306a7Sxc 	uint8_t		rs_phyerr;	/* phy error code */
791*129d67acSlin wang - Sun Microsystems - Beijing China 	int8_t		rs_rssi;	/* rx frame RSSI (xombined for 11n) */
7927a1306a7Sxc 	uint8_t		rs_keyix;	/* key cache index */
7937a1306a7Sxc 	uint8_t		rs_rate;	/* h/w receive rate index */
7947a1306a7Sxc 	uint8_t		rs_more;	/* see HAL_RXERR_XXX definition */
795*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	rs_tstamp;	/* h/w assigned timestamp */
796*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	rs_antenna;	/* antenna information */
797*129d67acSlin wang - Sun Microsystems - Beijing China 	/* AH_SUPPORT_AR5416 */		/* 802.11n status */
798*129d67acSlin wang - Sun Microsystems - Beijing China 	int8_t		rs_rssi_ctl[3];	/* rx frame RSSI [ctl, chain 0-2] */
799*129d67acSlin wang - Sun Microsystems - Beijing China 	int8_t		rs_rssi_ext[3];	/* rx frame RSSI [ext, chain 0-2] */
800*129d67acSlin wang - Sun Microsystems - Beijing China 	uint8_t		rs_isaggr;	/* is part of the aggregate */
801*129d67acSlin wang - Sun Microsystems - Beijing China 	uint8_t		rs_moreaggr;	/* more frames in aggr to follow */
802*129d67acSlin wang - Sun Microsystems - Beijing China 	uint8_t		rs_num_delims;	/* number of delims in aggr */
803*129d67acSlin wang - Sun Microsystems - Beijing China 	uint8_t		rs_flags;	/* misc flags */
804*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	rs_evm0;	/* evm bytes */
805*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	rs_evm1;
806*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	rs_evm2;
8077a1306a7Sxc };
8087a1306a7Sxc 
8097a1306a7Sxc /*
8107a1306a7Sxc  * Definitions for the software frame/packet descriptors used by
8117a1306a7Sxc  * the Atheros HAL.  This definition obscures hardware-specific
8127a1306a7Sxc  * details from the driver.  Drivers are expected to fillin the
8137a1306a7Sxc  * portions of a descriptor that are not opaque then use HAL calls
8147a1306a7Sxc  * to complete the work.  Status for completed frames is returned
8157a1306a7Sxc  * in a device-independent format.
8167a1306a7Sxc  */
817*129d67acSlin wang - Sun Microsystems - Beijing China /* AH_SUPPORT_AR5416 */
818*129d67acSlin wang - Sun Microsystems - Beijing China #define	HAL_DESC_HW_SIZE	20
819*129d67acSlin wang - Sun Microsystems - Beijing China 
8207a1306a7Sxc #pragma pack(1)
8217a1306a7Sxc struct ath_desc {
8227a1306a7Sxc 	/*
8237a1306a7Sxc 	 * The following definitions are passed directly
8247a1306a7Sxc 	 * the hardware and managed by the HAL.  Drivers
8257a1306a7Sxc 	 * should not touch those elements marked opaque.
8267a1306a7Sxc 	 */
8277a1306a7Sxc 	uint32_t	ds_link;	/* phys address of next descriptor */
8287a1306a7Sxc 	uint32_t	ds_data;	/* phys address of data buffer */
8297a1306a7Sxc 	uint32_t	ds_ctl0;	/* opaque DMA control 0 */
8307a1306a7Sxc 	uint32_t	ds_ctl1;	/* opaque DMA control 1 */
831*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	ds_hw[HAL_DESC_HW_SIZE]; /* opaque h/w region */
832*129d67acSlin wang - Sun Microsystems - Beijing China };
833*129d67acSlin wang - Sun Microsystems - Beijing China 
834*129d67acSlin wang - Sun Microsystems - Beijing China struct ath_desc_status {
8357a1306a7Sxc 	union {
8367a1306a7Sxc 		struct ath_tx_status tx; /* xmit status */
8377a1306a7Sxc 		struct ath_rx_status rx; /* recv status */
8387a1306a7Sxc 	} ds_us;
8397a1306a7Sxc };
8407a1306a7Sxc #pragma pack()
8417a1306a7Sxc 
8427a1306a7Sxc #define	ds_txstat	ds_us.tx
8437a1306a7Sxc #define	ds_rxstat	ds_us.rx
8447a1306a7Sxc 
8457a1306a7Sxc /*
8467a1306a7Sxc  * Hardware Access Layer (HAL) API.
8477a1306a7Sxc  *
8487a1306a7Sxc  * Clients of the HAL call ath_hal_attach to obtain a reference to an
8497a1306a7Sxc  * ath_hal structure for use with the device.  Hardware-related operations
8507a1306a7Sxc  * that follow must call back into the HAL through interface, supplying
8517a1306a7Sxc  * the reference as the first parameter.  Note that before using the
8527a1306a7Sxc  * reference returned by ath_hal_attach the caller should verify the
8537a1306a7Sxc  * ABI version number.
8547a1306a7Sxc  */
8557a1306a7Sxc struct ath_hal {
8567a1306a7Sxc 	uint32_t	ah_magic;	/* consistency check magic number */
8577a1306a7Sxc 	uint32_t	ah_abi;		/* HAL ABI version */
8587a1306a7Sxc 	uint16_t	ah_devid;	/* PCI device ID */
8597a1306a7Sxc 	uint16_t	ah_subvendorid;	/* PCI subvendor ID */
8607a1306a7Sxc 	HAL_SOFTC	ah_sc;		/* back pointer to driver/os state */
8617a1306a7Sxc 	HAL_BUS_TAG	ah_st;		/* params for register r+w */
8627a1306a7Sxc 	HAL_BUS_HANDLE	ah_sh;
8637a1306a7Sxc 	HAL_CTRY_CODE	ah_countryCode;
8647a1306a7Sxc 
8657a1306a7Sxc 	uint32_t	ah_macVersion;	/* MAC version id */
8667a1306a7Sxc 	uint16_t	ah_macRev;	/* MAC revision */
8677a1306a7Sxc 	uint16_t	ah_phyRev;	/* PHY revision */
8680ba2cbe9Sxc 	/* NB: when only one radio is present the rev is in 5Ghz */
8690ba2cbe9Sxc 	uint16_t	ah_analog5GhzRev; /* 5GHz radio revision */
8700ba2cbe9Sxc 	uint16_t	ah_analog2GhzRev; /* 2GHz radio revision */
8717a1306a7Sxc 
8727a1306a7Sxc 	const HAL_RATE_TABLE *(*ah_getRateTable)(struct ath_hal *,
8737a1306a7Sxc 				uint32_t mode);
8747a1306a7Sxc 	void	  (*ah_detach) (struct ath_hal *);
8757a1306a7Sxc 
8767a1306a7Sxc 	/* Reset functions */
8777a1306a7Sxc 	HAL_BOOL  (*ah_reset) (struct ath_hal *, HAL_OPMODE,
8787a1306a7Sxc 				HAL_CHANNEL *, HAL_BOOL bChannelChange,
8797a1306a7Sxc 				HAL_STATUS *status);
8800ba2cbe9Sxc 	HAL_BOOL  (*ah_phyDisable) (struct ath_hal *);
8810ba2cbe9Sxc 	HAL_BOOL  (*ah_disable) (struct ath_hal *);
8820ba2cbe9Sxc 	void	  (*ah_setPCUConfig) (struct ath_hal *);
8830ba2cbe9Sxc 	HAL_BOOL  (*ah_perCalibration) (struct ath_hal *, HAL_CHANNEL *,
8840ba2cbe9Sxc 				HAL_BOOL *);
8857a1306a7Sxc 	HAL_BOOL  (*ah_setTxPowerLimit)(struct ath_hal *, uint32_t);
8867a1306a7Sxc 
887*129d67acSlin wang - Sun Microsystems - Beijing China 	/* DFS support */
8880ba2cbe9Sxc 	HAL_BOOL  (*ah_radarWait)(struct ath_hal *, HAL_CHANNEL *);
8890ba2cbe9Sxc 
8907a1306a7Sxc 	/* Transmit functions */
8917a1306a7Sxc 	HAL_BOOL  (*ah_updateTxTrigLevel) (struct ath_hal *,
8927a1306a7Sxc 				HAL_BOOL incTrigLevel);
8937a1306a7Sxc 	int	  (*ah_setupTxQueue) (struct ath_hal *, HAL_TX_QUEUE,
8947a1306a7Sxc 				const HAL_TXQ_INFO *qInfo);
8957a1306a7Sxc 	HAL_BOOL  (*ah_setTxQueueProps) (struct ath_hal *, int q,
8967a1306a7Sxc 				const HAL_TXQ_INFO *qInfo);
8977a1306a7Sxc 	HAL_BOOL  (*ah_getTxQueueProps)(struct ath_hal *, int q,
8987a1306a7Sxc 				HAL_TXQ_INFO *qInfo);
8997a1306a7Sxc 	HAL_BOOL  (*ah_releaseTxQueue) (struct ath_hal *ah, uint32_t q);
9007a1306a7Sxc 	HAL_BOOL  (*ah_resetTxQueue) (struct ath_hal *ah, uint32_t q);
9017a1306a7Sxc 	uint32_t (*ah_getTxDP) (struct ath_hal *, uint32_t);
9027a1306a7Sxc 	HAL_BOOL  (*ah_setTxDP) (struct ath_hal *, uint32_t, uint32_t txdp);
9037a1306a7Sxc 	uint32_t (*ah_numTxPending)(struct ath_hal *, uint32_t q);
9047a1306a7Sxc 	HAL_BOOL  (*ah_startTxDma) (struct ath_hal *, uint32_t);
9057a1306a7Sxc 	HAL_BOOL  (*ah_stopTxDma) (struct ath_hal *, uint32_t);
9067a1306a7Sxc 	HAL_BOOL  (*ah_setupTxDesc) (struct ath_hal *, struct ath_desc *,
9077a1306a7Sxc 				uint32_t pktLen, uint32_t hdrLen,
9087a1306a7Sxc 				HAL_PKT_TYPE type, uint32_t txPower,
9097a1306a7Sxc 				uint32_t txRate0, uint32_t txTries0,
9107a1306a7Sxc 				uint32_t keyIx, uint32_t antMode,
9117a1306a7Sxc 				uint32_t flags, uint32_t rtsctsRate,
9120ba2cbe9Sxc 				uint32_t rtsctsDuration,
9130ba2cbe9Sxc 				uint32_t compicvLen, uint32_t compivLen,
9140ba2cbe9Sxc 				uint32_t comp);
9157a1306a7Sxc 	HAL_BOOL  (*ah_setupXTxDesc) (struct ath_hal *, struct ath_desc *,
9167a1306a7Sxc 				uint32_t txRate1, uint32_t txTries1,
9177a1306a7Sxc 				uint32_t txRate2, uint32_t txTries2,
9187a1306a7Sxc 				uint32_t txRate3, uint32_t txTries3);
9197a1306a7Sxc 	HAL_BOOL  (*ah_fillTxDesc) (struct ath_hal *, struct ath_desc *,
9207a1306a7Sxc 				uint32_t segLen, HAL_BOOL firstSeg,
9217a1306a7Sxc 				HAL_BOOL lastSeg, const struct ath_desc *);
922*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_STATUS (*ah_procTxDesc)(struct ath_hal *, struct ath_desc *,
923*129d67acSlin wang - Sun Microsystems - Beijing China 				struct ath_tx_status *);
9247a1306a7Sxc 	void	   (*ah_getTxIntrQueue)(struct ath_hal *, uint32_t *);
9250ba2cbe9Sxc 	void	   (*ah_reqTxIntrDesc)(struct ath_hal *, struct ath_desc *);
9267a1306a7Sxc 
9277a1306a7Sxc 	/* Receive Functions */
9287a1306a7Sxc 	uint32_t (*ah_getRxDP) (struct ath_hal *);
9297a1306a7Sxc 	void	  (*ah_setRxDP) (struct ath_hal *, uint32_t rxdp);
9307a1306a7Sxc 	void	  (*ah_enableReceive) (struct ath_hal *);
9317a1306a7Sxc 	HAL_BOOL  (*ah_stopDmaReceive) (struct ath_hal *);
9327a1306a7Sxc 	void	  (*ah_startPcuReceive) (struct ath_hal *);
9337a1306a7Sxc 	void	  (*ah_stopPcuReceive) (struct ath_hal *);
9347a1306a7Sxc 	void	  (*ah_setMulticastFilter) (struct ath_hal *,
9357a1306a7Sxc 				uint32_t filter0, uint32_t filter1);
9367a1306a7Sxc 	HAL_BOOL  (*ah_setMulticastFilterIndex) (struct ath_hal *,
9377a1306a7Sxc 				uint32_t index);
9387a1306a7Sxc 	HAL_BOOL  (*ah_clrMulticastFilterIndex) (struct ath_hal *,
9397a1306a7Sxc 				uint32_t index);
9407a1306a7Sxc 	uint32_t (*ah_getRxFilter) (struct ath_hal *);
9417a1306a7Sxc 	void	  (*ah_setRxFilter) (struct ath_hal *, uint32_t);
9427a1306a7Sxc 	HAL_BOOL  (*ah_setupRxDesc) (struct ath_hal *, struct ath_desc *,
9437a1306a7Sxc 				uint32_t size, uint32_t flags);
9447a1306a7Sxc 	HAL_STATUS (*ah_procRxDesc) (struct ath_hal *, struct ath_desc *,
9450ba2cbe9Sxc 				uint32_t phyAddr, struct ath_desc *next,
946*129d67acSlin wang - Sun Microsystems - Beijing China 				uint64_t tsf, struct ath_rx_status *);
9477a1306a7Sxc 	void	  (*ah_rxMonitor) (struct ath_hal *,
9480ba2cbe9Sxc 				const HAL_NODE_STATS *, HAL_CHANNEL *);
9497a1306a7Sxc 	void	  (*ah_procMibEvent) (struct ath_hal *,
9507a1306a7Sxc 				const HAL_NODE_STATS *);
9517a1306a7Sxc 
9527a1306a7Sxc 	/* Misc Functions */
9537a1306a7Sxc 	HAL_STATUS  (*ah_getCapability) (struct ath_hal *,
9547a1306a7Sxc 				HAL_CAPABILITY_TYPE, uint32_t capability,
9557a1306a7Sxc 				uint32_t *result);
9567a1306a7Sxc 	HAL_BOOL    (*ah_setCapability) (struct ath_hal *,
9577a1306a7Sxc 				HAL_CAPABILITY_TYPE, uint32_t capability,
9587a1306a7Sxc 				uint32_t setting, HAL_STATUS *);
9597a1306a7Sxc 	HAL_BOOL    (*ah_getDiagState) (struct ath_hal *, int request,
9607a1306a7Sxc 				const void *args, uint32_t argsize,
9617a1306a7Sxc 				void **result, uint32_t *resultsize);
9627a1306a7Sxc 	void	  (*ah_getMacAddress) (struct ath_hal *, uint8_t *);
9637a1306a7Sxc 	HAL_BOOL  (*ah_setMacAddress) (struct ath_hal *, const uint8_t *);
9640ba2cbe9Sxc 	void	  (*ah_getBssIdMask)(struct ath_hal *, uint8_t *);
9650ba2cbe9Sxc 	HAL_BOOL  (*ah_setBssIdMask)(struct ath_hal *, const uint8_t *);
9667a1306a7Sxc 	HAL_BOOL  (*ah_setRegulatoryDomain) (struct ath_hal *,
9677a1306a7Sxc 				uint16_t, HAL_STATUS *);
9687a1306a7Sxc 	void	  (*ah_setLedState) (struct ath_hal *, HAL_LED_STATE);
9697a1306a7Sxc 	void	  (*ah_writeAssocid) (struct ath_hal *,
9707a1306a7Sxc 				const uint8_t *bssid, uint16_t assocId);
9717a1306a7Sxc 	HAL_BOOL  (*ah_gpioCfgOutput) (struct ath_hal *, uint32_t gpio);
9727a1306a7Sxc 	HAL_BOOL  (*ah_gpioCfgInput) (struct ath_hal *, uint32_t gpio);
9737a1306a7Sxc 	uint32_t (*ah_gpioGet) (struct ath_hal *, uint32_t gpio);
9747a1306a7Sxc 	HAL_BOOL  (*ah_gpioSet) (struct ath_hal *,
9757a1306a7Sxc 				uint32_t gpio, uint32_t val);
9767a1306a7Sxc 	void	  (*ah_gpioSetIntr) (struct ath_hal *, uint32_t, uint32_t);
9777a1306a7Sxc 	uint32_t (*ah_getTsf32) (struct ath_hal *);
9787a1306a7Sxc 	uint64_t (*ah_getTsf64) (struct ath_hal *);
9797a1306a7Sxc 	void	  (*ah_resetTsf) (struct ath_hal *);
9807a1306a7Sxc 	HAL_BOOL  (*ah_detectCardPresent) (struct ath_hal *);
9817a1306a7Sxc 	void	  (*ah_updateMibCounters) (struct ath_hal *, HAL_MIB_STATS *);
9827a1306a7Sxc 	HAL_RFGAIN (*ah_getRfGain) (struct ath_hal *);
9837a1306a7Sxc 	uint32_t  (*ah_getDefAntenna) (struct ath_hal *);
9847a1306a7Sxc 	void	  (*ah_setDefAntenna) (struct ath_hal *, uint32_t);
9850ba2cbe9Sxc 	HAL_ANT_SETTING (*ah_getAntennaSwitch) (struct ath_hal *);
9860ba2cbe9Sxc 	HAL_BOOL  (*ah_setAntennaSwitch) (struct ath_hal *, HAL_ANT_SETTING);
987*129d67acSlin wang - Sun Microsystems - Beijing China 	HAL_BOOL  (*ah_setSifsTime) (struct ath_hal *, uint32_t);
988*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t  (*ah_getSifsTime) (struct ath_hal *);
9897a1306a7Sxc 	HAL_BOOL  (*ah_setSlotTime) (struct ath_hal *, uint32_t);
9907a1306a7Sxc 	uint32_t  (*ah_getSlotTime) (struct ath_hal *);
9917a1306a7Sxc 	HAL_BOOL  (*ah_setAckTimeout) (struct ath_hal *, uint32_t);
9927a1306a7Sxc 	uint32_t  (*ah_getAckTimeout) (struct ath_hal *);
9930ba2cbe9Sxc 	HAL_BOOL  (*ah_setAckCTSRate) (struct ath_hal *, uint32_t);
9940ba2cbe9Sxc 	uint32_t  (*ah_getAckCTSRate) (struct ath_hal *);
9957a1306a7Sxc 	HAL_BOOL  (*ah_setCTSTimeout) (struct ath_hal *, uint32_t);
9967a1306a7Sxc 	uint32_t  (*ah_getCTSTimeout) (struct ath_hal *);
9970ba2cbe9Sxc 	HAL_BOOL  (*ah_setDecompMask)(struct ath_hal *, uint16_t, int);
9980ba2cbe9Sxc 	void	  (*ah_setCoverageClass)(struct ath_hal *, uint8_t, int);
9997a1306a7Sxc 	/* Key Cache Functions */
10007a1306a7Sxc 	uint32_t (*ah_getKeyCacheSize) (struct ath_hal *);
10017a1306a7Sxc 	HAL_BOOL  (*ah_resetKeyCacheEntry) (struct ath_hal *, uint16_t);
10027a1306a7Sxc 	HAL_BOOL  (*ah_isKeyCacheEntryValid) (struct ath_hal *, uint16_t);
10037a1306a7Sxc 	HAL_BOOL  (*ah_setKeyCacheEntry) (struct ath_hal *,
10047a1306a7Sxc 				uint16_t, const HAL_KEYVAL *,
10057a1306a7Sxc 				const uint8_t *, int);
10067a1306a7Sxc 	HAL_BOOL  (*ah_setKeyCacheEntryMac) (struct ath_hal *,
10077a1306a7Sxc 				uint16_t, const uint8_t *);
10087a1306a7Sxc 
10097a1306a7Sxc 	/* Power Management Functions */
10107a1306a7Sxc 	HAL_BOOL  (*ah_setPowerMode) (struct ath_hal *,
10110ba2cbe9Sxc 				HAL_POWER_MODE mode, int setChip);
10127a1306a7Sxc 	HAL_POWER_MODE (*ah_getPowerMode) (struct ath_hal *);
10130ba2cbe9Sxc 	int16_t   (*ah_getChanNoise)(struct ath_hal *, HAL_CHANNEL *);
10147a1306a7Sxc 
10157a1306a7Sxc 	/* Beacon Management Functions */
10160ba2cbe9Sxc 	void	  (*ah_setBeaconTimers) (struct ath_hal *,
10170ba2cbe9Sxc 				const HAL_BEACON_TIMERS *);
10180ba2cbe9Sxc 	/* NB: deprecated, use ah_setBeaconTimers instead */
10197a1306a7Sxc 	void	  (*ah_beaconInit) (struct ath_hal *,
10207a1306a7Sxc 				uint32_t nexttbtt, uint32_t intval);
10217a1306a7Sxc 	void	  (*ah_setStationBeaconTimers) (struct ath_hal *,
10227a1306a7Sxc 				const HAL_BEACON_STATE *);
10237a1306a7Sxc 	void	  (*ah_resetStationBeaconTimers) (struct ath_hal *);
10247a1306a7Sxc 
10257a1306a7Sxc 	/* Interrupt functions */
10267a1306a7Sxc 	HAL_BOOL  (*ah_isInterruptPending) (struct ath_hal *);
10277a1306a7Sxc 	HAL_BOOL  (*ah_getPendingInterrupts) (struct ath_hal *, HAL_INT *);
10287a1306a7Sxc 	HAL_INT	  (*ah_getInterrupts) (struct ath_hal *);
10297a1306a7Sxc 	HAL_INT	  (*ah_setInterrupts) (struct ath_hal *, HAL_INT);
10307a1306a7Sxc };
10317a1306a7Sxc 
10327a1306a7Sxc /*
10337a1306a7Sxc  * Check the PCI vendor ID and device ID against Atheros' values
10347a1306a7Sxc  * and return a printable description for any Atheros hardware.
10357a1306a7Sxc  * AH_NULL is returned if the ID's do not describe Atheros hardware.
10367a1306a7Sxc  */
10377a1306a7Sxc extern	const char *ath_hal_probe(uint16_t vendorid, uint16_t devid);
10387a1306a7Sxc 
10397a1306a7Sxc /*
10407a1306a7Sxc  * Attach the HAL for use with the specified device.  The device is
10417a1306a7Sxc  * defined by the PCI device ID.  The caller provides an opaque pointer
10427a1306a7Sxc  * to an upper-layer data structure (HAL_SOFTC) that is stored in the
10437a1306a7Sxc  * HAL state block for later use.  Hardware register accesses are done
10447a1306a7Sxc  * using the specified bus tag and handle.  On successful return a
10457a1306a7Sxc  * reference to a state block is returned that must be supplied in all
10467a1306a7Sxc  * subsequent HAL calls.  Storage associated with this reference is
10477a1306a7Sxc  * dynamically allocated and must be freed by calling the ah_detach
10487a1306a7Sxc  * method when the client is done.  If the attach operation fails a
10497a1306a7Sxc  * null (AH_NULL) reference will be returned and a status code will
10507a1306a7Sxc  * be returned if the status parameter is non-zero.
10517a1306a7Sxc  */
10527a1306a7Sxc extern	struct ath_hal *ath_hal_attach(uint16_t devid, HAL_SOFTC,
10537a1306a7Sxc 		HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS *status);
10547a1306a7Sxc 
10550ba2cbe9Sxc /*
10560ba2cbe9Sxc  * Set the Vendor ID for Vendor SKU's which can modify the
10570ba2cbe9Sxc  * channel properties returned by ath_hal_init_channels.
10580ba2cbe9Sxc  * Return AH_TRUE if set succeeds
10590ba2cbe9Sxc  */
10600ba2cbe9Sxc extern  HAL_BOOL ath_hal_setvendor(struct ath_hal *, uint32_t);
10610ba2cbe9Sxc 
10627a1306a7Sxc /*
10637a1306a7Sxc  * Return a list of channels available for use with the hardware.
10647a1306a7Sxc  * The list is based on what the hardware is capable of, the specified
10657a1306a7Sxc  * country code, the modeSelect mask, and whether or not outdoor
10667a1306a7Sxc  * channels are to be permitted.
10677a1306a7Sxc  *
10687a1306a7Sxc  * The channel list is returned in the supplied array.  maxchans
10697a1306a7Sxc  * defines the maximum size of this array.  nchans contains the actual
10707a1306a7Sxc  * number of channels returned.  If a problem occurred or there were
10717a1306a7Sxc  * no channels that met the criteria then AH_FALSE is returned.
10727a1306a7Sxc  */
10737a1306a7Sxc extern	HAL_BOOL  ath_hal_init_channels(struct ath_hal *,
10747a1306a7Sxc 		HAL_CHANNEL *chans, uint32_t maxchans, uint32_t *nchans,
10750ba2cbe9Sxc 		uint8_t *regclassids, uint32_t maxregids, uint32_t *nregids,
1076*129d67acSlin wang - Sun Microsystems - Beijing China 		HAL_CTRY_CODE cc, uint_t modeSelect,
10777a1306a7Sxc 		HAL_BOOL enableOutdoor, HAL_BOOL enableExtendedChannels);
10787a1306a7Sxc 
10790ba2cbe9Sxc /*
10800ba2cbe9Sxc  * Calibrate noise floor data following a channel scan or similar.
10810ba2cbe9Sxc  *  This must be called prior retrieving noise floor data.
10820ba2cbe9Sxc  */
10830ba2cbe9Sxc extern void ath_hal_process_noisefloor(struct ath_hal *ah);
10840ba2cbe9Sxc 
10857a1306a7Sxc /*
10867a1306a7Sxc  * Return bit mask of wireless modes supported by the hardware.
10877a1306a7Sxc  */
10887a1306a7Sxc extern	uint32_t  ath_hal_getwirelessmodes(struct ath_hal *, HAL_CTRY_CODE);
10897a1306a7Sxc 
10907a1306a7Sxc /*
10917a1306a7Sxc  * Calculate the transmit duration of a frame.
10927a1306a7Sxc  */
10937a1306a7Sxc extern uint16_t  ath_hal_computetxtime(struct ath_hal *,
10947a1306a7Sxc 		const HAL_RATE_TABLE *rates, uint32_t frameLen,
10957a1306a7Sxc 		uint16_t rateix, HAL_BOOL shortPreamble);
10967a1306a7Sxc 
10970ba2cbe9Sxc /*
10980ba2cbe9Sxc  * Return if device is public safety.
10990ba2cbe9Sxc  */
11000ba2cbe9Sxc extern HAL_BOOL ath_hal_ispublicsafetysku(struct ath_hal *);
11010ba2cbe9Sxc 
1102*129d67acSlin wang - Sun Microsystems - Beijing China /*
1103*129d67acSlin wang - Sun Microsystems - Beijing China  * Return if device is operating in 900 MHz band.
1104*129d67acSlin wang - Sun Microsystems - Beijing China  */
1105*129d67acSlin wang - Sun Microsystems - Beijing China extern HAL_BOOL ath_hal_isgsmsku(struct ath_hal *);
1106*129d67acSlin wang - Sun Microsystems - Beijing China 
11077a1306a7Sxc /*
11087a1306a7Sxc  * Convert between IEEE channel number and channel frequency
11097a1306a7Sxc  * using the specified channel flags; e.g. CHANNEL_2GHZ.
11107a1306a7Sxc  */
11110ba2cbe9Sxc extern	int  ath_hal_mhz2ieee(struct ath_hal *, uint32_t mhz, uint32_t flags);
11127a1306a7Sxc 
11137a1306a7Sxc /*
11147a1306a7Sxc  * Return a version string for the HAL release.
11157a1306a7Sxc  */
11167a1306a7Sxc extern	char ath_hal_version[];
11177a1306a7Sxc 
11187a1306a7Sxc /*
11197a1306a7Sxc  * Return a NULL-terminated array of build/configuration options.
11207a1306a7Sxc  */
11217a1306a7Sxc extern	const char *ath_hal_buildopts[];
11227a1306a7Sxc 
11237a1306a7Sxc /*
11247a1306a7Sxc  * Macros to encapsulated HAL functions.
11257a1306a7Sxc  */
11267a1306a7Sxc #define	ATH_HAL_RESET(_ah, _opmode, _chan, _outdoor, _pstatus) \
11277a1306a7Sxc 	((*(_ah)->ah_reset)((_ah), (_opmode), (_chan), (_outdoor), (_pstatus)))
11280ba2cbe9Sxc #define	ATH_HAL_PHYDISABLE(_ah)	\
11290ba2cbe9Sxc 	((*(_ah)->ah_phyDisable)((_ah)))
11307a1306a7Sxc #define	ATH_HAL_GETCAPABILITY(_ah, _cap, _param, _result) \
11317a1306a7Sxc 	((*(_ah)->ah_getCapability)((_ah), (_cap), (_param), (_result)))
11320ba2cbe9Sxc #define	ATH_HAL_SETCAPABILITY(_ah, _type, _cap, _param, _status) \
1133*129d67acSlin wang - Sun Microsystems - Beijing China 	((*(_ah)->ah_setCapability)((_ah), (_type), (_cap), (_param), \
1134*129d67acSlin wang - Sun Microsystems - Beijing China 	(_status)))
11357a1306a7Sxc #define	ATH_HAL_GETREGDOMAIN(_ah, _prd) \
11367a1306a7Sxc 	ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_REG_DMN, 0, (_prd))
11377a1306a7Sxc #define	ATH_HAL_GETCOUNTRYCODE(_ah, _pcc) \
11387a1306a7Sxc 	(*(_pcc) = (_ah)->ah_countryCode)
11397a1306a7Sxc #define	ATH_HAL_GETRATETABLE(_ah, _mode) \
11407a1306a7Sxc 	((*(_ah)->ah_getRateTable)((_ah), (_mode)))
11417a1306a7Sxc #define	ATH_HAL_GETMAC(_ah, _mac) \
11427a1306a7Sxc 	((*(_ah)->ah_getMacAddress)((_ah), (_mac)))
11437a1306a7Sxc #define	ATH_HAL_SETMAC(_ah, _mac) \
11447a1306a7Sxc 	((*(_ah)->ah_setMacAddress)((_ah), (_mac)))
11457a1306a7Sxc #define	ATH_HAL_INTRSET(_ah, _mask) \
11467a1306a7Sxc 	((*(_ah)->ah_setInterrupts)((_ah), (_mask)))
11477a1306a7Sxc #define	ATH_HAL_INTRGET(_ah) \
11487a1306a7Sxc 	((*(_ah)->ah_getInterrupts)((_ah)))
11497a1306a7Sxc #define	ATH_HAL_INTRPEND(_ah) \
11507a1306a7Sxc 	((*(_ah)->ah_isInterruptPending)((_ah)))
11517a1306a7Sxc #define	ATH_HAL_GETISR(_ah, _pmask) \
11527a1306a7Sxc 	((*(_ah)->ah_getPendingInterrupts)((_ah), (_pmask)))
11537a1306a7Sxc #define	ATH_HAL_UPDATETXTRIGLEVEL(_ah, _inc) \
11547a1306a7Sxc 	((*(_ah)->ah_updateTxTrigLevel)((_ah), (_inc)))
11550ba2cbe9Sxc #define	ATH_HAL_SETPOWER(_ah, _mode) \
11560ba2cbe9Sxc 	((*(_ah)->ah_setPowerMode)((_ah), (_mode), AH_TRUE))
11577a1306a7Sxc #define	ATH_HAL_KEYRESET(_ah, _ix) \
11587a1306a7Sxc 	((*(_ah)->ah_resetKeyCacheEntry)((_ah), (_ix)))
11590ba2cbe9Sxc #define	ATH_HAL_KEYSET(_ah, _ix, _pk, _mac) \
11600ba2cbe9Sxc 	((*(_ah)->ah_setKeyCacheEntry)((_ah), (_ix), (_pk), (_mac), AH_FALSE))
11617a1306a7Sxc #define	ATH_HAL_KEYISVALID(_ah, _ix) \
11627a1306a7Sxc 	(((*(_ah)->ah_isKeyCacheEntryValid)((_ah), (_ix))))
11637a1306a7Sxc #define	ATH_HAL_KEYSETMAC(_ah, _ix, _mac) \
11647a1306a7Sxc 	((*(_ah)->ah_setKeyCacheEntryMac)((_ah), (_ix), (_mac)))
11657a1306a7Sxc #define	ATH_HAL_KEYCACHESIZE(_ah) \
11667a1306a7Sxc 	((*(_ah)->ah_getKeyCacheSize)((_ah)))
11677a1306a7Sxc #define	ATH_HAL_GETRXFILTER(_ah) \
11687a1306a7Sxc 	((*(_ah)->ah_getRxFilter)((_ah)))
11697a1306a7Sxc #define	ATH_HAL_SETRXFILTER(_ah, _filter) \
11707a1306a7Sxc 	((*(_ah)->ah_setRxFilter)((_ah), (_filter)))
11717a1306a7Sxc #define	ATH_HAL_SETMCASTFILTER(_ah, _mfilt0, _mfilt1) \
11727a1306a7Sxc 	((*(_ah)->ah_setMulticastFilter)((_ah), (_mfilt0), (_mfilt1)))
11737a1306a7Sxc #define	ATH_HAL_WAITFORBEACON(_ah, _bf) \
11747a1306a7Sxc 	((*(_ah)->ah_waitForBeaconDone)((_ah), (_bf)->bf_daddr))
11757a1306a7Sxc #define	ATH_HAL_PUTRXBUF(_ah, _bufaddr) \
11767a1306a7Sxc 	((*(_ah)->ah_setRxDP)((_ah), (_bufaddr)))
11777a1306a7Sxc #define	ATH_HAL_GETTSF32(_ah) \
11787a1306a7Sxc 	((*(_ah)->ah_getTsf32)((_ah)))
11797a1306a7Sxc #define	ATH_HAL_GETTSF64(_ah) \
11807a1306a7Sxc 	((*(_ah)->ah_getTsf64)((_ah)))
11817a1306a7Sxc #define	ATH_HAL_RESETTSF(_ah) \
11827a1306a7Sxc 	((*(_ah)->ah_resetTsf)((_ah)))
11837a1306a7Sxc #define	ATH_HAL_RXENA(_ah) \
11847a1306a7Sxc 	((*(_ah)->ah_enableReceive)((_ah)))
11857a1306a7Sxc #define	ATH_HAL_PUTTXBUF(_ah, _q, _bufaddr) \
11867a1306a7Sxc 	((*(_ah)->ah_setTxDP)((_ah), (_q), (_bufaddr)))
11877a1306a7Sxc #define	ATH_HAL_GETTXBUF(_ah, _q) \
11887a1306a7Sxc 	((*(_ah)->ah_getTxDP)((_ah), (_q)))
11897a1306a7Sxc #define	ATH_HAL_GETRXBUF(_ah) \
11907a1306a7Sxc 	((*(_ah)->ah_getRxDP)((_ah)))
11917a1306a7Sxc #define	ATH_HAL_TXSTART(_ah, _q) \
11927a1306a7Sxc 	((*(_ah)->ah_startTxDma)((_ah), (_q)))
11937a1306a7Sxc #define	ATH_HAL_SETCHANNEL(_ah, _chan) \
11947a1306a7Sxc 	((*(_ah)->ah_setChannel)((_ah), (_chan)))
11950ba2cbe9Sxc #define	ATH_HAL_CALIBRATE(_ah, _chan, _iqcal) \
11960ba2cbe9Sxc 	((*(_ah)->ah_perCalibration)((_ah), (_chan), (_iqcal)))
11977a1306a7Sxc #define	ATH_HAL_SETLEDSTATE(_ah, _state) \
11987a1306a7Sxc 	((*(_ah)->ah_setLedState)((_ah), (_state)))
11997a1306a7Sxc #define	ATH_HAL_BEACONINIT(_ah, _nextb, _bperiod) \
12007a1306a7Sxc 	((*(_ah)->ah_beaconInit)((_ah), (_nextb), (_bperiod)))
12017a1306a7Sxc #define	ATH_HAL_BEACONRESET(_ah) \
12027a1306a7Sxc 	((*(_ah)->ah_resetStationBeaconTimers)((_ah)))
12037a1306a7Sxc #define	ATH_HAL_BEACONTIMERS(_ah, _beacon_state) \
12047a1306a7Sxc 	((*(_ah)->ah_setStationBeaconTimers)((_ah), (_beacon_state)))
12057a1306a7Sxc #define	ATH_HAL_SETASSOCID(_ah, _bss, _associd) \
12067a1306a7Sxc 	((*(_ah)->ah_writeAssocid)((_ah), (_bss), (_associd)))
12077a1306a7Sxc #define	ATH_HAL_SETOPMODE(_ah) \
12087a1306a7Sxc 	((*(_ah)->ah_setPCUConfig)((_ah)))
12097a1306a7Sxc #define	ATH_HAL_STOPTXDMA(_ah, _qnum) \
12107a1306a7Sxc 	((*(_ah)->ah_stopTxDma)((_ah), (_qnum)))
12117a1306a7Sxc #define	ATH_HAL_STOPPCURECV(_ah) \
12127a1306a7Sxc 	((*(_ah)->ah_stopPcuReceive)((_ah)))
12137a1306a7Sxc #define	ATH_HAL_STARTPCURECV(_ah) \
12147a1306a7Sxc 	((*(_ah)->ah_startPcuReceive)((_ah)))
12157a1306a7Sxc #define	ATH_HAL_STOPDMARECV(_ah) \
12167a1306a7Sxc 	((*(_ah)->ah_stopDmaReceive)((_ah)))
12177a1306a7Sxc #define	ATH_HAL_DUMPSTATE(_ah) \
12187a1306a7Sxc 	((*(_ah)->ah_dumpState)((_ah)))
12197a1306a7Sxc #define	ATH_HAL_DUMPEEPROM(_ah) \
12207a1306a7Sxc 	((*(_ah)->ah_dumpEeprom)((_ah)))
12217a1306a7Sxc #define	ATH_HAL_DUMPRFGAIN(_ah) \
12227a1306a7Sxc 	((*(_ah)->ah_dumpRfGain)((_ah)))
12237a1306a7Sxc #define	ATH_HAL_DUMPANI(_ah) \
12247a1306a7Sxc 	((*(_ah)->ah_dumpAni)((_ah)))
12257a1306a7Sxc #define	ATH_HAL_SETUPTXQUEUE(_ah, _type, _irq) \
12267a1306a7Sxc 	((*(_ah)->ah_setupTxQueue)((_ah), (_type), (_irq)))
12277a1306a7Sxc #define	ATH_HAL_RESETTXQUEUE(_ah, _q) \
12287a1306a7Sxc 	((*(_ah)->ah_resetTxQueue)((_ah), (_q)))
12297a1306a7Sxc #define	ATH_HAL_RELEASETXQUEUE(_ah, _q) \
12307a1306a7Sxc 	((*(_ah)->ah_releaseTxQueue)((_ah), (_q)))
1231*129d67acSlin wang - Sun Microsystems - Beijing China #define	ATH_HAL_GETTXQUEUEPROPS(_ah, _q, _qi) \
1232*129d67acSlin wang - Sun Microsystems - Beijing China 	((*(_ah)->ah_getTxQueueProps)((_ah), (_q), (_qi)))
1233*129d67acSlin wang - Sun Microsystems - Beijing China #define	ATH_HAL_SETTXQUEUEPROPS(_ah, _q, _qi) \
1234*129d67acSlin wang - Sun Microsystems - Beijing China 	((*(_ah)->ah_setTxQueueProps)((_ah), (_q), (_qi)))
1235*129d67acSlin wang - Sun Microsystems - Beijing China #define	ATH_HAL_HASVEOL(_ah) \
1236*129d67acSlin wang - Sun Microsystems - Beijing China 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_VEOL, 0, NULL) == HAL_OK)
12377a1306a7Sxc #define	ATH_HAL_GETRFGAIN(_ah) \
12387a1306a7Sxc 	((*(_ah)->ah_getRfGain)((_ah)))
12390ba2cbe9Sxc #define	ATH_HAL_RXMONITOR(_ah, _arg, _chan) \
12400ba2cbe9Sxc 	((*(_ah)->ah_rxMonitor)((_ah), (_arg), (_chan)))
12410ba2cbe9Sxc #define	ATH_HAL_SETSLOTTIME(_ah, _us) \
12420ba2cbe9Sxc 	((*(_ah)->ah_setSlotTime)((_ah), (_us)))
12437a1306a7Sxc #define	ATH_HAL_SETUPBEACONDESC(_ah, _ds, _opmode, _flen, _hlen, \
12447a1306a7Sxc 		_rate, _antmode) \
12457a1306a7Sxc 	((*(_ah)->ah_setupBeaconDesc)((_ah), (_ds), (_opmode), \
12467a1306a7Sxc 		(_flen), (_hlen), (_rate), (_antmode)))
12477a1306a7Sxc #define	ATH_HAL_SETUPRXDESC(_ah, _ds, _size, _intreq) \
12487a1306a7Sxc 	((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq)))
1249*129d67acSlin wang - Sun Microsystems - Beijing China #define	ATH_HAL_RXPROCDESC(_ah, _ds, _dspa, _dsnext, _rs) \
1250*129d67acSlin wang - Sun Microsystems - Beijing China 	((*(_ah)->ah_procRxDesc)((_ah), (_ds), (_dspa), (_dsnext), 0, (_rs)))
12517a1306a7Sxc #define	ATH_HAL_SETUPTXDESC(_ah, _ds, _plen, _hlen, _atype, _txpow, \
12527a1306a7Sxc 		_txr0, _txtr0, _keyix, _ant, _flags, \
12537a1306a7Sxc 		_rtsrate, _rtsdura) \
12547a1306a7Sxc 	((*(_ah)->ah_setupTxDesc)((_ah), (_ds), (_plen), (_hlen), (_atype), \
12557a1306a7Sxc 		(_txpow), (_txr0), (_txtr0), (_keyix), (_ant), \
12560ba2cbe9Sxc 		(_flags), (_rtsrate), (_rtsdura), 0, 0, 0))
12577a1306a7Sxc #define	ATH_HAL_SETUPXTXDESC(_ah, _ds, \
12587a1306a7Sxc 		_txr1, _txtr1, _txr2, _txtr2, _txr3, _txtr3) \
12597a1306a7Sxc 	((*(_ah)->ah_setupXTxDesc)((_ah), (_ds), \
12607a1306a7Sxc 		(_txr1), (_txtr1), (_txr2), (_txtr2), (_txr3), (_txtr3)))
12617a1306a7Sxc #define	ATH_HAL_FILLTXDESC(_ah, _ds, _l, _first, _last, _ath_desc) \
12627a1306a7Sxc 	((*(_ah)->ah_fillTxDesc)((_ah), (_ds), (_l), (_first), (_last), \
12637a1306a7Sxc 	(_ath_desc)))
1264*129d67acSlin wang - Sun Microsystems - Beijing China #define	ATH_HAL_TXPROCDESC(_ah, _ds, _ts) \
1265*129d67acSlin wang - Sun Microsystems - Beijing China 	((*(_ah)->ah_procTxDesc)((_ah), (_ds), (_ts)))
12667a1306a7Sxc #define	ATH_HAL_CIPHERSUPPORTED(_ah, _cipher) \
12677a1306a7Sxc 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_CIPHER, _cipher, NULL) == HAL_OK)
1268*129d67acSlin wang - Sun Microsystems - Beijing China #define	ATH_HAL_HASTKIPSPLIT(_ah) \
12697a1306a7Sxc 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_TKIP_SPLIT, 0, NULL) == HAL_OK)
1270*129d67acSlin wang - Sun Microsystems - Beijing China #define	ATH_HAL_GETTKIPSPLIT(_ah) \
1271*129d67acSlin wang - Sun Microsystems - Beijing China 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_TKIP_SPLIT, 1, NULL) == HAL_OK)
1272*129d67acSlin wang - Sun Microsystems - Beijing China #define	ATH_HAL_SETTKIPSPLIT(_ah, _v) \
1273*129d67acSlin wang - Sun Microsystems - Beijing China 	(ATH_HAL_SETCAPABILITY(_ah, HAL_CAP_TKIP_SPLIT, 1, _v, NULL))
12740ba2cbe9Sxc #define	ATH_HAL_HASRFSILENT(ah) \
12750ba2cbe9Sxc 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_RFSILENT, 0, NULL) == HAL_OK)
12760ba2cbe9Sxc #define	ATH_HAL_GETRFKILL(_ah) \
12770ba2cbe9Sxc 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_RFSILENT, 1, NULL) == HAL_OK)
12780ba2cbe9Sxc #define	ATH_HAL_SETRFKILL(_ah, _onoff) \
12790ba2cbe9Sxc 	(ATH_HAL_SETCAPABILITY(_ah, HAL_CAP_RFSILENT, 1, _onoff, NULL))
12800ba2cbe9Sxc #define	ATH_HAL_GETRFSILENT(_ah, _prfsilent) \
12810ba2cbe9Sxc 	(ATH_HAL_GETCAPABILITY(_ah, HAL_CAP_RFSILENT, 2, _prfsilent) == HAL_OK)
12820ba2cbe9Sxc #define	ATH_HAL_SETRFSILENT(_ah, _rfsilent) \
12830ba2cbe9Sxc 	(ATH_HAL_SETCAPABILITY(_ah, HAL_CAP_RFSILENT, 2, _rfsilent, NULL))
12840ba2cbe9Sxc 
12850ba2cbe9Sxc #if HAL_ABI_VERSION < 0x05120700
12860ba2cbe9Sxc #define	ATH_HAL_PROCESS_NOISEFLOOR(_ah)
12870ba2cbe9Sxc #define	ATH_HAL_GETCHANNOISE(_ah, _c)	(-96)
12880ba2cbe9Sxc #define	HAL_CAP_TPC_ACK	100
12890ba2cbe9Sxc #define	HAL_CAP_TPC_CTS	101
12900ba2cbe9Sxc #else
12910ba2cbe9Sxc #define	ATH_HAL_GETCHANNOISE(_ah, _c)	\
12920ba2cbe9Sxc 	((*(_ah)->ah_getChanNoise)((_ah), (_c)))
12930ba2cbe9Sxc #endif
12940ba2cbe9Sxc 
12950ba2cbe9Sxc #if HAL_ABI_VERSION < 0x05122200
12960ba2cbe9Sxc #define	HAL_TXQ_TXOKINT_ENABLE	TXQ_FLAG_TXOKINT_ENABLE
12970ba2cbe9Sxc #define	HAL_TXQ_TXERRINT_ENABLE	TXQ_FLAG_TXERRINT_ENABLE
12980ba2cbe9Sxc #define	HAL_TXQ_TXDESCINT_ENABLE	TXQ_FLAG_TXDESCINT_ENABLE
12990ba2cbe9Sxc #define	HAL_TXQ_TXEOLINT_ENABLE	TXQ_FLAG_TXEOLINT_ENABLE
13000ba2cbe9Sxc #define	HAL_TXQ_TXURNINT_ENABLE	TXQ_FLAG_TXURNINT_ENABLE
13010ba2cbe9Sxc #endif
13027a1306a7Sxc 
13037a1306a7Sxc #ifdef __cplusplus
13047a1306a7Sxc }
13057a1306a7Sxc #endif
13067a1306a7Sxc 
13077a1306a7Sxc #endif /* _ATH_HAL_H */
1308