13fb28ae7STim Collier /* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */
28ffd91d9SAldas Taraškevičius /*
300b3ed16SGreg Kroah-Hartman  *
400b3ed16SGreg Kroah-Hartman  * Defines the constants and data structures for the hfa384x
500b3ed16SGreg Kroah-Hartman  *
600b3ed16SGreg Kroah-Hartman  * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
700b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
800b3ed16SGreg Kroah-Hartman  *
900b3ed16SGreg Kroah-Hartman  * linux-wlan
1000b3ed16SGreg Kroah-Hartman  *
1100b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
1200b3ed16SGreg Kroah-Hartman  *
1300b3ed16SGreg Kroah-Hartman  * Inquiries regarding the linux-wlan Open Source project can be
1400b3ed16SGreg Kroah-Hartman  * made directly to:
1500b3ed16SGreg Kroah-Hartman  *
1600b3ed16SGreg Kroah-Hartman  * AbsoluteValue Systems Inc.
1700b3ed16SGreg Kroah-Hartman  * info@linux-wlan.com
1800b3ed16SGreg Kroah-Hartman  * http://www.linux-wlan.com
1900b3ed16SGreg Kroah-Hartman  *
2000b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
2100b3ed16SGreg Kroah-Hartman  *
2200b3ed16SGreg Kroah-Hartman  * Portions of the development of this software were funded by
2300b3ed16SGreg Kroah-Hartman  * Intersil Corporation as part of PRISM(R) chipset product development.
2400b3ed16SGreg Kroah-Hartman  *
2500b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
2600b3ed16SGreg Kroah-Hartman  *
2700b3ed16SGreg Kroah-Hartman  *   [Implementation and usage notes]
2800b3ed16SGreg Kroah-Hartman  *
2900b3ed16SGreg Kroah-Hartman  *   [References]
3000b3ed16SGreg Kroah-Hartman  *	CW10 Programmer's Manual v1.5
3100b3ed16SGreg Kroah-Hartman  *	IEEE 802.11 D10.0
3200b3ed16SGreg Kroah-Hartman  *
3300b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
3400b3ed16SGreg Kroah-Hartman  */
3500b3ed16SGreg Kroah-Hartman 
3600b3ed16SGreg Kroah-Hartman #ifndef _HFA384x_H
3700b3ed16SGreg Kroah-Hartman #define _HFA384x_H
3800b3ed16SGreg Kroah-Hartman 
3900b3ed16SGreg Kroah-Hartman #define HFA384x_FIRMWARE_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
4000b3ed16SGreg Kroah-Hartman 
4128b17a4bSMoritz Muehlenhoff #include <linux/if_ether.h>
422e380275SKumar Amit Mehta #include <linux/usb.h>
4328b17a4bSMoritz Muehlenhoff 
4400b3ed16SGreg Kroah-Hartman /*--- Mins & Maxs -----------------------------------*/
45aaad4303SSolomon Peachy #define	HFA384x_PORTID_MAX		((u16)7)
46aaad4303SSolomon Peachy #define	HFA384x_NUMPORTS_MAX		((u16)(HFA384x_PORTID_MAX + 1))
47aaad4303SSolomon Peachy #define	HFA384x_PDR_LEN_MAX		((u16)512) /* in bytes, from EK */
4876e3e7c4SKarl Relton #define	HFA384x_PDA_RECS_MAX		((u16)200) /* a guess */
49aaad4303SSolomon Peachy #define	HFA384x_PDA_LEN_MAX		((u16)1024) /* in bytes, from EK*/
50aaad4303SSolomon Peachy #define	HFA384x_SCANRESULT_MAX		((u16)31)
51aaad4303SSolomon Peachy #define	HFA384x_HSCANRESULT_MAX		((u16)31)
52aaad4303SSolomon Peachy #define	HFA384x_CHINFORESULT_MAX	((u16)16)
5300b3ed16SGreg Kroah-Hartman #define	HFA384x_RID_GUESSING_MAXLEN	2048	/* I'm not really sure */
5400b3ed16SGreg Kroah-Hartman #define	HFA384x_RIDDATA_MAXLEN		HFA384x_RID_GUESSING_MAXLEN
5500b3ed16SGreg Kroah-Hartman #define	HFA384x_USB_RWMEM_MAXLEN	2048
5600b3ed16SGreg Kroah-Hartman 
5700b3ed16SGreg Kroah-Hartman /*--- Support Constants -----------------------------*/
58aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_IBSS			((u16)0)
59aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_BSS			((u16)1)
60aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_PSUEDOIBSS		((u16)3)
617f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_PRIVINVOKED		((u16)BIT(0))
627f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_EXCLUDE		((u16)BIT(1))
637f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_DISABLE_TXCRYPT	((u16)BIT(4))
647f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_DISABLE_RXCRYPT	((u16)BIT(7))
65aaad4303SSolomon Peachy #define		HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM	((u16)3)
66aaad4303SSolomon Peachy #define		HFA384x_PORTSTATUS_DISABLED		((u16)1)
67aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_1			((u16)1)
68aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_2			((u16)2)
69aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_5dot5			((u16)4)
70aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_11			((u16)8)
7100b3ed16SGreg Kroah-Hartman 
7200b3ed16SGreg Kroah-Hartman /*--- MAC Internal memory constants and macros ------*/
7300b3ed16SGreg Kroah-Hartman /* masks and macros used to manipulate MAC internal memory addresses. */
7400b3ed16SGreg Kroah-Hartman /* MAC internal memory addresses are 23 bit quantities.  The MAC uses
7500b3ed16SGreg Kroah-Hartman  * a paged address space where the upper 16 bits are the page number
7600b3ed16SGreg Kroah-Hartman  * and the lower 7 bits are the offset.  There are various Host API
7700b3ed16SGreg Kroah-Hartman  * elements that require two 16-bit quantities to specify a MAC
7800b3ed16SGreg Kroah-Hartman  * internal memory address.  Unfortunately, some of the API's use a
7900b3ed16SGreg Kroah-Hartman  * page/offset format where the offset value is JUST the lower seven
8000b3ed16SGreg Kroah-Hartman  * bits and the page is  the remaining 16 bits.  Some of the API's
8100b3ed16SGreg Kroah-Hartman  * assume that the 23 bit address has been split at the 16th bit.  We
8200b3ed16SGreg Kroah-Hartman  * refer to these two formats as AUX format and CMD format.  The
8300b3ed16SGreg Kroah-Hartman  * macros below help handle some of this.
8400b3ed16SGreg Kroah-Hartman  */
8500b3ed16SGreg Kroah-Hartman 
8600b3ed16SGreg Kroah-Hartman /* Mask bits for discarding unwanted pieces in a flat address */
8700b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_AUX_PAGE_MASK	(0x007fff80)
8800b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_AUX_OFF_MASK	(0x0000007f)
8900b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_CMD_PAGE_MASK	(0xffff0000)
9000b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_CMD_OFF_MASK	(0x0000ffff)
9100b3ed16SGreg Kroah-Hartman 
92e573aaa4SMoritz Muehlenhoff /* Mask bits for discarding unwanted pieces in AUX format
9395842bc9SJuliana Rodrigues  * 16-bit address parts
9495842bc9SJuliana Rodrigues  */
9500b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_PAGE_MASK	(0xffff)
9600b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_OFF_MASK	(0x007f)
9700b3ed16SGreg Kroah-Hartman 
9800b3ed16SGreg Kroah-Hartman /* Make a 32-bit flat address from AUX format 16-bit page and offset */
9900b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_MKFLAT(p, o)	\
1005dd8acc8SSvenne Krap 		((((u32)(((u16)(p)) & HFA384x_ADDR_AUX_PAGE_MASK)) << 7) | \
1015dd8acc8SSvenne Krap 		((u32)(((u16)(o)) & HFA384x_ADDR_AUX_OFF_MASK)))
10200b3ed16SGreg Kroah-Hartman 
10300b3ed16SGreg Kroah-Hartman /* Make CMD format offset and page from a 32-bit flat address */
10400b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_CMD_MKPAGE(f) \
105aaad4303SSolomon Peachy 		((u16)((((u32)(f)) & HFA384x_ADDR_FLAT_CMD_PAGE_MASK) >> 16))
10600b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_CMD_MKOFF(f) \
107aaad4303SSolomon Peachy 		((u16)(((u32)(f)) & HFA384x_ADDR_FLAT_CMD_OFF_MASK))
10800b3ed16SGreg Kroah-Hartman 
10900b3ed16SGreg Kroah-Hartman /*--- Controller Memory addresses -------------------*/
11000b3ed16SGreg Kroah-Hartman #define		HFA3842_PDA_BASE	(0x007f0000UL)
11100b3ed16SGreg Kroah-Hartman #define		HFA3841_PDA_BASE	(0x003f0000UL)
11200b3ed16SGreg Kroah-Hartman #define		HFA3841_PDA_BOGUS_BASE	(0x00390000UL)
11300b3ed16SGreg Kroah-Hartman 
11400b3ed16SGreg Kroah-Hartman /*--- Driver Download states  -----------------------*/
11500b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_DISABLED		0
11600b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_RAMENABLED		1
11700b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_FLASHENABLED		2
11800b3ed16SGreg Kroah-Hartman 
11900b3ed16SGreg Kroah-Hartman /*--- Register Field Masks --------------------------*/
120d349883fSSergio Paracuellos #define		HFA384x_CMD_AINFO		((u16)GENMASK(14, 8))
121d349883fSSergio Paracuellos #define		HFA384x_CMD_MACPORT		((u16)GENMASK(10, 8))
122d349883fSSergio Paracuellos #define		HFA384x_CMD_PROGMODE		((u16)GENMASK(9, 8))
123d349883fSSergio Paracuellos #define		HFA384x_CMD_CMDCODE		((u16)GENMASK(5, 0))
124d349883fSSergio Paracuellos #define		HFA384x_STATUS_RESULT		((u16)GENMASK(14, 8))
12500b3ed16SGreg Kroah-Hartman 
12600b3ed16SGreg Kroah-Hartman /*--- Command Code Constants --------------------------*/
12700b3ed16SGreg Kroah-Hartman /*--- Controller Commands --------------------------*/
128aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INIT		((u16)0x00)
129aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_ENABLE		((u16)0x01)
130aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DISABLE		((u16)0x02)
13100b3ed16SGreg Kroah-Hartman 
13200b3ed16SGreg Kroah-Hartman /*--- Regulate Commands --------------------------*/
133aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INQ		((u16)0x11)
13400b3ed16SGreg Kroah-Hartman 
13500b3ed16SGreg Kroah-Hartman /*--- Configure Commands --------------------------*/
136aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DOWNLD		((u16)0x22)
13700b3ed16SGreg Kroah-Hartman 
13800b3ed16SGreg Kroah-Hartman /*--- Debugging Commands -----------------------------*/
139aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_MONITOR		((u16)(0x38))
140aaad4303SSolomon Peachy #define		HFA384x_MONITOR_ENABLE		((u16)(0x0b))
141aaad4303SSolomon Peachy #define		HFA384x_MONITOR_DISABLE		((u16)(0x0f))
14200b3ed16SGreg Kroah-Hartman 
14300b3ed16SGreg Kroah-Hartman /*--- Result Codes --------------------------*/
144aaad4303SSolomon Peachy #define		HFA384x_CMD_ERR			((u16)(0x7F))
14500b3ed16SGreg Kroah-Hartman 
14600b3ed16SGreg Kroah-Hartman /*--- Programming Modes --------------------------
1473e27dfa2SSergio Paracuellos  *	MODE 0: Disable programming
1483e27dfa2SSergio Paracuellos  *	MODE 1: Enable volatile memory programming
1493e27dfa2SSergio Paracuellos  *	MODE 2: Enable non-volatile memory programming
1503e27dfa2SSergio Paracuellos  *	MODE 3: Program non-volatile memory section
1513e27dfa2SSergio Paracuellos  *-------------------------------------------------
1523e27dfa2SSergio Paracuellos  */
153aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_DISABLE	((u16)0x00)
154aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_RAM		((u16)0x01)
155aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NV		((u16)0x02)
156aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NVWRITE	((u16)0x03)
15700b3ed16SGreg Kroah-Hartman 
15800b3ed16SGreg Kroah-Hartman /*--- Record ID Constants --------------------------*/
15900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
1603e27dfa2SSergio Paracuellos  * Configuration RIDs: Network Parameters, Static Configuration Entities
1613e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
1623e27dfa2SSergio Paracuellos  */
163aaad4303SSolomon Peachy #define		HFA384x_RID_CNFPORTTYPE		((u16)0xFC00)
164aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR	((u16)0xFC01)
165aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID	((u16)0xFC02)
166aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNCHANNEL	((u16)0xFC03)
167aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID		((u16)0xFC04)
168aaad4303SSolomon Peachy #define		HFA384x_RID_CNFMAXDATALEN	((u16)0xFC07)
16900b3ed16SGreg Kroah-Hartman 
17000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
1713e27dfa2SSergio Paracuellos  * Configuration RID lengths: Network Params, Static Config Entities
1723e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
1733e27dfa2SSergio Paracuellos  * include the len or code fields)
1743e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
1753e27dfa2SSergio Paracuellos  */
176aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR_LEN	((u16)6)
177aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID_LEN	((u16)34)
178aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID_LEN	((u16)34)
17900b3ed16SGreg Kroah-Hartman 
18000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
1813e27dfa2SSergio Paracuellos  * Configuration RIDs: Network Parameters, Dynamic Configuration Entities
1823e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
1833e27dfa2SSergio Paracuellos  */
184aaad4303SSolomon Peachy #define		HFA384x_RID_CREATEIBSS		((u16)0xFC81)
185aaad4303SSolomon Peachy #define		HFA384x_RID_FRAGTHRESH		((u16)0xFC82)
186aaad4303SSolomon Peachy #define		HFA384x_RID_RTSTHRESH		((u16)0xFC83)
187aaad4303SSolomon Peachy #define		HFA384x_RID_TXRATECNTL		((u16)0xFC84)
188aaad4303SSolomon Peachy #define		HFA384x_RID_PROMISCMODE		((u16)0xFC85)
18900b3ed16SGreg Kroah-Hartman 
19000b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
1913e27dfa2SSergio Paracuellos  * Information RIDs: NIC Information
1923e27dfa2SSergio Paracuellos  *----------------------------------------------------------------------
1933e27dfa2SSergio Paracuellos  */
194aaad4303SSolomon Peachy #define		HFA384x_RID_MAXLOADTIME		((u16)0xFD00)
195aaad4303SSolomon Peachy #define		HFA384x_RID_DOWNLOADBUFFER	((u16)0xFD01)
196aaad4303SSolomon Peachy #define		HFA384x_RID_PRIIDENTITY		((u16)0xFD02)
197aaad4303SSolomon Peachy #define		HFA384x_RID_PRISUPRANGE		((u16)0xFD03)
198aaad4303SSolomon Peachy #define		HFA384x_RID_PRI_CFIACTRANGES	((u16)0xFD04)
199aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER	((u16)0xFD0A)
200aaad4303SSolomon Peachy #define		HFA384x_RID_NICIDENTITY		((u16)0xFD0B)
201aaad4303SSolomon Peachy #define		HFA384x_RID_MFISUPRANGE		((u16)0xFD0C)
202aaad4303SSolomon Peachy #define		HFA384x_RID_CFISUPRANGE		((u16)0xFD0D)
203aaad4303SSolomon Peachy #define		HFA384x_RID_STAIDENTITY		((u16)0xFD20)
204aaad4303SSolomon Peachy #define		HFA384x_RID_STASUPRANGE		((u16)0xFD21)
205aaad4303SSolomon Peachy #define		HFA384x_RID_STA_MFIACTRANGES	((u16)0xFD22)
206aaad4303SSolomon Peachy #define		HFA384x_RID_STA_CFIACTRANGES	((u16)0xFD23)
20700b3ed16SGreg Kroah-Hartman 
20800b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
2093e27dfa2SSergio Paracuellos  * Information RID Lengths: NIC Information
2103e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
2113e27dfa2SSergio Paracuellos  * include the len or code fields)
2123e27dfa2SSergio Paracuellos  *---------------------------------------------------------------------
2133e27dfa2SSergio Paracuellos  */
214aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER_LEN		((u16)12)
21500b3ed16SGreg Kroah-Hartman 
21600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2173e27dfa2SSergio Paracuellos  * Information RIDs:  MAC Information
2183e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2193e27dfa2SSergio Paracuellos  */
220aaad4303SSolomon Peachy #define		HFA384x_RID_PORTSTATUS		((u16)0xFD40)
221aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTSSID		((u16)0xFD41)
222aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTBSSID	((u16)0xFD42)
223aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTTXRATE	((u16)0xFD44)
224aaad4303SSolomon Peachy #define		HFA384x_RID_SHORTRETRYLIMIT	((u16)0xFD48)
225aaad4303SSolomon Peachy #define		HFA384x_RID_LONGRETRYLIMIT	((u16)0xFD49)
226aaad4303SSolomon Peachy #define		HFA384x_RID_MAXTXLIFETIME	((u16)0xFD4A)
227aaad4303SSolomon Peachy #define		HFA384x_RID_PRIVACYOPTIMP	((u16)0xFD4F)
228aaad4303SSolomon Peachy #define		HFA384x_RID_DBMCOMMSQUALITY	((u16)0xFD51)
22900b3ed16SGreg Kroah-Hartman 
23000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2313e27dfa2SSergio Paracuellos  * Information RID Lengths:  MAC Information
2323e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
2333e27dfa2SSergio Paracuellos  * include the len or code fields)
2343e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2353e27dfa2SSergio Paracuellos  */
23671508ee4SAlessandro Ghedini #define		HFA384x_RID_DBMCOMMSQUALITY_LEN	 \
23762e493c4SSergio Paracuellos 	((u16)sizeof(struct hfa384x_dbmcommsquality))
23871508ee4SAlessandro Ghedini #define		HFA384x_RID_JOINREQUEST_LEN \
239de3dc47cSJuliana Rodrigues 	((u16)sizeof(struct hfa384x_join_request_data))
24040a67411SMoritz Muehlenhoff 
24100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2423e27dfa2SSergio Paracuellos  * Information RIDs:  Modem Information
2433e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2443e27dfa2SSergio Paracuellos  */
245aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTCHANNEL	((u16)0xFDC1)
24600b3ed16SGreg Kroah-Hartman 
24700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2483e27dfa2SSergio Paracuellos  * API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
2493e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2503e27dfa2SSergio Paracuellos  */
251aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEYID	((u16)0xFC23)
252aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY0	((u16)0xFC24)
253aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY1	((u16)0xFC25)
254aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY2	((u16)0xFC26)
255aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY3	((u16)0xFC27)
256aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPFLAGS		((u16)0xFC28)
257aaad4303SSolomon Peachy #define		HFA384x_RID_CNFAUTHENTICATION	((u16)0xFC2A)
258aaad4303SSolomon Peachy #define		HFA384x_RID_CNFROAMINGMODE	((u16)0xFC2D)
259b937612fSSergio Paracuellos #define		HFA384x_RID_CNFAPBCNINT		((u16)0xFC33)
260e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFDBMADJUST	((u16)0xFC46)
261e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFWPADATA		((u16)0xFC48)
262aaad4303SSolomon Peachy #define		HFA384x_RID_CNFBASICRATES	((u16)0xFCB3)
263aaad4303SSolomon Peachy #define		HFA384x_RID_CNFSUPPRATES	((u16)0xFCB4)
264e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFPASSIVESCANCTRL	((u16)0xFCBA)
265e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_TXPOWERMAX		((u16)0xFCBE)
266aaad4303SSolomon Peachy #define		HFA384x_RID_JOINREQUEST		((u16)0xFCE2)
267aaad4303SSolomon Peachy #define		HFA384x_RID_AUTHENTICATESTA	((u16)0xFCE3)
268e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_HOSTSCAN		((u16)0xFCE5)
26900b3ed16SGreg Kroah-Hartman 
270aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY_LEN	((u16)6)
271aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEP128DEFAULTKEY_LEN	((u16)14)
27240a67411SMoritz Muehlenhoff 
27300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2743e27dfa2SSergio Paracuellos  * PD Record codes
2753e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2763e27dfa2SSergio Paracuellos  */
277aaad4303SSolomon Peachy #define HFA384x_PDR_PCB_PARTNUM		((u16)0x0001)
278aaad4303SSolomon Peachy #define HFA384x_PDR_PDAVER		((u16)0x0002)
279aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_SERIAL		((u16)0x0003)
280aaad4303SSolomon Peachy #define HFA384x_PDR_MKK_MEASUREMENTS	((u16)0x0004)
281aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_RAMSIZE		((u16)0x0005)
282aaad4303SSolomon Peachy #define HFA384x_PDR_MFISUPRANGE		((u16)0x0006)
283aaad4303SSolomon Peachy #define HFA384x_PDR_CFISUPRANGE		((u16)0x0007)
284aaad4303SSolomon Peachy #define HFA384x_PDR_NICID		((u16)0x0008)
285aaad4303SSolomon Peachy #define HFA384x_PDR_MAC_ADDRESS		((u16)0x0101)
286aaad4303SSolomon Peachy #define HFA384x_PDR_REGDOMAIN		((u16)0x0103)
287aaad4303SSolomon Peachy #define HFA384x_PDR_ALLOWED_CHANNEL	((u16)0x0104)
288aaad4303SSolomon Peachy #define HFA384x_PDR_DEFAULT_CHANNEL	((u16)0x0105)
289aaad4303SSolomon Peachy #define HFA384x_PDR_TEMPTYPE		((u16)0x0107)
290aaad4303SSolomon Peachy #define HFA384x_PDR_IFR_SETTING		((u16)0x0200)
291aaad4303SSolomon Peachy #define HFA384x_PDR_RFR_SETTING		((u16)0x0201)
292aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_BASELINE	((u16)0x0202)
293aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_SHADOW	((u16)0x0203)
294aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_IFRF	((u16)0x0204)
295aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALSP	((u16)0x0300)
296aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALI	((u16)0x0301)
297aaad4303SSolomon Peachy #define HFA384x_PDR_MAX_TX_POWER	((u16)0x0302)
298aaad4303SSolomon Peachy #define HFA384x_PDR_MASTER_CHAN_LIST	((u16)0x0303)
299aaad4303SSolomon Peachy #define HFA384x_PDR_3842_NIC_CONFIG	((u16)0x0400)
300aaad4303SSolomon Peachy #define HFA384x_PDR_USB_ID		((u16)0x0401)
301aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_ID		((u16)0x0402)
302aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_IFCONF		((u16)0x0403)
303aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_PMCONF		((u16)0x0404)
304aaad4303SSolomon Peachy #define HFA384x_PDR_RFENRGY		((u16)0x0406)
305aaad4303SSolomon Peachy #define HFA384x_PDR_USB_POWER_TYPE      ((u16)0x0407)
306aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MAX_POWER	((u16)0x0409)
307aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MANUFACTURER	((u16)0x0410)
308aaad4303SSolomon Peachy #define HFA384x_PDR_USB_PRODUCT		((u16)0x0411)
309aaad4303SSolomon Peachy #define HFA384x_PDR_ANT_DIVERSITY	((u16)0x0412)
310aaad4303SSolomon Peachy #define HFA384x_PDR_HFO_DELAY		((u16)0x0413)
311aaad4303SSolomon Peachy #define HFA384x_PDR_SCALE_THRESH	((u16)0x0414)
31200b3ed16SGreg Kroah-Hartman 
313aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTSP	((u16)0x0900)
314aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTI	((u16)0x0901)
315aaad4303SSolomon Peachy #define HFA384x_PDR_END_OF_PDA		((u16)0x0000)
31600b3ed16SGreg Kroah-Hartman 
31700b3ed16SGreg Kroah-Hartman /*--- Register Test/Get/Set Field macros ------------------------*/
31800b3ed16SGreg Kroah-Hartman 
319aaad4303SSolomon Peachy #define		HFA384x_CMD_AINFO_SET(value)	((u16)((u16)(value) << 8))
32071508ee4SAlessandro Ghedini #define		HFA384x_CMD_MACPORT_SET(value)	\
32171508ee4SAlessandro Ghedini 			((u16)HFA384x_CMD_AINFO_SET(value))
32271508ee4SAlessandro Ghedini #define		HFA384x_CMD_PROGMODE_SET(value)	\
32371508ee4SAlessandro Ghedini 			((u16)HFA384x_CMD_AINFO_SET((u16)value))
324aaad4303SSolomon Peachy #define		HFA384x_CMD_CMDCODE_SET(value)		((u16)(value))
32500b3ed16SGreg Kroah-Hartman 
326aaad4303SSolomon Peachy #define		HFA384x_STATUS_RESULT_SET(value)	(((u16)(value)) << 8)
32700b3ed16SGreg Kroah-Hartman 
32800b3ed16SGreg Kroah-Hartman /* Host Maintained State Info */
32900b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_PREINIT	0
33000b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_INIT	1
33100b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_RUNNING	2
33200b3ed16SGreg Kroah-Hartman 
33300b3ed16SGreg Kroah-Hartman /*-------------------------------------------------------------*/
33400b3ed16SGreg Kroah-Hartman /* Commonly used basic types */
335b2119911SHimangi Saraogi struct hfa384x_bytestr {
3360a3bbcbdSOlav Haugan 	__le16 len;
3375979afa2SGustavo A. R. Silva 	u8 data[];
338b2119911SHimangi Saraogi } __packed;
33900b3ed16SGreg Kroah-Hartman 
34003c2975bSSergio Paracuellos struct hfa384x_bytestr32 {
34118cd9021SSuniel Mahesh 	__le16 len;
342aaad4303SSolomon Peachy 	u8 data[32];
34303c2975bSSergio Paracuellos } __packed;
34400b3ed16SGreg Kroah-Hartman 
34500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
3463e27dfa2SSergio Paracuellos  * Configuration Record Structures:
3473e27dfa2SSergio Paracuellos  *	Network Parameters, Static Configuration Entities
3483e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
3493e27dfa2SSergio Paracuellos  */
35000b3ed16SGreg Kroah-Hartman 
35100b3ed16SGreg Kroah-Hartman /*-- Hardware/Firmware Component Information ----------*/
3525f046456SSergio Paracuellos struct hfa384x_compident {
353aaad4303SSolomon Peachy 	u16 id;
354aaad4303SSolomon Peachy 	u16 variant;
355aaad4303SSolomon Peachy 	u16 major;
356aaad4303SSolomon Peachy 	u16 minor;
3575f046456SSergio Paracuellos } __packed;
35800b3ed16SGreg Kroah-Hartman 
35965f170c6SSergio Paracuellos struct hfa384x_caplevel {
360aaad4303SSolomon Peachy 	u16 role;
361aaad4303SSolomon Peachy 	u16 id;
362aaad4303SSolomon Peachy 	u16 variant;
363aaad4303SSolomon Peachy 	u16 bottom;
364aaad4303SSolomon Peachy 	u16 top;
36565f170c6SSergio Paracuellos } __packed;
36600b3ed16SGreg Kroah-Hartman 
36700b3ed16SGreg Kroah-Hartman /*-- Configuration Record: cnfAuthentication --*/
36800b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM	0x0001
36900b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_SHAREDKEY	0x0002
37000b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_LEAP		0x0004
37100b3ed16SGreg Kroah-Hartman 
37200b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
3733e27dfa2SSergio Paracuellos  * Configuration Record Structures:
3743e27dfa2SSergio Paracuellos  *	Network Parameters, Dynamic Configuration Entities
3753e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
3763e27dfa2SSergio Paracuellos  */
37700b3ed16SGreg Kroah-Hartman 
37800b3ed16SGreg Kroah-Hartman #define HFA384x_CREATEIBSS_JOINCREATEIBSS          0
37900b3ed16SGreg Kroah-Hartman 
38000b3ed16SGreg Kroah-Hartman /*-- Configuration Record: HostScanRequest (data portion only) --*/
381e474b4d4SSergio Paracuellos struct hfa384x_host_scan_request_data {
38218cd9021SSuniel Mahesh 	__le16 channel_list;
38318cd9021SSuniel Mahesh 	__le16 tx_rate;
38403c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
385935cbfb2SSergio Paracuellos } __packed;
38600b3ed16SGreg Kroah-Hartman 
38700b3ed16SGreg Kroah-Hartman /*-- Configuration Record: JoinRequest (data portion only) --*/
388de3dc47cSJuliana Rodrigues struct hfa384x_join_request_data {
389aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
390aaad4303SSolomon Peachy 	u16 channel;
391f0ffa0e2SSergio Paracuellos } __packed;
39200b3ed16SGreg Kroah-Hartman 
39300b3ed16SGreg Kroah-Hartman /*-- Configuration Record: authenticateStation (data portion only) --*/
3944c976b16SJuliana Rodrigues struct hfa384x_authenticate_station_data {
39528b17a4bSMoritz Muehlenhoff 	u8 address[ETH_ALEN];
396e708d2c7SAviv Palivoda 	__le16 status;
397e708d2c7SAviv Palivoda 	__le16 algorithm;
39817fb19f0SSergio Paracuellos } __packed;
39900b3ed16SGreg Kroah-Hartman 
40000b3ed16SGreg Kroah-Hartman /*-- Configuration Record: WPAData       (data portion only) --*/
401162da263SSergio Paracuellos struct hfa384x_wpa_data {
4020a3bbcbdSOlav Haugan 	__le16 datalen;
4035979afa2SGustavo A. R. Silva 	u8 data[];		/* max 80 */
404a2a44803SSergio Paracuellos } __packed;
40500b3ed16SGreg Kroah-Hartman 
40600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4073e27dfa2SSergio Paracuellos  * Information Record Structures: NIC Information
4083e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4093e27dfa2SSergio Paracuellos  */
41000b3ed16SGreg Kroah-Hartman 
41100b3ed16SGreg Kroah-Hartman /*-- Information Record: DownLoadBuffer --*/
41200b3ed16SGreg Kroah-Hartman /* NOTE: The page and offset are in AUX format */
413b71db740SSergio Paracuellos struct hfa384x_downloadbuffer {
414aaad4303SSolomon Peachy 	u16 page;
415aaad4303SSolomon Peachy 	u16 offset;
416aaad4303SSolomon Peachy 	u16 len;
417b71db740SSergio Paracuellos } __packed;
41800b3ed16SGreg Kroah-Hartman 
41900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4203e27dfa2SSergio Paracuellos  * Information Record Structures: NIC Information
4213e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4223e27dfa2SSergio Paracuellos  */
42300b3ed16SGreg Kroah-Hartman 
424aaad4303SSolomon Peachy #define HFA384x_PSTATUS_CONN_IBSS	((u16)3)
42500b3ed16SGreg Kroah-Hartman 
42600b3ed16SGreg Kroah-Hartman /*-- Information Record: commsquality --*/
427a1e95045SSergio Paracuellos struct hfa384x_commsquality {
4287d647bcfSVitali Liaukovich 	__le16 cq_curr_bss;
4297d647bcfSVitali Liaukovich 	__le16 asl_curr_bss;
4307d647bcfSVitali Liaukovich 	__le16 anl_curr_fc;
431a1e95045SSergio Paracuellos } __packed;
43200b3ed16SGreg Kroah-Hartman 
43300b3ed16SGreg Kroah-Hartman /*-- Information Record: dmbcommsquality --*/
43462e493c4SSergio Paracuellos struct hfa384x_dbmcommsquality {
435c08510e1SSergio Paracuellos 	u16 cq_dbm_curr_bss;
436c08510e1SSergio Paracuellos 	u16 asl_dbm_curr_bss;
437c08510e1SSergio Paracuellos 	u16 anl_dbm_curr_fc;
43862e493c4SSergio Paracuellos } __packed;
43900b3ed16SGreg Kroah-Hartman 
44000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4413e27dfa2SSergio Paracuellos  * FRAME STRUCTURES: Communication Frames
4423e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4433e27dfa2SSergio Paracuellos  * Communication Frames: Transmit Frames
4443e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4453e27dfa2SSergio Paracuellos  */
44600b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Transmit Frame Structure --*/
447eb76afc9SSergio Paracuellos struct hfa384x_tx_frame {
448aaad4303SSolomon Peachy 	u16 status;
449aaad4303SSolomon Peachy 	u16 reserved1;
450aaad4303SSolomon Peachy 	u16 reserved2;
451aaad4303SSolomon Peachy 	u32 sw_support;
452aaad4303SSolomon Peachy 	u8 tx_retrycount;
453aaad4303SSolomon Peachy 	u8 tx_rate;
454aaad4303SSolomon Peachy 	u16 tx_control;
45500b3ed16SGreg Kroah-Hartman 
45600b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information --*/
45786a0727bSKees Cook 	struct p80211_hdr hdr;
458a18ffdf4SAdrien Descamps 	__le16 data_len;		/* little endian format */
45900b3ed16SGreg Kroah-Hartman 
46000b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
46100b3ed16SGreg Kroah-Hartman 
462aaad4303SSolomon Peachy 	u8 dest_addr[6];
463aaad4303SSolomon Peachy 	u8 src_addr[6];
464aaad4303SSolomon Peachy 	u16 data_length;	/* big endian format */
465eb76afc9SSergio Paracuellos } __packed;
46600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4673e27dfa2SSergio Paracuellos  * Communication Frames: Field Masks for Transmit Frames
4683e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4693e27dfa2SSergio Paracuellos  */
47000b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
4717f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_ACKERR			((u16)BIT(5))
4727f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_FORMERR		((u16)BIT(3))
4737f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_DISCON			((u16)BIT(2))
4747f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_AGEDERR		((u16)BIT(1))
4757f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_RETRYERR		((u16)BIT(0))
47600b3ed16SGreg Kroah-Hartman /*-- Transmit Control Field --*/
477d349883fSSergio Paracuellos #define		HFA384x_TX_MACPORT			((u16)GENMASK(10, 8))
478d349883fSSergio Paracuellos #define		HFA384x_TX_STRUCTYPE			((u16)GENMASK(4, 3))
4797f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXEX				((u16)BIT(2))
4807f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXOK				((u16)BIT(1))
48100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4823e27dfa2SSergio Paracuellos  * Communication Frames: Test/Get/Set Field Values for Transmit Frames
4833e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4843e27dfa2SSergio Paracuellos  */
48500b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
48600b3ed16SGreg Kroah-Hartman #define HFA384x_TXSTATUS_ISERROR(v)	\
487aaad4303SSolomon Peachy 	(((u16)(v)) & \
48800b3ed16SGreg Kroah-Hartman 	(HFA384x_TXSTATUS_ACKERR | HFA384x_TXSTATUS_FORMERR | \
48900b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_DISCON | HFA384x_TXSTATUS_AGEDERR | \
49000b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_RETRYERR))
49100b3ed16SGreg Kroah-Hartman 
492aaad4303SSolomon Peachy #define	HFA384x_TX_SET(v, m, s)		((((u16)(v)) << ((u16)(s))) & ((u16)(m)))
49300b3ed16SGreg Kroah-Hartman 
49400b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_MACPORT_SET(v)	HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
49571508ee4SAlessandro Ghedini #define	HFA384x_TX_STRUCTYPE_SET(v)	HFA384x_TX_SET(v, \
49671508ee4SAlessandro Ghedini 						HFA384x_TX_STRUCTYPE, 3)
49700b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXEX_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
49800b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXOK_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
49900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5003e27dfa2SSergio Paracuellos  * Communication Frames: Receive Frames
5013e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5023e27dfa2SSergio Paracuellos  */
50300b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Receive Frame Structure --*/
50470adf509SSergio Paracuellos struct hfa384x_rx_frame {
50500b3ed16SGreg Kroah-Hartman 	/*-- MAC rx descriptor (hfa384x byte order) --*/
506aaad4303SSolomon Peachy 	u16 status;
507aaad4303SSolomon Peachy 	u32 time;
508aaad4303SSolomon Peachy 	u8 silence;
509aaad4303SSolomon Peachy 	u8 signal;
510aaad4303SSolomon Peachy 	u8 rate;
511aaad4303SSolomon Peachy 	u8 rx_flow;
512aaad4303SSolomon Peachy 	u16 reserved1;
513aaad4303SSolomon Peachy 	u16 reserved2;
51400b3ed16SGreg Kroah-Hartman 
51500b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information (802.11 byte order) --*/
51686a0727bSKees Cook 	struct p80211_hdr hdr;
5178cbe56e0SHimangi Saraogi 	__le16 data_len;		/* hfa384x (little endian) format */
51800b3ed16SGreg Kroah-Hartman 
51900b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
520aaad4303SSolomon Peachy 	u8 dest_addr[6];
521aaad4303SSolomon Peachy 	u8 src_addr[6];
522aaad4303SSolomon Peachy 	u16 data_length;	/* IEEE? (big endian) format */
52370adf509SSergio Paracuellos } __packed;
52400b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5253e27dfa2SSergio Paracuellos  * Communication Frames: Field Masks for Receive Frames
5263e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5273e27dfa2SSergio Paracuellos  */
52800b3ed16SGreg Kroah-Hartman 
52900b3ed16SGreg Kroah-Hartman /*-- Status Fields --*/
530d349883fSSergio Paracuellos #define		HFA384x_RXSTATUS_MACPORT		((u16)GENMASK(10, 8))
5317f6e0e44SMoritz Muehlenhoff #define		HFA384x_RXSTATUS_FCSERR			((u16)BIT(0))
53200b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5333e27dfa2SSergio Paracuellos  * Communication Frames: Test/Get/Set Field Values for Receive Frames
5343e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5353e27dfa2SSergio Paracuellos  */
53671508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_MACPORT_GET(value)	((u16)((((u16)(value)) \
53771508ee4SAlessandro Ghedini 					    & HFA384x_RXSTATUS_MACPORT) >> 8))
53871508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_ISFCSERR(value)	((u16)(((u16)(value)) \
53971508ee4SAlessandro Ghedini 						  & HFA384x_RXSTATUS_FCSERR))
54000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5413e27dfa2SSergio Paracuellos  * FRAME STRUCTURES: Information Types and Information Frame Structures
5423e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5433e27dfa2SSergio Paracuellos  * Information Types
5443e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5453e27dfa2SSergio Paracuellos  */
546aaad4303SSolomon Peachy #define		HFA384x_IT_HANDOVERADDR			((u16)0xF000UL)
547aaad4303SSolomon Peachy #define		HFA384x_IT_COMMTALLIES			((u16)0xF100UL)
548aaad4303SSolomon Peachy #define		HFA384x_IT_SCANRESULTS			((u16)0xF101UL)
549aaad4303SSolomon Peachy #define		HFA384x_IT_CHINFORESULTS		((u16)0xF102UL)
550aaad4303SSolomon Peachy #define		HFA384x_IT_HOSTSCANRESULTS		((u16)0xF103UL)
551aaad4303SSolomon Peachy #define		HFA384x_IT_LINKSTATUS			((u16)0xF200UL)
552aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCSTATUS			((u16)0xF201UL)
553aaad4303SSolomon Peachy #define		HFA384x_IT_AUTHREQ			((u16)0xF202UL)
554aaad4303SSolomon Peachy #define		HFA384x_IT_PSUSERCNT			((u16)0xF203UL)
555aaad4303SSolomon Peachy #define		HFA384x_IT_KEYIDCHANGED			((u16)0xF204UL)
556aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCREQ			((u16)0xF205UL)
557aaad4303SSolomon Peachy #define		HFA384x_IT_MICFAILURE			((u16)0xF206UL)
55800b3ed16SGreg Kroah-Hartman 
55900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5603e27dfa2SSergio Paracuellos  * Information Frames Structures
5613e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5623e27dfa2SSergio Paracuellos  * Information Frames: Notification Frame Structures
5633e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5643e27dfa2SSergio Paracuellos  */
56500b3ed16SGreg Kroah-Hartman 
56600b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Communication Tallies --*/
5674cc454f2SSergio Paracuellos struct hfa384x_comm_tallies_16 {
5685551ad1eSChristopher H Pezley 	__le16 txunicastframes;
5695551ad1eSChristopher H Pezley 	__le16 txmulticastframes;
5705551ad1eSChristopher H Pezley 	__le16 txfragments;
5715551ad1eSChristopher H Pezley 	__le16 txunicastoctets;
5725551ad1eSChristopher H Pezley 	__le16 txmulticastoctets;
5735551ad1eSChristopher H Pezley 	__le16 txdeferredtrans;
5745551ad1eSChristopher H Pezley 	__le16 txsingleretryframes;
5755551ad1eSChristopher H Pezley 	__le16 txmultipleretryframes;
5765551ad1eSChristopher H Pezley 	__le16 txretrylimitexceeded;
5775551ad1eSChristopher H Pezley 	__le16 txdiscards;
5785551ad1eSChristopher H Pezley 	__le16 rxunicastframes;
5795551ad1eSChristopher H Pezley 	__le16 rxmulticastframes;
5805551ad1eSChristopher H Pezley 	__le16 rxfragments;
5815551ad1eSChristopher H Pezley 	__le16 rxunicastoctets;
5825551ad1eSChristopher H Pezley 	__le16 rxmulticastoctets;
5835551ad1eSChristopher H Pezley 	__le16 rxfcserrors;
5845551ad1eSChristopher H Pezley 	__le16 rxdiscardsnobuffer;
5855551ad1eSChristopher H Pezley 	__le16 txdiscardswrongsa;
5865551ad1eSChristopher H Pezley 	__le16 rxdiscardswepundecr;
5875551ad1eSChristopher H Pezley 	__le16 rxmsginmsgfrag;
5885551ad1eSChristopher H Pezley 	__le16 rxmsginbadmsgfrag;
58907e23b67SSergio Paracuellos } __packed;
59000b3ed16SGreg Kroah-Hartman 
591b244edc6SJuliana Rodrigues struct hfa384x_comm_tallies_32 {
5925551ad1eSChristopher H Pezley 	__le32 txunicastframes;
5935551ad1eSChristopher H Pezley 	__le32 txmulticastframes;
5945551ad1eSChristopher H Pezley 	__le32 txfragments;
5955551ad1eSChristopher H Pezley 	__le32 txunicastoctets;
5965551ad1eSChristopher H Pezley 	__le32 txmulticastoctets;
5975551ad1eSChristopher H Pezley 	__le32 txdeferredtrans;
5985551ad1eSChristopher H Pezley 	__le32 txsingleretryframes;
5995551ad1eSChristopher H Pezley 	__le32 txmultipleretryframes;
6005551ad1eSChristopher H Pezley 	__le32 txretrylimitexceeded;
6015551ad1eSChristopher H Pezley 	__le32 txdiscards;
6025551ad1eSChristopher H Pezley 	__le32 rxunicastframes;
6035551ad1eSChristopher H Pezley 	__le32 rxmulticastframes;
6045551ad1eSChristopher H Pezley 	__le32 rxfragments;
6055551ad1eSChristopher H Pezley 	__le32 rxunicastoctets;
6065551ad1eSChristopher H Pezley 	__le32 rxmulticastoctets;
6075551ad1eSChristopher H Pezley 	__le32 rxfcserrors;
6085551ad1eSChristopher H Pezley 	__le32 rxdiscardsnobuffer;
6095551ad1eSChristopher H Pezley 	__le32 txdiscardswrongsa;
6105551ad1eSChristopher H Pezley 	__le32 rxdiscardswepundecr;
6115551ad1eSChristopher H Pezley 	__le32 rxmsginmsgfrag;
6125551ad1eSChristopher H Pezley 	__le32 rxmsginbadmsgfrag;
613cfc6cb1fSSergio Paracuellos } __packed;
61400b3ed16SGreg Kroah-Hartman 
61500b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Scan Results & Subfields--*/
616b263dd5eSJuliana Rodrigues struct hfa384x_scan_result_sub {
617aaad4303SSolomon Peachy 	u16 chid;
618aaad4303SSolomon Peachy 	u16 anl;
619aaad4303SSolomon Peachy 	u16 sl;
620aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
621aaad4303SSolomon Peachy 	u16 bcnint;
622aaad4303SSolomon Peachy 	u16 capinfo;
62303c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
624aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
625aaad4303SSolomon Peachy 	u16 proberesp_rate;
6264400334bSSergio Paracuellos } __packed;
62700b3ed16SGreg Kroah-Hartman 
628040a7bd4SJuliana Rodrigues struct hfa384x_scan_result {
629aaad4303SSolomon Peachy 	u16 rsvd;
630aaad4303SSolomon Peachy 	u16 scanreason;
631b263dd5eSJuliana Rodrigues 	struct hfa384x_scan_result_sub result[HFA384x_SCANRESULT_MAX];
632dc0bb002SSergio Paracuellos } __packed;
63300b3ed16SGreg Kroah-Hartman 
63400b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
635e35baeb0SJuliana Rodrigues struct hfa384x_ch_info_result_sub {
636aaad4303SSolomon Peachy 	u16 chid;
637aaad4303SSolomon Peachy 	u16 anl;
638aaad4303SSolomon Peachy 	u16 pnl;
639aaad4303SSolomon Peachy 	u16 active;
6401bc4292aSSergio Paracuellos } __packed;
64100b3ed16SGreg Kroah-Hartman 
6427f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_BSSACTIVE	BIT(0)
6437f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_PCFACTIVE	BIT(1)
64400b3ed16SGreg Kroah-Hartman 
645c447358aSSergio Paracuellos struct hfa384x_ch_info_result {
646aaad4303SSolomon Peachy 	u16 scanchannels;
647e35baeb0SJuliana Rodrigues 	struct hfa384x_ch_info_result_sub result[HFA384x_CHINFORESULT_MAX];
6480fddae8eSSergio Paracuellos } __packed;
64900b3ed16SGreg Kroah-Hartman 
65000b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
6518f8149deSSergio Paracuellos struct hfa384x_hscan_result_sub {
65218cd9021SSuniel Mahesh 	__le16 chid;
65318cd9021SSuniel Mahesh 	__le16 anl;
65418cd9021SSuniel Mahesh 	__le16 sl;
655aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
65618cd9021SSuniel Mahesh 	__le16 bcnint;
65718cd9021SSuniel Mahesh 	__le16 capinfo;
65803c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
659aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
660aaad4303SSolomon Peachy 	u16 proberesp_rate;
66118cd9021SSuniel Mahesh 	__le16 atim;
662b353d11aSSergio Paracuellos } __packed;
66300b3ed16SGreg Kroah-Hartman 
6640e2ce9adSSergio Paracuellos struct hfa384x_hscan_result {
665aaad4303SSolomon Peachy 	u16 nresult;
666aaad4303SSolomon Peachy 	u16 rsvd;
6678f8149deSSergio Paracuellos 	struct hfa384x_hscan_result_sub result[HFA384x_HSCANRESULT_MAX];
668f8f2821eSSergio Paracuellos } __packed;
66900b3ed16SGreg Kroah-Hartman 
67000b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: LinkStatus --*/
67100b3ed16SGreg Kroah-Hartman 
672aaad4303SSolomon Peachy #define HFA384x_LINK_NOTCONNECTED	((u16)0)
673aaad4303SSolomon Peachy #define HFA384x_LINK_CONNECTED		((u16)1)
674aaad4303SSolomon Peachy #define HFA384x_LINK_DISCONNECTED	((u16)2)
675aaad4303SSolomon Peachy #define HFA384x_LINK_AP_CHANGE		((u16)3)
676aaad4303SSolomon Peachy #define HFA384x_LINK_AP_OUTOFRANGE	((u16)4)
677aaad4303SSolomon Peachy #define HFA384x_LINK_AP_INRANGE		((u16)5)
678aaad4303SSolomon Peachy #define HFA384x_LINK_ASSOCFAIL		((u16)6)
67900b3ed16SGreg Kroah-Hartman 
6807190f3f1SSergio Paracuellos struct hfa384x_link_status {
681e0384407SRicardo Silva 	__le16 linkstatus;
682a8eb5139SSergio Paracuellos } __packed;
68300b3ed16SGreg Kroah-Hartman 
68400b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
68500b3ed16SGreg Kroah-Hartman 
686aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_STAASSOC	((u16)1)
687aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_REASSOC	((u16)2)
688aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_AUTHFAIL	((u16)5)
68900b3ed16SGreg Kroah-Hartman 
6901889b0dbSJuliana Rodrigues struct hfa384x_assoc_status {
691aaad4303SSolomon Peachy 	u16 assocstatus;
69228b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
69300b3ed16SGreg Kroah-Hartman 	/* old_ap_addr is only valid if assocstatus == 2 */
69428b17a4bSMoritz Muehlenhoff 	u8 old_ap_addr[ETH_ALEN];
695aaad4303SSolomon Peachy 	u16 reason;
696aaad4303SSolomon Peachy 	u16 reserved;
6975383f13eSSergio Paracuellos } __packed;
69800b3ed16SGreg Kroah-Hartman 
69900b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
70000b3ed16SGreg Kroah-Hartman 
701b8f55192SSergio Paracuellos struct hfa384x_auth_request {
70228b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
703e708d2c7SAviv Palivoda 	__le16 algorithm;
704b9820e0cSSergio Paracuellos } __packed;
70500b3ed16SGreg Kroah-Hartman 
70600b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
70700b3ed16SGreg Kroah-Hartman 
7080c3b2bd7SSergio Paracuellos struct hfa384x_ps_user_count {
7098cd924a2SManny Vindiola 	__le16 usercnt;
710013e69ebSSergio Paracuellos } __packed;
71100b3ed16SGreg Kroah-Hartman 
712ab42187aSSergio Paracuellos struct hfa384x_key_id_changed {
71328b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
714aaad4303SSolomon Peachy 	u16 keyid;
71544049d81SSergio Paracuellos } __packed;
71600b3ed16SGreg Kroah-Hartman 
71700b3ed16SGreg Kroah-Hartman /*--  Collection of all Inf frames ---------------*/
718f745ea61SSergio Paracuellos union hfa384x_infodata {
7194cc454f2SSergio Paracuellos 	struct hfa384x_comm_tallies_16 commtallies16;
720b244edc6SJuliana Rodrigues 	struct hfa384x_comm_tallies_32 commtallies32;
721040a7bd4SJuliana Rodrigues 	struct hfa384x_scan_result scanresult;
722c447358aSSergio Paracuellos 	struct hfa384x_ch_info_result chinforesult;
7230e2ce9adSSergio Paracuellos 	struct hfa384x_hscan_result hscanresult;
7247190f3f1SSergio Paracuellos 	struct hfa384x_link_status linkstatus;
7251889b0dbSJuliana Rodrigues 	struct hfa384x_assoc_status assocstatus;
726b8f55192SSergio Paracuellos 	struct hfa384x_auth_request authreq;
7270c3b2bd7SSergio Paracuellos 	struct hfa384x_ps_user_count psusercnt;
728ab42187aSSergio Paracuellos 	struct hfa384x_key_id_changed keyidchanged;
729f745ea61SSergio Paracuellos } __packed;
73000b3ed16SGreg Kroah-Hartman 
73160f5f3fbSJuliana Rodrigues struct hfa384x_inf_frame {
732aaad4303SSolomon Peachy 	u16 framelen;
733aaad4303SSolomon Peachy 	u16 infotype;
734f745ea61SSergio Paracuellos 	union hfa384x_infodata info;
735f69de9e3SSergio Paracuellos } __packed;
73600b3ed16SGreg Kroah-Hartman 
73700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
7383e27dfa2SSergio Paracuellos  * USB Packet structures and constants.
7393e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
7403e27dfa2SSergio Paracuellos  */
74100b3ed16SGreg Kroah-Hartman 
74200b3ed16SGreg Kroah-Hartman /* Should be sent to the bulkout endpoint */
74300b3ed16SGreg Kroah-Hartman #define HFA384x_USB_TXFRM	0
74400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDREQ	1
74500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDREQ	2
74600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDREQ	3
74700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMREQ	4
74800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMREQ	5
74900b3ed16SGreg Kroah-Hartman 
75000b3ed16SGreg Kroah-Hartman /* Received from the bulkin endpoint */
75100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISTXFRM(a)	(((a) & 0x9000) == 0x1000)
75200b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISRXFRM(a)	(!((a) & 0x9000))
75300b3ed16SGreg Kroah-Hartman #define HFA384x_USB_INFOFRM	0x8000
75400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDRESP	0x8001
75500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDRESP	0x8002
75600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDRESP	0x8003
75700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMRESP	0x8004
75800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMRESP	0x8005
75900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_BUFAVAIL	0x8006
76000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ERROR	0x8007
76100b3ed16SGreg Kroah-Hartman 
76200b3ed16SGreg Kroah-Hartman /*------------------------------------*/
76300b3ed16SGreg Kroah-Hartman /* Request (bulk OUT) packet contents */
76400b3ed16SGreg Kroah-Hartman 
7652f1014f7SSergio Paracuellos struct hfa384x_usb_txfrm {
766eb76afc9SSergio Paracuellos 	struct hfa384x_tx_frame desc;
767aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
7682f1014f7SSergio Paracuellos } __packed;
76900b3ed16SGreg Kroah-Hartman 
770a6dcbdfeSSergio Paracuellos struct hfa384x_usb_cmdreq {
771a18ffdf4SAdrien Descamps 	__le16 type;
772a18ffdf4SAdrien Descamps 	__le16 cmd;
773a18ffdf4SAdrien Descamps 	__le16 parm0;
774a18ffdf4SAdrien Descamps 	__le16 parm1;
775a18ffdf4SAdrien Descamps 	__le16 parm2;
776aaad4303SSolomon Peachy 	u8 pad[54];
777a6dcbdfeSSergio Paracuellos } __packed;
77800b3ed16SGreg Kroah-Hartman 
7793bc070f6SSergio Paracuellos struct hfa384x_usb_wridreq {
780a18ffdf4SAdrien Descamps 	__le16 type;
781a18ffdf4SAdrien Descamps 	__le16 frmlen;
782a18ffdf4SAdrien Descamps 	__le16 rid;
783aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
7843bc070f6SSergio Paracuellos } __packed;
78500b3ed16SGreg Kroah-Hartman 
7865b9f240eSSergio Paracuellos struct hfa384x_usb_rridreq {
787a18ffdf4SAdrien Descamps 	__le16 type;
788a18ffdf4SAdrien Descamps 	__le16 frmlen;
789a18ffdf4SAdrien Descamps 	__le16 rid;
790aaad4303SSolomon Peachy 	u8 pad[58];
7915b9f240eSSergio Paracuellos } __packed;
79200b3ed16SGreg Kroah-Hartman 
793f0e15d40SSergio Paracuellos struct hfa384x_usb_wmemreq {
794a18ffdf4SAdrien Descamps 	__le16 type;
795a18ffdf4SAdrien Descamps 	__le16 frmlen;
796a18ffdf4SAdrien Descamps 	__le16 offset;
797a18ffdf4SAdrien Descamps 	__le16 page;
798aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
799f0e15d40SSergio Paracuellos } __packed;
80000b3ed16SGreg Kroah-Hartman 
80194ec5464SSergio Paracuellos struct hfa384x_usb_rmemreq {
802a18ffdf4SAdrien Descamps 	__le16 type;
803a18ffdf4SAdrien Descamps 	__le16 frmlen;
804a18ffdf4SAdrien Descamps 	__le16 offset;
805a18ffdf4SAdrien Descamps 	__le16 page;
806aaad4303SSolomon Peachy 	u8 pad[56];
80794ec5464SSergio Paracuellos } __packed;
80800b3ed16SGreg Kroah-Hartman 
80900b3ed16SGreg Kroah-Hartman /*------------------------------------*/
81000b3ed16SGreg Kroah-Hartman /* Response (bulk IN) packet contents */
81100b3ed16SGreg Kroah-Hartman 
812684b2e08SSergio Paracuellos struct hfa384x_usb_rxfrm {
81370adf509SSergio Paracuellos 	struct hfa384x_rx_frame desc;
814aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
815684b2e08SSergio Paracuellos } __packed;
81600b3ed16SGreg Kroah-Hartman 
817e20a7ca1SSergio Paracuellos struct hfa384x_usb_infofrm {
818aaad4303SSolomon Peachy 	u16 type;
81960f5f3fbSJuliana Rodrigues 	struct hfa384x_inf_frame info;
820e20a7ca1SSergio Paracuellos } __packed;
82100b3ed16SGreg Kroah-Hartman 
822385a79dfSSergio Paracuellos struct hfa384x_usb_statusresp {
823aaad4303SSolomon Peachy 	u16 type;
824a18ffdf4SAdrien Descamps 	__le16 status;
825a18ffdf4SAdrien Descamps 	__le16 resp0;
826a18ffdf4SAdrien Descamps 	__le16 resp1;
827a18ffdf4SAdrien Descamps 	__le16 resp2;
828385a79dfSSergio Paracuellos } __packed;
82900b3ed16SGreg Kroah-Hartman 
830a988c9f3SSergio Paracuellos struct hfa384x_usb_rridresp {
831aaad4303SSolomon Peachy 	u16 type;
832a18ffdf4SAdrien Descamps 	__le16 frmlen;
833a18ffdf4SAdrien Descamps 	__le16 rid;
834aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
835a988c9f3SSergio Paracuellos } __packed;
83600b3ed16SGreg Kroah-Hartman 
8371ed54806SSergio Paracuellos struct hfa384x_usb_rmemresp {
838aaad4303SSolomon Peachy 	u16 type;
839aaad4303SSolomon Peachy 	u16 frmlen;
840aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
8411ed54806SSergio Paracuellos } __packed;
84200b3ed16SGreg Kroah-Hartman 
843c4d8a0a8SSergio Paracuellos struct hfa384x_usb_bufavail {
844aaad4303SSolomon Peachy 	u16 type;
845aaad4303SSolomon Peachy 	u16 frmlen;
846c4d8a0a8SSergio Paracuellos } __packed;
84700b3ed16SGreg Kroah-Hartman 
848d4734c30SSergio Paracuellos struct hfa384x_usb_error {
849aaad4303SSolomon Peachy 	u16 type;
850aaad4303SSolomon Peachy 	u16 errortype;
851d4734c30SSergio Paracuellos } __packed;
85200b3ed16SGreg Kroah-Hartman 
85300b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------*/
85400b3ed16SGreg Kroah-Hartman /* Unions for packaging all the known packet types together */
85500b3ed16SGreg Kroah-Hartman 
8564012684aSSergio Paracuellos union hfa384x_usbout {
857a78d1312SAsaf Vertz 	__le16 type;
8582f1014f7SSergio Paracuellos 	struct hfa384x_usb_txfrm txfrm;
859a6dcbdfeSSergio Paracuellos 	struct hfa384x_usb_cmdreq cmdreq;
8603bc070f6SSergio Paracuellos 	struct hfa384x_usb_wridreq wridreq;
8615b9f240eSSergio Paracuellos 	struct hfa384x_usb_rridreq rridreq;
862f0e15d40SSergio Paracuellos 	struct hfa384x_usb_wmemreq wmemreq;
86394ec5464SSergio Paracuellos 	struct hfa384x_usb_rmemreq rmemreq;
8644012684aSSergio Paracuellos } __packed;
86500b3ed16SGreg Kroah-Hartman 
8663e4180c3SSergio Paracuellos union hfa384x_usbin {
867a78d1312SAsaf Vertz 	__le16 type;
868684b2e08SSergio Paracuellos 	struct hfa384x_usb_rxfrm rxfrm;
8692f1014f7SSergio Paracuellos 	struct hfa384x_usb_txfrm txfrm;
870e20a7ca1SSergio Paracuellos 	struct hfa384x_usb_infofrm infofrm;
871385a79dfSSergio Paracuellos 	struct hfa384x_usb_statusresp cmdresp;
8722c8079deSSergio Paracuellos 	struct hfa384x_usb_statusresp wridresp;
873a988c9f3SSergio Paracuellos 	struct hfa384x_usb_rridresp rridresp;
874499c1cc9SSergio Paracuellos 	struct hfa384x_usb_statusresp wmemresp;
8751ed54806SSergio Paracuellos 	struct hfa384x_usb_rmemresp rmemresp;
876c4d8a0a8SSergio Paracuellos 	struct hfa384x_usb_bufavail bufavail;
877d4734c30SSergio Paracuellos 	struct hfa384x_usb_error usberror;
878aaad4303SSolomon Peachy 	u8 boguspad[3000];
8793e4180c3SSergio Paracuellos } __packed;
88000b3ed16SGreg Kroah-Hartman 
88176e3e7c4SKarl Relton /*--------------------------------------------------------------------
8823e27dfa2SSergio Paracuellos  * PD record structures.
8833e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
8843e27dfa2SSergio Paracuellos  */
88576e3e7c4SKarl Relton 
8869127692fSSergio Paracuellos struct hfa384x_pdr_mfisuprange {
88776e3e7c4SKarl Relton 	u16 id;
88876e3e7c4SKarl Relton 	u16 variant;
88976e3e7c4SKarl Relton 	u16 bottom;
89076e3e7c4SKarl Relton 	u16 top;
8919127692fSSergio Paracuellos } __packed;
89276e3e7c4SKarl Relton 
8934ae2996fSSergio Paracuellos struct hfa384x_pdr_cfisuprange {
89476e3e7c4SKarl Relton 	u16 id;
89576e3e7c4SKarl Relton 	u16 variant;
89676e3e7c4SKarl Relton 	u16 bottom;
89776e3e7c4SKarl Relton 	u16 top;
8984ae2996fSSergio Paracuellos } __packed;
89976e3e7c4SKarl Relton 
900e9ee92c7SSergio Paracuellos struct hfa384x_pdr_nicid {
90176e3e7c4SKarl Relton 	u16 id;
90276e3e7c4SKarl Relton 	u16 variant;
90376e3e7c4SKarl Relton 	u16 major;
90476e3e7c4SKarl Relton 	u16 minor;
905e9ee92c7SSergio Paracuellos } __packed;
90676e3e7c4SKarl Relton 
9074f026e89SSergio Paracuellos struct hfa384x_pdrec {
90876b4580bSMaciek Borzecki 	__le16 len;		/* in words */
90976b4580bSMaciek Borzecki 	__le16 code;
91076e3e7c4SKarl Relton 	union pdr {
9119127692fSSergio Paracuellos 		struct hfa384x_pdr_mfisuprange mfisuprange;
9124ae2996fSSergio Paracuellos 		struct hfa384x_pdr_cfisuprange cfisuprange;
913e9ee92c7SSergio Paracuellos 		struct hfa384x_pdr_nicid nicid;
91476e3e7c4SKarl Relton 
91576e3e7c4SKarl Relton 	} data;
9164f026e89SSergio Paracuellos } __packed;
91776e3e7c4SKarl Relton 
91800b3ed16SGreg Kroah-Hartman #ifdef __KERNEL__
91900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
9203e27dfa2SSergio Paracuellos  * ---  MAC state structure, argument to all functions --
9213e27dfa2SSergio Paracuellos  * ---  Also, a collection of support types --
9223e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
9233e27dfa2SSergio Paracuellos  */
924501f5f96SSergio Paracuellos struct hfa384x_cmdresult {
925aaad4303SSolomon Peachy 	u16 status;
926aaad4303SSolomon Peachy 	u16 resp0;
927aaad4303SSolomon Peachy 	u16 resp1;
928aaad4303SSolomon Peachy 	u16 resp2;
929501f5f96SSergio Paracuellos };
93000b3ed16SGreg Kroah-Hartman 
93100b3ed16SGreg Kroah-Hartman /* USB Control Exchange (CTLX):
93200b3ed16SGreg Kroah-Hartman  *  A queue of the structure below is maintained for all of the
93300b3ed16SGreg Kroah-Hartman  *  Request/Response type USB packets supported by Prism2.
93400b3ed16SGreg Kroah-Hartman  */
93500b3ed16SGreg Kroah-Hartman /* The following hfa384x_* structures are arguments to
93600b3ed16SGreg Kroah-Hartman  * the usercb() for the different CTLX types.
93700b3ed16SGreg Kroah-Hartman  */
938b3fd890eSSergio Paracuellos struct hfa384x_rridresult {
939aaad4303SSolomon Peachy 	u16 rid;
94000b3ed16SGreg Kroah-Hartman 	const void *riddata;
941aaad4303SSolomon Peachy 	unsigned int riddata_len;
942b3fd890eSSergio Paracuellos };
94300b3ed16SGreg Kroah-Hartman 
94400b3ed16SGreg Kroah-Hartman enum ctlx_state {
94500b3ed16SGreg Kroah-Hartman 	CTLX_START = 0,		/* Start state, not queued */
94600b3ed16SGreg Kroah-Hartman 
94700b3ed16SGreg Kroah-Hartman 	CTLX_COMPLETE,		/* CTLX successfully completed */
94800b3ed16SGreg Kroah-Hartman 	CTLX_REQ_FAILED,	/* OUT URB completed w/ error */
94900b3ed16SGreg Kroah-Hartman 
95000b3ed16SGreg Kroah-Hartman 	CTLX_PENDING,		/* Queued, data valid */
95100b3ed16SGreg Kroah-Hartman 	CTLX_REQ_SUBMITTED,	/* OUT URB submitted */
95200b3ed16SGreg Kroah-Hartman 	CTLX_REQ_COMPLETE,	/* OUT URB complete */
95300b3ed16SGreg Kroah-Hartman 	CTLX_RESP_COMPLETE	/* IN URB received */
95400b3ed16SGreg Kroah-Hartman };
95500b3ed16SGreg Kroah-Hartman 
95600b3ed16SGreg Kroah-Hartman struct hfa384x_usbctlx;
95700b3ed16SGreg Kroah-Hartman struct hfa384x;
95800b3ed16SGreg Kroah-Hartman 
95900b3ed16SGreg Kroah-Hartman typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);
96000b3ed16SGreg Kroah-Hartman 
961e573aaa4SMoritz Muehlenhoff typedef void (*ctlx_usercb_t) (struct hfa384x *hw,
962e573aaa4SMoritz Muehlenhoff 			       void *ctlxresult, void *usercb_data);
96300b3ed16SGreg Kroah-Hartman 
964a10d36b0SSergio Paracuellos struct hfa384x_usbctlx {
96500b3ed16SGreg Kroah-Hartman 	struct list_head list;
96600b3ed16SGreg Kroah-Hartman 
96700b3ed16SGreg Kroah-Hartman 	size_t outbufsize;
9684012684aSSergio Paracuellos 	union hfa384x_usbout outbuf;	/* pkt buf for OUT */
9693e4180c3SSergio Paracuellos 	union hfa384x_usbin inbuf;	/* pkt buf for IN(a copy) */
97000b3ed16SGreg Kroah-Hartman 
971173bf7e3SSergio Paracuellos 	enum ctlx_state state;	/* Tracks running state */
97200b3ed16SGreg Kroah-Hartman 
97300b3ed16SGreg Kroah-Hartman 	struct completion done;
974318c66d4STim Collier 	int reapable;		/* Food for the reaper task */
97500b3ed16SGreg Kroah-Hartman 
97600b3ed16SGreg Kroah-Hartman 	ctlx_cmdcb_t cmdcb;	/* Async command callback */
97700b3ed16SGreg Kroah-Hartman 	ctlx_usercb_t usercb;	/* Async user callback, */
97800b3ed16SGreg Kroah-Hartman 	void *usercb_data;	/*  at CTLX completion  */
979a10d36b0SSergio Paracuellos };
98000b3ed16SGreg Kroah-Hartman 
9813df38936SSergio Paracuellos struct hfa384x_usbctlxq {
98200b3ed16SGreg Kroah-Hartman 	spinlock_t lock;
98300b3ed16SGreg Kroah-Hartman 	struct list_head pending;
98400b3ed16SGreg Kroah-Hartman 	struct list_head active;
98500b3ed16SGreg Kroah-Hartman 	struct list_head completing;
98600b3ed16SGreg Kroah-Hartman 	struct list_head reapable;
9873df38936SSergio Paracuellos };
98800b3ed16SGreg Kroah-Hartman 
989e2f503c4SSergio Paracuellos struct hfa384x_metacmd {
990aaad4303SSolomon Peachy 	u16 cmd;
99100b3ed16SGreg Kroah-Hartman 
992aaad4303SSolomon Peachy 	u16 parm0;
993aaad4303SSolomon Peachy 	u16 parm1;
994aaad4303SSolomon Peachy 	u16 parm2;
99500b3ed16SGreg Kroah-Hartman 
996501f5f96SSergio Paracuellos 	struct hfa384x_cmdresult result;
997e2f503c4SSergio Paracuellos };
99800b3ed16SGreg Kroah-Hartman 
99900b3ed16SGreg Kroah-Hartman #define	MAX_GRP_ADDR		32
100000b3ed16SGreg Kroah-Hartman #define WLAN_COMMENT_MAX	80  /* Max. length of user comment string. */
100100b3ed16SGreg Kroah-Hartman 
100200b3ed16SGreg Kroah-Hartman #define WLAN_AUTH_MAX           60  /* Max. # of authenticated stations. */
100300b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_MAX		60  /* Max. # of stations in an access list. */
100400b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_NONE	0   /* No stations may be authenticated. */
100500b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALL		1   /* All stations may be authenticated. */
100600b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALLOW	2   /* Authenticate only "allowed" stations. */
100700b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_DENY	3   /* Do not authenticate "denied" stations. */
100800b3ed16SGreg Kroah-Hartman 
100900b3ed16SGreg Kroah-Hartman /* XXX These are going away ASAP */
1010c84b528cSVatika Harlalka struct prism2sta_authlist {
1011aaad4303SSolomon Peachy 	unsigned int cnt;
101228b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_AUTH_MAX][ETH_ALEN];
1013aaad4303SSolomon Peachy 	u8 assoc[WLAN_AUTH_MAX];
1014c84b528cSVatika Harlalka };
101500b3ed16SGreg Kroah-Hartman 
10164d10ece3SVatika Harlalka struct prism2sta_accesslist {
1017aaad4303SSolomon Peachy 	unsigned int modify;
1018aaad4303SSolomon Peachy 	unsigned int cnt;
101928b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_ACCESS_MAX][ETH_ALEN];
1020aaad4303SSolomon Peachy 	unsigned int cnt1;
102128b17a4bSMoritz Muehlenhoff 	u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN];
10224d10ece3SVatika Harlalka };
102300b3ed16SGreg Kroah-Hartman 
10245a2214e2SSergio Paracuellos struct hfa384x {
102500b3ed16SGreg Kroah-Hartman 	/* USB support data */
102600b3ed16SGreg Kroah-Hartman 	struct usb_device *usb;
102700b3ed16SGreg Kroah-Hartman 	struct urb rx_urb;
102800b3ed16SGreg Kroah-Hartman 	struct sk_buff *rx_urb_skb;
102900b3ed16SGreg Kroah-Hartman 	struct urb tx_urb;
103000b3ed16SGreg Kroah-Hartman 	struct urb ctlx_urb;
10314012684aSSergio Paracuellos 	union hfa384x_usbout txbuff;
10323df38936SSergio Paracuellos 	struct hfa384x_usbctlxq ctlxq;
103300b3ed16SGreg Kroah-Hartman 	struct timer_list reqtimer;
103400b3ed16SGreg Kroah-Hartman 	struct timer_list resptimer;
103500b3ed16SGreg Kroah-Hartman 
103600b3ed16SGreg Kroah-Hartman 	struct timer_list throttle;
103700b3ed16SGreg Kroah-Hartman 
1038cbe0f674SDavidlohr Bueso 	struct work_struct reaper_bh;
1039*9442e81dSDavidlohr Bueso 	struct work_struct completion_bh;
104000b3ed16SGreg Kroah-Hartman 
104100b3ed16SGreg Kroah-Hartman 	struct work_struct usb_work;
104200b3ed16SGreg Kroah-Hartman 
104300b3ed16SGreg Kroah-Hartman 	unsigned long usb_flags;
104400b3ed16SGreg Kroah-Hartman #define THROTTLE_RX	0
104500b3ed16SGreg Kroah-Hartman #define THROTTLE_TX	1
104600b3ed16SGreg Kroah-Hartman #define WORK_RX_HALT	2
104700b3ed16SGreg Kroah-Hartman #define WORK_TX_HALT	3
104800b3ed16SGreg Kroah-Hartman #define WORK_RX_RESUME	4
104900b3ed16SGreg Kroah-Hartman #define WORK_TX_RESUME	5
105000b3ed16SGreg Kroah-Hartman 
105100b3ed16SGreg Kroah-Hartman 	unsigned short req_timer_done:1;
105200b3ed16SGreg Kroah-Hartman 	unsigned short resp_timer_done:1;
105300b3ed16SGreg Kroah-Hartman 
105400b3ed16SGreg Kroah-Hartman 	int endp_in;
105500b3ed16SGreg Kroah-Hartman 	int endp_out;
105600b3ed16SGreg Kroah-Hartman 
105700b3ed16SGreg Kroah-Hartman 	int sniff_fcs;
105800b3ed16SGreg Kroah-Hartman 	int sniff_channel;
105900b3ed16SGreg Kroah-Hartman 	int sniff_truncate;
106000b3ed16SGreg Kroah-Hartman 	int sniffhdr;
106100b3ed16SGreg Kroah-Hartman 
106200b3ed16SGreg Kroah-Hartman 	wait_queue_head_t cmdq;	/* wait queue itself */
106300b3ed16SGreg Kroah-Hartman 
106400b3ed16SGreg Kroah-Hartman 	/* Controller state */
1065aaad4303SSolomon Peachy 	u32 state;
1066aaad4303SSolomon Peachy 	u32 isap;
1067aaad4303SSolomon Peachy 	u8 port_enabled[HFA384x_NUMPORTS_MAX];
106800b3ed16SGreg Kroah-Hartman 
106900b3ed16SGreg Kroah-Hartman 	/* Download support */
1070aaad4303SSolomon Peachy 	unsigned int dlstate;
1071b71db740SSergio Paracuellos 	struct hfa384x_downloadbuffer bufinfo;
1072aaad4303SSolomon Peachy 	u16 dltimeout;
107300b3ed16SGreg Kroah-Hartman 
10741a6dfce7SMasanari Iida 	int scanflag;		/* to signal scan complete */
107500b3ed16SGreg Kroah-Hartman 	int join_ap;		/* are we joined to a specific ap */
107600b3ed16SGreg Kroah-Hartman 	int join_retries;	/* number of join retries till we fail */
1077de3dc47cSJuliana Rodrigues 	struct hfa384x_join_request_data joinreq;/* join request saved data */
107800b3ed16SGreg Kroah-Hartman 
1079c9573a8dSsayli karnik 	struct wlandevice *wlandev;
108000b3ed16SGreg Kroah-Hartman 	/* Timer to allow for the deferred processing of linkstatus messages */
108100b3ed16SGreg Kroah-Hartman 	struct work_struct link_bh;
108200b3ed16SGreg Kroah-Hartman 
108300b3ed16SGreg Kroah-Hartman 	struct work_struct commsqual_bh;
1084a1e95045SSergio Paracuellos 	struct hfa384x_commsquality qual;
108500b3ed16SGreg Kroah-Hartman 	struct timer_list commsqual_timer;
108600b3ed16SGreg Kroah-Hartman 
1087aaad4303SSolomon Peachy 	u16 link_status;
1088aaad4303SSolomon Peachy 	u16 link_status_new;
108900b3ed16SGreg Kroah-Hartman 	struct sk_buff_head authq;
109000b3ed16SGreg Kroah-Hartman 
1091cb3126e6SKarl Relton 	u32 txrate;
1092cb3126e6SKarl Relton 
109300b3ed16SGreg Kroah-Hartman 	/* And here we have stuff that used to be in priv */
109400b3ed16SGreg Kroah-Hartman 
109500b3ed16SGreg Kroah-Hartman 	/* State variables */
1096aaad4303SSolomon Peachy 	unsigned int presniff_port_type;
1097aaad4303SSolomon Peachy 	u16 presniff_wepflags;
1098aaad4303SSolomon Peachy 	u32 dot11_desired_bss_type;
109900b3ed16SGreg Kroah-Hartman 
110000b3ed16SGreg Kroah-Hartman 	int dbmadjust;
110100b3ed16SGreg Kroah-Hartman 
110200b3ed16SGreg Kroah-Hartman 	/* Group Addresses - right now, there are up to a total
11035f0730fdSJuliana Rodrigues 	 * of MAX_GRP_ADDR group addresses
11045f0730fdSJuliana Rodrigues 	 */
110528b17a4bSMoritz Muehlenhoff 	u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN];
1106aaad4303SSolomon Peachy 	unsigned int dot11_grpcnt;
110700b3ed16SGreg Kroah-Hartman 
110800b3ed16SGreg Kroah-Hartman 	/* Component Identities */
11095f046456SSergio Paracuellos 	struct hfa384x_compident ident_nic;
11105f046456SSergio Paracuellos 	struct hfa384x_compident ident_pri_fw;
11115f046456SSergio Paracuellos 	struct hfa384x_compident ident_sta_fw;
11125f046456SSergio Paracuellos 	struct hfa384x_compident ident_ap_fw;
1113aaad4303SSolomon Peachy 	u16 mm_mods;
111400b3ed16SGreg Kroah-Hartman 
111500b3ed16SGreg Kroah-Hartman 	/* Supplier compatibility ranges */
111665f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_mfi;
111765f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_cfi;
111865f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_pri;
111965f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_sta;
112065f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_ap;
112100b3ed16SGreg Kroah-Hartman 
112200b3ed16SGreg Kroah-Hartman 	/* Actor compatibility ranges */
112365f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_pri_cfi; /*
112471508ee4SAlessandro Ghedini 						  * pri f/w to controller
112571508ee4SAlessandro Ghedini 						  * interface
112671508ee4SAlessandro Ghedini 						  */
112771508ee4SAlessandro Ghedini 
112865f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_sta_cfi; /*
112971508ee4SAlessandro Ghedini 						  * sta f/w to controller
113071508ee4SAlessandro Ghedini 						  * interface
113171508ee4SAlessandro Ghedini 						  */
113271508ee4SAlessandro Ghedini 
11337003e01aSTim Collier 	struct hfa384x_caplevel cap_act_sta_mfi; /*
11347003e01aSTim Collier 						  * sta f/w to modem interface
11357003e01aSTim Collier 						  */
113671508ee4SAlessandro Ghedini 
113765f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_ap_cfi;	/*
113871508ee4SAlessandro Ghedini 						 * ap f/w to controller
113971508ee4SAlessandro Ghedini 						 * interface
114071508ee4SAlessandro Ghedini 						 */
114171508ee4SAlessandro Ghedini 
114265f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_ap_mfi;	/* ap f/w to modem interface */
114300b3ed16SGreg Kroah-Hartman 
1144aaad4303SSolomon Peachy 	u32 psusercount;	/* Power save user count. */
1145b244edc6SJuliana Rodrigues 	struct hfa384x_comm_tallies_32 tallies;	/* Communication tallies. */
1146aaad4303SSolomon Peachy 	u8 comment[WLAN_COMMENT_MAX + 1];	/* User comment */
114700b3ed16SGreg Kroah-Hartman 
114800b3ed16SGreg Kroah-Hartman 	/* Channel Info request results (AP only) */
114900b3ed16SGreg Kroah-Hartman 	struct {
115000b3ed16SGreg Kroah-Hartman 		atomic_t done;
1151aaad4303SSolomon Peachy 		u8 count;
1152c447358aSSergio Paracuellos 		struct hfa384x_ch_info_result results;
115300b3ed16SGreg Kroah-Hartman 	} channel_info;
115400b3ed16SGreg Kroah-Hartman 
115560f5f3fbSJuliana Rodrigues 	struct hfa384x_inf_frame *scanresults;
115600b3ed16SGreg Kroah-Hartman 
11577003e01aSTim Collier 	struct prism2sta_authlist authlist;	/*
11587003e01aSTim Collier 						 * Authenticated station list.
11597003e01aSTim Collier 						 */
1160aaad4303SSolomon Peachy 	unsigned int accessmode;		/* Access mode. */
11614d10ece3SVatika Harlalka 	struct prism2sta_accesslist allow;	/* Allowed station list. */
11624d10ece3SVatika Harlalka 	struct prism2sta_accesslist deny;	/* Denied station list. */
116300b3ed16SGreg Kroah-Hartman 
11645a2214e2SSergio Paracuellos };
116500b3ed16SGreg Kroah-Hartman 
11665a2214e2SSergio Paracuellos void hfa384x_create(struct hfa384x *hw, struct usb_device *usb);
11675a2214e2SSergio Paracuellos void hfa384x_destroy(struct hfa384x *hw);
116800b3ed16SGreg Kroah-Hartman 
1169ffe5a0a1SBranden Bonaby int hfa384x_corereset(struct hfa384x *hw, int holdtime, int settletime,
1170ffe5a0a1SBranden Bonaby 		      int genesis);
11715a2214e2SSergio Paracuellos int hfa384x_drvr_disable(struct hfa384x *hw, u16 macport);
11725a2214e2SSergio Paracuellos int hfa384x_drvr_enable(struct hfa384x *hw, u16 macport);
11735a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_enable(struct hfa384x *hw);
11745a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_disable(struct hfa384x *hw);
11757003e01aSTim Collier int hfa384x_drvr_flashdl_write(struct hfa384x *hw, u32 daddr, void *buf,
11767003e01aSTim Collier 			       u32 len);
11775a2214e2SSergio Paracuellos int hfa384x_drvr_getconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
11785a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_enable(struct hfa384x *hw, u32 exeaddr);
11795a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_disable(struct hfa384x *hw);
11805a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
11815a2214e2SSergio Paracuellos int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len);
11825a2214e2SSergio Paracuellos int hfa384x_drvr_setconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
118300b3ed16SGreg Kroah-Hartman 
11847003e01aSTim Collier static inline int
hfa384x_drvr_getconfig16(struct hfa384x * hw,u16 rid,void * val)11857003e01aSTim Collier hfa384x_drvr_getconfig16(struct hfa384x *hw, u16 rid, void *val)
118600b3ed16SGreg Kroah-Hartman {
118700b3ed16SGreg Kroah-Hartman 	int result = 0;
11887489df36SVeronika Kabatova 
1189aaad4303SSolomon Peachy 	result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
1190e573aaa4SMoritz Muehlenhoff 	if (result == 0)
1191e996024fSEric Salem 		le16_to_cpus(val);
119200b3ed16SGreg Kroah-Hartman 	return result;
119300b3ed16SGreg Kroah-Hartman }
119400b3ed16SGreg Kroah-Hartman 
hfa384x_drvr_setconfig16(struct hfa384x * hw,u16 rid,u16 val)11955a2214e2SSergio Paracuellos static inline int hfa384x_drvr_setconfig16(struct hfa384x *hw, u16 rid, u16 val)
119600b3ed16SGreg Kroah-Hartman {
1197e996024fSEric Salem 	__le16 value = cpu_to_le16(val);
11987489df36SVeronika Kabatova 
119900b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
120000b3ed16SGreg Kroah-Hartman }
120100b3ed16SGreg Kroah-Hartman 
120200b3ed16SGreg Kroah-Hartman int
12035a2214e2SSergio Paracuellos hfa384x_drvr_setconfig_async(struct hfa384x *hw,
1204aaad4303SSolomon Peachy 			     u16 rid,
120500b3ed16SGreg Kroah-Hartman 			     void *buf,
1206e573aaa4SMoritz Muehlenhoff 			     u16 len, ctlx_usercb_t usercb, void *usercb_data);
120700b3ed16SGreg Kroah-Hartman 
120800b3ed16SGreg Kroah-Hartman static inline int
hfa384x_drvr_setconfig16_async(struct hfa384x * hw,u16 rid,u16 val)12095a2214e2SSergio Paracuellos hfa384x_drvr_setconfig16_async(struct hfa384x *hw, u16 rid, u16 val)
121000b3ed16SGreg Kroah-Hartman {
1211a18ffdf4SAdrien Descamps 	__le16 value = cpu_to_le16(val);
12127489df36SVeronika Kabatova 
121300b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
121400b3ed16SGreg Kroah-Hartman 					    NULL, NULL);
121500b3ed16SGreg Kroah-Hartman }
121600b3ed16SGreg Kroah-Hartman 
12175a2214e2SSergio Paracuellos int hfa384x_drvr_start(struct hfa384x *hw);
12185a2214e2SSergio Paracuellos int hfa384x_drvr_stop(struct hfa384x *hw);
121900b3ed16SGreg Kroah-Hartman int
12205a2214e2SSergio Paracuellos hfa384x_drvr_txframe(struct hfa384x *hw, struct sk_buff *skb,
12216277fbfdSKees Cook 		     struct p80211_hdr *p80211_hdr,
1222f6b43c2eSSven Dziadek 		     struct p80211_metawep *p80211_wep);
1223c9573a8dSsayli karnik void hfa384x_tx_timeout(struct wlandevice *wlandev);
122400b3ed16SGreg Kroah-Hartman 
12255a2214e2SSergio Paracuellos int hfa384x_cmd_initialize(struct hfa384x *hw);
12265a2214e2SSergio Paracuellos int hfa384x_cmd_enable(struct hfa384x *hw, u16 macport);
12275a2214e2SSergio Paracuellos int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport);
12285a2214e2SSergio Paracuellos int hfa384x_cmd_allocate(struct hfa384x *hw, u16 len);
12295a2214e2SSergio Paracuellos int hfa384x_cmd_monitor(struct hfa384x *hw, u16 enable);
123000b3ed16SGreg Kroah-Hartman int
12315a2214e2SSergio Paracuellos hfa384x_cmd_download(struct hfa384x *hw,
1232e573aaa4SMoritz Muehlenhoff 		     u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
123300b3ed16SGreg Kroah-Hartman 
123400b3ed16SGreg Kroah-Hartman #endif /*__KERNEL__ */
123500b3ed16SGreg Kroah-Hartman 
123600b3ed16SGreg Kroah-Hartman #endif /*_HFA384x_H */
1237