xref: /onnv-gate/usr/src/uts/common/io/mwl/mwl_var.h (revision 10747:3e9fff3cbcc7)
110741SFei.Feng@Sun.COM /*
210741SFei.Feng@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
310741SFei.Feng@Sun.COM  * Use is subject to license terms.
410741SFei.Feng@Sun.COM  */
510741SFei.Feng@Sun.COM 
610741SFei.Feng@Sun.COM /*
710741SFei.Feng@Sun.COM  * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
810741SFei.Feng@Sun.COM  * Copyright (c) 2007-2009 Marvell Semiconductor, Inc.
910741SFei.Feng@Sun.COM  * All rights reserved.
1010741SFei.Feng@Sun.COM  *
1110741SFei.Feng@Sun.COM  * Redistribution and use in source and binary forms, with or without
1210741SFei.Feng@Sun.COM  * modification, are permitted provided that the following conditions
1310741SFei.Feng@Sun.COM  * are met:
1410741SFei.Feng@Sun.COM  * 1. Redistributions of source code must retain the above copyright
1510741SFei.Feng@Sun.COM  *    notice, this list of conditions and the following disclaimer,
1610741SFei.Feng@Sun.COM  *    without modification.
1710741SFei.Feng@Sun.COM  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1810741SFei.Feng@Sun.COM  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
1910741SFei.Feng@Sun.COM  *    redistribution must be conditioned upon including a substantially
2010741SFei.Feng@Sun.COM  *    similar Disclaimer requirement for further binary redistribution.
2110741SFei.Feng@Sun.COM  *
2210741SFei.Feng@Sun.COM  * NO WARRANTY
2310741SFei.Feng@Sun.COM  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2410741SFei.Feng@Sun.COM  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2510741SFei.Feng@Sun.COM  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
2610741SFei.Feng@Sun.COM  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
2710741SFei.Feng@Sun.COM  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
2810741SFei.Feng@Sun.COM  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2910741SFei.Feng@Sun.COM  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3010741SFei.Feng@Sun.COM  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
3110741SFei.Feng@Sun.COM  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3210741SFei.Feng@Sun.COM  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
3310741SFei.Feng@Sun.COM  * THE POSSIBILITY OF SUCH DAMAGES.
3410741SFei.Feng@Sun.COM  */
3510741SFei.Feng@Sun.COM 
3610741SFei.Feng@Sun.COM /*
3710741SFei.Feng@Sun.COM  * Definitions for the Marvell 88W8363 Wireless LAN controller.
3810741SFei.Feng@Sun.COM  */
3910741SFei.Feng@Sun.COM 
4010741SFei.Feng@Sun.COM #ifndef	_MWL_VAR_H
4110741SFei.Feng@Sun.COM #define	_MWL_VAR_H
4210741SFei.Feng@Sun.COM 
4310741SFei.Feng@Sun.COM #ifdef __cplusplus
4410741SFei.Feng@Sun.COM extern "C" {
4510741SFei.Feng@Sun.COM #endif
4610741SFei.Feng@Sun.COM 
4710741SFei.Feng@Sun.COM #include <sys/note.h>
4810741SFei.Feng@Sun.COM #include "mwl_reg.h"
4910741SFei.Feng@Sun.COM 
5010741SFei.Feng@Sun.COM #define	MWL_CMDBUF_SIZE		0x4000	/* size of f/w command buffer */
5110741SFei.Feng@Sun.COM #define	MWL_RX_RING_COUNT	256
5210741SFei.Feng@Sun.COM #define	MWL_TX_RING_COUNT	256
5310741SFei.Feng@Sun.COM 
5410741SFei.Feng@Sun.COM #ifndef MWL_AGGR_SIZE
5510741SFei.Feng@Sun.COM #define	MWL_AGGR_SIZE		3839	/* max tx agregation size */
5610741SFei.Feng@Sun.COM #endif
5710741SFei.Feng@Sun.COM #define	MWL_AGEINTERVAL		1	/* poke f/w every sec to age q's */
5810741SFei.Feng@Sun.COM 
5910741SFei.Feng@Sun.COM /*
6010741SFei.Feng@Sun.COM  * Define total number of TX queues in the shared memory.
6110741SFei.Feng@Sun.COM  * This count includes the EDCA queues, Block Ack queues, and HCCA queues
6210741SFei.Feng@Sun.COM  * In addition to this, there could be a management packet queue some
6310741SFei.Feng@Sun.COM  * time in the future
6410741SFei.Feng@Sun.COM  */
6510741SFei.Feng@Sun.COM #define	MWL_NUM_EDCA_QUEUES	4
6610741SFei.Feng@Sun.COM #define	MWL_NUM_HCCA_QUEUES	0
6710741SFei.Feng@Sun.COM #define	MWL_NUM_BA_QUEUES	0
6810741SFei.Feng@Sun.COM #define	MWL_NUM_MGMT_QUEUES	0
6910741SFei.Feng@Sun.COM #define	MWL_NUM_ACK_QUEUES	0
7010741SFei.Feng@Sun.COM #define	MWL_NUM_TX_QUEUES \
7110741SFei.Feng@Sun.COM 	(MWL_NUM_EDCA_QUEUES + MWL_NUM_HCCA_QUEUES + MWL_NUM_BA_QUEUES + \
7210741SFei.Feng@Sun.COM 	MWL_NUM_MGMT_QUEUES + MWL_NUM_ACK_QUEUES)
7310741SFei.Feng@Sun.COM #define	MWL_MAX_RXWCB_QUEUES	1
7410741SFei.Feng@Sun.COM 
7510741SFei.Feng@Sun.COM #define	MWL_MAX_SUPPORTED_RATES	12
7610741SFei.Feng@Sun.COM #define	MWL_MAX_SUPPORTED_MCS	32
7710741SFei.Feng@Sun.COM 
7810741SFei.Feng@Sun.COM #define	PWTAGETRATETABLE20M	14 * 4
7910741SFei.Feng@Sun.COM #define	PWTAGETRATETABLE40M	9 * 4
8010741SFei.Feng@Sun.COM #define	PWTAGETRATETABLE20M_5G	35 * 4
8110741SFei.Feng@Sun.COM #define	PWTAGETRATETABLE40M_5G	16 * 4
8210741SFei.Feng@Sun.COM 
8310741SFei.Feng@Sun.COM #define	MHF_CALDATA	0x0001		/* cal data retrieved */
8410741SFei.Feng@Sun.COM #define	MHF_FWHANG	0x0002		/* fw appears hung */
8510741SFei.Feng@Sun.COM #define	MHF_MBSS	0x0004		/* mbss enabled */
8610741SFei.Feng@Sun.COM 
8710741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_STURBO	0x00002000 /* 11a static turbo channel only */
8810741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_HALF	0x00004000 /* Half rate channel */
8910741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_QUARTER	0x00008000 /* Quarter rate channel */
9010741SFei.Feng@Sun.COM 
9110741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_HT20	0x00010000 /* HT 20 channel */
9210741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_HT40U	0x00020000 /* HT 40 channel w/ ext above */
9310741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_HT40D	0x00040000 /* HT 40 channel w/ ext below */
9410741SFei.Feng@Sun.COM 
9510741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_FHSS \
9610741SFei.Feng@Sun.COM 	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
9710741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_A	\
9810741SFei.Feng@Sun.COM 	(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
9910741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_B	\
10010741SFei.Feng@Sun.COM 	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
10110741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_PUREG \
10210741SFei.Feng@Sun.COM 	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
10310741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_G	\
10410741SFei.Feng@Sun.COM 	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
10510741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_HT40	\
10610741SFei.Feng@Sun.COM 	(IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)
10710741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_HT	\
10810741SFei.Feng@Sun.COM 	(IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40)
10910741SFei.Feng@Sun.COM 
11010741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_108A \
11110741SFei.Feng@Sun.COM 	(IEEE80211_CHAN_A | IEEE80211_CHAN_TURBO)
11210741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_108G \
11310741SFei.Feng@Sun.COM 	(IEEE80211_CHAN_PUREG | IEEE80211_CHAN_TURBO)
11410741SFei.Feng@Sun.COM #define	IEEE80211_CHAN_ST \
11510741SFei.Feng@Sun.COM 	(IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO)
11610741SFei.Feng@Sun.COM 
11710741SFei.Feng@Sun.COM #define	IEEE80211_MODE_STURBO_A	7
11810741SFei.Feng@Sun.COM #define	IEEE80211_MODE_11NA	8	/* 5GHz, w/ HT */
11910741SFei.Feng@Sun.COM #define	IEEE80211_MODE_11NG	9	/* 2GHz, w/ HT */
12010741SFei.Feng@Sun.COM #define	IEEE80211_MODE_HALF	10	/* OFDM, 1/2x clock */
12110741SFei.Feng@Sun.COM #define	IEEE80211_MODE_QUARTER	11	/* OFDM, 1/4x clock */
12210741SFei.Feng@Sun.COM 
12310741SFei.Feng@Sun.COM 
12410741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_2GHZ_F(_c) \
12510741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)
12610741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_5GHZ_F(_c) \
12710741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)
12810741SFei.Feng@Sun.COM 
12910741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_FHSS(_c) \
13010741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
13110741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_A(_c) \
13210741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
13310741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_B(_c) \
13410741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
13510741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_PUREG(_c) \
13610741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
13710741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_G(_c) \
13810741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
13910741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_ANYG(_c) \
14010741SFei.Feng@Sun.COM 	(IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c))
14110741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_ST(_c) \
14210741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST)
14310741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_108A(_c) \
14410741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A)
14510741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_108G(_c) \
14610741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G)
14710741SFei.Feng@Sun.COM 
14810741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_HTA(_c) \
14910741SFei.Feng@Sun.COM 	(IEEE80211_IS_CHAN_5GHZ_F(_c) && \
15010741SFei.Feng@Sun.COM 	((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
15110741SFei.Feng@Sun.COM 
15210741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_HTG(_c) \
15310741SFei.Feng@Sun.COM 	(IEEE80211_IS_CHAN_2GHZ_F(_c) && \
15410741SFei.Feng@Sun.COM 	((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
15510741SFei.Feng@Sun.COM 
15610741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_TURBO(_c) \
15710741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0)
15810741SFei.Feng@Sun.COM 
15910741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_HALF(_c) \
16010741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0)
16110741SFei.Feng@Sun.COM 
16210741SFei.Feng@Sun.COM #define	IEEE80211_IS_CHAN_QUARTER(_c) \
16310741SFei.Feng@Sun.COM 	(((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0)
16410741SFei.Feng@Sun.COM 
16510741SFei.Feng@Sun.COM /* WME stream classes */
16610741SFei.Feng@Sun.COM #define	WME_AC_BE	0		/* best effort */
16710741SFei.Feng@Sun.COM #define	WME_AC_BK	1		/* background */
16810741SFei.Feng@Sun.COM #define	WME_AC_VI	2		/* video */
16910741SFei.Feng@Sun.COM #define	WME_AC_VO	3		/* voice */
17010741SFei.Feng@Sun.COM 
17110741SFei.Feng@Sun.COM /*
17210741SFei.Feng@Sun.COM  * Transmit queue assignment.
17310741SFei.Feng@Sun.COM  */
17410741SFei.Feng@Sun.COM enum {
17510741SFei.Feng@Sun.COM 	MWL_WME_AC_BK	= 0,		/* background access category */
17610741SFei.Feng@Sun.COM 	MWL_WME_AC_BE	= 1, 		/* best effort access category */
17710741SFei.Feng@Sun.COM 	MWL_WME_AC_VI	= 2,		/* video access category */
17810741SFei.Feng@Sun.COM 	MWL_WME_AC_VO	= 3,		/* voice access category */
17910741SFei.Feng@Sun.COM };
18010741SFei.Feng@Sun.COM 
18110741SFei.Feng@Sun.COM const char *mwl_wme_acnames[] = {
18210741SFei.Feng@Sun.COM 	"WME_AC_BE",
18310741SFei.Feng@Sun.COM 	"WME_AC_BK",
18410741SFei.Feng@Sun.COM 	"WME_AC_VI",
18510741SFei.Feng@Sun.COM 	"WME_AC_VO",
18610741SFei.Feng@Sun.COM 	"WME_UPSD",
18710741SFei.Feng@Sun.COM };
18810741SFei.Feng@Sun.COM 
18910741SFei.Feng@Sun.COM /*
19010741SFei.Feng@Sun.COM  * Set Antenna Configuration (legacy operation).
19110741SFei.Feng@Sun.COM  *
19210741SFei.Feng@Sun.COM  * The RX antenna can be selected using the the bitmask
19310741SFei.Feng@Sun.COM  * ant (bit 0 = antenna 1, bit 1 = antenna 2, etc.)
19410741SFei.Feng@Sun.COM  * (diversity?XXX)
19510741SFei.Feng@Sun.COM  */
19610741SFei.Feng@Sun.COM typedef enum {
19710741SFei.Feng@Sun.COM 	WL_ANTENNATYPE_RX = 1,
19810741SFei.Feng@Sun.COM 	WL_ANTENNATYPE_TX = 2,
19910741SFei.Feng@Sun.COM } MWL_HAL_ANTENNA;
20010741SFei.Feng@Sun.COM 
20110741SFei.Feng@Sun.COM /*
20210741SFei.Feng@Sun.COM  * Set Radio Configuration.
20310741SFei.Feng@Sun.COM  *
20410741SFei.Feng@Sun.COM  * onoff != 0 turns radio on; otherwise off.
20510741SFei.Feng@Sun.COM  * if radio is enabled, the preamble is set too.
20610741SFei.Feng@Sun.COM  */
20710741SFei.Feng@Sun.COM typedef enum {
20810741SFei.Feng@Sun.COM 	WL_LONG_PREAMBLE = 1,
20910741SFei.Feng@Sun.COM 	WL_SHORT_PREAMBLE = 3,
21010741SFei.Feng@Sun.COM 	WL_AUTO_PREAMBLE = 5,
21110741SFei.Feng@Sun.COM } MWL_HAL_PREAMBLE;
21210741SFei.Feng@Sun.COM 
21310741SFei.Feng@Sun.COM /*
21410741SFei.Feng@Sun.COM  * Transmit rate control.  Rate codes with bit 0x80 set are
21510741SFei.Feng@Sun.COM  * interpreted as MCS codes (this limits us to 0-127).  The
21610741SFei.Feng@Sun.COM  * transmit rate can be set to a single fixed rate or can
21710741SFei.Feng@Sun.COM  * be configured to start at an initial rate and drop based
21810741SFei.Feng@Sun.COM  * on retry counts.
21910741SFei.Feng@Sun.COM  */
22010741SFei.Feng@Sun.COM typedef enum {
22110741SFei.Feng@Sun.COM 	RATE_AUTO	= 0,	/* rate selected by firmware */
22210741SFei.Feng@Sun.COM 	RATE_FIXED	= 2,	/* rate fixed */
22310741SFei.Feng@Sun.COM 	RATE_FIXED_DROP	= 1,	/* rate starts fixed but may drop */
22410741SFei.Feng@Sun.COM } MWL_HAL_TXRATE_HANDLING;
22510741SFei.Feng@Sun.COM 
22610741SFei.Feng@Sun.COM typedef enum {
22710741SFei.Feng@Sun.COM 	CSMODE_CONSERVATIVE = 0,
22810741SFei.Feng@Sun.COM 	CSMODE_AGGRESSIVE = 1,
22910741SFei.Feng@Sun.COM 	CSMODE_AUTO_ENA = 2,
23010741SFei.Feng@Sun.COM 	CSMODE_AUTO_DIS = 3,
23110741SFei.Feng@Sun.COM } MWL_HAL_CSMODE;
23210741SFei.Feng@Sun.COM 
23310741SFei.Feng@Sun.COM #pragma pack(1)
23410741SFei.Feng@Sun.COM 
23510741SFei.Feng@Sun.COM /*
23610741SFei.Feng@Sun.COM  * Device revision information.
23710741SFei.Feng@Sun.COM  */
23810741SFei.Feng@Sun.COM typedef struct {
23910741SFei.Feng@Sun.COM 	uint16_t	mh_devid;		/* PCI device ID */
24010741SFei.Feng@Sun.COM 	uint16_t	mh_subvendorid;		/* PCI subvendor ID */
24110741SFei.Feng@Sun.COM 	uint16_t	mh_macRev;		/* MAC revision */
24210741SFei.Feng@Sun.COM 	uint16_t	mh_phyRev;		/* PHY revision */
24310741SFei.Feng@Sun.COM } MWL_DIAG_REVS;
24410741SFei.Feng@Sun.COM 
24510741SFei.Feng@Sun.COM typedef struct {
24610741SFei.Feng@Sun.COM 	uint16_t freqLow;
24710741SFei.Feng@Sun.COM 	uint16_t freqHigh;
24810741SFei.Feng@Sun.COM 	int nchannels;
24910741SFei.Feng@Sun.COM 	struct mwl_hal_channel {
25010741SFei.Feng@Sun.COM 		uint16_t freq;		/* channel center */
25110741SFei.Feng@Sun.COM 		uint8_t ieee;		/* channel number */
25210741SFei.Feng@Sun.COM 		int8_t maxTxPow;	/* max tx power (dBm) */
25310741SFei.Feng@Sun.COM 		uint8_t targetPowers[4]; /* target powers (dBm) */
25410741SFei.Feng@Sun.COM #define	MWL_HAL_MAXCHAN	40
25510741SFei.Feng@Sun.COM 	} channels[MWL_HAL_MAXCHAN];
25610741SFei.Feng@Sun.COM } MWL_HAL_CHANNELINFO;
25710741SFei.Feng@Sun.COM 
25810741SFei.Feng@Sun.COM typedef struct {
25910741SFei.Feng@Sun.COM     uint32_t	FreqBand : 6,
26010741SFei.Feng@Sun.COM #define	MWL_FREQ_BAND_2DOT4GHZ	0x1
26110741SFei.Feng@Sun.COM #define	MWL_FREQ_BAND_5GHZ	0x4
26210741SFei.Feng@Sun.COM 		ChnlWidth: 5,
26310741SFei.Feng@Sun.COM #define	MWL_CH_10_MHz_WIDTH  	0x1
26410741SFei.Feng@Sun.COM #define	MWL_CH_20_MHz_WIDTH  	0x2
26510741SFei.Feng@Sun.COM #define	MWL_CH_40_MHz_WIDTH  	0x4
26610741SFei.Feng@Sun.COM 		ExtChnlOffset: 2,
26710741SFei.Feng@Sun.COM #define	MWL_EXT_CH_NONE		0x0
26810741SFei.Feng@Sun.COM #define	MWL_EXT_CH_ABOVE_CTRL_CH 0x1
26910741SFei.Feng@Sun.COM #define	MWL_EXT_CH_BELOW_CTRL_CH 0x3
27010741SFei.Feng@Sun.COM 		    : 19;		/* reserved */
27110741SFei.Feng@Sun.COM } MWL_HAL_CHANNEL_FLAGS;
27210741SFei.Feng@Sun.COM 
27310741SFei.Feng@Sun.COM typedef struct {
27410741SFei.Feng@Sun.COM     uint32_t	channel;
27510741SFei.Feng@Sun.COM     MWL_HAL_CHANNEL_FLAGS channelFlags;
27610741SFei.Feng@Sun.COM } MWL_HAL_CHANNEL;
27710741SFei.Feng@Sun.COM 
27810741SFei.Feng@Sun.COM /*
27910741SFei.Feng@Sun.COM  * Channels are specified by frequency and attributes.
28010741SFei.Feng@Sun.COM  */
28110741SFei.Feng@Sun.COM struct mwl_channel {
28210741SFei.Feng@Sun.COM 	uint32_t	ic_flags;	/* see below */
28310741SFei.Feng@Sun.COM 	uint16_t	ic_freq;	/* setting in Mhz */
28410741SFei.Feng@Sun.COM 	uint8_t		ic_ieee;	/* IEEE channel number */
28510741SFei.Feng@Sun.COM 	int8_t		ic_maxregpower;	/* maximum regulatory tx power in dBm */
28610741SFei.Feng@Sun.COM 	int8_t		ic_maxpower;	/* maximum tx power in .5 dBm */
28710741SFei.Feng@Sun.COM 	int8_t		ic_minpower;	/* minimum tx power in .5 dBm */
28810741SFei.Feng@Sun.COM 	uint8_t		ic_state;	/* dynamic state */
28910741SFei.Feng@Sun.COM 	uint8_t		ic_extieee;	/* HT40 extension channel number */
29010741SFei.Feng@Sun.COM 	int8_t		ic_maxantgain;	/* maximum antenna gain in .5 dBm */
29110741SFei.Feng@Sun.COM 	uint8_t		ic_pad;
29210741SFei.Feng@Sun.COM 	uint16_t	ic_devdata;	/* opaque device/driver data */
29310741SFei.Feng@Sun.COM };
29410741SFei.Feng@Sun.COM 
29510741SFei.Feng@Sun.COM /*
29610741SFei.Feng@Sun.COM  * Regulatory Information.
29710741SFei.Feng@Sun.COM  */
29810741SFei.Feng@Sun.COM struct mwl_regdomain {
29910741SFei.Feng@Sun.COM 	uint16_t	regdomain;	/* SKU */
30010741SFei.Feng@Sun.COM 	uint16_t	country;	/* ISO country code */
30110741SFei.Feng@Sun.COM 	uint8_t		location;	/* I (indoor), O (outdoor), other */
30210741SFei.Feng@Sun.COM 	uint8_t		ecm;		/* Extended Channel Mode */
30310741SFei.Feng@Sun.COM 	char		isocc[2];	/* country code string */
30410741SFei.Feng@Sun.COM 	short		pad[2];
30510741SFei.Feng@Sun.COM };
30610741SFei.Feng@Sun.COM 
30710741SFei.Feng@Sun.COM /*
30810741SFei.Feng@Sun.COM  * Get Hardware/Firmware capabilities.
30910741SFei.Feng@Sun.COM  */
31010741SFei.Feng@Sun.COM struct mwl_hal_hwspec {
31110741SFei.Feng@Sun.COM 	uint8_t		hwVersion;	/* version of the HW */
31210741SFei.Feng@Sun.COM 	uint8_t		hostInterface;	/* host interface */
31310741SFei.Feng@Sun.COM 	uint16_t	maxNumWCB;	/* max # of WCB FW handles */
31410741SFei.Feng@Sun.COM 	uint16_t	maxNumMCAddr;	/* max # of mcast addresse FW handles */
31510741SFei.Feng@Sun.COM 	uint16_t	maxNumTxWcb;	/* max # of tx descs per WCB */
31610741SFei.Feng@Sun.COM 	uint8_t		macAddr[6];	/* MAC address programmed in HW */
31710741SFei.Feng@Sun.COM 	uint16_t	regionCode;	/* EEPROM region code */
31810741SFei.Feng@Sun.COM 	uint16_t	numAntennas;	/* Number of antenna used */
31910741SFei.Feng@Sun.COM 	uint32_t	fwReleaseNumber; /* firmware release number */
32010741SFei.Feng@Sun.COM 	uint32_t	wcbBase0;
32110741SFei.Feng@Sun.COM 	uint32_t	rxDescRead;
32210741SFei.Feng@Sun.COM 	uint32_t	rxDescWrite;
32310741SFei.Feng@Sun.COM 	uint32_t	ulFwAwakeCookie;
32410741SFei.Feng@Sun.COM 	uint32_t	wcbBase[MWL_NUM_TX_QUEUES - MWL_NUM_ACK_QUEUES];
32510741SFei.Feng@Sun.COM };
32610741SFei.Feng@Sun.COM 
32710741SFei.Feng@Sun.COM /*
32810741SFei.Feng@Sun.COM  * Crypto Configuration.
32910741SFei.Feng@Sun.COM  */
33010741SFei.Feng@Sun.COM typedef struct {
33110741SFei.Feng@Sun.COM 	uint16_t	pad;
33210741SFei.Feng@Sun.COM 	uint16_t	keyTypeId;
33310741SFei.Feng@Sun.COM #define	KEY_TYPE_ID_WEP		0
33410741SFei.Feng@Sun.COM #define	KEY_TYPE_ID_TKIP	1
33510741SFei.Feng@Sun.COM #define	KEY_TYPE_ID_AES		2	/* AES-CCMP */
33610741SFei.Feng@Sun.COM 	uint32_t	keyFlags;
33710741SFei.Feng@Sun.COM #define	KEY_FLAG_INUSE		0x00000001	/* indicate key is in use */
33810741SFei.Feng@Sun.COM #define	KEY_FLAG_RXGROUPKEY	0x00000002	/* Group key for RX only */
33910741SFei.Feng@Sun.COM #define	KEY_FLAG_TXGROUPKEY	0x00000004	/* Group key for TX */
34010741SFei.Feng@Sun.COM #define	KEY_FLAG_PAIRWISE	0x00000008	/* pairwise */
34110741SFei.Feng@Sun.COM #define	KEY_FLAG_RXONLY		0x00000010	/* only used for RX */
34210741SFei.Feng@Sun.COM #define	KEY_FLAG_AUTHENTICATOR	0x00000020	/* Key is for Authenticator */
34310741SFei.Feng@Sun.COM #define	KEY_FLAG_TSC_VALID	0x00000040	/* Sequence counters valid */
34410741SFei.Feng@Sun.COM #define	KEY_FLAG_WEP_TXKEY	0x01000000	/* Tx key for WEP */
34510741SFei.Feng@Sun.COM #define	KEY_FLAG_MICKEY_VALID	0x02000000	/* Tx/Rx MIC keys are valid */
34610741SFei.Feng@Sun.COM 	uint32_t	keyIndex; 	/* for WEP only; actual key index */
34710741SFei.Feng@Sun.COM 	uint16_t	keyLen;		/* key size in bytes */
34810741SFei.Feng@Sun.COM 	union {			/* key material, keyLen gives size */
34910741SFei.Feng@Sun.COM 		uint8_t	wep[16];	/* enough for 128 bits */
35010741SFei.Feng@Sun.COM 		uint8_t	aes[16];
35110741SFei.Feng@Sun.COM 		struct	{
35210741SFei.Feng@Sun.COM 		    /* NB: group or pairwise key is determined by keyFlags */
35310741SFei.Feng@Sun.COM 		    uint8_t	keyMaterial[16];
35410741SFei.Feng@Sun.COM 		    uint8_t	txMic[8];
35510741SFei.Feng@Sun.COM 		    uint8_t	rxMic[8];
35610741SFei.Feng@Sun.COM 		    struct {
35710741SFei.Feng@Sun.COM 			uint16_t	low;
35810741SFei.Feng@Sun.COM 			uint32_t	high;
35910741SFei.Feng@Sun.COM 		    } rsc;
36010741SFei.Feng@Sun.COM 		struct	{
36110741SFei.Feng@Sun.COM 			uint16_t	low;
36210741SFei.Feng@Sun.COM 			uint32_t	high;
36310741SFei.Feng@Sun.COM 		    } tsc;
36410741SFei.Feng@Sun.COM 		} tkip;
36510741SFei.Feng@Sun.COM 	} key;
36610741SFei.Feng@Sun.COM } MWL_HAL_KEYVAL;
36710741SFei.Feng@Sun.COM 
36810741SFei.Feng@Sun.COM /*
36910741SFei.Feng@Sun.COM  * Supply tx/rx dma-related settings to the firmware.
37010741SFei.Feng@Sun.COM  */
37110741SFei.Feng@Sun.COM struct mwl_hal_txrxdma {
37210741SFei.Feng@Sun.COM 	uint32_t   maxNumWCB;		/* max # of WCB FW handles */
37310741SFei.Feng@Sun.COM 	uint32_t   maxNumTxWcb;		/* max # of tx descs per WCB */
37410741SFei.Feng@Sun.COM 	uint32_t   rxDescRead;
37510741SFei.Feng@Sun.COM 	uint32_t   rxDescWrite;
37610741SFei.Feng@Sun.COM 	uint32_t   wcbBase[MWL_NUM_TX_QUEUES - MWL_NUM_ACK_QUEUES];
37710741SFei.Feng@Sun.COM };
37810741SFei.Feng@Sun.COM 
37910741SFei.Feng@Sun.COM /*
38010741SFei.Feng@Sun.COM  * Inform the firmware of a new association station.
38110741SFei.Feng@Sun.COM  * The address is the MAC address of the peer station.
38210741SFei.Feng@Sun.COM  * The AID is supplied sans the 0xc000 bits.  The station
38310741SFei.Feng@Sun.COM  * ID is defined by the caller.  The peer information must
38410741SFei.Feng@Sun.COM  * be supplied.
38510741SFei.Feng@Sun.COM  *
38610741SFei.Feng@Sun.COM  * NB: All values are in host byte order; any byte swapping
38710741SFei.Feng@Sun.COM  *     is handled by the hal.
38810741SFei.Feng@Sun.COM  */
38910741SFei.Feng@Sun.COM typedef struct {
39010741SFei.Feng@Sun.COM 	uint32_t LegacyRateBitMap;
39110741SFei.Feng@Sun.COM 	uint32_t HTRateBitMap;
39210741SFei.Feng@Sun.COM 	uint16_t CapInfo;
39310741SFei.Feng@Sun.COM 	uint16_t HTCapabilitiesInfo;
39410741SFei.Feng@Sun.COM 	uint8_t	MacHTParamInfo;
39510741SFei.Feng@Sun.COM 	uint8_t	Rev;
39610741SFei.Feng@Sun.COM 	struct {
39710741SFei.Feng@Sun.COM 	    uint8_t ControlChan;
39810741SFei.Feng@Sun.COM 	    uint8_t AddChan;
39910741SFei.Feng@Sun.COM 	    uint8_t OpMode;
40010741SFei.Feng@Sun.COM 	    uint8_t stbc;
40110741SFei.Feng@Sun.COM 	} AddHtInfo;
40210741SFei.Feng@Sun.COM } MWL_HAL_PEERINFO;
40310741SFei.Feng@Sun.COM 
40410741SFei.Feng@Sun.COM typedef struct {
40510741SFei.Feng@Sun.COM 	uint8_t	McastRate;	/* rate for multicast frames */
40610741SFei.Feng@Sun.COM #define	RATE_MCS	0x80	/* rate is an MCS index */
40710741SFei.Feng@Sun.COM 	uint8_t	MgtRate;	/* rate for management frames */
40810741SFei.Feng@Sun.COM 	struct {
40910741SFei.Feng@Sun.COM 	    uint8_t TryCount;	/* try this many times */
41010741SFei.Feng@Sun.COM 	    uint8_t Rate;	/* use this tx rate */
41110741SFei.Feng@Sun.COM 	} RateSeries[4];	/* rate series */
41210741SFei.Feng@Sun.COM } MWL_HAL_TXRATE;
41310741SFei.Feng@Sun.COM 
41410741SFei.Feng@Sun.COM #pragma pack()
41510741SFei.Feng@Sun.COM 
41610741SFei.Feng@Sun.COM /* driver-specific node state */
41710741SFei.Feng@Sun.COM struct mwl_node {
41810741SFei.Feng@Sun.COM 	struct ieee80211_node	mn_node;	/* base class */
41910741SFei.Feng@Sun.COM 	struct mwl_ant_info	mn_ai;		/* antenna info */
42010741SFei.Feng@Sun.COM 	uint32_t	mn_avgrssi;	/* average rssi over all rx frames */
42110741SFei.Feng@Sun.COM 	uint16_t	mn_staid;	/* firmware station id */
42210741SFei.Feng@Sun.COM };
42310741SFei.Feng@Sun.COM #define	MWL_NODE(ni)		((struct mwl_node *)(ni))
42410741SFei.Feng@Sun.COM #define	MWL_NODE_CONST(ni)	((const struct mwl_node *)(ni))
42510741SFei.Feng@Sun.COM 
42610741SFei.Feng@Sun.COM /*
42710741SFei.Feng@Sun.COM  * DMA state for tx/rx.
42810741SFei.Feng@Sun.COM  */
42910741SFei.Feng@Sun.COM 
43010741SFei.Feng@Sun.COM /*
43110741SFei.Feng@Sun.COM  * Software backed version of tx/rx descriptors.  We keep
43210741SFei.Feng@Sun.COM  * the software state out of the h/w descriptor structure
43310741SFei.Feng@Sun.COM  * so that may be allocated in uncached memory w/o paying
43410741SFei.Feng@Sun.COM  * performance hit.
43510741SFei.Feng@Sun.COM  */
43610741SFei.Feng@Sun.COM struct dma_area {
43710741SFei.Feng@Sun.COM 	ddi_acc_handle_t	acc_hdl;	/* handle for memory */
43810741SFei.Feng@Sun.COM 	caddr_t			mem_va;		/* CPU VA of memory */
43910741SFei.Feng@Sun.COM 	uint32_t		nslots;		/* number of slots */
44010741SFei.Feng@Sun.COM 	uint32_t		size;		/* size per slot */
44110741SFei.Feng@Sun.COM 	size_t			alength;	/* allocated size */
44210741SFei.Feng@Sun.COM 	ddi_dma_handle_t	dma_hdl;	/* DMA handle */
44310741SFei.Feng@Sun.COM 	offset_t		offset;		/* relative to handle */
44410741SFei.Feng@Sun.COM 	ddi_dma_cookie_t	cookie;		/* associated cookie */
44510741SFei.Feng@Sun.COM 	uint32_t		ncookies;	/* must be 1 */
44610741SFei.Feng@Sun.COM 	uint32_t		token;		/* arbitrary identifier */
44710741SFei.Feng@Sun.COM };
44810741SFei.Feng@Sun.COM 
44910741SFei.Feng@Sun.COM struct mwl_rxbuf {
45010741SFei.Feng@Sun.COM 	struct dma_area		rxbuf_dma;	/* dma area for buf */
45110741SFei.Feng@Sun.COM 	uint32_t		bf_baddr;
45210741SFei.Feng@Sun.COM 	uint8_t			*bf_mem;
45310741SFei.Feng@Sun.COM 	void			*bf_desc;
45410741SFei.Feng@Sun.COM 	uint32_t		bf_daddr;
45510741SFei.Feng@Sun.COM };
45610741SFei.Feng@Sun.COM 
45710741SFei.Feng@Sun.COM struct mwl_rx_ring {
45810741SFei.Feng@Sun.COM 	struct dma_area		rxdesc_dma;
45910741SFei.Feng@Sun.COM 	uint32_t		physaddr;
46010741SFei.Feng@Sun.COM 	struct mwl_rxdesc	*desc;
46110741SFei.Feng@Sun.COM 	struct mwl_rxbuf	*buf;
46210741SFei.Feng@Sun.COM 	int			count;
46310741SFei.Feng@Sun.COM 	int			cur;
46410741SFei.Feng@Sun.COM 	int			next;
46510741SFei.Feng@Sun.COM };
46610741SFei.Feng@Sun.COM 
46710741SFei.Feng@Sun.COM struct mwl_txbuf {
46810741SFei.Feng@Sun.COM 	struct dma_area		txbuf_dma;
46910741SFei.Feng@Sun.COM 	uint32_t		bf_baddr;	/* physical addr of buf */
47010741SFei.Feng@Sun.COM 	uint8_t			*bf_mem;
47110741SFei.Feng@Sun.COM 	uint32_t		bf_daddr;	/* physical addr of desc */
47210741SFei.Feng@Sun.COM 	void 			*bf_desc;	/* h/w descriptor */
47310741SFei.Feng@Sun.COM 	int			bf_nseg;
47410741SFei.Feng@Sun.COM 	struct ieee80211_node	*bf_node;
47510741SFei.Feng@Sun.COM 	struct mwl_txq		*bf_txq;	/* backpointer to tx q/ring */
47610741SFei.Feng@Sun.COM };
47710741SFei.Feng@Sun.COM 
47810741SFei.Feng@Sun.COM struct mwl_tx_ring {
47910741SFei.Feng@Sun.COM 	struct dma_area		txdesc_dma;
48010741SFei.Feng@Sun.COM 	uint32_t		physaddr;
48110741SFei.Feng@Sun.COM 	struct mwl_txdesc	*desc;
48210741SFei.Feng@Sun.COM 	struct mwl_txbuf	*buf;
48310741SFei.Feng@Sun.COM 	int			qnum;	/* f/w q number */
48410741SFei.Feng@Sun.COM 	int			txpri;	/* f/w tx priority */
48510741SFei.Feng@Sun.COM 	int			count;
48610741SFei.Feng@Sun.COM 	int			queued;
48710741SFei.Feng@Sun.COM 	int			cur;
48810741SFei.Feng@Sun.COM 	int			next;
48910741SFei.Feng@Sun.COM 	int			stat;
49010741SFei.Feng@Sun.COM };
49110741SFei.Feng@Sun.COM 
49210741SFei.Feng@Sun.COM struct mwl_softc {
49310741SFei.Feng@Sun.COM 	ieee80211com_t		sc_ic;
49410741SFei.Feng@Sun.COM 	dev_info_t		*sc_dev;
49510741SFei.Feng@Sun.COM 
49610741SFei.Feng@Sun.COM 	/* ddi reg handler */
49710741SFei.Feng@Sun.COM 	ddi_acc_handle_t	sc_cfg_handle;
49810741SFei.Feng@Sun.COM 	caddr_t			sc_cfg_base;
49910741SFei.Feng@Sun.COM 
50010741SFei.Feng@Sun.COM 	/* bar0 handler */
50110741SFei.Feng@Sun.COM 	ddi_acc_handle_t	sc_mem_handle;
50210741SFei.Feng@Sun.COM 	caddr_t			sc_mem_base;
50310741SFei.Feng@Sun.COM 
50410741SFei.Feng@Sun.COM 	/* bar1 handler */
50510741SFei.Feng@Sun.COM 	ddi_acc_handle_t	sc_io_handle;
50610741SFei.Feng@Sun.COM 	caddr_t			sc_io_base;
50710741SFei.Feng@Sun.COM 
50810741SFei.Feng@Sun.COM 	uint16_t		sc_cachelsz;
50910741SFei.Feng@Sun.COM 	uint32_t		sc_dmabuf_size;
51010741SFei.Feng@Sun.COM 	uchar_t			sc_macaddr[6];
51110741SFei.Feng@Sun.COM 
51210741SFei.Feng@Sun.COM 	struct dma_area		sc_cmd_dma;
51310741SFei.Feng@Sun.COM 	uint16_t		*sc_cmd_mem;	/* f/w cmd buffer */
51410741SFei.Feng@Sun.COM 	uint32_t		sc_cmd_dmaaddr;	/* physaddr of cmd buffer */
51510741SFei.Feng@Sun.COM 
51610741SFei.Feng@Sun.COM 	int			sc_hw_flags;
51710741SFei.Feng@Sun.COM 	uint32_t		sc_flags;
51810741SFei.Feng@Sun.COM 
51910741SFei.Feng@Sun.COM 	/* SDRAM addr in the chipset */
52010741SFei.Feng@Sun.COM 	int			sc_SDRAMSIZE_Addr;
52110741SFei.Feng@Sun.COM 
52210741SFei.Feng@Sun.COM 	MWL_HAL_CHANNELINFO	sc_20M;
52310741SFei.Feng@Sun.COM 	MWL_HAL_CHANNELINFO	sc_40M;
52410741SFei.Feng@Sun.COM 	MWL_HAL_CHANNELINFO	sc_20M_5G;
52510741SFei.Feng@Sun.COM 	MWL_HAL_CHANNELINFO	sc_40M_5G;
52610741SFei.Feng@Sun.COM 
52710741SFei.Feng@Sun.COM 	struct mwl_hal_hwspec	sc_hwspecs;	/* h/w capabilities */
52810741SFei.Feng@Sun.COM 	MWL_DIAG_REVS		sc_revs;
52910741SFei.Feng@Sun.COM 
53010741SFei.Feng@Sun.COM 	int			sc_nchans;	/* # entries in ic_channels */
53110741SFei.Feng@Sun.COM 	struct mwl_channel 	sc_channels[IEEE80211_CHAN_MAX];
53210741SFei.Feng@Sun.COM 	struct mwl_channel 	*sc_cur_chan;
53310741SFei.Feng@Sun.COM 	MWL_HAL_CHANNEL		sc_curchan;
53410741SFei.Feng@Sun.COM 	struct mwl_regdomain 	sc_regdomain; /* regulatory data */
53510741SFei.Feng@Sun.COM 
53610741SFei.Feng@Sun.COM 	struct mwl_rx_ring	sc_rxring;
53710741SFei.Feng@Sun.COM 	struct mwl_tx_ring	sc_txring[MWL_NUM_TX_QUEUES];
53810741SFei.Feng@Sun.COM 	struct mwl_tx_ring	*sc_ac2q[5];	/* WME AC -> h/w q map */
53910741SFei.Feng@Sun.COM 
54010741SFei.Feng@Sun.COM 	struct mwl_hal_txrxdma	sc_hwdma;	/* h/w dma setup */
54110741SFei.Feng@Sun.COM 
54210741SFei.Feng@Sun.COM 	/* interrupt */
54310741SFei.Feng@Sun.COM 	ddi_iblock_cookie_t	sc_iblock;
54410741SFei.Feng@Sun.COM 	ddi_softint_handle_t	sc_softintr_hdl;
54510741SFei.Feng@Sun.COM 	ddi_intr_handle_t	*sc_intr_htable;
54610741SFei.Feng@Sun.COM 	uint_t			sc_intr_pri;
54710741SFei.Feng@Sun.COM 	uint32_t		sc_imask;	/* interrupt mask */
54810741SFei.Feng@Sun.COM 	uint32_t		sc_hal_imask;	/* interrupt mask copy */
54910741SFei.Feng@Sun.COM 	uint32_t		sc_rx_pend;
55010741SFei.Feng@Sun.COM 
55110741SFei.Feng@Sun.COM 	/* mutex lock */
55210741SFei.Feng@Sun.COM 	kmutex_t		sc_glock;
55310741SFei.Feng@Sun.COM 	kmutex_t		sc_rxlock;
55410741SFei.Feng@Sun.COM 	kmutex_t		sc_txlock;
55510741SFei.Feng@Sun.COM 
55610741SFei.Feng@Sun.COM 	uint16_t		sc_rxantenna;	/* rx antenna */
55710741SFei.Feng@Sun.COM 	uint16_t		sc_txantenna;	/* tx antenna */
55810741SFei.Feng@Sun.COM 
55910741SFei.Feng@Sun.COM 	timeout_id_t		sc_scan_id;
56010741SFei.Feng@Sun.COM 
56110741SFei.Feng@Sun.COM 	/* kstats */
56210741SFei.Feng@Sun.COM 	uint32_t		sc_tx_nobuf;
56310741SFei.Feng@Sun.COM 	uint32_t		sc_rx_nobuf;
56410741SFei.Feng@Sun.COM 	uint32_t		sc_tx_err;
56510741SFei.Feng@Sun.COM 	uint32_t		sc_rx_err;
56610741SFei.Feng@Sun.COM 	uint32_t		sc_tx_retries;
56710741SFei.Feng@Sun.COM 
56810741SFei.Feng@Sun.COM 	uint32_t		sc_need_sched;
56910741SFei.Feng@Sun.COM 	uint32_t		sc_rcr;
57010741SFei.Feng@Sun.COM 
57110741SFei.Feng@Sun.COM 	int			(*sc_newstate)(struct ieee80211com *,
57210741SFei.Feng@Sun.COM 				    enum ieee80211_state, int);
57310741SFei.Feng@Sun.COM };
57410741SFei.Feng@Sun.COM 
57510741SFei.Feng@Sun.COM #define	mwl_mem_write4(sc, off, x) \
57610741SFei.Feng@Sun.COM 	ddi_put32((sc)->sc_mem_handle, \
57710741SFei.Feng@Sun.COM 	(uint32_t *)((sc)->sc_mem_base + (off)), x)
57810741SFei.Feng@Sun.COM 
57910741SFei.Feng@Sun.COM #define	mwl_mem_read4(sc, off) \
58010741SFei.Feng@Sun.COM 	ddi_get32((sc)->sc_mem_handle, \
58110741SFei.Feng@Sun.COM 	(uint32_t *)((sc)->sc_mem_base + (off)))
58210741SFei.Feng@Sun.COM 
58310741SFei.Feng@Sun.COM #define	mwl_ctl_write4(sc, off, x) \
58410741SFei.Feng@Sun.COM 	ddi_put32((sc)->sc_io_handle, \
58510741SFei.Feng@Sun.COM 	(uint32_t *)((sc)->sc_io_base + (off)), x)
58610741SFei.Feng@Sun.COM 
58710741SFei.Feng@Sun.COM #define	mwl_ctl_read4(sc, off) \
58810741SFei.Feng@Sun.COM 	ddi_get32((sc)->sc_io_handle, \
58910741SFei.Feng@Sun.COM 	(uint32_t *)((sc)->sc_io_base + (off)))
59010741SFei.Feng@Sun.COM 
59110741SFei.Feng@Sun.COM #define	mwl_ctl_read1(sc, off) \
59210741SFei.Feng@Sun.COM 	ddi_get8((sc)->sc_io_handle, \
59310741SFei.Feng@Sun.COM 	(uint8_t *)((sc)->sc_io_base + (off)))
59410741SFei.Feng@Sun.COM 
59510741SFei.Feng@Sun.COM #define	_CMD_SETUP(pCmd, type, cmd) do {				\
59610741SFei.Feng@Sun.COM 	pCmd = (type *)&sc->sc_cmd_mem[0];				\
597*10747SFei.Feng@Sun.COM 	(void) memset(pCmd, 0, sizeof (type));				\
59810741SFei.Feng@Sun.COM 	pCmd->CmdHdr.Cmd = LE_16(cmd);					\
59910741SFei.Feng@Sun.COM 	pCmd->CmdHdr.Length = LE_16(sizeof (type));			\
60010741SFei.Feng@Sun.COM 	_NOTE(CONSTCOND)						\
60110741SFei.Feng@Sun.COM } while (0)
60210741SFei.Feng@Sun.COM 
60310741SFei.Feng@Sun.COM #define	_VCMD_SETUP(pCmd, type, cmd) do {				\
60410741SFei.Feng@Sun.COM 	_CMD_SETUP(pCmd, type, cmd);					\
60510741SFei.Feng@Sun.COM 	pCmd->CmdHdr.MacId = 8;						\
60610741SFei.Feng@Sun.COM 	_NOTE(CONSTCOND)						\
60710741SFei.Feng@Sun.COM } while (0)
60810741SFei.Feng@Sun.COM 
60910741SFei.Feng@Sun.COM #define	MWL_GLOCK(_sc)		mutex_enter(&(_sc)->sc_glock)
61010741SFei.Feng@Sun.COM #define	MWL_GUNLOCK(_sc)	mutex_exit(&(_sc)->sc_glock)
61110741SFei.Feng@Sun.COM 
61210741SFei.Feng@Sun.COM #define	MWL_RXLOCK(_sc)		mutex_enter(&(_sc)->sc_rxlock)
61310741SFei.Feng@Sun.COM #define	MWL_RXUNLOCK(_sc)	mutex_exit(&(_sc)->sc_rxlock)
61410741SFei.Feng@Sun.COM 
61510741SFei.Feng@Sun.COM #define	MWL_TXLOCK(_sc)		mutex_enter(&(_sc)->sc_txlock)
61610741SFei.Feng@Sun.COM #define	MWL_TXUNLOCK(_sc)	mutex_exit(&(_sc)->sc_txlock)
61710741SFei.Feng@Sun.COM 
61810741SFei.Feng@Sun.COM #define	MWL_F_RUNNING		(1 << 0)
61910741SFei.Feng@Sun.COM #define	MWL_F_SUSPEND		(1 << 1)
62010741SFei.Feng@Sun.COM #define	MWL_F_QUIESCE		(1 << 2)
62110741SFei.Feng@Sun.COM 
62210741SFei.Feng@Sun.COM #define	MWL_RCR_PROMISC		(1 << 0)
62310741SFei.Feng@Sun.COM #define	MWL_RCR_MULTI		(1 << 1)
62410741SFei.Feng@Sun.COM 
62510741SFei.Feng@Sun.COM #define	MWL_IS_RUNNING(_sc)	(((_sc)->sc_flags & MWL_F_RUNNING))
62610741SFei.Feng@Sun.COM #define	MWL_IS_SUSPEND(_sc)	(((_sc)->sc_flags & MWL_F_SUSPEND))
62710741SFei.Feng@Sun.COM #define	MWL_IS_QUIESCE(_sc)	(((_sc)->sc_flags & MWL_F_QUIESCE))
62810741SFei.Feng@Sun.COM 
62910741SFei.Feng@Sun.COM /*
63010741SFei.Feng@Sun.COM  * 802.11 regulatory domain definitions.
63110741SFei.Feng@Sun.COM  */
63210741SFei.Feng@Sun.COM enum ISOCountryCode {
63310741SFei.Feng@Sun.COM 	CTRY_AFGHANISTAN	= 4,
63410741SFei.Feng@Sun.COM 	CTRY_ALBANIA		= 8,	/* Albania */
63510741SFei.Feng@Sun.COM 	CTRY_ALGERIA		= 12,	/* Algeria */
63610741SFei.Feng@Sun.COM 	CTRY_AMERICAN_SAMOA	= 16,
63710741SFei.Feng@Sun.COM 	CTRY_ANDORRA		= 20,
63810741SFei.Feng@Sun.COM 	CTRY_ANGOLA		= 24,
63910741SFei.Feng@Sun.COM 	CTRY_ANGUILLA		= 660,
64010741SFei.Feng@Sun.COM 	CTRY_ANTARTICA		= 10,
64110741SFei.Feng@Sun.COM 	CTRY_ANTIGUA		= 28,	/* Antigua and Barbuda */
64210741SFei.Feng@Sun.COM 	CTRY_ARGENTINA		= 32,	/* Argentina */
64310741SFei.Feng@Sun.COM 	CTRY_ARMENIA		= 51,	/* Armenia */
64410741SFei.Feng@Sun.COM 	CTRY_ARUBA		= 533,	/* Aruba */
64510741SFei.Feng@Sun.COM 	CTRY_AUSTRALIA		= 36,	/* Australia */
64610741SFei.Feng@Sun.COM 	CTRY_AUSTRIA		= 40,	/* Austria */
64710741SFei.Feng@Sun.COM 	CTRY_AZERBAIJAN		= 31,	/* Azerbaijan */
64810741SFei.Feng@Sun.COM 	CTRY_BAHAMAS		= 44,	/* Bahamas */
64910741SFei.Feng@Sun.COM 	CTRY_BAHRAIN		= 48,	/* Bahrain */
65010741SFei.Feng@Sun.COM 	CTRY_BANGLADESH		= 50,	/* Bangladesh */
65110741SFei.Feng@Sun.COM 	CTRY_BARBADOS		= 52,
65210741SFei.Feng@Sun.COM 	CTRY_BELARUS		= 112,	/* Belarus */
65310741SFei.Feng@Sun.COM 	CTRY_BELGIUM		= 56,	/* Belgium */
65410741SFei.Feng@Sun.COM 	CTRY_BELIZE		= 84,
65510741SFei.Feng@Sun.COM 	CTRY_BENIN		= 204,
65610741SFei.Feng@Sun.COM 	CTRY_BERMUDA		= 60,
65710741SFei.Feng@Sun.COM 	CTRY_BHUTAN		= 64,
65810741SFei.Feng@Sun.COM 	CTRY_BOLIVIA		= 68,	/* Bolivia */
65910741SFei.Feng@Sun.COM 	CTRY_BOSNIA_AND_HERZEGOWINA = 70,
66010741SFei.Feng@Sun.COM 	CTRY_BOTSWANA		= 72,
66110741SFei.Feng@Sun.COM 	CTRY_BOUVET_ISLAND	= 74,
66210741SFei.Feng@Sun.COM 	CTRY_BRAZIL		= 76,	/* Brazil */
66310741SFei.Feng@Sun.COM 	CTRY_BRITISH_INDIAN_OCEAN_TERRITORY = 86,
66410741SFei.Feng@Sun.COM 	CTRY_BRUNEI_DARUSSALAM	= 96,	/* Brunei Darussalam */
66510741SFei.Feng@Sun.COM 	CTRY_BULGARIA		= 100,	/* Bulgaria */
66610741SFei.Feng@Sun.COM 	CTRY_BURKINA_FASO	= 854,
66710741SFei.Feng@Sun.COM 	CTRY_BURUNDI		= 108,
66810741SFei.Feng@Sun.COM 	CTRY_CAMBODIA		= 116,
66910741SFei.Feng@Sun.COM 	CTRY_CAMEROON		= 120,
67010741SFei.Feng@Sun.COM 	CTRY_CANADA		= 124,	/* Canada */
67110741SFei.Feng@Sun.COM 	CTRY_CAPE_VERDE		= 132,
67210741SFei.Feng@Sun.COM 	CTRY_CAYMAN_ISLANDS	= 136,
67310741SFei.Feng@Sun.COM 	CTRY_CENTRAL_AFRICAN_REPUBLIC = 140,
67410741SFei.Feng@Sun.COM 	CTRY_CHAD		= 148,
67510741SFei.Feng@Sun.COM 	CTRY_CHILE		= 152,	/* Chile */
67610741SFei.Feng@Sun.COM 	CTRY_CHINA		= 156,	/* People's Republic of China */
67710741SFei.Feng@Sun.COM 	CTRY_CHRISTMAS_ISLAND	= 162,
67810741SFei.Feng@Sun.COM 	CTRY_COCOS_ISLANDS	= 166,
67910741SFei.Feng@Sun.COM 	CTRY_COLOMBIA		= 170,	/* Colombia */
68010741SFei.Feng@Sun.COM 	CTRY_COMOROS		= 174,
68110741SFei.Feng@Sun.COM 	CTRY_CONGO		= 178,
68210741SFei.Feng@Sun.COM 	CTRY_COOK_ISLANDS	= 184,
68310741SFei.Feng@Sun.COM 	CTRY_COSTA_RICA		= 188,	/* Costa Rica */
68410741SFei.Feng@Sun.COM 	CTRY_COTE_DIVOIRE	= 384,
68510741SFei.Feng@Sun.COM 	CTRY_CROATIA		= 191,	/* Croatia (local name: Hrvatska) */
68610741SFei.Feng@Sun.COM 	CTRY_CYPRUS		= 196,	/* Cyprus */
68710741SFei.Feng@Sun.COM 	CTRY_CZECH		= 203,	/* Czech Republic */
68810741SFei.Feng@Sun.COM 	CTRY_DENMARK		= 208,	/* Denmark */
68910741SFei.Feng@Sun.COM 	CTRY_DJIBOUTI		= 262,
69010741SFei.Feng@Sun.COM 	CTRY_DOMINICA		= 212,
69110741SFei.Feng@Sun.COM 	CTRY_DOMINICAN_REPUBLIC	= 214,	/* Dominican Republic */
69210741SFei.Feng@Sun.COM 	CTRY_EAST_TIMOR		= 626,
69310741SFei.Feng@Sun.COM 	CTRY_ECUADOR		= 218,	/* Ecuador */
69410741SFei.Feng@Sun.COM 	CTRY_EGYPT		= 818,	/* Egypt */
69510741SFei.Feng@Sun.COM 	CTRY_EL_SALVADOR	= 222,	/* El Salvador */
69610741SFei.Feng@Sun.COM 	CTRY_EQUATORIAL_GUINEA	= 226,
69710741SFei.Feng@Sun.COM 	CTRY_ERITREA		= 232,
69810741SFei.Feng@Sun.COM 	CTRY_ESTONIA		= 233,	/* Estonia */
69910741SFei.Feng@Sun.COM 	CTRY_ETHIOPIA		= 210,
70010741SFei.Feng@Sun.COM 	CTRY_FALKLAND_ISLANDS	= 238,	/* (Malvinas) */
70110741SFei.Feng@Sun.COM 	CTRY_FAEROE_ISLANDS	= 234,	/* Faeroe Islands */
70210741SFei.Feng@Sun.COM 	CTRY_FIJI		= 242,
70310741SFei.Feng@Sun.COM 	CTRY_FINLAND		= 246,	/* Finland */
70410741SFei.Feng@Sun.COM 	CTRY_FRANCE		= 250,	/* France */
70510741SFei.Feng@Sun.COM 	CTRY_FRANCE2		= 255,	/* France (Metropolitan) */
70610741SFei.Feng@Sun.COM 	CTRY_FRENCH_GUIANA	= 254,
70710741SFei.Feng@Sun.COM 	CTRY_FRENCH_POLYNESIA	= 258,
70810741SFei.Feng@Sun.COM 	CTRY_FRENCH_SOUTHERN_TERRITORIES	= 260,
70910741SFei.Feng@Sun.COM 	CTRY_GABON		= 266,
71010741SFei.Feng@Sun.COM 	CTRY_GAMBIA		= 270,
71110741SFei.Feng@Sun.COM 	CTRY_GEORGIA		= 268,	/* Georgia */
71210741SFei.Feng@Sun.COM 	CTRY_GERMANY		= 276,	/* Germany */
71310741SFei.Feng@Sun.COM 	CTRY_GHANA		= 288,
71410741SFei.Feng@Sun.COM 	CTRY_GIBRALTAR		= 292,
71510741SFei.Feng@Sun.COM 	CTRY_GREECE		= 300,	/* Greece */
71610741SFei.Feng@Sun.COM 	CTRY_GREENLAND		= 304,
71710741SFei.Feng@Sun.COM 	CTRY_GRENADA		= 308,
71810741SFei.Feng@Sun.COM 	CTRY_GUADELOUPE		= 312,
71910741SFei.Feng@Sun.COM 	CTRY_GUAM		= 316,
72010741SFei.Feng@Sun.COM 	CTRY_GUATEMALA		= 320,	/* Guatemala */
72110741SFei.Feng@Sun.COM 	CTRY_GUINEA		= 324,
72210741SFei.Feng@Sun.COM 	CTRY_GUINEA_BISSAU	= 624,
72310741SFei.Feng@Sun.COM 	CTRY_GUYANA		= 328,
72410741SFei.Feng@Sun.COM 	/* XXX correct remainder */
72510741SFei.Feng@Sun.COM 	CTRY_HAITI		= 332,
72610741SFei.Feng@Sun.COM 	CTRY_HONDURAS		= 340,	/* Honduras */
72710741SFei.Feng@Sun.COM 	CTRY_HONG_KONG		= 344,	/* Hong Kong S.A.R., P.R.C. */
72810741SFei.Feng@Sun.COM 	CTRY_HUNGARY		= 348,	/* Hungary */
72910741SFei.Feng@Sun.COM 	CTRY_ICELAND		= 352,	/* Iceland */
73010741SFei.Feng@Sun.COM 	CTRY_INDIA		= 356,	/* India */
73110741SFei.Feng@Sun.COM 	CTRY_INDONESIA		= 360,	/* Indonesia */
73210741SFei.Feng@Sun.COM 	CTRY_IRAN		= 364,	/* Iran */
73310741SFei.Feng@Sun.COM 	CTRY_IRAQ		= 368,	/* Iraq */
73410741SFei.Feng@Sun.COM 	CTRY_IRELAND		= 372,	/* Ireland */
73510741SFei.Feng@Sun.COM 	CTRY_ISRAEL		= 376,	/* Israel */
73610741SFei.Feng@Sun.COM 	CTRY_ITALY		= 380,	/* Italy */
73710741SFei.Feng@Sun.COM 	CTRY_JAMAICA		= 388,	/* Jamaica */
73810741SFei.Feng@Sun.COM 	CTRY_JAPAN		= 392,	/* Japan */
73910741SFei.Feng@Sun.COM 	CTRY_JORDAN		= 400,	/* Jordan */
74010741SFei.Feng@Sun.COM 	CTRY_KAZAKHSTAN		= 398,	/* Kazakhstan */
74110741SFei.Feng@Sun.COM 	CTRY_KENYA		= 404,	/* Kenya */
74210741SFei.Feng@Sun.COM 	CTRY_KOREA_NORTH	= 408,	/* North Korea */
74310741SFei.Feng@Sun.COM 	CTRY_KOREA_ROC		= 410,	/* South Korea */
74410741SFei.Feng@Sun.COM 	CTRY_KOREA_ROC2		= 411,	/* South Korea */
74510741SFei.Feng@Sun.COM 	CTRY_KUWAIT		= 414,	/* Kuwait */
74610741SFei.Feng@Sun.COM 	CTRY_LATVIA		= 428,	/* Latvia */
74710741SFei.Feng@Sun.COM 	CTRY_LEBANON		= 422,	/* Lebanon */
74810741SFei.Feng@Sun.COM 	CTRY_LIBYA		= 434,	/* Libya */
74910741SFei.Feng@Sun.COM 	CTRY_LIECHTENSTEIN	= 438,	/* Liechtenstein */
75010741SFei.Feng@Sun.COM 	CTRY_LITHUANIA		= 440,	/* Lithuania */
75110741SFei.Feng@Sun.COM 	CTRY_LUXEMBOURG		= 442,	/* Luxembourg */
75210741SFei.Feng@Sun.COM 	CTRY_MACAU		= 446,	/* Macau */
75310741SFei.Feng@Sun.COM 	CTRY_MACEDONIA		= 807,	/* Macedonia */
75410741SFei.Feng@Sun.COM 	CTRY_MALAYSIA		= 458,	/* Malaysia */
75510741SFei.Feng@Sun.COM 	CTRY_MALTA		= 470,	/* Malta */
75610741SFei.Feng@Sun.COM 	CTRY_MEXICO		= 484,	/* Mexico */
75710741SFei.Feng@Sun.COM 	CTRY_MONACO		= 492,	/* Principality of Monaco */
75810741SFei.Feng@Sun.COM 	CTRY_MOROCCO		= 504,	/* Morocco */
75910741SFei.Feng@Sun.COM 	CTRY_NEPAL		= 524,	/* Nepal */
76010741SFei.Feng@Sun.COM 	CTRY_NETHERLANDS	= 528,	/* Netherlands */
76110741SFei.Feng@Sun.COM 	CTRY_NEW_ZEALAND	= 554,	/* New Zealand */
76210741SFei.Feng@Sun.COM 	CTRY_NICARAGUA		= 558,	/* Nicaragua */
76310741SFei.Feng@Sun.COM 	CTRY_NORWAY		= 578,	/* Norway */
76410741SFei.Feng@Sun.COM 	CTRY_OMAN		= 512,	/* Oman */
76510741SFei.Feng@Sun.COM 	CTRY_PAKISTAN		= 586,	/* Islamic Republic of Pakistan */
76610741SFei.Feng@Sun.COM 	CTRY_PANAMA		= 591,	/* Panama */
76710741SFei.Feng@Sun.COM 	CTRY_PARAGUAY		= 600,	/* Paraguay */
76810741SFei.Feng@Sun.COM 	CTRY_PERU		= 604,	/* Peru */
76910741SFei.Feng@Sun.COM 	CTRY_PHILIPPINES	= 608,	/* Republic of the Philippines */
77010741SFei.Feng@Sun.COM 	CTRY_POLAND		= 616,	/* Poland */
77110741SFei.Feng@Sun.COM 	CTRY_PORTUGAL		= 620,	/* Portugal */
77210741SFei.Feng@Sun.COM 	CTRY_PUERTO_RICO	= 630,	/* Puerto Rico */
77310741SFei.Feng@Sun.COM 	CTRY_QATAR		= 634,	/* Qatar */
77410741SFei.Feng@Sun.COM 	CTRY_ROMANIA		= 642,	/* Romania */
77510741SFei.Feng@Sun.COM 	CTRY_RUSSIA		= 643,	/* Russia */
77610741SFei.Feng@Sun.COM 	CTRY_SAUDI_ARABIA	= 682,	/* Saudi Arabia */
77710741SFei.Feng@Sun.COM 	CTRY_SINGAPORE		= 702,	/* Singapore */
77810741SFei.Feng@Sun.COM 	CTRY_SLOVAKIA		= 703,	/* Slovak Republic */
77910741SFei.Feng@Sun.COM 	CTRY_SLOVENIA		= 705,	/* Slovenia */
78010741SFei.Feng@Sun.COM 	CTRY_SOUTH_AFRICA	= 710,	/* South Africa */
78110741SFei.Feng@Sun.COM 	CTRY_SPAIN		= 724,	/* Spain */
78210741SFei.Feng@Sun.COM 	CTRY_SRILANKA		= 144,	/* Sri Lanka */
78310741SFei.Feng@Sun.COM 	CTRY_SWEDEN		= 752,	/* Sweden */
78410741SFei.Feng@Sun.COM 	CTRY_SWITZERLAND	= 756,	/* Switzerland */
78510741SFei.Feng@Sun.COM 	CTRY_SYRIA		= 760,	/* Syria */
78610741SFei.Feng@Sun.COM 	CTRY_TAIWAN		= 158,	/* Taiwan */
78710741SFei.Feng@Sun.COM 	CTRY_THAILAND		= 764,	/* Thailand */
78810741SFei.Feng@Sun.COM 	CTRY_TRINIDAD_Y_TOBAGO	= 780,	/* Trinidad y Tobago */
78910741SFei.Feng@Sun.COM 	CTRY_TUNISIA		= 788,	/* Tunisia */
79010741SFei.Feng@Sun.COM 	CTRY_TURKEY		= 792,	/* Turkey */
79110741SFei.Feng@Sun.COM 	CTRY_UAE		= 784,	/* U.A.E. */
79210741SFei.Feng@Sun.COM 	CTRY_UKRAINE		= 804,	/* Ukraine */
79310741SFei.Feng@Sun.COM 	CTRY_UNITED_KINGDOM	= 826,	/* United Kingdom */
79410741SFei.Feng@Sun.COM 	CTRY_UNITED_STATES	= 840,	/* United States */
79510741SFei.Feng@Sun.COM 	CTRY_URUGUAY		= 858,	/* Uruguay */
79610741SFei.Feng@Sun.COM 	CTRY_UZBEKISTAN		= 860,	/* Uzbekistan */
79710741SFei.Feng@Sun.COM 	CTRY_VENEZUELA		= 862,	/* Venezuela */
79810741SFei.Feng@Sun.COM 	CTRY_VIET_NAM		= 704,	/* Viet Nam */
79910741SFei.Feng@Sun.COM 	CTRY_YEMEN		= 887,	/* Yemen */
80010741SFei.Feng@Sun.COM 	CTRY_ZIMBABWE		= 716,	/* Zimbabwe */
80110741SFei.Feng@Sun.COM 
80210741SFei.Feng@Sun.COM 	/* NB: from here down not listed in 3166; they come from Atheros */
80310741SFei.Feng@Sun.COM 	CTRY_DEBUG		= 0x1ff, /* debug */
80410741SFei.Feng@Sun.COM 	CTRY_DEFAULT		= 0,	 /* default */
80510741SFei.Feng@Sun.COM 
80610741SFei.Feng@Sun.COM 	CTRY_UNITED_STATES_FCC49 = 842,	/* United States (Public Safety) */
80710741SFei.Feng@Sun.COM 	CTRY_KOREA_ROC3		= 412,	/* South Korea */
80810741SFei.Feng@Sun.COM 
80910741SFei.Feng@Sun.COM 	CTRY_JAPAN1		= 393,	/* Japan (JP1) */
81010741SFei.Feng@Sun.COM 	CTRY_JAPAN2		= 394,	/* Japan (JP0) */
81110741SFei.Feng@Sun.COM 	CTRY_JAPAN3		= 395,	/* Japan (JP1-1) */
81210741SFei.Feng@Sun.COM 	CTRY_JAPAN4		= 396,	/* Japan (JE1) */
81310741SFei.Feng@Sun.COM 	CTRY_JAPAN5		= 397,	/* Japan (JE2) */
81410741SFei.Feng@Sun.COM 	CTRY_JAPAN6		= 399,	/* Japan (JP6) */
81510741SFei.Feng@Sun.COM 	CTRY_JAPAN7		= 4007,	/* Japan (J7) */
81610741SFei.Feng@Sun.COM 	CTRY_JAPAN8		= 4008,	/* Japan (J8) */
81710741SFei.Feng@Sun.COM 	CTRY_JAPAN9		= 4009,	/* Japan (J9) */
81810741SFei.Feng@Sun.COM 	CTRY_JAPAN10		= 4010,	/* Japan (J10) */
81910741SFei.Feng@Sun.COM 	CTRY_JAPAN11		= 4011,	/* Japan (J11) */
82010741SFei.Feng@Sun.COM 	CTRY_JAPAN12		= 4012,	/* Japan (J12) */
82110741SFei.Feng@Sun.COM 	CTRY_JAPAN13		= 4013,	/* Japan (J13) */
82210741SFei.Feng@Sun.COM 	CTRY_JAPAN14		= 4014,	/* Japan (J14) */
82310741SFei.Feng@Sun.COM 	CTRY_JAPAN15		= 4015,	/* Japan (J15) */
82410741SFei.Feng@Sun.COM 	CTRY_JAPAN16		= 4016,	/* Japan (J16) */
82510741SFei.Feng@Sun.COM 	CTRY_JAPAN17		= 4017,	/* Japan (J17) */
82610741SFei.Feng@Sun.COM 	CTRY_JAPAN18		= 4018,	/* Japan (J18) */
82710741SFei.Feng@Sun.COM 	CTRY_JAPAN19		= 4019,	/* Japan (J19) */
82810741SFei.Feng@Sun.COM 	CTRY_JAPAN20		= 4020,	/* Japan (J20) */
82910741SFei.Feng@Sun.COM 	CTRY_JAPAN21		= 4021,	/* Japan (J21) */
83010741SFei.Feng@Sun.COM 	CTRY_JAPAN22		= 4022,	/* Japan (J22) */
83110741SFei.Feng@Sun.COM 	CTRY_JAPAN23		= 4023,	/* Japan (J23) */
83210741SFei.Feng@Sun.COM 	CTRY_JAPAN24		= 4024,	/* Japan (J24) */
83310741SFei.Feng@Sun.COM };
83410741SFei.Feng@Sun.COM 
83510741SFei.Feng@Sun.COM enum RegdomainCode {
83610741SFei.Feng@Sun.COM 	SKU_FCC			= 0x10,	/* FCC, aka United States */
83710741SFei.Feng@Sun.COM 	SKU_CA			= 0x20,	/* North America, aka Canada */
83810741SFei.Feng@Sun.COM 	SKU_ETSI		= 0x30,	/* Europe */
83910741SFei.Feng@Sun.COM 	SKU_ETSI2		= 0x32,	/* Europe w/o HT40 in 5GHz */
84010741SFei.Feng@Sun.COM 	SKU_ETSI3		= 0x33,	/* Europe - channel 36 */
84110741SFei.Feng@Sun.COM 	SKU_FCC3		= 0x3a,	/* FCC w/5470 band, 11h, DFS */
84210741SFei.Feng@Sun.COM 	SKU_JAPAN		= 0x40,
84310741SFei.Feng@Sun.COM 	SKU_KOREA		= 0x45,
84410741SFei.Feng@Sun.COM 	SKU_APAC		= 0x50,	/* Asia Pacific */
84510741SFei.Feng@Sun.COM 	SKU_APAC2		= 0x51,	/* Asia Pacific w/ DFS on mid-band */
84610741SFei.Feng@Sun.COM 	SKU_APAC3		= 0x5d,	/* Asia Pacific w/o ISM band */
84710741SFei.Feng@Sun.COM 	SKU_ROW			= 0x81,	/* China/Taiwan/Rest of World */
84810741SFei.Feng@Sun.COM 	SKU_NONE		= 0xf0,	/* "Region Free" */
84910741SFei.Feng@Sun.COM 	SKU_DEBUG		= 0x1ff,
85010741SFei.Feng@Sun.COM 
85110741SFei.Feng@Sun.COM 	/* NB: from here down private */
85210741SFei.Feng@Sun.COM 	SKU_SR9			= 0x0298, /* Ubiquiti SR9 (900MHz/GSM) */
85310741SFei.Feng@Sun.COM 	SKU_XR9			= 0x0299, /* Ubiquiti XR9 (900MHz/GSM) */
85410741SFei.Feng@Sun.COM 	SKU_GZ901		= 0x029a, /* Zcomax GZ-901 (900MHz/GSM) */
85510741SFei.Feng@Sun.COM };
85610741SFei.Feng@Sun.COM 
85710741SFei.Feng@Sun.COM /*
85810741SFei.Feng@Sun.COM  * Set regdomain code (IEEE SKU).
85910741SFei.Feng@Sun.COM  */
86010741SFei.Feng@Sun.COM enum {
86110741SFei.Feng@Sun.COM 	DOMAIN_CODE_FCC		= 0x10,	/* USA */
86210741SFei.Feng@Sun.COM 	DOMAIN_CODE_IC		= 0x20,	/* Canda */
86310741SFei.Feng@Sun.COM 	DOMAIN_CODE_ETSI	= 0x30,	/* Europe */
86410741SFei.Feng@Sun.COM 	DOMAIN_CODE_SPAIN	= 0x31,	/* Spain */
86510741SFei.Feng@Sun.COM 	DOMAIN_CODE_FRANCE	= 0x32,	/* France */
86610741SFei.Feng@Sun.COM 	DOMAIN_CODE_ETSI_131	= 0x130, /* ETSI w/ 1.3.1 radar type */
86710741SFei.Feng@Sun.COM 	DOMAIN_CODE_MKK		= 0x40,	/* Japan */
86810741SFei.Feng@Sun.COM 	DOMAIN_CODE_MKK2	= 0x41,	/* Japan w/ 10MHz chan spacing */
86910741SFei.Feng@Sun.COM 	DOMAIN_CODE_DGT		= 0x80,	/* Taiwan */
87010741SFei.Feng@Sun.COM 	DOMAIN_CODE_AUS		= 0x81,	/* Australia */
87110741SFei.Feng@Sun.COM };
87210741SFei.Feng@Sun.COM 
87310741SFei.Feng@Sun.COM 
87410741SFei.Feng@Sun.COM #ifdef __cplusplus
87510741SFei.Feng@Sun.COM }
87610741SFei.Feng@Sun.COM #endif
87710741SFei.Feng@Sun.COM 
87810741SFei.Feng@Sun.COM #endif /* _MWL_VAR_H */
879