100b3ed16SGreg Kroah-Hartman /* hfa384x.h
200b3ed16SGreg Kroah-Hartman *
300b3ed16SGreg Kroah-Hartman * Defines the constants and data structures for the hfa384x
400b3ed16SGreg Kroah-Hartman *
500b3ed16SGreg Kroah-Hartman * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
600b3ed16SGreg Kroah-Hartman * --------------------------------------------------------------------
700b3ed16SGreg Kroah-Hartman *
800b3ed16SGreg Kroah-Hartman * linux-wlan
900b3ed16SGreg Kroah-Hartman *
1000b3ed16SGreg Kroah-Hartman *   The contents of this file are subject to the Mozilla Public
1100b3ed16SGreg Kroah-Hartman *   License Version 1.1 (the "License"); you may not use this file
1200b3ed16SGreg Kroah-Hartman *   except in compliance with the License. You may obtain a copy of
1300b3ed16SGreg Kroah-Hartman *   the License at http://www.mozilla.org/MPL/
1400b3ed16SGreg Kroah-Hartman *
1500b3ed16SGreg Kroah-Hartman *   Software distributed under the License is distributed on an "AS
1600b3ed16SGreg Kroah-Hartman *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
1700b3ed16SGreg Kroah-Hartman *   implied. See the License for the specific language governing
1800b3ed16SGreg Kroah-Hartman *   rights and limitations under the License.
1900b3ed16SGreg Kroah-Hartman *
2000b3ed16SGreg Kroah-Hartman *   Alternatively, the contents of this file may be used under the
2100b3ed16SGreg Kroah-Hartman *   terms of the GNU Public License version 2 (the "GPL"), in which
2200b3ed16SGreg Kroah-Hartman *   case the provisions of the GPL are applicable instead of the
2300b3ed16SGreg Kroah-Hartman *   above.  If you wish to allow the use of your version of this file
2400b3ed16SGreg Kroah-Hartman *   only under the terms of the GPL and not to allow others to use
2500b3ed16SGreg Kroah-Hartman *   your version of this file under the MPL, indicate your decision
2600b3ed16SGreg Kroah-Hartman *   by deleting the provisions above and replace them with the notice
2700b3ed16SGreg Kroah-Hartman *   and other provisions required by the GPL.  If you do not delete
2800b3ed16SGreg Kroah-Hartman *   the provisions above, a recipient may use your version of this
2900b3ed16SGreg Kroah-Hartman *   file under either the MPL or the GPL.
3000b3ed16SGreg Kroah-Hartman *
3100b3ed16SGreg Kroah-Hartman * --------------------------------------------------------------------
3200b3ed16SGreg Kroah-Hartman *
3300b3ed16SGreg Kroah-Hartman * Inquiries regarding the linux-wlan Open Source project can be
3400b3ed16SGreg Kroah-Hartman * made directly to:
3500b3ed16SGreg Kroah-Hartman *
3600b3ed16SGreg Kroah-Hartman * AbsoluteValue Systems Inc.
3700b3ed16SGreg Kroah-Hartman * info@linux-wlan.com
3800b3ed16SGreg Kroah-Hartman * http://www.linux-wlan.com
3900b3ed16SGreg Kroah-Hartman *
4000b3ed16SGreg Kroah-Hartman * --------------------------------------------------------------------
4100b3ed16SGreg Kroah-Hartman *
4200b3ed16SGreg Kroah-Hartman * Portions of the development of this software were funded by
4300b3ed16SGreg Kroah-Hartman * Intersil Corporation as part of PRISM(R) chipset product development.
4400b3ed16SGreg Kroah-Hartman *
4500b3ed16SGreg Kroah-Hartman * --------------------------------------------------------------------
4600b3ed16SGreg Kroah-Hartman *
4700b3ed16SGreg Kroah-Hartman *   [Implementation and usage notes]
4800b3ed16SGreg Kroah-Hartman *
4900b3ed16SGreg Kroah-Hartman *   [References]
5000b3ed16SGreg Kroah-Hartman *	CW10 Programmer's Manual v1.5
5100b3ed16SGreg Kroah-Hartman *	IEEE 802.11 D10.0
5200b3ed16SGreg Kroah-Hartman *
5300b3ed16SGreg Kroah-Hartman * --------------------------------------------------------------------
5400b3ed16SGreg Kroah-Hartman */
5500b3ed16SGreg Kroah-Hartman 
5600b3ed16SGreg Kroah-Hartman #ifndef _HFA384x_H
5700b3ed16SGreg Kroah-Hartman #define _HFA384x_H
5800b3ed16SGreg Kroah-Hartman 
5900b3ed16SGreg Kroah-Hartman #define HFA384x_FIRMWARE_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
6000b3ed16SGreg Kroah-Hartman 
6128b17a4bSMoritz Muehlenhoff #include <linux/if_ether.h>
622e380275SKumar Amit Mehta #include <linux/usb.h>
6328b17a4bSMoritz Muehlenhoff 
6400b3ed16SGreg Kroah-Hartman /*--- Mins & Maxs -----------------------------------*/
65aaad4303SSolomon Peachy #define	HFA384x_PORTID_MAX		((u16)7)
66aaad4303SSolomon Peachy #define	HFA384x_NUMPORTS_MAX		((u16)(HFA384x_PORTID_MAX + 1))
67aaad4303SSolomon Peachy #define	HFA384x_PDR_LEN_MAX		((u16)512) /* in bytes, from EK */
6876e3e7c4SKarl Relton #define	HFA384x_PDA_RECS_MAX		((u16)200) /* a guess */
69aaad4303SSolomon Peachy #define	HFA384x_PDA_LEN_MAX		((u16)1024) /* in bytes, from EK*/
70aaad4303SSolomon Peachy #define	HFA384x_SCANRESULT_MAX		((u16)31)
71aaad4303SSolomon Peachy #define	HFA384x_HSCANRESULT_MAX		((u16)31)
72aaad4303SSolomon Peachy #define	HFA384x_CHINFORESULT_MAX	((u16)16)
7300b3ed16SGreg Kroah-Hartman #define	HFA384x_RID_GUESSING_MAXLEN	2048	/* I'm not really sure */
7400b3ed16SGreg Kroah-Hartman #define	HFA384x_RIDDATA_MAXLEN		HFA384x_RID_GUESSING_MAXLEN
7500b3ed16SGreg Kroah-Hartman #define	HFA384x_USB_RWMEM_MAXLEN	2048
7600b3ed16SGreg Kroah-Hartman 
7700b3ed16SGreg Kroah-Hartman /*--- Support Constants -----------------------------*/
78aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_IBSS			((u16)0)
79aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_BSS			((u16)1)
80aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_PSUEDOIBSS		((u16)3)
817f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_PRIVINVOKED		((u16)BIT(0))
827f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_EXCLUDE		((u16)BIT(1))
837f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_DISABLE_TXCRYPT	((u16)BIT(4))
847f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_DISABLE_RXCRYPT	((u16)BIT(7))
85aaad4303SSolomon Peachy #define		HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM	((u16)3)
86aaad4303SSolomon Peachy #define		HFA384x_PORTSTATUS_DISABLED		((u16)1)
87aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_1			((u16)1)
88aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_2			((u16)2)
89aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_5dot5			((u16)4)
90aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_11			((u16)8)
9100b3ed16SGreg Kroah-Hartman 
9200b3ed16SGreg Kroah-Hartman /*--- MAC Internal memory constants and macros ------*/
9300b3ed16SGreg Kroah-Hartman /* masks and macros used to manipulate MAC internal memory addresses. */
9400b3ed16SGreg Kroah-Hartman /* MAC internal memory addresses are 23 bit quantities.  The MAC uses
9500b3ed16SGreg Kroah-Hartman  * a paged address space where the upper 16 bits are the page number
9600b3ed16SGreg Kroah-Hartman  * and the lower 7 bits are the offset.  There are various Host API
9700b3ed16SGreg Kroah-Hartman  * elements that require two 16-bit quantities to specify a MAC
9800b3ed16SGreg Kroah-Hartman  * internal memory address.  Unfortunately, some of the API's use a
9900b3ed16SGreg Kroah-Hartman  * page/offset format where the offset value is JUST the lower seven
10000b3ed16SGreg Kroah-Hartman  * bits and the page is  the remaining 16 bits.  Some of the API's
10100b3ed16SGreg Kroah-Hartman  * assume that the 23 bit address has been split at the 16th bit.  We
10200b3ed16SGreg Kroah-Hartman  * refer to these two formats as AUX format and CMD format.  The
10300b3ed16SGreg Kroah-Hartman  * macros below help handle some of this.
10400b3ed16SGreg Kroah-Hartman  */
10500b3ed16SGreg Kroah-Hartman 
10600b3ed16SGreg Kroah-Hartman /* Mask bits for discarding unwanted pieces in a flat address */
10700b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_AUX_PAGE_MASK	(0x007fff80)
10800b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_AUX_OFF_MASK	(0x0000007f)
10900b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_CMD_PAGE_MASK	(0xffff0000)
11000b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_CMD_OFF_MASK	(0x0000ffff)
11100b3ed16SGreg Kroah-Hartman 
112e573aaa4SMoritz Muehlenhoff /* Mask bits for discarding unwanted pieces in AUX format
11395842bc9SJuliana Rodrigues  * 16-bit address parts
11495842bc9SJuliana Rodrigues  */
11500b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_PAGE_MASK	(0xffff)
11600b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_OFF_MASK	(0x007f)
11700b3ed16SGreg Kroah-Hartman 
11800b3ed16SGreg Kroah-Hartman /* Make a 32-bit flat address from AUX format 16-bit page and offset */
11900b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_MKFLAT(p, o)	\
1205dd8acc8SSvenne Krap 		((((u32)(((u16)(p)) & HFA384x_ADDR_AUX_PAGE_MASK)) << 7) | \
1215dd8acc8SSvenne Krap 		((u32)(((u16)(o)) & HFA384x_ADDR_AUX_OFF_MASK)))
12200b3ed16SGreg Kroah-Hartman 
12300b3ed16SGreg Kroah-Hartman /* Make CMD format offset and page from a 32-bit flat address */
12400b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_CMD_MKPAGE(f) \
125aaad4303SSolomon Peachy 		((u16)((((u32)(f)) & HFA384x_ADDR_FLAT_CMD_PAGE_MASK) >> 16))
12600b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_CMD_MKOFF(f) \
127aaad4303SSolomon Peachy 		((u16)(((u32)(f)) & HFA384x_ADDR_FLAT_CMD_OFF_MASK))
12800b3ed16SGreg Kroah-Hartman 
12900b3ed16SGreg Kroah-Hartman /*--- Controller Memory addresses -------------------*/
13000b3ed16SGreg Kroah-Hartman #define		HFA3842_PDA_BASE	(0x007f0000UL)
13100b3ed16SGreg Kroah-Hartman #define		HFA3841_PDA_BASE	(0x003f0000UL)
13200b3ed16SGreg Kroah-Hartman #define		HFA3841_PDA_BOGUS_BASE	(0x00390000UL)
13300b3ed16SGreg Kroah-Hartman 
13400b3ed16SGreg Kroah-Hartman /*--- Driver Download states  -----------------------*/
13500b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_DISABLED		0
13600b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_RAMENABLED		1
13700b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_FLASHENABLED		2
13800b3ed16SGreg Kroah-Hartman 
13900b3ed16SGreg Kroah-Hartman /*--- Register Field Masks --------------------------*/
14071508ee4SAlessandro Ghedini #define		HFA384x_CMD_AINFO		((u16)(BIT(14) | BIT(13) \
14171508ee4SAlessandro Ghedini 							| BIT(12) | BIT(11) \
14271508ee4SAlessandro Ghedini 							| BIT(10) | BIT(9) \
14371508ee4SAlessandro Ghedini 							| BIT(8)))
14471508ee4SAlessandro Ghedini #define		HFA384x_CMD_MACPORT		((u16)(BIT(10) | BIT(9) | \
14571508ee4SAlessandro Ghedini 							BIT(8)))
1467f6e0e44SMoritz Muehlenhoff #define		HFA384x_CMD_PROGMODE		((u16)(BIT(9) | BIT(8)))
14771508ee4SAlessandro Ghedini #define		HFA384x_CMD_CMDCODE		((u16)(BIT(5) | BIT(4) | \
14871508ee4SAlessandro Ghedini 							BIT(3) | BIT(2) | \
14971508ee4SAlessandro Ghedini 							BIT(1) | BIT(0)))
15000b3ed16SGreg Kroah-Hartman 
15171508ee4SAlessandro Ghedini #define		HFA384x_STATUS_RESULT		((u16)(BIT(14) | BIT(13) \
15271508ee4SAlessandro Ghedini 							| BIT(12) | BIT(11) \
15371508ee4SAlessandro Ghedini 							| BIT(10) | BIT(9) \
15471508ee4SAlessandro Ghedini 							| BIT(8)))
15500b3ed16SGreg Kroah-Hartman 
15600b3ed16SGreg Kroah-Hartman /*--- Command Code Constants --------------------------*/
15700b3ed16SGreg Kroah-Hartman /*--- Controller Commands --------------------------*/
158aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INIT		((u16)0x00)
159aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_ENABLE		((u16)0x01)
160aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DISABLE		((u16)0x02)
16100b3ed16SGreg Kroah-Hartman 
16200b3ed16SGreg Kroah-Hartman /*--- Regulate Commands --------------------------*/
163aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INQ		((u16)0x11)
16400b3ed16SGreg Kroah-Hartman 
16500b3ed16SGreg Kroah-Hartman /*--- Configure Commands --------------------------*/
166aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DOWNLD		((u16)0x22)
16700b3ed16SGreg Kroah-Hartman 
16800b3ed16SGreg Kroah-Hartman /*--- Debugging Commands -----------------------------*/
169aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_MONITOR		((u16)(0x38))
170aaad4303SSolomon Peachy #define		HFA384x_MONITOR_ENABLE		((u16)(0x0b))
171aaad4303SSolomon Peachy #define		HFA384x_MONITOR_DISABLE		((u16)(0x0f))
17200b3ed16SGreg Kroah-Hartman 
17300b3ed16SGreg Kroah-Hartman /*--- Result Codes --------------------------*/
174aaad4303SSolomon Peachy #define		HFA384x_CMD_ERR			((u16)(0x7F))
17500b3ed16SGreg Kroah-Hartman 
17600b3ed16SGreg Kroah-Hartman /*--- Programming Modes --------------------------
17700b3ed16SGreg Kroah-Hartman 	MODE 0: Disable programming
17800b3ed16SGreg Kroah-Hartman 	MODE 1: Enable volatile memory programming
17900b3ed16SGreg Kroah-Hartman 	MODE 2: Enable non-volatile memory programming
18000b3ed16SGreg Kroah-Hartman 	MODE 3: Program non-volatile memory section
18100b3ed16SGreg Kroah-Hartman --------------------------------------------------*/
182aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_DISABLE	((u16)0x00)
183aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_RAM		((u16)0x01)
184aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NV		((u16)0x02)
185aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NVWRITE	((u16)0x03)
18600b3ed16SGreg Kroah-Hartman 
18700b3ed16SGreg Kroah-Hartman /*--- Record ID Constants --------------------------*/
18800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
18900b3ed16SGreg Kroah-Hartman Configuration RIDs: Network Parameters, Static Configuration Entities
19000b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
191aaad4303SSolomon Peachy #define		HFA384x_RID_CNFPORTTYPE		((u16)0xFC00)
192aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR	((u16)0xFC01)
193aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID	((u16)0xFC02)
194aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNCHANNEL	((u16)0xFC03)
195aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID		((u16)0xFC04)
196aaad4303SSolomon Peachy #define		HFA384x_RID_CNFMAXDATALEN	((u16)0xFC07)
19700b3ed16SGreg Kroah-Hartman 
19800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
19900b3ed16SGreg Kroah-Hartman Configuration RID lengths: Network Params, Static Config Entities
20000b3ed16SGreg Kroah-Hartman   This is the length of JUST the DATA part of the RID (does not
20100b3ed16SGreg Kroah-Hartman   include the len or code fields)
20200b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
203aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR_LEN	((u16)6)
204aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID_LEN	((u16)34)
205aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID_LEN	((u16)34)
20600b3ed16SGreg Kroah-Hartman 
20700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
20800b3ed16SGreg Kroah-Hartman Configuration RIDs: Network Parameters, Dynamic Configuration Entities
20900b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
210aaad4303SSolomon Peachy #define		HFA384x_RID_CREATEIBSS		((u16)0xFC81)
211aaad4303SSolomon Peachy #define		HFA384x_RID_FRAGTHRESH		((u16)0xFC82)
212aaad4303SSolomon Peachy #define		HFA384x_RID_RTSTHRESH		((u16)0xFC83)
213aaad4303SSolomon Peachy #define		HFA384x_RID_TXRATECNTL		((u16)0xFC84)
214aaad4303SSolomon Peachy #define		HFA384x_RID_PROMISCMODE		((u16)0xFC85)
21500b3ed16SGreg Kroah-Hartman 
21600b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
21700b3ed16SGreg Kroah-Hartman Information RIDs: NIC Information
21800b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
219aaad4303SSolomon Peachy #define		HFA384x_RID_MAXLOADTIME		((u16)0xFD00)
220aaad4303SSolomon Peachy #define		HFA384x_RID_DOWNLOADBUFFER	((u16)0xFD01)
221aaad4303SSolomon Peachy #define		HFA384x_RID_PRIIDENTITY		((u16)0xFD02)
222aaad4303SSolomon Peachy #define		HFA384x_RID_PRISUPRANGE		((u16)0xFD03)
223aaad4303SSolomon Peachy #define		HFA384x_RID_PRI_CFIACTRANGES	((u16)0xFD04)
224aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER	((u16)0xFD0A)
225aaad4303SSolomon Peachy #define		HFA384x_RID_NICIDENTITY		((u16)0xFD0B)
226aaad4303SSolomon Peachy #define		HFA384x_RID_MFISUPRANGE		((u16)0xFD0C)
227aaad4303SSolomon Peachy #define		HFA384x_RID_CFISUPRANGE		((u16)0xFD0D)
228aaad4303SSolomon Peachy #define		HFA384x_RID_STAIDENTITY		((u16)0xFD20)
229aaad4303SSolomon Peachy #define		HFA384x_RID_STASUPRANGE		((u16)0xFD21)
230aaad4303SSolomon Peachy #define		HFA384x_RID_STA_MFIACTRANGES	((u16)0xFD22)
231aaad4303SSolomon Peachy #define		HFA384x_RID_STA_CFIACTRANGES	((u16)0xFD23)
23200b3ed16SGreg Kroah-Hartman 
23300b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
23400b3ed16SGreg Kroah-Hartman Information RID Lengths: NIC Information
23500b3ed16SGreg Kroah-Hartman   This is the length of JUST the DATA part of the RID (does not
23600b3ed16SGreg Kroah-Hartman   include the len or code fields)
23700b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
238aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER_LEN		((u16)12)
23900b3ed16SGreg Kroah-Hartman 
24000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
24100b3ed16SGreg Kroah-Hartman Information RIDs:  MAC Information
24200b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
243aaad4303SSolomon Peachy #define		HFA384x_RID_PORTSTATUS		((u16)0xFD40)
244aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTSSID		((u16)0xFD41)
245aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTBSSID	((u16)0xFD42)
246aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTTXRATE	((u16)0xFD44)
247aaad4303SSolomon Peachy #define		HFA384x_RID_SHORTRETRYLIMIT	((u16)0xFD48)
248aaad4303SSolomon Peachy #define		HFA384x_RID_LONGRETRYLIMIT	((u16)0xFD49)
249aaad4303SSolomon Peachy #define		HFA384x_RID_MAXTXLIFETIME	((u16)0xFD4A)
250aaad4303SSolomon Peachy #define		HFA384x_RID_PRIVACYOPTIMP	((u16)0xFD4F)
251aaad4303SSolomon Peachy #define		HFA384x_RID_DBMCOMMSQUALITY	((u16)0xFD51)
25200b3ed16SGreg Kroah-Hartman 
25300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
25400b3ed16SGreg Kroah-Hartman Information RID Lengths:  MAC Information
25500b3ed16SGreg Kroah-Hartman   This is the length of JUST the DATA part of the RID (does not
25600b3ed16SGreg Kroah-Hartman   include the len or code fields)
25700b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
25871508ee4SAlessandro Ghedini #define		HFA384x_RID_DBMCOMMSQUALITY_LEN	 \
25971508ee4SAlessandro Ghedini 	((u16) sizeof(hfa384x_dbmcommsquality_t))
26071508ee4SAlessandro Ghedini #define		HFA384x_RID_JOINREQUEST_LEN \
26171508ee4SAlessandro Ghedini 	((u16)sizeof(hfa384x_JoinRequest_data_t))
26240a67411SMoritz Muehlenhoff 
26300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
26400b3ed16SGreg Kroah-Hartman Information RIDs:  Modem Information
26500b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
266aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTCHANNEL	((u16)0xFDC1)
26700b3ed16SGreg Kroah-Hartman 
26800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
26900b3ed16SGreg Kroah-Hartman API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
27000b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
271aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEYID	((u16)0xFC23)
272aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY0	((u16)0xFC24)
273aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY1	((u16)0xFC25)
274aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY2	((u16)0xFC26)
275aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY3	((u16)0xFC27)
276aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPFLAGS		((u16)0xFC28)
277aaad4303SSolomon Peachy #define		HFA384x_RID_CNFAUTHENTICATION	((u16)0xFC2A)
278aaad4303SSolomon Peachy #define		HFA384x_RID_CNFROAMINGMODE	((u16)0xFC2D)
279aaad4303SSolomon Peachy #define		HFA384x_RID_CNFAPBCNint		((u16)0xFC33)
280e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFDBMADJUST	((u16)0xFC46)
281e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFWPADATA		((u16)0xFC48)
282aaad4303SSolomon Peachy #define		HFA384x_RID_CNFBASICRATES	((u16)0xFCB3)
283aaad4303SSolomon Peachy #define		HFA384x_RID_CNFSUPPRATES	((u16)0xFCB4)
284e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFPASSIVESCANCTRL	((u16)0xFCBA)
285e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_TXPOWERMAX		((u16)0xFCBE)
286aaad4303SSolomon Peachy #define		HFA384x_RID_JOINREQUEST		((u16)0xFCE2)
287aaad4303SSolomon Peachy #define		HFA384x_RID_AUTHENTICATESTA	((u16)0xFCE3)
288e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_HOSTSCAN		((u16)0xFCE5)
28900b3ed16SGreg Kroah-Hartman 
290aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY_LEN	((u16)6)
291aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEP128DEFAULTKEY_LEN	((u16)14)
29240a67411SMoritz Muehlenhoff 
29300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
29400b3ed16SGreg Kroah-Hartman PD Record codes
29500b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
296aaad4303SSolomon Peachy #define HFA384x_PDR_PCB_PARTNUM		((u16)0x0001)
297aaad4303SSolomon Peachy #define HFA384x_PDR_PDAVER		((u16)0x0002)
298aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_SERIAL		((u16)0x0003)
299aaad4303SSolomon Peachy #define HFA384x_PDR_MKK_MEASUREMENTS	((u16)0x0004)
300aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_RAMSIZE		((u16)0x0005)
301aaad4303SSolomon Peachy #define HFA384x_PDR_MFISUPRANGE		((u16)0x0006)
302aaad4303SSolomon Peachy #define HFA384x_PDR_CFISUPRANGE		((u16)0x0007)
303aaad4303SSolomon Peachy #define HFA384x_PDR_NICID		((u16)0x0008)
304aaad4303SSolomon Peachy #define HFA384x_PDR_MAC_ADDRESS		((u16)0x0101)
305aaad4303SSolomon Peachy #define HFA384x_PDR_REGDOMAIN		((u16)0x0103)
306aaad4303SSolomon Peachy #define HFA384x_PDR_ALLOWED_CHANNEL	((u16)0x0104)
307aaad4303SSolomon Peachy #define HFA384x_PDR_DEFAULT_CHANNEL	((u16)0x0105)
308aaad4303SSolomon Peachy #define HFA384x_PDR_TEMPTYPE		((u16)0x0107)
309aaad4303SSolomon Peachy #define HFA384x_PDR_IFR_SETTING		((u16)0x0200)
310aaad4303SSolomon Peachy #define HFA384x_PDR_RFR_SETTING		((u16)0x0201)
311aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_BASELINE	((u16)0x0202)
312aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_SHADOW	((u16)0x0203)
313aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_IFRF	((u16)0x0204)
314aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALSP	((u16)0x0300)
315aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALI	((u16)0x0301)
316aaad4303SSolomon Peachy #define HFA384x_PDR_MAX_TX_POWER	((u16)0x0302)
317aaad4303SSolomon Peachy #define HFA384x_PDR_MASTER_CHAN_LIST	((u16)0x0303)
318aaad4303SSolomon Peachy #define HFA384x_PDR_3842_NIC_CONFIG	((u16)0x0400)
319aaad4303SSolomon Peachy #define HFA384x_PDR_USB_ID		((u16)0x0401)
320aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_ID		((u16)0x0402)
321aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_IFCONF		((u16)0x0403)
322aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_PMCONF		((u16)0x0404)
323aaad4303SSolomon Peachy #define HFA384x_PDR_RFENRGY		((u16)0x0406)
324aaad4303SSolomon Peachy #define HFA384x_PDR_USB_POWER_TYPE      ((u16)0x0407)
325aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MAX_POWER	((u16)0x0409)
326aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MANUFACTURER	((u16)0x0410)
327aaad4303SSolomon Peachy #define HFA384x_PDR_USB_PRODUCT		((u16)0x0411)
328aaad4303SSolomon Peachy #define HFA384x_PDR_ANT_DIVERSITY	((u16)0x0412)
329aaad4303SSolomon Peachy #define HFA384x_PDR_HFO_DELAY		((u16)0x0413)
330aaad4303SSolomon Peachy #define HFA384x_PDR_SCALE_THRESH	((u16)0x0414)
33100b3ed16SGreg Kroah-Hartman 
332aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTSP	((u16)0x0900)
333aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTI	((u16)0x0901)
334aaad4303SSolomon Peachy #define HFA384x_PDR_END_OF_PDA		((u16)0x0000)
33500b3ed16SGreg Kroah-Hartman 
33600b3ed16SGreg Kroah-Hartman /*--- Register Test/Get/Set Field macros ------------------------*/
33700b3ed16SGreg Kroah-Hartman 
338aaad4303SSolomon Peachy #define		HFA384x_CMD_AINFO_SET(value)	((u16)((u16)(value) << 8))
33971508ee4SAlessandro Ghedini #define		HFA384x_CMD_MACPORT_SET(value)	\
34071508ee4SAlessandro Ghedini 			((u16)HFA384x_CMD_AINFO_SET(value))
34171508ee4SAlessandro Ghedini #define		HFA384x_CMD_PROGMODE_SET(value)	\
34271508ee4SAlessandro Ghedini 			((u16)HFA384x_CMD_AINFO_SET((u16)value))
343aaad4303SSolomon Peachy #define		HFA384x_CMD_CMDCODE_SET(value)		((u16)(value))
34400b3ed16SGreg Kroah-Hartman 
345aaad4303SSolomon Peachy #define		HFA384x_STATUS_RESULT_SET(value)	(((u16)(value)) << 8)
34600b3ed16SGreg Kroah-Hartman 
34700b3ed16SGreg Kroah-Hartman /* Host Maintained State Info */
34800b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_PREINIT	0
34900b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_INIT	1
35000b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_RUNNING	2
35100b3ed16SGreg Kroah-Hartman 
35200b3ed16SGreg Kroah-Hartman /*-------------------------------------------------------------*/
35300b3ed16SGreg Kroah-Hartman /* Commonly used basic types */
354b2119911SHimangi Saraogi struct hfa384x_bytestr {
355aaad4303SSolomon Peachy 	u16 len;
356aaad4303SSolomon Peachy 	u8 data[0];
357b2119911SHimangi Saraogi } __packed;
35800b3ed16SGreg Kroah-Hartman 
359e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_bytestr32 {
360aaad4303SSolomon Peachy 	u16 len;
361aaad4303SSolomon Peachy 	u8 data[32];
3627d3864d1SBas van den Berg } __packed hfa384x_bytestr32_t;
36300b3ed16SGreg Kroah-Hartman 
36400b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
36500b3ed16SGreg Kroah-Hartman Configuration Record Structures:
36600b3ed16SGreg Kroah-Hartman 	Network Parameters, Static Configuration Entities
36700b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
36800b3ed16SGreg Kroah-Hartman 
36900b3ed16SGreg Kroah-Hartman /*-- Hardware/Firmware Component Information ----------*/
370e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_compident {
371aaad4303SSolomon Peachy 	u16 id;
372aaad4303SSolomon Peachy 	u16 variant;
373aaad4303SSolomon Peachy 	u16 major;
374aaad4303SSolomon Peachy 	u16 minor;
3757d3864d1SBas van den Berg } __packed hfa384x_compident_t;
37600b3ed16SGreg Kroah-Hartman 
377e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_caplevel {
378aaad4303SSolomon Peachy 	u16 role;
379aaad4303SSolomon Peachy 	u16 id;
380aaad4303SSolomon Peachy 	u16 variant;
381aaad4303SSolomon Peachy 	u16 bottom;
382aaad4303SSolomon Peachy 	u16 top;
3837d3864d1SBas van den Berg } __packed hfa384x_caplevel_t;
38400b3ed16SGreg Kroah-Hartman 
38500b3ed16SGreg Kroah-Hartman /*-- Configuration Record: cnfAuthentication --*/
38600b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM	0x0001
38700b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_SHAREDKEY	0x0002
38800b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_LEAP		0x0004
38900b3ed16SGreg Kroah-Hartman 
39000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
39100b3ed16SGreg Kroah-Hartman Configuration Record Structures:
39200b3ed16SGreg Kroah-Hartman 	Network Parameters, Dynamic Configuration Entities
39300b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
39400b3ed16SGreg Kroah-Hartman 
39500b3ed16SGreg Kroah-Hartman #define HFA384x_CREATEIBSS_JOINCREATEIBSS          0
39600b3ed16SGreg Kroah-Hartman 
39700b3ed16SGreg Kroah-Hartman /*-- Configuration Record: HostScanRequest (data portion only) --*/
398e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_HostScanRequest_data {
399aaad4303SSolomon Peachy 	u16 channelList;
400aaad4303SSolomon Peachy 	u16 txRate;
40100b3ed16SGreg Kroah-Hartman 	hfa384x_bytestr32_t ssid;
4027d3864d1SBas van den Berg } __packed hfa384x_HostScanRequest_data_t;
40300b3ed16SGreg Kroah-Hartman 
40400b3ed16SGreg Kroah-Hartman /*-- Configuration Record: JoinRequest (data portion only) --*/
405e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_JoinRequest_data {
406aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
407aaad4303SSolomon Peachy 	u16 channel;
4087d3864d1SBas van den Berg } __packed hfa384x_JoinRequest_data_t;
40900b3ed16SGreg Kroah-Hartman 
41000b3ed16SGreg Kroah-Hartman /*-- Configuration Record: authenticateStation (data portion only) --*/
411e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_authenticateStation_data {
41228b17a4bSMoritz Muehlenhoff 	u8 address[ETH_ALEN];
413aaad4303SSolomon Peachy 	u16 status;
414aaad4303SSolomon Peachy 	u16 algorithm;
4157d3864d1SBas van den Berg } __packed hfa384x_authenticateStation_data_t;
41600b3ed16SGreg Kroah-Hartman 
41700b3ed16SGreg Kroah-Hartman /*-- Configuration Record: WPAData       (data portion only) --*/
418e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_WPAData {
419aaad4303SSolomon Peachy 	u16 datalen;
4205dd8acc8SSvenne Krap 	u8 data[0];		/* max 80 */
4217d3864d1SBas van den Berg } __packed hfa384x_WPAData_t;
42200b3ed16SGreg Kroah-Hartman 
42300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
42400b3ed16SGreg Kroah-Hartman Information Record Structures: NIC Information
42500b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
42600b3ed16SGreg Kroah-Hartman 
42700b3ed16SGreg Kroah-Hartman /*-- Information Record: DownLoadBuffer --*/
42800b3ed16SGreg Kroah-Hartman /* NOTE: The page and offset are in AUX format */
429e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_downloadbuffer {
430aaad4303SSolomon Peachy 	u16 page;
431aaad4303SSolomon Peachy 	u16 offset;
432aaad4303SSolomon Peachy 	u16 len;
4337d3864d1SBas van den Berg } __packed hfa384x_downloadbuffer_t;
43400b3ed16SGreg Kroah-Hartman 
43500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
43600b3ed16SGreg Kroah-Hartman Information Record Structures: NIC Information
43700b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
43800b3ed16SGreg Kroah-Hartman 
439aaad4303SSolomon Peachy #define HFA384x_PSTATUS_CONN_IBSS	((u16)3)
44000b3ed16SGreg Kroah-Hartman 
44100b3ed16SGreg Kroah-Hartman /*-- Information Record: commsquality --*/
442e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_commsquality {
443aaad4303SSolomon Peachy 	u16 CQ_currBSS;
444aaad4303SSolomon Peachy 	u16 ASL_currBSS;
445aaad4303SSolomon Peachy 	u16 ANL_currFC;
4467d3864d1SBas van den Berg } __packed hfa384x_commsquality_t;
44700b3ed16SGreg Kroah-Hartman 
44800b3ed16SGreg Kroah-Hartman /*-- Information Record: dmbcommsquality --*/
449e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_dbmcommsquality {
450aaad4303SSolomon Peachy 	u16 CQdbm_currBSS;
451aaad4303SSolomon Peachy 	u16 ASLdbm_currBSS;
452aaad4303SSolomon Peachy 	u16 ANLdbm_currFC;
4537d3864d1SBas van den Berg } __packed hfa384x_dbmcommsquality_t;
45400b3ed16SGreg Kroah-Hartman 
45500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
45600b3ed16SGreg Kroah-Hartman FRAME STRUCTURES: Communication Frames
45700b3ed16SGreg Kroah-Hartman ----------------------------------------------------------------------
45800b3ed16SGreg Kroah-Hartman Communication Frames: Transmit Frames
45900b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
46000b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Transmit Frame Structure --*/
461e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_tx_frame {
462aaad4303SSolomon Peachy 	u16 status;
463aaad4303SSolomon Peachy 	u16 reserved1;
464aaad4303SSolomon Peachy 	u16 reserved2;
465aaad4303SSolomon Peachy 	u32 sw_support;
466aaad4303SSolomon Peachy 	u8 tx_retrycount;
467aaad4303SSolomon Peachy 	u8 tx_rate;
468aaad4303SSolomon Peachy 	u16 tx_control;
46900b3ed16SGreg Kroah-Hartman 
47000b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information --*/
47100b3ed16SGreg Kroah-Hartman 
472aaad4303SSolomon Peachy 	u16 frame_control;
473aaad4303SSolomon Peachy 	u16 duration_id;
474aaad4303SSolomon Peachy 	u8 address1[6];
475aaad4303SSolomon Peachy 	u8 address2[6];
476aaad4303SSolomon Peachy 	u8 address3[6];
477aaad4303SSolomon Peachy 	u16 sequence_control;
478aaad4303SSolomon Peachy 	u8 address4[6];
479aaad4303SSolomon Peachy 	u16 data_len;		/* little endian format */
48000b3ed16SGreg Kroah-Hartman 
48100b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
48200b3ed16SGreg Kroah-Hartman 
483aaad4303SSolomon Peachy 	u8 dest_addr[6];
484aaad4303SSolomon Peachy 	u8 src_addr[6];
485aaad4303SSolomon Peachy 	u16 data_length;	/* big endian format */
4867d3864d1SBas van den Berg } __packed hfa384x_tx_frame_t;
48700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
48800b3ed16SGreg Kroah-Hartman Communication Frames: Field Masks for Transmit Frames
48900b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
49000b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
4917f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_ACKERR			((u16)BIT(5))
4927f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_FORMERR		((u16)BIT(3))
4937f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_DISCON			((u16)BIT(2))
4947f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_AGEDERR		((u16)BIT(1))
4957f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_RETRYERR		((u16)BIT(0))
49600b3ed16SGreg Kroah-Hartman /*-- Transmit Control Field --*/
49771508ee4SAlessandro Ghedini #define		HFA384x_TX_MACPORT			((u16)(BIT(10) | \
49871508ee4SAlessandro Ghedini 							  BIT(9) | BIT(8)))
4997f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_STRUCTYPE			((u16)(BIT(4) | BIT(3)))
5007f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXEX				((u16)BIT(2))
5017f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXOK				((u16)BIT(1))
50200b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
50300b3ed16SGreg Kroah-Hartman Communication Frames: Test/Get/Set Field Values for Transmit Frames
50400b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
50500b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
50600b3ed16SGreg Kroah-Hartman #define HFA384x_TXSTATUS_ISERROR(v)	\
507aaad4303SSolomon Peachy 	(((u16)(v)) & \
50800b3ed16SGreg Kroah-Hartman 	(HFA384x_TXSTATUS_ACKERR | HFA384x_TXSTATUS_FORMERR | \
50900b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_DISCON | HFA384x_TXSTATUS_AGEDERR | \
51000b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_RETRYERR))
51100b3ed16SGreg Kroah-Hartman 
512aaad4303SSolomon Peachy #define	HFA384x_TX_SET(v, m, s)		((((u16)(v)) << ((u16)(s))) & ((u16)(m)))
51300b3ed16SGreg Kroah-Hartman 
51400b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_MACPORT_SET(v)	HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
51571508ee4SAlessandro Ghedini #define	HFA384x_TX_STRUCTYPE_SET(v)	HFA384x_TX_SET(v, \
51671508ee4SAlessandro Ghedini 						HFA384x_TX_STRUCTYPE, 3)
51700b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXEX_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
51800b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXOK_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
51900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
52000b3ed16SGreg Kroah-Hartman Communication Frames: Receive Frames
52100b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
52200b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Receive Frame Structure --*/
523e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_rx_frame {
52400b3ed16SGreg Kroah-Hartman 	/*-- MAC rx descriptor (hfa384x byte order) --*/
525aaad4303SSolomon Peachy 	u16 status;
526aaad4303SSolomon Peachy 	u32 time;
527aaad4303SSolomon Peachy 	u8 silence;
528aaad4303SSolomon Peachy 	u8 signal;
529aaad4303SSolomon Peachy 	u8 rate;
530aaad4303SSolomon Peachy 	u8 rx_flow;
531aaad4303SSolomon Peachy 	u16 reserved1;
532aaad4303SSolomon Peachy 	u16 reserved2;
53300b3ed16SGreg Kroah-Hartman 
53400b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information (802.11 byte order) --*/
5358cbe56e0SHimangi Saraogi 	__le16 frame_control;
536aaad4303SSolomon Peachy 	u16 duration_id;
537aaad4303SSolomon Peachy 	u8 address1[6];
538aaad4303SSolomon Peachy 	u8 address2[6];
539aaad4303SSolomon Peachy 	u8 address3[6];
540aaad4303SSolomon Peachy 	u16 sequence_control;
541aaad4303SSolomon Peachy 	u8 address4[6];
5428cbe56e0SHimangi Saraogi 	__le16 data_len;		/* hfa384x (little endian) format */
54300b3ed16SGreg Kroah-Hartman 
54400b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
545aaad4303SSolomon Peachy 	u8 dest_addr[6];
546aaad4303SSolomon Peachy 	u8 src_addr[6];
547aaad4303SSolomon Peachy 	u16 data_length;	/* IEEE? (big endian) format */
5487d3864d1SBas van den Berg } __packed hfa384x_rx_frame_t;
54900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
55000b3ed16SGreg Kroah-Hartman Communication Frames: Field Masks for Receive Frames
55100b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
55200b3ed16SGreg Kroah-Hartman 
55300b3ed16SGreg Kroah-Hartman /*-- Status Fields --*/
55471508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_MACPORT		((u16)(BIT(10) | \
55571508ee4SAlessandro Ghedini 								BIT(9) | \
55671508ee4SAlessandro Ghedini 								BIT(8)))
5577f6e0e44SMoritz Muehlenhoff #define		HFA384x_RXSTATUS_FCSERR			((u16)BIT(0))
55800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
55900b3ed16SGreg Kroah-Hartman Communication Frames: Test/Get/Set Field Values for Receive Frames
56000b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
56171508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_MACPORT_GET(value)	((u16)((((u16)(value)) \
56271508ee4SAlessandro Ghedini 					    & HFA384x_RXSTATUS_MACPORT) >> 8))
56371508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_ISFCSERR(value)	((u16)(((u16)(value)) \
56471508ee4SAlessandro Ghedini 						  & HFA384x_RXSTATUS_FCSERR))
56500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
56600b3ed16SGreg Kroah-Hartman  FRAME STRUCTURES: Information Types and Information Frame Structures
56700b3ed16SGreg Kroah-Hartman ----------------------------------------------------------------------
56800b3ed16SGreg Kroah-Hartman Information Types
56900b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
570aaad4303SSolomon Peachy #define		HFA384x_IT_HANDOVERADDR			((u16)0xF000UL)
571aaad4303SSolomon Peachy #define		HFA384x_IT_COMMTALLIES			((u16)0xF100UL)
572aaad4303SSolomon Peachy #define		HFA384x_IT_SCANRESULTS			((u16)0xF101UL)
573aaad4303SSolomon Peachy #define		HFA384x_IT_CHINFORESULTS		((u16)0xF102UL)
574aaad4303SSolomon Peachy #define		HFA384x_IT_HOSTSCANRESULTS		((u16)0xF103UL)
575aaad4303SSolomon Peachy #define		HFA384x_IT_LINKSTATUS			((u16)0xF200UL)
576aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCSTATUS			((u16)0xF201UL)
577aaad4303SSolomon Peachy #define		HFA384x_IT_AUTHREQ			((u16)0xF202UL)
578aaad4303SSolomon Peachy #define		HFA384x_IT_PSUSERCNT			((u16)0xF203UL)
579aaad4303SSolomon Peachy #define		HFA384x_IT_KEYIDCHANGED			((u16)0xF204UL)
580aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCREQ			((u16)0xF205UL)
581aaad4303SSolomon Peachy #define		HFA384x_IT_MICFAILURE			((u16)0xF206UL)
58200b3ed16SGreg Kroah-Hartman 
58300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
58400b3ed16SGreg Kroah-Hartman Information Frames Structures
58500b3ed16SGreg Kroah-Hartman ----------------------------------------------------------------------
58600b3ed16SGreg Kroah-Hartman Information Frames: Notification Frame Structures
58700b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
58800b3ed16SGreg Kroah-Hartman 
58900b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Communication Tallies --*/
590e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_CommTallies16 {
591aaad4303SSolomon Peachy 	u16 txunicastframes;
592aaad4303SSolomon Peachy 	u16 txmulticastframes;
593aaad4303SSolomon Peachy 	u16 txfragments;
594aaad4303SSolomon Peachy 	u16 txunicastoctets;
595aaad4303SSolomon Peachy 	u16 txmulticastoctets;
596aaad4303SSolomon Peachy 	u16 txdeferredtrans;
597aaad4303SSolomon Peachy 	u16 txsingleretryframes;
598aaad4303SSolomon Peachy 	u16 txmultipleretryframes;
599aaad4303SSolomon Peachy 	u16 txretrylimitexceeded;
600aaad4303SSolomon Peachy 	u16 txdiscards;
601aaad4303SSolomon Peachy 	u16 rxunicastframes;
602aaad4303SSolomon Peachy 	u16 rxmulticastframes;
603aaad4303SSolomon Peachy 	u16 rxfragments;
604aaad4303SSolomon Peachy 	u16 rxunicastoctets;
605aaad4303SSolomon Peachy 	u16 rxmulticastoctets;
606aaad4303SSolomon Peachy 	u16 rxfcserrors;
607aaad4303SSolomon Peachy 	u16 rxdiscardsnobuffer;
608aaad4303SSolomon Peachy 	u16 txdiscardswrongsa;
609aaad4303SSolomon Peachy 	u16 rxdiscardswepundecr;
610aaad4303SSolomon Peachy 	u16 rxmsginmsgfrag;
611aaad4303SSolomon Peachy 	u16 rxmsginbadmsgfrag;
6127d3864d1SBas van den Berg } __packed hfa384x_CommTallies16_t;
61300b3ed16SGreg Kroah-Hartman 
614e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_CommTallies32 {
615aaad4303SSolomon Peachy 	u32 txunicastframes;
616aaad4303SSolomon Peachy 	u32 txmulticastframes;
617aaad4303SSolomon Peachy 	u32 txfragments;
618aaad4303SSolomon Peachy 	u32 txunicastoctets;
619aaad4303SSolomon Peachy 	u32 txmulticastoctets;
620aaad4303SSolomon Peachy 	u32 txdeferredtrans;
621aaad4303SSolomon Peachy 	u32 txsingleretryframes;
622aaad4303SSolomon Peachy 	u32 txmultipleretryframes;
623aaad4303SSolomon Peachy 	u32 txretrylimitexceeded;
624aaad4303SSolomon Peachy 	u32 txdiscards;
625aaad4303SSolomon Peachy 	u32 rxunicastframes;
626aaad4303SSolomon Peachy 	u32 rxmulticastframes;
627aaad4303SSolomon Peachy 	u32 rxfragments;
628aaad4303SSolomon Peachy 	u32 rxunicastoctets;
629aaad4303SSolomon Peachy 	u32 rxmulticastoctets;
630aaad4303SSolomon Peachy 	u32 rxfcserrors;
631aaad4303SSolomon Peachy 	u32 rxdiscardsnobuffer;
632aaad4303SSolomon Peachy 	u32 txdiscardswrongsa;
633aaad4303SSolomon Peachy 	u32 rxdiscardswepundecr;
634aaad4303SSolomon Peachy 	u32 rxmsginmsgfrag;
635aaad4303SSolomon Peachy 	u32 rxmsginbadmsgfrag;
6367d3864d1SBas van den Berg } __packed hfa384x_CommTallies32_t;
63700b3ed16SGreg Kroah-Hartman 
63800b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Scan Results & Subfields--*/
639e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_ScanResultSub {
640aaad4303SSolomon Peachy 	u16 chid;
641aaad4303SSolomon Peachy 	u16 anl;
642aaad4303SSolomon Peachy 	u16 sl;
643aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
644aaad4303SSolomon Peachy 	u16 bcnint;
645aaad4303SSolomon Peachy 	u16 capinfo;
64600b3ed16SGreg Kroah-Hartman 	hfa384x_bytestr32_t ssid;
647aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
648aaad4303SSolomon Peachy 	u16 proberesp_rate;
6497d3864d1SBas van den Berg } __packed hfa384x_ScanResultSub_t;
65000b3ed16SGreg Kroah-Hartman 
651e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_ScanResult {
652aaad4303SSolomon Peachy 	u16 rsvd;
653aaad4303SSolomon Peachy 	u16 scanreason;
654e573aaa4SMoritz Muehlenhoff 	hfa384x_ScanResultSub_t result[HFA384x_SCANRESULT_MAX];
6557d3864d1SBas van den Berg } __packed hfa384x_ScanResult_t;
65600b3ed16SGreg Kroah-Hartman 
65700b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
658e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_ChInfoResultSub {
659aaad4303SSolomon Peachy 	u16 chid;
660aaad4303SSolomon Peachy 	u16 anl;
661aaad4303SSolomon Peachy 	u16 pnl;
662aaad4303SSolomon Peachy 	u16 active;
6637d3864d1SBas van den Berg } __packed hfa384x_ChInfoResultSub_t;
66400b3ed16SGreg Kroah-Hartman 
6657f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_BSSACTIVE	BIT(0)
6667f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_PCFACTIVE	BIT(1)
66700b3ed16SGreg Kroah-Hartman 
668e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_ChInfoResult {
669aaad4303SSolomon Peachy 	u16 scanchannels;
670e573aaa4SMoritz Muehlenhoff 	hfa384x_ChInfoResultSub_t result[HFA384x_CHINFORESULT_MAX];
6717d3864d1SBas van den Berg } __packed hfa384x_ChInfoResult_t;
67200b3ed16SGreg Kroah-Hartman 
67300b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
674e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_HScanResultSub {
675aaad4303SSolomon Peachy 	u16 chid;
676aaad4303SSolomon Peachy 	u16 anl;
677aaad4303SSolomon Peachy 	u16 sl;
678aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
679aaad4303SSolomon Peachy 	u16 bcnint;
680aaad4303SSolomon Peachy 	u16 capinfo;
68100b3ed16SGreg Kroah-Hartman 	hfa384x_bytestr32_t ssid;
682aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
683aaad4303SSolomon Peachy 	u16 proberesp_rate;
684aaad4303SSolomon Peachy 	u16 atim;
6857d3864d1SBas van den Berg } __packed hfa384x_HScanResultSub_t;
68600b3ed16SGreg Kroah-Hartman 
687e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_HScanResult {
688aaad4303SSolomon Peachy 	u16 nresult;
689aaad4303SSolomon Peachy 	u16 rsvd;
690e573aaa4SMoritz Muehlenhoff 	hfa384x_HScanResultSub_t result[HFA384x_HSCANRESULT_MAX];
6917d3864d1SBas van den Berg } __packed hfa384x_HScanResult_t;
69200b3ed16SGreg Kroah-Hartman 
69300b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: LinkStatus --*/
69400b3ed16SGreg Kroah-Hartman 
695aaad4303SSolomon Peachy #define HFA384x_LINK_NOTCONNECTED	((u16)0)
696aaad4303SSolomon Peachy #define HFA384x_LINK_CONNECTED		((u16)1)
697aaad4303SSolomon Peachy #define HFA384x_LINK_DISCONNECTED	((u16)2)
698aaad4303SSolomon Peachy #define HFA384x_LINK_AP_CHANGE		((u16)3)
699aaad4303SSolomon Peachy #define HFA384x_LINK_AP_OUTOFRANGE	((u16)4)
700aaad4303SSolomon Peachy #define HFA384x_LINK_AP_INRANGE		((u16)5)
701aaad4303SSolomon Peachy #define HFA384x_LINK_ASSOCFAIL		((u16)6)
70200b3ed16SGreg Kroah-Hartman 
703e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_LinkStatus {
704aaad4303SSolomon Peachy 	u16 linkstatus;
7057d3864d1SBas van den Berg } __packed hfa384x_LinkStatus_t;
70600b3ed16SGreg Kroah-Hartman 
70700b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
70800b3ed16SGreg Kroah-Hartman 
709aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_STAASSOC	((u16)1)
710aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_REASSOC	((u16)2)
711aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_AUTHFAIL	((u16)5)
71200b3ed16SGreg Kroah-Hartman 
713e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_AssocStatus {
714aaad4303SSolomon Peachy 	u16 assocstatus;
71528b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
71600b3ed16SGreg Kroah-Hartman 	/* old_ap_addr is only valid if assocstatus == 2 */
71728b17a4bSMoritz Muehlenhoff 	u8 old_ap_addr[ETH_ALEN];
718aaad4303SSolomon Peachy 	u16 reason;
719aaad4303SSolomon Peachy 	u16 reserved;
7207d3864d1SBas van den Berg } __packed hfa384x_AssocStatus_t;
72100b3ed16SGreg Kroah-Hartman 
72200b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
72300b3ed16SGreg Kroah-Hartman 
724e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_AuthRequest {
72528b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
726aaad4303SSolomon Peachy 	u16 algorithm;
7277d3864d1SBas van den Berg } __packed hfa384x_AuthReq_t;
72800b3ed16SGreg Kroah-Hartman 
72900b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
73000b3ed16SGreg Kroah-Hartman 
731e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_PSUserCount {
732aaad4303SSolomon Peachy 	u16 usercnt;
7337d3864d1SBas van den Berg } __packed hfa384x_PSUserCount_t;
73400b3ed16SGreg Kroah-Hartman 
735e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_KeyIDChanged {
73628b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
737aaad4303SSolomon Peachy 	u16 keyid;
7387d3864d1SBas van den Berg } __packed hfa384x_KeyIDChanged_t;
73900b3ed16SGreg Kroah-Hartman 
74000b3ed16SGreg Kroah-Hartman /*--  Collection of all Inf frames ---------------*/
74100b3ed16SGreg Kroah-Hartman typedef union hfa384x_infodata {
74200b3ed16SGreg Kroah-Hartman 	hfa384x_CommTallies16_t commtallies16;
74300b3ed16SGreg Kroah-Hartman 	hfa384x_CommTallies32_t commtallies32;
74400b3ed16SGreg Kroah-Hartman 	hfa384x_ScanResult_t scanresult;
74500b3ed16SGreg Kroah-Hartman 	hfa384x_ChInfoResult_t chinforesult;
74600b3ed16SGreg Kroah-Hartman 	hfa384x_HScanResult_t hscanresult;
74700b3ed16SGreg Kroah-Hartman 	hfa384x_LinkStatus_t linkstatus;
74800b3ed16SGreg Kroah-Hartman 	hfa384x_AssocStatus_t assocstatus;
74900b3ed16SGreg Kroah-Hartman 	hfa384x_AuthReq_t authreq;
75000b3ed16SGreg Kroah-Hartman 	hfa384x_PSUserCount_t psusercnt;
75100b3ed16SGreg Kroah-Hartman 	hfa384x_KeyIDChanged_t keyidchanged;
7527d3864d1SBas van den Berg } __packed hfa384x_infodata_t;
75300b3ed16SGreg Kroah-Hartman 
754e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_InfFrame {
755aaad4303SSolomon Peachy 	u16 framelen;
756aaad4303SSolomon Peachy 	u16 infotype;
75700b3ed16SGreg Kroah-Hartman 	hfa384x_infodata_t info;
7587d3864d1SBas van den Berg } __packed hfa384x_InfFrame_t;
75900b3ed16SGreg Kroah-Hartman 
76000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
76100b3ed16SGreg Kroah-Hartman USB Packet structures and constants.
76200b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
76300b3ed16SGreg Kroah-Hartman 
76400b3ed16SGreg Kroah-Hartman /* Should be sent to the bulkout endpoint */
76500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_TXFRM	0
76600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDREQ	1
76700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDREQ	2
76800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDREQ	3
76900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMREQ	4
77000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMREQ	5
77100b3ed16SGreg Kroah-Hartman 
77200b3ed16SGreg Kroah-Hartman /* Received from the bulkin endpoint */
77300b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISTXFRM(a)	(((a) & 0x9000) == 0x1000)
77400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISRXFRM(a)	(!((a) & 0x9000))
77500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_INFOFRM	0x8000
77600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDRESP	0x8001
77700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDRESP	0x8002
77800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDRESP	0x8003
77900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMRESP	0x8004
78000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMRESP	0x8005
78100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_BUFAVAIL	0x8006
78200b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ERROR	0x8007
78300b3ed16SGreg Kroah-Hartman 
78400b3ed16SGreg Kroah-Hartman /*------------------------------------*/
78500b3ed16SGreg Kroah-Hartman /* Request (bulk OUT) packet contents */
78600b3ed16SGreg Kroah-Hartman 
78700b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_txfrm {
78800b3ed16SGreg Kroah-Hartman 	hfa384x_tx_frame_t desc;
789aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
7907d3864d1SBas van den Berg } __packed hfa384x_usb_txfrm_t;
79100b3ed16SGreg Kroah-Hartman 
79200b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_cmdreq {
793aaad4303SSolomon Peachy 	u16 type;
794aaad4303SSolomon Peachy 	u16 cmd;
795aaad4303SSolomon Peachy 	u16 parm0;
796aaad4303SSolomon Peachy 	u16 parm1;
797aaad4303SSolomon Peachy 	u16 parm2;
798aaad4303SSolomon Peachy 	u8 pad[54];
7997d3864d1SBas van den Berg } __packed hfa384x_usb_cmdreq_t;
80000b3ed16SGreg Kroah-Hartman 
80100b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_wridreq {
802aaad4303SSolomon Peachy 	u16 type;
803aaad4303SSolomon Peachy 	u16 frmlen;
804aaad4303SSolomon Peachy 	u16 rid;
805aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
8067d3864d1SBas van den Berg } __packed hfa384x_usb_wridreq_t;
80700b3ed16SGreg Kroah-Hartman 
80800b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_rridreq {
809aaad4303SSolomon Peachy 	u16 type;
810aaad4303SSolomon Peachy 	u16 frmlen;
811aaad4303SSolomon Peachy 	u16 rid;
812aaad4303SSolomon Peachy 	u8 pad[58];
8137d3864d1SBas van den Berg } __packed hfa384x_usb_rridreq_t;
81400b3ed16SGreg Kroah-Hartman 
81500b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_wmemreq {
816aaad4303SSolomon Peachy 	u16 type;
817aaad4303SSolomon Peachy 	u16 frmlen;
818aaad4303SSolomon Peachy 	u16 offset;
819aaad4303SSolomon Peachy 	u16 page;
820aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
8217d3864d1SBas van den Berg } __packed hfa384x_usb_wmemreq_t;
82200b3ed16SGreg Kroah-Hartman 
82300b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_rmemreq {
824aaad4303SSolomon Peachy 	u16 type;
825aaad4303SSolomon Peachy 	u16 frmlen;
826aaad4303SSolomon Peachy 	u16 offset;
827aaad4303SSolomon Peachy 	u16 page;
828aaad4303SSolomon Peachy 	u8 pad[56];
8297d3864d1SBas van den Berg } __packed hfa384x_usb_rmemreq_t;
83000b3ed16SGreg Kroah-Hartman 
83100b3ed16SGreg Kroah-Hartman /*------------------------------------*/
83200b3ed16SGreg Kroah-Hartman /* Response (bulk IN) packet contents */
83300b3ed16SGreg Kroah-Hartman 
83400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_rxfrm {
83500b3ed16SGreg Kroah-Hartman 	hfa384x_rx_frame_t desc;
836aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
8377d3864d1SBas van den Berg } __packed hfa384x_usb_rxfrm_t;
83800b3ed16SGreg Kroah-Hartman 
83900b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_infofrm {
840aaad4303SSolomon Peachy 	u16 type;
84100b3ed16SGreg Kroah-Hartman 	hfa384x_InfFrame_t info;
8427d3864d1SBas van den Berg } __packed hfa384x_usb_infofrm_t;
84300b3ed16SGreg Kroah-Hartman 
84400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_statusresp {
845aaad4303SSolomon Peachy 	u16 type;
846aaad4303SSolomon Peachy 	u16 status;
847aaad4303SSolomon Peachy 	u16 resp0;
848aaad4303SSolomon Peachy 	u16 resp1;
849aaad4303SSolomon Peachy 	u16 resp2;
8507d3864d1SBas van den Berg } __packed hfa384x_usb_cmdresp_t;
85100b3ed16SGreg Kroah-Hartman 
85200b3ed16SGreg Kroah-Hartman typedef hfa384x_usb_cmdresp_t hfa384x_usb_wridresp_t;
85300b3ed16SGreg Kroah-Hartman 
85400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_rridresp {
855aaad4303SSolomon Peachy 	u16 type;
856aaad4303SSolomon Peachy 	u16 frmlen;
857aaad4303SSolomon Peachy 	u16 rid;
858aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
8597d3864d1SBas van den Berg } __packed hfa384x_usb_rridresp_t;
86000b3ed16SGreg Kroah-Hartman 
86100b3ed16SGreg Kroah-Hartman typedef hfa384x_usb_cmdresp_t hfa384x_usb_wmemresp_t;
86200b3ed16SGreg Kroah-Hartman 
86300b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_rmemresp {
864aaad4303SSolomon Peachy 	u16 type;
865aaad4303SSolomon Peachy 	u16 frmlen;
866aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
8677d3864d1SBas van den Berg } __packed hfa384x_usb_rmemresp_t;
86800b3ed16SGreg Kroah-Hartman 
86900b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_bufavail {
870aaad4303SSolomon Peachy 	u16 type;
871aaad4303SSolomon Peachy 	u16 frmlen;
8727d3864d1SBas van den Berg } __packed hfa384x_usb_bufavail_t;
87300b3ed16SGreg Kroah-Hartman 
87400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_error {
875aaad4303SSolomon Peachy 	u16 type;
876aaad4303SSolomon Peachy 	u16 errortype;
8777d3864d1SBas van den Berg } __packed hfa384x_usb_error_t;
87800b3ed16SGreg Kroah-Hartman 
87900b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------*/
88000b3ed16SGreg Kroah-Hartman /* Unions for packaging all the known packet types together */
88100b3ed16SGreg Kroah-Hartman 
88200b3ed16SGreg Kroah-Hartman typedef union hfa384x_usbout {
883a78d1312SAsaf Vertz 	__le16 type;
88400b3ed16SGreg Kroah-Hartman 	hfa384x_usb_txfrm_t txfrm;
88500b3ed16SGreg Kroah-Hartman 	hfa384x_usb_cmdreq_t cmdreq;
88600b3ed16SGreg Kroah-Hartman 	hfa384x_usb_wridreq_t wridreq;
88700b3ed16SGreg Kroah-Hartman 	hfa384x_usb_rridreq_t rridreq;
88800b3ed16SGreg Kroah-Hartman 	hfa384x_usb_wmemreq_t wmemreq;
88900b3ed16SGreg Kroah-Hartman 	hfa384x_usb_rmemreq_t rmemreq;
8907d3864d1SBas van den Berg } __packed hfa384x_usbout_t;
89100b3ed16SGreg Kroah-Hartman 
89200b3ed16SGreg Kroah-Hartman typedef union hfa384x_usbin {
893a78d1312SAsaf Vertz 	__le16 type;
89400b3ed16SGreg Kroah-Hartman 	hfa384x_usb_rxfrm_t rxfrm;
89500b3ed16SGreg Kroah-Hartman 	hfa384x_usb_txfrm_t txfrm;
89600b3ed16SGreg Kroah-Hartman 	hfa384x_usb_infofrm_t infofrm;
89700b3ed16SGreg Kroah-Hartman 	hfa384x_usb_cmdresp_t cmdresp;
89800b3ed16SGreg Kroah-Hartman 	hfa384x_usb_wridresp_t wridresp;
89900b3ed16SGreg Kroah-Hartman 	hfa384x_usb_rridresp_t rridresp;
90000b3ed16SGreg Kroah-Hartman 	hfa384x_usb_wmemresp_t wmemresp;
90100b3ed16SGreg Kroah-Hartman 	hfa384x_usb_rmemresp_t rmemresp;
90200b3ed16SGreg Kroah-Hartman 	hfa384x_usb_bufavail_t bufavail;
90300b3ed16SGreg Kroah-Hartman 	hfa384x_usb_error_t usberror;
904aaad4303SSolomon Peachy 	u8 boguspad[3000];
9057d3864d1SBas van den Berg } __packed hfa384x_usbin_t;
90600b3ed16SGreg Kroah-Hartman 
90776e3e7c4SKarl Relton /*--------------------------------------------------------------------
90876e3e7c4SKarl Relton PD record structures.
90976e3e7c4SKarl Relton --------------------------------------------------------------------*/
91076e3e7c4SKarl Relton 
91175f49e07SMithlesh Thukral typedef struct hfa384x_pdr_pcb_partnum {
91276e3e7c4SKarl Relton 	u8 num[8];
9137d3864d1SBas van den Berg } __packed hfa384x_pdr_pcb_partnum_t;
91476e3e7c4SKarl Relton 
91575f49e07SMithlesh Thukral typedef struct hfa384x_pdr_pcb_tracenum {
91676e3e7c4SKarl Relton 	u8 num[8];
9177d3864d1SBas van den Berg } __packed hfa384x_pdr_pcb_tracenum_t;
91876e3e7c4SKarl Relton 
91975f49e07SMithlesh Thukral typedef struct hfa384x_pdr_nic_serial {
92076e3e7c4SKarl Relton 	u8 num[12];
9217d3864d1SBas van den Berg } __packed hfa384x_pdr_nic_serial_t;
92276e3e7c4SKarl Relton 
92375f49e07SMithlesh Thukral typedef struct hfa384x_pdr_mkk_measurements {
92476e3e7c4SKarl Relton 	double carrier_freq;
92576e3e7c4SKarl Relton 	double occupied_band;
92676e3e7c4SKarl Relton 	double power_density;
92776e3e7c4SKarl Relton 	double tx_spur_f1;
92876e3e7c4SKarl Relton 	double tx_spur_f2;
92976e3e7c4SKarl Relton 	double tx_spur_f3;
93076e3e7c4SKarl Relton 	double tx_spur_f4;
93176e3e7c4SKarl Relton 	double tx_spur_l1;
93276e3e7c4SKarl Relton 	double tx_spur_l2;
93376e3e7c4SKarl Relton 	double tx_spur_l3;
93476e3e7c4SKarl Relton 	double tx_spur_l4;
93576e3e7c4SKarl Relton 	double rx_spur_f1;
93676e3e7c4SKarl Relton 	double rx_spur_f2;
93776e3e7c4SKarl Relton 	double rx_spur_l1;
93876e3e7c4SKarl Relton 	double rx_spur_l2;
9397d3864d1SBas van den Berg } __packed hfa384x_pdr_mkk_measurements_t;
94076e3e7c4SKarl Relton 
94175f49e07SMithlesh Thukral typedef struct hfa384x_pdr_nic_ramsize {
94276e3e7c4SKarl Relton 	u8 size[12];		/* units of KB */
9437d3864d1SBas van den Berg } __packed hfa384x_pdr_nic_ramsize_t;
94476e3e7c4SKarl Relton 
94575f49e07SMithlesh Thukral typedef struct hfa384x_pdr_mfisuprange {
94676e3e7c4SKarl Relton 	u16 id;
94776e3e7c4SKarl Relton 	u16 variant;
94876e3e7c4SKarl Relton 	u16 bottom;
94976e3e7c4SKarl Relton 	u16 top;
9507d3864d1SBas van den Berg } __packed hfa384x_pdr_mfisuprange_t;
95176e3e7c4SKarl Relton 
95275f49e07SMithlesh Thukral typedef struct hfa384x_pdr_cfisuprange {
95376e3e7c4SKarl Relton 	u16 id;
95476e3e7c4SKarl Relton 	u16 variant;
95576e3e7c4SKarl Relton 	u16 bottom;
95676e3e7c4SKarl Relton 	u16 top;
9577d3864d1SBas van den Berg } __packed hfa384x_pdr_cfisuprange_t;
95876e3e7c4SKarl Relton 
95975f49e07SMithlesh Thukral typedef struct hfa384x_pdr_nicid {
96076e3e7c4SKarl Relton 	u16 id;
96176e3e7c4SKarl Relton 	u16 variant;
96276e3e7c4SKarl Relton 	u16 major;
96376e3e7c4SKarl Relton 	u16 minor;
9647d3864d1SBas van den Berg } __packed hfa384x_pdr_nicid_t;
96576e3e7c4SKarl Relton 
96675f49e07SMithlesh Thukral typedef struct hfa384x_pdr_refdac_measurements {
96776e3e7c4SKarl Relton 	u16 value[0];
9687d3864d1SBas van den Berg } __packed hfa384x_pdr_refdac_measurements_t;
96976e3e7c4SKarl Relton 
97075f49e07SMithlesh Thukral typedef struct hfa384x_pdr_vgdac_measurements {
97176e3e7c4SKarl Relton 	u16 value[0];
9727d3864d1SBas van den Berg } __packed hfa384x_pdr_vgdac_measurements_t;
97376e3e7c4SKarl Relton 
97475f49e07SMithlesh Thukral typedef struct hfa384x_pdr_level_comp_measurements {
97576e3e7c4SKarl Relton 	u16 value[0];
9767d3864d1SBas van den Berg } __packed hfa384x_pdr_level_compc_measurements_t;
97776e3e7c4SKarl Relton 
97875f49e07SMithlesh Thukral typedef struct hfa384x_pdr_mac_address {
97976e3e7c4SKarl Relton 	u8 addr[6];
9807d3864d1SBas van den Berg } __packed hfa384x_pdr_mac_address_t;
98176e3e7c4SKarl Relton 
98275f49e07SMithlesh Thukral typedef struct hfa384x_pdr_mkk_callname {
98376e3e7c4SKarl Relton 	u8 callname[8];
9847d3864d1SBas van den Berg } __packed hfa384x_pdr_mkk_callname_t;
98576e3e7c4SKarl Relton 
98675f49e07SMithlesh Thukral typedef struct hfa384x_pdr_regdomain {
98776e3e7c4SKarl Relton 	u16 numdomains;
98876e3e7c4SKarl Relton 	u16 domain[5];
9897d3864d1SBas van den Berg } __packed hfa384x_pdr_regdomain_t;
99076e3e7c4SKarl Relton 
99175f49e07SMithlesh Thukral typedef struct hfa384x_pdr_allowed_channel {
99276e3e7c4SKarl Relton 	u16 ch_bitmap;
9937d3864d1SBas van den Berg } __packed hfa384x_pdr_allowed_channel_t;
99476e3e7c4SKarl Relton 
99575f49e07SMithlesh Thukral typedef struct hfa384x_pdr_default_channel {
99676e3e7c4SKarl Relton 	u16 channel;
9977d3864d1SBas van den Berg } __packed hfa384x_pdr_default_channel_t;
99876e3e7c4SKarl Relton 
99975f49e07SMithlesh Thukral typedef struct hfa384x_pdr_privacy_option {
100076e3e7c4SKarl Relton 	u16 available;
10017d3864d1SBas van den Berg } __packed hfa384x_pdr_privacy_option_t;
100276e3e7c4SKarl Relton 
100375f49e07SMithlesh Thukral typedef struct hfa384x_pdr_temptype {
100476e3e7c4SKarl Relton 	u16 type;
10057d3864d1SBas van den Berg } __packed hfa384x_pdr_temptype_t;
100676e3e7c4SKarl Relton 
100775f49e07SMithlesh Thukral typedef struct hfa384x_pdr_refdac_setup {
100876e3e7c4SKarl Relton 	u16 ch_value[14];
10097d3864d1SBas van den Berg } __packed hfa384x_pdr_refdac_setup_t;
101076e3e7c4SKarl Relton 
101175f49e07SMithlesh Thukral typedef struct hfa384x_pdr_vgdac_setup {
101276e3e7c4SKarl Relton 	u16 ch_value[14];
10137d3864d1SBas van den Berg } __packed hfa384x_pdr_vgdac_setup_t;
101476e3e7c4SKarl Relton 
101575f49e07SMithlesh Thukral typedef struct hfa384x_pdr_level_comp_setup {
101676e3e7c4SKarl Relton 	u16 ch_value[14];
10177d3864d1SBas van den Berg } __packed hfa384x_pdr_level_comp_setup_t;
101876e3e7c4SKarl Relton 
101975f49e07SMithlesh Thukral typedef struct hfa384x_pdr_trimdac_setup {
102076e3e7c4SKarl Relton 	u16 trimidac;
102176e3e7c4SKarl Relton 	u16 trimqdac;
10227d3864d1SBas van den Berg } __packed hfa384x_pdr_trimdac_setup_t;
102376e3e7c4SKarl Relton 
102475f49e07SMithlesh Thukral typedef struct hfa384x_pdr_ifr_setting {
102576e3e7c4SKarl Relton 	u16 value[3];
10267d3864d1SBas van den Berg } __packed hfa384x_pdr_ifr_setting_t;
102776e3e7c4SKarl Relton 
102875f49e07SMithlesh Thukral typedef struct hfa384x_pdr_rfr_setting {
102976e3e7c4SKarl Relton 	u16 value[3];
10307d3864d1SBas van den Berg } __packed hfa384x_pdr_rfr_setting_t;
103176e3e7c4SKarl Relton 
103275f49e07SMithlesh Thukral typedef struct hfa384x_pdr_hfa3861_baseline {
103376e3e7c4SKarl Relton 	u16 value[50];
10347d3864d1SBas van den Berg } __packed hfa384x_pdr_hfa3861_baseline_t;
103576e3e7c4SKarl Relton 
103675f49e07SMithlesh Thukral typedef struct hfa384x_pdr_hfa3861_shadow {
103776e3e7c4SKarl Relton 	u32 value[32];
10387d3864d1SBas van den Berg } __packed hfa384x_pdr_hfa3861_shadow_t;
103976e3e7c4SKarl Relton 
104075f49e07SMithlesh Thukral typedef struct hfa384x_pdr_hfa3861_ifrf {
104176e3e7c4SKarl Relton 	u32 value[20];
10427d3864d1SBas van den Berg } __packed hfa384x_pdr_hfa3861_ifrf_t;
104376e3e7c4SKarl Relton 
104475f49e07SMithlesh Thukral typedef struct hfa384x_pdr_hfa3861_chcalsp {
104576e3e7c4SKarl Relton 	u16 value[14];
10467d3864d1SBas van den Berg } __packed hfa384x_pdr_hfa3861_chcalsp_t;
104776e3e7c4SKarl Relton 
104875f49e07SMithlesh Thukral typedef struct hfa384x_pdr_hfa3861_chcali {
104976e3e7c4SKarl Relton 	u16 value[17];
10507d3864d1SBas van den Berg } __packed hfa384x_pdr_hfa3861_chcali_t;
105176e3e7c4SKarl Relton 
105275f49e07SMithlesh Thukral typedef struct hfa384x_pdr_hfa3861_nic_config {
105376e3e7c4SKarl Relton 	u16 config_bitmap;
10547d3864d1SBas van den Berg } __packed hfa384x_pdr_nic_config_t;
105576e3e7c4SKarl Relton 
105675f49e07SMithlesh Thukral typedef struct hfa384x_pdr_hfo_delay {
105776e3e7c4SKarl Relton 	u8 hfo_delay;
10587d3864d1SBas van den Berg } __packed hfa384x_hfo_delay_t;
105976e3e7c4SKarl Relton 
106075f49e07SMithlesh Thukral typedef struct hfa384x_pdr_hfa3861_manf_testsp {
106176e3e7c4SKarl Relton 	u16 value[30];
10627d3864d1SBas van den Berg } __packed hfa384x_pdr_hfa3861_manf_testsp_t;
106376e3e7c4SKarl Relton 
106475f49e07SMithlesh Thukral typedef struct hfa384x_pdr_hfa3861_manf_testi {
106576e3e7c4SKarl Relton 	u16 value[30];
10667d3864d1SBas van den Berg } __packed hfa384x_pdr_hfa3861_manf_testi_t;
106776e3e7c4SKarl Relton 
106875f49e07SMithlesh Thukral typedef struct hfa384x_end_of_pda {
106976e3e7c4SKarl Relton 	u16 crc;
10707d3864d1SBas van den Berg } __packed hfa384x_pdr_end_of_pda_t;
107176e3e7c4SKarl Relton 
107275f49e07SMithlesh Thukral typedef struct hfa384x_pdrec {
107376e3e7c4SKarl Relton 	u16 len;		/* in words */
107476e3e7c4SKarl Relton 	u16 code;
107576e3e7c4SKarl Relton 	union pdr {
107676e3e7c4SKarl Relton 		hfa384x_pdr_pcb_partnum_t pcb_partnum;
107776e3e7c4SKarl Relton 		hfa384x_pdr_pcb_tracenum_t pcb_tracenum;
107876e3e7c4SKarl Relton 		hfa384x_pdr_nic_serial_t nic_serial;
107976e3e7c4SKarl Relton 		hfa384x_pdr_mkk_measurements_t mkk_measurements;
108076e3e7c4SKarl Relton 		hfa384x_pdr_nic_ramsize_t nic_ramsize;
108176e3e7c4SKarl Relton 		hfa384x_pdr_mfisuprange_t mfisuprange;
108276e3e7c4SKarl Relton 		hfa384x_pdr_cfisuprange_t cfisuprange;
108376e3e7c4SKarl Relton 		hfa384x_pdr_nicid_t nicid;
108476e3e7c4SKarl Relton 		hfa384x_pdr_refdac_measurements_t refdac_measurements;
108576e3e7c4SKarl Relton 		hfa384x_pdr_vgdac_measurements_t vgdac_measurements;
108676e3e7c4SKarl Relton 		hfa384x_pdr_level_compc_measurements_t level_compc_measurements;
108776e3e7c4SKarl Relton 		hfa384x_pdr_mac_address_t mac_address;
108876e3e7c4SKarl Relton 		hfa384x_pdr_mkk_callname_t mkk_callname;
108976e3e7c4SKarl Relton 		hfa384x_pdr_regdomain_t regdomain;
109076e3e7c4SKarl Relton 		hfa384x_pdr_allowed_channel_t allowed_channel;
109176e3e7c4SKarl Relton 		hfa384x_pdr_default_channel_t default_channel;
109276e3e7c4SKarl Relton 		hfa384x_pdr_privacy_option_t privacy_option;
109376e3e7c4SKarl Relton 		hfa384x_pdr_temptype_t temptype;
109476e3e7c4SKarl Relton 		hfa384x_pdr_refdac_setup_t refdac_setup;
109576e3e7c4SKarl Relton 		hfa384x_pdr_vgdac_setup_t vgdac_setup;
109676e3e7c4SKarl Relton 		hfa384x_pdr_level_comp_setup_t level_comp_setup;
109776e3e7c4SKarl Relton 		hfa384x_pdr_trimdac_setup_t trimdac_setup;
109876e3e7c4SKarl Relton 		hfa384x_pdr_ifr_setting_t ifr_setting;
109976e3e7c4SKarl Relton 		hfa384x_pdr_rfr_setting_t rfr_setting;
110076e3e7c4SKarl Relton 		hfa384x_pdr_hfa3861_baseline_t hfa3861_baseline;
110176e3e7c4SKarl Relton 		hfa384x_pdr_hfa3861_shadow_t hfa3861_shadow;
110276e3e7c4SKarl Relton 		hfa384x_pdr_hfa3861_ifrf_t hfa3861_ifrf;
110376e3e7c4SKarl Relton 		hfa384x_pdr_hfa3861_chcalsp_t hfa3861_chcalsp;
110476e3e7c4SKarl Relton 		hfa384x_pdr_hfa3861_chcali_t hfa3861_chcali;
110576e3e7c4SKarl Relton 		hfa384x_pdr_nic_config_t nic_config;
110676e3e7c4SKarl Relton 		hfa384x_hfo_delay_t hfo_delay;
110776e3e7c4SKarl Relton 		hfa384x_pdr_hfa3861_manf_testsp_t hfa3861_manf_testsp;
110876e3e7c4SKarl Relton 		hfa384x_pdr_hfa3861_manf_testi_t hfa3861_manf_testi;
110976e3e7c4SKarl Relton 		hfa384x_pdr_end_of_pda_t end_of_pda;
111076e3e7c4SKarl Relton 
111176e3e7c4SKarl Relton 	} data;
11127d3864d1SBas van den Berg } __packed hfa384x_pdrec_t;
111376e3e7c4SKarl Relton 
111400b3ed16SGreg Kroah-Hartman #ifdef __KERNEL__
111500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
111600b3ed16SGreg Kroah-Hartman ---  MAC state structure, argument to all functions --
111700b3ed16SGreg Kroah-Hartman ---  Also, a collection of support types --
111800b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
1119e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_statusresult {
1120aaad4303SSolomon Peachy 	u16 status;
1121aaad4303SSolomon Peachy 	u16 resp0;
1122aaad4303SSolomon Peachy 	u16 resp1;
1123aaad4303SSolomon Peachy 	u16 resp2;
112400b3ed16SGreg Kroah-Hartman } hfa384x_cmdresult_t;
112500b3ed16SGreg Kroah-Hartman 
112600b3ed16SGreg Kroah-Hartman /* USB Control Exchange (CTLX):
112700b3ed16SGreg Kroah-Hartman  *  A queue of the structure below is maintained for all of the
112800b3ed16SGreg Kroah-Hartman  *  Request/Response type USB packets supported by Prism2.
112900b3ed16SGreg Kroah-Hartman  */
113000b3ed16SGreg Kroah-Hartman /* The following hfa384x_* structures are arguments to
113100b3ed16SGreg Kroah-Hartman  * the usercb() for the different CTLX types.
113200b3ed16SGreg Kroah-Hartman  */
1133e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_rridresult {
1134aaad4303SSolomon Peachy 	u16 rid;
113500b3ed16SGreg Kroah-Hartman 	const void *riddata;
1136aaad4303SSolomon Peachy 	unsigned int riddata_len;
113700b3ed16SGreg Kroah-Hartman } hfa384x_rridresult_t;
113800b3ed16SGreg Kroah-Hartman 
113900b3ed16SGreg Kroah-Hartman enum ctlx_state {
114000b3ed16SGreg Kroah-Hartman 	CTLX_START = 0,		/* Start state, not queued */
114100b3ed16SGreg Kroah-Hartman 
114200b3ed16SGreg Kroah-Hartman 	CTLX_COMPLETE,		/* CTLX successfully completed */
114300b3ed16SGreg Kroah-Hartman 	CTLX_REQ_FAILED,	/* OUT URB completed w/ error */
114400b3ed16SGreg Kroah-Hartman 
114500b3ed16SGreg Kroah-Hartman 	CTLX_PENDING,		/* Queued, data valid */
114600b3ed16SGreg Kroah-Hartman 	CTLX_REQ_SUBMITTED,	/* OUT URB submitted */
114700b3ed16SGreg Kroah-Hartman 	CTLX_REQ_COMPLETE,	/* OUT URB complete */
114800b3ed16SGreg Kroah-Hartman 	CTLX_RESP_COMPLETE	/* IN URB received */
114900b3ed16SGreg Kroah-Hartman };
115000b3ed16SGreg Kroah-Hartman typedef enum ctlx_state CTLX_STATE;
115100b3ed16SGreg Kroah-Hartman 
115200b3ed16SGreg Kroah-Hartman struct hfa384x_usbctlx;
115300b3ed16SGreg Kroah-Hartman struct hfa384x;
115400b3ed16SGreg Kroah-Hartman 
115500b3ed16SGreg Kroah-Hartman typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);
115600b3ed16SGreg Kroah-Hartman 
1157e573aaa4SMoritz Muehlenhoff typedef void (*ctlx_usercb_t) (struct hfa384x *hw,
1158e573aaa4SMoritz Muehlenhoff 			       void *ctlxresult, void *usercb_data);
115900b3ed16SGreg Kroah-Hartman 
1160e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_usbctlx {
116100b3ed16SGreg Kroah-Hartman 	struct list_head list;
116200b3ed16SGreg Kroah-Hartman 
116300b3ed16SGreg Kroah-Hartman 	size_t outbufsize;
116400b3ed16SGreg Kroah-Hartman 	hfa384x_usbout_t outbuf;	/* pkt buf for OUT */
116500b3ed16SGreg Kroah-Hartman 	hfa384x_usbin_t inbuf;	/* pkt buf for IN(a copy) */
116600b3ed16SGreg Kroah-Hartman 
116700b3ed16SGreg Kroah-Hartman 	CTLX_STATE state;	/* Tracks running state */
116800b3ed16SGreg Kroah-Hartman 
116900b3ed16SGreg Kroah-Hartman 	struct completion done;
117000b3ed16SGreg Kroah-Hartman 	volatile int reapable;	/* Food for the reaper task */
117100b3ed16SGreg Kroah-Hartman 
117200b3ed16SGreg Kroah-Hartman 	ctlx_cmdcb_t cmdcb;	/* Async command callback */
117300b3ed16SGreg Kroah-Hartman 	ctlx_usercb_t usercb;	/* Async user callback, */
117400b3ed16SGreg Kroah-Hartman 	void *usercb_data;	/*  at CTLX completion  */
117500b3ed16SGreg Kroah-Hartman 
117600b3ed16SGreg Kroah-Hartman 	int variant;		/* Identifies cmd variant */
117700b3ed16SGreg Kroah-Hartman } hfa384x_usbctlx_t;
117800b3ed16SGreg Kroah-Hartman 
1179e573aaa4SMoritz Muehlenhoff typedef struct hfa384x_usbctlxq {
118000b3ed16SGreg Kroah-Hartman 	spinlock_t lock;
118100b3ed16SGreg Kroah-Hartman 	struct list_head pending;
118200b3ed16SGreg Kroah-Hartman 	struct list_head active;
118300b3ed16SGreg Kroah-Hartman 	struct list_head completing;
118400b3ed16SGreg Kroah-Hartman 	struct list_head reapable;
118500b3ed16SGreg Kroah-Hartman } hfa384x_usbctlxq_t;
118600b3ed16SGreg Kroah-Hartman 
1187e573aaa4SMoritz Muehlenhoff typedef struct hfa484x_metacmd {
1188aaad4303SSolomon Peachy 	u16 cmd;
118900b3ed16SGreg Kroah-Hartman 
1190aaad4303SSolomon Peachy 	u16 parm0;
1191aaad4303SSolomon Peachy 	u16 parm1;
1192aaad4303SSolomon Peachy 	u16 parm2;
119300b3ed16SGreg Kroah-Hartman 
119400b3ed16SGreg Kroah-Hartman 	hfa384x_cmdresult_t result;
119500b3ed16SGreg Kroah-Hartman } hfa384x_metacmd_t;
119600b3ed16SGreg Kroah-Hartman 
119700b3ed16SGreg Kroah-Hartman #define	MAX_GRP_ADDR		32
119800b3ed16SGreg Kroah-Hartman #define WLAN_COMMENT_MAX	80  /* Max. length of user comment string. */
119900b3ed16SGreg Kroah-Hartman 
120000b3ed16SGreg Kroah-Hartman #define WLAN_AUTH_MAX           60  /* Max. # of authenticated stations. */
120100b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_MAX		60  /* Max. # of stations in an access list. */
120200b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_NONE	0   /* No stations may be authenticated. */
120300b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALL		1   /* All stations may be authenticated. */
120400b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALLOW	2   /* Authenticate only "allowed" stations. */
120500b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_DENY	3   /* Do not authenticate "denied" stations. */
120600b3ed16SGreg Kroah-Hartman 
120700b3ed16SGreg Kroah-Hartman /* XXX These are going away ASAP */
1208c84b528cSVatika Harlalka struct prism2sta_authlist {
1209aaad4303SSolomon Peachy 	unsigned int cnt;
121028b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_AUTH_MAX][ETH_ALEN];
1211aaad4303SSolomon Peachy 	u8 assoc[WLAN_AUTH_MAX];
1212c84b528cSVatika Harlalka };
121300b3ed16SGreg Kroah-Hartman 
12144d10ece3SVatika Harlalka struct prism2sta_accesslist {
1215aaad4303SSolomon Peachy 	unsigned int modify;
1216aaad4303SSolomon Peachy 	unsigned int cnt;
121728b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_ACCESS_MAX][ETH_ALEN];
1218aaad4303SSolomon Peachy 	unsigned int cnt1;
121928b17a4bSMoritz Muehlenhoff 	u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN];
12204d10ece3SVatika Harlalka };
122100b3ed16SGreg Kroah-Hartman 
1222e573aaa4SMoritz Muehlenhoff typedef struct hfa384x {
122300b3ed16SGreg Kroah-Hartman 	/* USB support data */
122400b3ed16SGreg Kroah-Hartman 	struct usb_device *usb;
122500b3ed16SGreg Kroah-Hartman 	struct urb rx_urb;
122600b3ed16SGreg Kroah-Hartman 	struct sk_buff *rx_urb_skb;
122700b3ed16SGreg Kroah-Hartman 	struct urb tx_urb;
122800b3ed16SGreg Kroah-Hartman 	struct urb ctlx_urb;
122900b3ed16SGreg Kroah-Hartman 	hfa384x_usbout_t txbuff;
123000b3ed16SGreg Kroah-Hartman 	hfa384x_usbctlxq_t ctlxq;
123100b3ed16SGreg Kroah-Hartman 	struct timer_list reqtimer;
123200b3ed16SGreg Kroah-Hartman 	struct timer_list resptimer;
123300b3ed16SGreg Kroah-Hartman 
123400b3ed16SGreg Kroah-Hartman 	struct timer_list throttle;
123500b3ed16SGreg Kroah-Hartman 
123600b3ed16SGreg Kroah-Hartman 	struct tasklet_struct reaper_bh;
123700b3ed16SGreg Kroah-Hartman 	struct tasklet_struct completion_bh;
123800b3ed16SGreg Kroah-Hartman 
123900b3ed16SGreg Kroah-Hartman 	struct work_struct usb_work;
124000b3ed16SGreg Kroah-Hartman 
124100b3ed16SGreg Kroah-Hartman 	unsigned long usb_flags;
124200b3ed16SGreg Kroah-Hartman #define THROTTLE_RX	0
124300b3ed16SGreg Kroah-Hartman #define THROTTLE_TX	1
124400b3ed16SGreg Kroah-Hartman #define WORK_RX_HALT	2
124500b3ed16SGreg Kroah-Hartman #define WORK_TX_HALT	3
124600b3ed16SGreg Kroah-Hartman #define WORK_RX_RESUME	4
124700b3ed16SGreg Kroah-Hartman #define WORK_TX_RESUME	5
124800b3ed16SGreg Kroah-Hartman 
124900b3ed16SGreg Kroah-Hartman 	unsigned short req_timer_done:1;
125000b3ed16SGreg Kroah-Hartman 	unsigned short resp_timer_done:1;
125100b3ed16SGreg Kroah-Hartman 
125200b3ed16SGreg Kroah-Hartman 	int endp_in;
125300b3ed16SGreg Kroah-Hartman 	int endp_out;
125400b3ed16SGreg Kroah-Hartman 
125500b3ed16SGreg Kroah-Hartman 	int sniff_fcs;
125600b3ed16SGreg Kroah-Hartman 	int sniff_channel;
125700b3ed16SGreg Kroah-Hartman 	int sniff_truncate;
125800b3ed16SGreg Kroah-Hartman 	int sniffhdr;
125900b3ed16SGreg Kroah-Hartman 
126000b3ed16SGreg Kroah-Hartman 	wait_queue_head_t cmdq;	/* wait queue itself */
126100b3ed16SGreg Kroah-Hartman 
126200b3ed16SGreg Kroah-Hartman 	/* Controller state */
1263aaad4303SSolomon Peachy 	u32 state;
1264aaad4303SSolomon Peachy 	u32 isap;
1265aaad4303SSolomon Peachy 	u8 port_enabled[HFA384x_NUMPORTS_MAX];
126600b3ed16SGreg Kroah-Hartman 
126700b3ed16SGreg Kroah-Hartman 	/* Download support */
1268aaad4303SSolomon Peachy 	unsigned int dlstate;
126900b3ed16SGreg Kroah-Hartman 	hfa384x_downloadbuffer_t bufinfo;
1270aaad4303SSolomon Peachy 	u16 dltimeout;
127100b3ed16SGreg Kroah-Hartman 
12721a6dfce7SMasanari Iida 	int scanflag;		/* to signal scan complete */
127300b3ed16SGreg Kroah-Hartman 	int join_ap;		/* are we joined to a specific ap */
127400b3ed16SGreg Kroah-Hartman 	int join_retries;	/* number of join retries till we fail */
127500b3ed16SGreg Kroah-Hartman 	hfa384x_JoinRequest_data_t joinreq;	/* join request saved data */
127600b3ed16SGreg Kroah-Hartman 
1277c9573a8dSsayli karnik 	struct wlandevice *wlandev;
127800b3ed16SGreg Kroah-Hartman 	/* Timer to allow for the deferred processing of linkstatus messages */
127900b3ed16SGreg Kroah-Hartman 	struct work_struct link_bh;
128000b3ed16SGreg Kroah-Hartman 
128100b3ed16SGreg Kroah-Hartman 	struct work_struct commsqual_bh;
128200b3ed16SGreg Kroah-Hartman 	hfa384x_commsquality_t qual;
128300b3ed16SGreg Kroah-Hartman 	struct timer_list commsqual_timer;
128400b3ed16SGreg Kroah-Hartman 
1285aaad4303SSolomon Peachy 	u16 link_status;
1286aaad4303SSolomon Peachy 	u16 link_status_new;
128700b3ed16SGreg Kroah-Hartman 	struct sk_buff_head authq;
128800b3ed16SGreg Kroah-Hartman 
1289cb3126e6SKarl Relton 	u32 txrate;
1290cb3126e6SKarl Relton 
129100b3ed16SGreg Kroah-Hartman 	/* And here we have stuff that used to be in priv */
129200b3ed16SGreg Kroah-Hartman 
129300b3ed16SGreg Kroah-Hartman 	/* State variables */
1294aaad4303SSolomon Peachy 	unsigned int presniff_port_type;
1295aaad4303SSolomon Peachy 	u16 presniff_wepflags;
1296aaad4303SSolomon Peachy 	u32 dot11_desired_bss_type;
129700b3ed16SGreg Kroah-Hartman 
129800b3ed16SGreg Kroah-Hartman 	int dbmadjust;
129900b3ed16SGreg Kroah-Hartman 
130000b3ed16SGreg Kroah-Hartman 	/* Group Addresses - right now, there are up to a total
13015f0730fdSJuliana Rodrigues 	 * of MAX_GRP_ADDR group addresses
13025f0730fdSJuliana Rodrigues 	 */
130328b17a4bSMoritz Muehlenhoff 	u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN];
1304aaad4303SSolomon Peachy 	unsigned int dot11_grpcnt;
130500b3ed16SGreg Kroah-Hartman 
130600b3ed16SGreg Kroah-Hartman 	/* Component Identities */
130700b3ed16SGreg Kroah-Hartman 	hfa384x_compident_t ident_nic;
130800b3ed16SGreg Kroah-Hartman 	hfa384x_compident_t ident_pri_fw;
130900b3ed16SGreg Kroah-Hartman 	hfa384x_compident_t ident_sta_fw;
131000b3ed16SGreg Kroah-Hartman 	hfa384x_compident_t ident_ap_fw;
1311aaad4303SSolomon Peachy 	u16 mm_mods;
131200b3ed16SGreg Kroah-Hartman 
131300b3ed16SGreg Kroah-Hartman 	/* Supplier compatibility ranges */
131400b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t cap_sup_mfi;
131500b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t cap_sup_cfi;
131600b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t cap_sup_pri;
131700b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t cap_sup_sta;
131800b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t cap_sup_ap;
131900b3ed16SGreg Kroah-Hartman 
132000b3ed16SGreg Kroah-Hartman 	/* Actor compatibility ranges */
132171508ee4SAlessandro Ghedini 	hfa384x_caplevel_t cap_act_pri_cfi;	/*
132271508ee4SAlessandro Ghedini 						 * pri f/w to controller
132371508ee4SAlessandro Ghedini 						 * interface
132471508ee4SAlessandro Ghedini 						 */
132571508ee4SAlessandro Ghedini 
132671508ee4SAlessandro Ghedini 	hfa384x_caplevel_t cap_act_sta_cfi;	/*
132771508ee4SAlessandro Ghedini 						 * sta f/w to controller
132871508ee4SAlessandro Ghedini 						 * interface
132971508ee4SAlessandro Ghedini 						 */
133071508ee4SAlessandro Ghedini 
133100b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t cap_act_sta_mfi;	/* sta f/w to modem interface */
133271508ee4SAlessandro Ghedini 
133371508ee4SAlessandro Ghedini 	hfa384x_caplevel_t cap_act_ap_cfi;	/*
133471508ee4SAlessandro Ghedini 						 * ap f/w to controller
133571508ee4SAlessandro Ghedini 						 * interface
133671508ee4SAlessandro Ghedini 						 */
133771508ee4SAlessandro Ghedini 
133800b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t cap_act_ap_mfi;	/* ap f/w to modem interface */
133900b3ed16SGreg Kroah-Hartman 
1340aaad4303SSolomon Peachy 	u32 psusercount;	/* Power save user count. */
134100b3ed16SGreg Kroah-Hartman 	hfa384x_CommTallies32_t tallies;	/* Communication tallies. */
1342aaad4303SSolomon Peachy 	u8 comment[WLAN_COMMENT_MAX + 1];	/* User comment */
134300b3ed16SGreg Kroah-Hartman 
134400b3ed16SGreg Kroah-Hartman 	/* Channel Info request results (AP only) */
134500b3ed16SGreg Kroah-Hartman 	struct {
134600b3ed16SGreg Kroah-Hartman 		atomic_t done;
1347aaad4303SSolomon Peachy 		u8 count;
134800b3ed16SGreg Kroah-Hartman 		hfa384x_ChInfoResult_t results;
134900b3ed16SGreg Kroah-Hartman 	} channel_info;
135000b3ed16SGreg Kroah-Hartman 
135100b3ed16SGreg Kroah-Hartman 	hfa384x_InfFrame_t *scanresults;
135200b3ed16SGreg Kroah-Hartman 
1353c84b528cSVatika Harlalka 	struct prism2sta_authlist authlist;	/* Authenticated station list. */
1354aaad4303SSolomon Peachy 	unsigned int accessmode;		/* Access mode. */
13554d10ece3SVatika Harlalka 	struct prism2sta_accesslist allow;	/* Allowed station list. */
13564d10ece3SVatika Harlalka 	struct prism2sta_accesslist deny;	/* Denied station list. */
135700b3ed16SGreg Kroah-Hartman 
135800b3ed16SGreg Kroah-Hartman } hfa384x_t;
135900b3ed16SGreg Kroah-Hartman 
1360e573aaa4SMoritz Muehlenhoff void hfa384x_create(hfa384x_t *hw, struct usb_device *usb);
136100b3ed16SGreg Kroah-Hartman void hfa384x_destroy(hfa384x_t *hw);
136200b3ed16SGreg Kroah-Hartman 
136300b3ed16SGreg Kroah-Hartman int
136400b3ed16SGreg Kroah-Hartman hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis);
1365e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_disable(hfa384x_t *hw, u16 macport);
1366e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_enable(hfa384x_t *hw, u16 macport);
1367e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_flashdl_enable(hfa384x_t *hw);
1368e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_flashdl_disable(hfa384x_t *hw);
1369e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len);
1370e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len);
1371e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr);
1372e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_ramdl_disable(hfa384x_t *hw);
1373e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len);
1374e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len);
1375e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len);
137600b3ed16SGreg Kroah-Hartman 
1377e573aaa4SMoritz Muehlenhoff static inline int hfa384x_drvr_getconfig16(hfa384x_t *hw, u16 rid, void *val)
137800b3ed16SGreg Kroah-Hartman {
137900b3ed16SGreg Kroah-Hartman 	int result = 0;
13807489df36SVeronika Kabatova 
1381aaad4303SSolomon Peachy 	result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
1382e573aaa4SMoritz Muehlenhoff 	if (result == 0)
138318c7f792SMoritz Muehlenhoff 		*((u16 *) val) = le16_to_cpu(*((u16 *) val));
138400b3ed16SGreg Kroah-Hartman 	return result;
138500b3ed16SGreg Kroah-Hartman }
138600b3ed16SGreg Kroah-Hartman 
1387e573aaa4SMoritz Muehlenhoff static inline int hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val)
138800b3ed16SGreg Kroah-Hartman {
138918c7f792SMoritz Muehlenhoff 	u16 value = cpu_to_le16(val);
13907489df36SVeronika Kabatova 
139100b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
139200b3ed16SGreg Kroah-Hartman }
139300b3ed16SGreg Kroah-Hartman 
139400b3ed16SGreg Kroah-Hartman int
139500b3ed16SGreg Kroah-Hartman hfa384x_drvr_setconfig_async(hfa384x_t *hw,
1396aaad4303SSolomon Peachy 			     u16 rid,
139700b3ed16SGreg Kroah-Hartman 			     void *buf,
1398e573aaa4SMoritz Muehlenhoff 			     u16 len, ctlx_usercb_t usercb, void *usercb_data);
139900b3ed16SGreg Kroah-Hartman 
140000b3ed16SGreg Kroah-Hartman static inline int
1401aaad4303SSolomon Peachy hfa384x_drvr_setconfig16_async(hfa384x_t *hw, u16 rid, u16 val)
140200b3ed16SGreg Kroah-Hartman {
140318c7f792SMoritz Muehlenhoff 	u16 value = cpu_to_le16(val);
14047489df36SVeronika Kabatova 
140500b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
140600b3ed16SGreg Kroah-Hartman 					    NULL, NULL);
140700b3ed16SGreg Kroah-Hartman }
140800b3ed16SGreg Kroah-Hartman 
1409e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_start(hfa384x_t *hw);
1410e573aaa4SMoritz Muehlenhoff int hfa384x_drvr_stop(hfa384x_t *hw);
141100b3ed16SGreg Kroah-Hartman int
1412e573aaa4SMoritz Muehlenhoff hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb,
1413f6b43c2eSSven Dziadek 		     union p80211_hdr *p80211_hdr,
1414f6b43c2eSSven Dziadek 		     struct p80211_metawep *p80211_wep);
1415c9573a8dSsayli karnik void hfa384x_tx_timeout(struct wlandevice *wlandev);
141600b3ed16SGreg Kroah-Hartman 
1417e573aaa4SMoritz Muehlenhoff int hfa384x_cmd_initialize(hfa384x_t *hw);
1418e573aaa4SMoritz Muehlenhoff int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport);
1419e573aaa4SMoritz Muehlenhoff int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport);
1420e573aaa4SMoritz Muehlenhoff int hfa384x_cmd_allocate(hfa384x_t *hw, u16 len);
1421e573aaa4SMoritz Muehlenhoff int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable);
142200b3ed16SGreg Kroah-Hartman int
1423e573aaa4SMoritz Muehlenhoff hfa384x_cmd_download(hfa384x_t *hw,
1424e573aaa4SMoritz Muehlenhoff 		     u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
142500b3ed16SGreg Kroah-Hartman 
142600b3ed16SGreg Kroah-Hartman #endif /*__KERNEL__ */
142700b3ed16SGreg Kroah-Hartman 
142800b3ed16SGreg Kroah-Hartman #endif /*_HFA384x_H */
1429