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 --------------------------*/
140d349883fSSergio Paracuellos #define		HFA384x_CMD_AINFO		((u16)GENMASK(14, 8))
141d349883fSSergio Paracuellos #define		HFA384x_CMD_MACPORT		((u16)GENMASK(10, 8))
142d349883fSSergio Paracuellos #define		HFA384x_CMD_PROGMODE		((u16)GENMASK(9, 8))
143d349883fSSergio Paracuellos #define		HFA384x_CMD_CMDCODE		((u16)GENMASK(5, 0))
144d349883fSSergio Paracuellos #define		HFA384x_STATUS_RESULT		((u16)GENMASK(14, 8))
14500b3ed16SGreg Kroah-Hartman 
14600b3ed16SGreg Kroah-Hartman /*--- Command Code Constants --------------------------*/
14700b3ed16SGreg Kroah-Hartman /*--- Controller Commands --------------------------*/
148aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INIT		((u16)0x00)
149aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_ENABLE		((u16)0x01)
150aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DISABLE		((u16)0x02)
15100b3ed16SGreg Kroah-Hartman 
15200b3ed16SGreg Kroah-Hartman /*--- Regulate Commands --------------------------*/
153aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INQ		((u16)0x11)
15400b3ed16SGreg Kroah-Hartman 
15500b3ed16SGreg Kroah-Hartman /*--- Configure Commands --------------------------*/
156aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DOWNLD		((u16)0x22)
15700b3ed16SGreg Kroah-Hartman 
15800b3ed16SGreg Kroah-Hartman /*--- Debugging Commands -----------------------------*/
159aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_MONITOR		((u16)(0x38))
160aaad4303SSolomon Peachy #define		HFA384x_MONITOR_ENABLE		((u16)(0x0b))
161aaad4303SSolomon Peachy #define		HFA384x_MONITOR_DISABLE		((u16)(0x0f))
16200b3ed16SGreg Kroah-Hartman 
16300b3ed16SGreg Kroah-Hartman /*--- Result Codes --------------------------*/
164aaad4303SSolomon Peachy #define		HFA384x_CMD_ERR			((u16)(0x7F))
16500b3ed16SGreg Kroah-Hartman 
16600b3ed16SGreg Kroah-Hartman /*--- Programming Modes --------------------------
1673e27dfa2SSergio Paracuellos  *	MODE 0: Disable programming
1683e27dfa2SSergio Paracuellos  *	MODE 1: Enable volatile memory programming
1693e27dfa2SSergio Paracuellos  *	MODE 2: Enable non-volatile memory programming
1703e27dfa2SSergio Paracuellos  *	MODE 3: Program non-volatile memory section
1713e27dfa2SSergio Paracuellos  *-------------------------------------------------
1723e27dfa2SSergio Paracuellos  */
173aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_DISABLE	((u16)0x00)
174aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_RAM		((u16)0x01)
175aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NV		((u16)0x02)
176aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NVWRITE	((u16)0x03)
17700b3ed16SGreg Kroah-Hartman 
17800b3ed16SGreg Kroah-Hartman /*--- Record ID Constants --------------------------*/
17900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
1803e27dfa2SSergio Paracuellos  * Configuration RIDs: Network Parameters, Static Configuration Entities
1813e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
1823e27dfa2SSergio Paracuellos  */
183aaad4303SSolomon Peachy #define		HFA384x_RID_CNFPORTTYPE		((u16)0xFC00)
184aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR	((u16)0xFC01)
185aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID	((u16)0xFC02)
186aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNCHANNEL	((u16)0xFC03)
187aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID		((u16)0xFC04)
188aaad4303SSolomon Peachy #define		HFA384x_RID_CNFMAXDATALEN	((u16)0xFC07)
18900b3ed16SGreg Kroah-Hartman 
19000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
1913e27dfa2SSergio Paracuellos  * Configuration RID lengths: Network Params, Static Config Entities
1923e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
1933e27dfa2SSergio Paracuellos  * include the len or code fields)
1943e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
1953e27dfa2SSergio Paracuellos  */
196aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR_LEN	((u16)6)
197aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID_LEN	((u16)34)
198aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID_LEN	((u16)34)
19900b3ed16SGreg Kroah-Hartman 
20000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2013e27dfa2SSergio Paracuellos  * Configuration RIDs: Network Parameters, Dynamic Configuration Entities
2023e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2033e27dfa2SSergio Paracuellos  */
204aaad4303SSolomon Peachy #define		HFA384x_RID_CREATEIBSS		((u16)0xFC81)
205aaad4303SSolomon Peachy #define		HFA384x_RID_FRAGTHRESH		((u16)0xFC82)
206aaad4303SSolomon Peachy #define		HFA384x_RID_RTSTHRESH		((u16)0xFC83)
207aaad4303SSolomon Peachy #define		HFA384x_RID_TXRATECNTL		((u16)0xFC84)
208aaad4303SSolomon Peachy #define		HFA384x_RID_PROMISCMODE		((u16)0xFC85)
20900b3ed16SGreg Kroah-Hartman 
21000b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
2113e27dfa2SSergio Paracuellos  * Information RIDs: NIC Information
2123e27dfa2SSergio Paracuellos  *----------------------------------------------------------------------
2133e27dfa2SSergio Paracuellos  */
214aaad4303SSolomon Peachy #define		HFA384x_RID_MAXLOADTIME		((u16)0xFD00)
215aaad4303SSolomon Peachy #define		HFA384x_RID_DOWNLOADBUFFER	((u16)0xFD01)
216aaad4303SSolomon Peachy #define		HFA384x_RID_PRIIDENTITY		((u16)0xFD02)
217aaad4303SSolomon Peachy #define		HFA384x_RID_PRISUPRANGE		((u16)0xFD03)
218aaad4303SSolomon Peachy #define		HFA384x_RID_PRI_CFIACTRANGES	((u16)0xFD04)
219aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER	((u16)0xFD0A)
220aaad4303SSolomon Peachy #define		HFA384x_RID_NICIDENTITY		((u16)0xFD0B)
221aaad4303SSolomon Peachy #define		HFA384x_RID_MFISUPRANGE		((u16)0xFD0C)
222aaad4303SSolomon Peachy #define		HFA384x_RID_CFISUPRANGE		((u16)0xFD0D)
223aaad4303SSolomon Peachy #define		HFA384x_RID_STAIDENTITY		((u16)0xFD20)
224aaad4303SSolomon Peachy #define		HFA384x_RID_STASUPRANGE		((u16)0xFD21)
225aaad4303SSolomon Peachy #define		HFA384x_RID_STA_MFIACTRANGES	((u16)0xFD22)
226aaad4303SSolomon Peachy #define		HFA384x_RID_STA_CFIACTRANGES	((u16)0xFD23)
22700b3ed16SGreg Kroah-Hartman 
22800b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
2293e27dfa2SSergio Paracuellos  * Information RID Lengths: NIC Information
2303e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
2313e27dfa2SSergio Paracuellos  * include the len or code fields)
2323e27dfa2SSergio Paracuellos  *---------------------------------------------------------------------
2333e27dfa2SSergio Paracuellos  */
234aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER_LEN		((u16)12)
23500b3ed16SGreg Kroah-Hartman 
23600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2373e27dfa2SSergio Paracuellos  * Information RIDs:  MAC Information
2383e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2393e27dfa2SSergio Paracuellos  */
240aaad4303SSolomon Peachy #define		HFA384x_RID_PORTSTATUS		((u16)0xFD40)
241aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTSSID		((u16)0xFD41)
242aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTBSSID	((u16)0xFD42)
243aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTTXRATE	((u16)0xFD44)
244aaad4303SSolomon Peachy #define		HFA384x_RID_SHORTRETRYLIMIT	((u16)0xFD48)
245aaad4303SSolomon Peachy #define		HFA384x_RID_LONGRETRYLIMIT	((u16)0xFD49)
246aaad4303SSolomon Peachy #define		HFA384x_RID_MAXTXLIFETIME	((u16)0xFD4A)
247aaad4303SSolomon Peachy #define		HFA384x_RID_PRIVACYOPTIMP	((u16)0xFD4F)
248aaad4303SSolomon Peachy #define		HFA384x_RID_DBMCOMMSQUALITY	((u16)0xFD51)
24900b3ed16SGreg Kroah-Hartman 
25000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2513e27dfa2SSergio Paracuellos  * Information RID Lengths:  MAC Information
2523e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
2533e27dfa2SSergio Paracuellos  * include the len or code fields)
2543e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2553e27dfa2SSergio Paracuellos  */
25671508ee4SAlessandro Ghedini #define		HFA384x_RID_DBMCOMMSQUALITY_LEN	 \
25762e493c4SSergio Paracuellos 	((u16)sizeof(struct hfa384x_dbmcommsquality))
25871508ee4SAlessandro Ghedini #define		HFA384x_RID_JOINREQUEST_LEN \
259de3dc47cSJuliana Rodrigues 	((u16)sizeof(struct hfa384x_join_request_data))
26040a67411SMoritz Muehlenhoff 
26100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2623e27dfa2SSergio Paracuellos  * Information RIDs:  Modem Information
2633e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2643e27dfa2SSergio Paracuellos  */
265aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTCHANNEL	((u16)0xFDC1)
26600b3ed16SGreg Kroah-Hartman 
26700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2683e27dfa2SSergio Paracuellos  * API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
2693e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2703e27dfa2SSergio Paracuellos  */
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)
279b937612fSSergio Paracuellos #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 /*--------------------------------------------------------------------
2943e27dfa2SSergio Paracuellos  * PD Record codes
2953e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2963e27dfa2SSergio Paracuellos  */
297aaad4303SSolomon Peachy #define HFA384x_PDR_PCB_PARTNUM		((u16)0x0001)
298aaad4303SSolomon Peachy #define HFA384x_PDR_PDAVER		((u16)0x0002)
299aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_SERIAL		((u16)0x0003)
300aaad4303SSolomon Peachy #define HFA384x_PDR_MKK_MEASUREMENTS	((u16)0x0004)
301aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_RAMSIZE		((u16)0x0005)
302aaad4303SSolomon Peachy #define HFA384x_PDR_MFISUPRANGE		((u16)0x0006)
303aaad4303SSolomon Peachy #define HFA384x_PDR_CFISUPRANGE		((u16)0x0007)
304aaad4303SSolomon Peachy #define HFA384x_PDR_NICID		((u16)0x0008)
305aaad4303SSolomon Peachy #define HFA384x_PDR_MAC_ADDRESS		((u16)0x0101)
306aaad4303SSolomon Peachy #define HFA384x_PDR_REGDOMAIN		((u16)0x0103)
307aaad4303SSolomon Peachy #define HFA384x_PDR_ALLOWED_CHANNEL	((u16)0x0104)
308aaad4303SSolomon Peachy #define HFA384x_PDR_DEFAULT_CHANNEL	((u16)0x0105)
309aaad4303SSolomon Peachy #define HFA384x_PDR_TEMPTYPE		((u16)0x0107)
310aaad4303SSolomon Peachy #define HFA384x_PDR_IFR_SETTING		((u16)0x0200)
311aaad4303SSolomon Peachy #define HFA384x_PDR_RFR_SETTING		((u16)0x0201)
312aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_BASELINE	((u16)0x0202)
313aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_SHADOW	((u16)0x0203)
314aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_IFRF	((u16)0x0204)
315aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALSP	((u16)0x0300)
316aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALI	((u16)0x0301)
317aaad4303SSolomon Peachy #define HFA384x_PDR_MAX_TX_POWER	((u16)0x0302)
318aaad4303SSolomon Peachy #define HFA384x_PDR_MASTER_CHAN_LIST	((u16)0x0303)
319aaad4303SSolomon Peachy #define HFA384x_PDR_3842_NIC_CONFIG	((u16)0x0400)
320aaad4303SSolomon Peachy #define HFA384x_PDR_USB_ID		((u16)0x0401)
321aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_ID		((u16)0x0402)
322aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_IFCONF		((u16)0x0403)
323aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_PMCONF		((u16)0x0404)
324aaad4303SSolomon Peachy #define HFA384x_PDR_RFENRGY		((u16)0x0406)
325aaad4303SSolomon Peachy #define HFA384x_PDR_USB_POWER_TYPE      ((u16)0x0407)
326aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MAX_POWER	((u16)0x0409)
327aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MANUFACTURER	((u16)0x0410)
328aaad4303SSolomon Peachy #define HFA384x_PDR_USB_PRODUCT		((u16)0x0411)
329aaad4303SSolomon Peachy #define HFA384x_PDR_ANT_DIVERSITY	((u16)0x0412)
330aaad4303SSolomon Peachy #define HFA384x_PDR_HFO_DELAY		((u16)0x0413)
331aaad4303SSolomon Peachy #define HFA384x_PDR_SCALE_THRESH	((u16)0x0414)
33200b3ed16SGreg Kroah-Hartman 
333aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTSP	((u16)0x0900)
334aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTI	((u16)0x0901)
335aaad4303SSolomon Peachy #define HFA384x_PDR_END_OF_PDA		((u16)0x0000)
33600b3ed16SGreg Kroah-Hartman 
33700b3ed16SGreg Kroah-Hartman /*--- Register Test/Get/Set Field macros ------------------------*/
33800b3ed16SGreg Kroah-Hartman 
339aaad4303SSolomon Peachy #define		HFA384x_CMD_AINFO_SET(value)	((u16)((u16)(value) << 8))
34071508ee4SAlessandro Ghedini #define		HFA384x_CMD_MACPORT_SET(value)	\
34171508ee4SAlessandro Ghedini 			((u16)HFA384x_CMD_AINFO_SET(value))
34271508ee4SAlessandro Ghedini #define		HFA384x_CMD_PROGMODE_SET(value)	\
34371508ee4SAlessandro Ghedini 			((u16)HFA384x_CMD_AINFO_SET((u16)value))
344aaad4303SSolomon Peachy #define		HFA384x_CMD_CMDCODE_SET(value)		((u16)(value))
34500b3ed16SGreg Kroah-Hartman 
346aaad4303SSolomon Peachy #define		HFA384x_STATUS_RESULT_SET(value)	(((u16)(value)) << 8)
34700b3ed16SGreg Kroah-Hartman 
34800b3ed16SGreg Kroah-Hartman /* Host Maintained State Info */
34900b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_PREINIT	0
35000b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_INIT	1
35100b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_RUNNING	2
35200b3ed16SGreg Kroah-Hartman 
35300b3ed16SGreg Kroah-Hartman /*-------------------------------------------------------------*/
35400b3ed16SGreg Kroah-Hartman /* Commonly used basic types */
355b2119911SHimangi Saraogi struct hfa384x_bytestr {
356aaad4303SSolomon Peachy 	u16 len;
357aaad4303SSolomon Peachy 	u8 data[0];
358b2119911SHimangi Saraogi } __packed;
35900b3ed16SGreg Kroah-Hartman 
36003c2975bSSergio Paracuellos struct hfa384x_bytestr32 {
361aaad4303SSolomon Peachy 	u16 len;
362aaad4303SSolomon Peachy 	u8 data[32];
36303c2975bSSergio Paracuellos } __packed;
36400b3ed16SGreg Kroah-Hartman 
36500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
3663e27dfa2SSergio Paracuellos  * Configuration Record Structures:
3673e27dfa2SSergio Paracuellos  *	Network Parameters, Static Configuration Entities
3683e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
3693e27dfa2SSergio Paracuellos  */
37000b3ed16SGreg Kroah-Hartman 
37100b3ed16SGreg Kroah-Hartman /*-- Hardware/Firmware Component Information ----------*/
3725f046456SSergio Paracuellos struct hfa384x_compident {
373aaad4303SSolomon Peachy 	u16 id;
374aaad4303SSolomon Peachy 	u16 variant;
375aaad4303SSolomon Peachy 	u16 major;
376aaad4303SSolomon Peachy 	u16 minor;
3775f046456SSergio Paracuellos } __packed;
37800b3ed16SGreg Kroah-Hartman 
37965f170c6SSergio Paracuellos struct hfa384x_caplevel {
380aaad4303SSolomon Peachy 	u16 role;
381aaad4303SSolomon Peachy 	u16 id;
382aaad4303SSolomon Peachy 	u16 variant;
383aaad4303SSolomon Peachy 	u16 bottom;
384aaad4303SSolomon Peachy 	u16 top;
38565f170c6SSergio Paracuellos } __packed;
38600b3ed16SGreg Kroah-Hartman 
38700b3ed16SGreg Kroah-Hartman /*-- Configuration Record: cnfAuthentication --*/
38800b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM	0x0001
38900b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_SHAREDKEY	0x0002
39000b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_LEAP		0x0004
39100b3ed16SGreg Kroah-Hartman 
39200b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
3933e27dfa2SSergio Paracuellos  * Configuration Record Structures:
3943e27dfa2SSergio Paracuellos  *	Network Parameters, Dynamic Configuration Entities
3953e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
3963e27dfa2SSergio Paracuellos  */
39700b3ed16SGreg Kroah-Hartman 
39800b3ed16SGreg Kroah-Hartman #define HFA384x_CREATEIBSS_JOINCREATEIBSS          0
39900b3ed16SGreg Kroah-Hartman 
40000b3ed16SGreg Kroah-Hartman /*-- Configuration Record: HostScanRequest (data portion only) --*/
401e474b4d4SSergio Paracuellos struct hfa384x_host_scan_request_data {
402e474b4d4SSergio Paracuellos 	u16 channel_list;
403e474b4d4SSergio Paracuellos 	u16 tx_rate;
40403c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
405935cbfb2SSergio Paracuellos } __packed;
40600b3ed16SGreg Kroah-Hartman 
40700b3ed16SGreg Kroah-Hartman /*-- Configuration Record: JoinRequest (data portion only) --*/
408de3dc47cSJuliana Rodrigues struct hfa384x_join_request_data {
409aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
410aaad4303SSolomon Peachy 	u16 channel;
411f0ffa0e2SSergio Paracuellos } __packed;
41200b3ed16SGreg Kroah-Hartman 
41300b3ed16SGreg Kroah-Hartman /*-- Configuration Record: authenticateStation (data portion only) --*/
4144c976b16SJuliana Rodrigues struct hfa384x_authenticate_station_data {
41528b17a4bSMoritz Muehlenhoff 	u8 address[ETH_ALEN];
416aaad4303SSolomon Peachy 	u16 status;
417aaad4303SSolomon Peachy 	u16 algorithm;
41817fb19f0SSergio Paracuellos } __packed;
41900b3ed16SGreg Kroah-Hartman 
42000b3ed16SGreg Kroah-Hartman /*-- Configuration Record: WPAData       (data portion only) --*/
421162da263SSergio Paracuellos struct hfa384x_wpa_data {
422aaad4303SSolomon Peachy 	u16 datalen;
4235dd8acc8SSvenne Krap 	u8 data[0];		/* max 80 */
424a2a44803SSergio Paracuellos } __packed;
42500b3ed16SGreg Kroah-Hartman 
42600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4273e27dfa2SSergio Paracuellos  * Information Record Structures: NIC Information
4283e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4293e27dfa2SSergio Paracuellos  */
43000b3ed16SGreg Kroah-Hartman 
43100b3ed16SGreg Kroah-Hartman /*-- Information Record: DownLoadBuffer --*/
43200b3ed16SGreg Kroah-Hartman /* NOTE: The page and offset are in AUX format */
433b71db740SSergio Paracuellos struct hfa384x_downloadbuffer {
434aaad4303SSolomon Peachy 	u16 page;
435aaad4303SSolomon Peachy 	u16 offset;
436aaad4303SSolomon Peachy 	u16 len;
437b71db740SSergio Paracuellos } __packed;
43800b3ed16SGreg Kroah-Hartman 
43900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4403e27dfa2SSergio Paracuellos  * Information Record Structures: NIC Information
4413e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4423e27dfa2SSergio Paracuellos  */
44300b3ed16SGreg Kroah-Hartman 
444aaad4303SSolomon Peachy #define HFA384x_PSTATUS_CONN_IBSS	((u16)3)
44500b3ed16SGreg Kroah-Hartman 
44600b3ed16SGreg Kroah-Hartman /*-- Information Record: commsquality --*/
447a1e95045SSergio Paracuellos struct hfa384x_commsquality {
4481680202cSJuliana Rodrigues 	u16 cq_curr_bss;
4490e771659SJuliana Rodrigues 	u16 asl_curr_bss;
4506b6f9491SJuliana Rodrigues 	u16 anl_curr_fc;
451a1e95045SSergio Paracuellos } __packed;
45200b3ed16SGreg Kroah-Hartman 
45300b3ed16SGreg Kroah-Hartman /*-- Information Record: dmbcommsquality --*/
45462e493c4SSergio Paracuellos struct hfa384x_dbmcommsquality {
455c08510e1SSergio Paracuellos 	u16 cq_dbm_curr_bss;
456c08510e1SSergio Paracuellos 	u16 asl_dbm_curr_bss;
457c08510e1SSergio Paracuellos 	u16 anl_dbm_curr_fc;
45862e493c4SSergio Paracuellos } __packed;
45900b3ed16SGreg Kroah-Hartman 
46000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4613e27dfa2SSergio Paracuellos  * FRAME STRUCTURES: Communication Frames
4623e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4633e27dfa2SSergio Paracuellos  * Communication Frames: Transmit Frames
4643e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4653e27dfa2SSergio Paracuellos  */
46600b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Transmit Frame Structure --*/
467eb76afc9SSergio Paracuellos struct hfa384x_tx_frame {
468aaad4303SSolomon Peachy 	u16 status;
469aaad4303SSolomon Peachy 	u16 reserved1;
470aaad4303SSolomon Peachy 	u16 reserved2;
471aaad4303SSolomon Peachy 	u32 sw_support;
472aaad4303SSolomon Peachy 	u8 tx_retrycount;
473aaad4303SSolomon Peachy 	u8 tx_rate;
474aaad4303SSolomon Peachy 	u16 tx_control;
47500b3ed16SGreg Kroah-Hartman 
47600b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information --*/
47700b3ed16SGreg Kroah-Hartman 
478aaad4303SSolomon Peachy 	u16 frame_control;
479aaad4303SSolomon Peachy 	u16 duration_id;
480aaad4303SSolomon Peachy 	u8 address1[6];
481aaad4303SSolomon Peachy 	u8 address2[6];
482aaad4303SSolomon Peachy 	u8 address3[6];
483aaad4303SSolomon Peachy 	u16 sequence_control;
484aaad4303SSolomon Peachy 	u8 address4[6];
485a18ffdf4SAdrien Descamps 	__le16 data_len;		/* little endian format */
48600b3ed16SGreg Kroah-Hartman 
48700b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
48800b3ed16SGreg Kroah-Hartman 
489aaad4303SSolomon Peachy 	u8 dest_addr[6];
490aaad4303SSolomon Peachy 	u8 src_addr[6];
491aaad4303SSolomon Peachy 	u16 data_length;	/* big endian format */
492eb76afc9SSergio Paracuellos } __packed;
49300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4943e27dfa2SSergio Paracuellos  * Communication Frames: Field Masks for Transmit Frames
4953e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4963e27dfa2SSergio Paracuellos  */
49700b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
4987f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_ACKERR			((u16)BIT(5))
4997f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_FORMERR		((u16)BIT(3))
5007f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_DISCON			((u16)BIT(2))
5017f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_AGEDERR		((u16)BIT(1))
5027f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_RETRYERR		((u16)BIT(0))
50300b3ed16SGreg Kroah-Hartman /*-- Transmit Control Field --*/
504d349883fSSergio Paracuellos #define		HFA384x_TX_MACPORT			((u16)GENMASK(10, 8))
505d349883fSSergio Paracuellos #define		HFA384x_TX_STRUCTYPE			((u16)GENMASK(4, 3))
5067f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXEX				((u16)BIT(2))
5077f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXOK				((u16)BIT(1))
50800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5093e27dfa2SSergio Paracuellos  * Communication Frames: Test/Get/Set Field Values for Transmit Frames
5103e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5113e27dfa2SSergio Paracuellos  */
51200b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
51300b3ed16SGreg Kroah-Hartman #define HFA384x_TXSTATUS_ISERROR(v)	\
514aaad4303SSolomon Peachy 	(((u16)(v)) & \
51500b3ed16SGreg Kroah-Hartman 	(HFA384x_TXSTATUS_ACKERR | HFA384x_TXSTATUS_FORMERR | \
51600b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_DISCON | HFA384x_TXSTATUS_AGEDERR | \
51700b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_RETRYERR))
51800b3ed16SGreg Kroah-Hartman 
519aaad4303SSolomon Peachy #define	HFA384x_TX_SET(v, m, s)		((((u16)(v)) << ((u16)(s))) & ((u16)(m)))
52000b3ed16SGreg Kroah-Hartman 
52100b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_MACPORT_SET(v)	HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
52271508ee4SAlessandro Ghedini #define	HFA384x_TX_STRUCTYPE_SET(v)	HFA384x_TX_SET(v, \
52371508ee4SAlessandro Ghedini 						HFA384x_TX_STRUCTYPE, 3)
52400b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXEX_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
52500b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXOK_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
52600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5273e27dfa2SSergio Paracuellos  * Communication Frames: Receive Frames
5283e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5293e27dfa2SSergio Paracuellos  */
53000b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Receive Frame Structure --*/
53170adf509SSergio Paracuellos struct hfa384x_rx_frame {
53200b3ed16SGreg Kroah-Hartman 	/*-- MAC rx descriptor (hfa384x byte order) --*/
533aaad4303SSolomon Peachy 	u16 status;
534aaad4303SSolomon Peachy 	u32 time;
535aaad4303SSolomon Peachy 	u8 silence;
536aaad4303SSolomon Peachy 	u8 signal;
537aaad4303SSolomon Peachy 	u8 rate;
538aaad4303SSolomon Peachy 	u8 rx_flow;
539aaad4303SSolomon Peachy 	u16 reserved1;
540aaad4303SSolomon Peachy 	u16 reserved2;
54100b3ed16SGreg Kroah-Hartman 
54200b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information (802.11 byte order) --*/
5438cbe56e0SHimangi Saraogi 	__le16 frame_control;
544aaad4303SSolomon Peachy 	u16 duration_id;
545aaad4303SSolomon Peachy 	u8 address1[6];
546aaad4303SSolomon Peachy 	u8 address2[6];
547aaad4303SSolomon Peachy 	u8 address3[6];
548aaad4303SSolomon Peachy 	u16 sequence_control;
549aaad4303SSolomon Peachy 	u8 address4[6];
5508cbe56e0SHimangi Saraogi 	__le16 data_len;		/* hfa384x (little endian) format */
55100b3ed16SGreg Kroah-Hartman 
55200b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
553aaad4303SSolomon Peachy 	u8 dest_addr[6];
554aaad4303SSolomon Peachy 	u8 src_addr[6];
555aaad4303SSolomon Peachy 	u16 data_length;	/* IEEE? (big endian) format */
55670adf509SSergio Paracuellos } __packed;
55700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5583e27dfa2SSergio Paracuellos  * Communication Frames: Field Masks for Receive Frames
5593e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5603e27dfa2SSergio Paracuellos  */
56100b3ed16SGreg Kroah-Hartman 
56200b3ed16SGreg Kroah-Hartman /*-- Status Fields --*/
563d349883fSSergio Paracuellos #define		HFA384x_RXSTATUS_MACPORT		((u16)GENMASK(10, 8))
5647f6e0e44SMoritz Muehlenhoff #define		HFA384x_RXSTATUS_FCSERR			((u16)BIT(0))
56500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5663e27dfa2SSergio Paracuellos  * Communication Frames: Test/Get/Set Field Values for Receive Frames
5673e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5683e27dfa2SSergio Paracuellos  */
56971508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_MACPORT_GET(value)	((u16)((((u16)(value)) \
57071508ee4SAlessandro Ghedini 					    & HFA384x_RXSTATUS_MACPORT) >> 8))
57171508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_ISFCSERR(value)	((u16)(((u16)(value)) \
57271508ee4SAlessandro Ghedini 						  & HFA384x_RXSTATUS_FCSERR))
57300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5743e27dfa2SSergio Paracuellos  * FRAME STRUCTURES: Information Types and Information Frame Structures
5753e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5763e27dfa2SSergio Paracuellos  * Information Types
5773e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5783e27dfa2SSergio Paracuellos  */
579aaad4303SSolomon Peachy #define		HFA384x_IT_HANDOVERADDR			((u16)0xF000UL)
580aaad4303SSolomon Peachy #define		HFA384x_IT_COMMTALLIES			((u16)0xF100UL)
581aaad4303SSolomon Peachy #define		HFA384x_IT_SCANRESULTS			((u16)0xF101UL)
582aaad4303SSolomon Peachy #define		HFA384x_IT_CHINFORESULTS		((u16)0xF102UL)
583aaad4303SSolomon Peachy #define		HFA384x_IT_HOSTSCANRESULTS		((u16)0xF103UL)
584aaad4303SSolomon Peachy #define		HFA384x_IT_LINKSTATUS			((u16)0xF200UL)
585aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCSTATUS			((u16)0xF201UL)
586aaad4303SSolomon Peachy #define		HFA384x_IT_AUTHREQ			((u16)0xF202UL)
587aaad4303SSolomon Peachy #define		HFA384x_IT_PSUSERCNT			((u16)0xF203UL)
588aaad4303SSolomon Peachy #define		HFA384x_IT_KEYIDCHANGED			((u16)0xF204UL)
589aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCREQ			((u16)0xF205UL)
590aaad4303SSolomon Peachy #define		HFA384x_IT_MICFAILURE			((u16)0xF206UL)
59100b3ed16SGreg Kroah-Hartman 
59200b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5933e27dfa2SSergio Paracuellos  * Information Frames Structures
5943e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5953e27dfa2SSergio Paracuellos  * Information Frames: Notification Frame Structures
5963e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5973e27dfa2SSergio Paracuellos  */
59800b3ed16SGreg Kroah-Hartman 
59900b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Communication Tallies --*/
6004cc454f2SSergio Paracuellos struct hfa384x_comm_tallies_16 {
601aaad4303SSolomon Peachy 	u16 txunicastframes;
602aaad4303SSolomon Peachy 	u16 txmulticastframes;
603aaad4303SSolomon Peachy 	u16 txfragments;
604aaad4303SSolomon Peachy 	u16 txunicastoctets;
605aaad4303SSolomon Peachy 	u16 txmulticastoctets;
606aaad4303SSolomon Peachy 	u16 txdeferredtrans;
607aaad4303SSolomon Peachy 	u16 txsingleretryframes;
608aaad4303SSolomon Peachy 	u16 txmultipleretryframes;
609aaad4303SSolomon Peachy 	u16 txretrylimitexceeded;
610aaad4303SSolomon Peachy 	u16 txdiscards;
611aaad4303SSolomon Peachy 	u16 rxunicastframes;
612aaad4303SSolomon Peachy 	u16 rxmulticastframes;
613aaad4303SSolomon Peachy 	u16 rxfragments;
614aaad4303SSolomon Peachy 	u16 rxunicastoctets;
615aaad4303SSolomon Peachy 	u16 rxmulticastoctets;
616aaad4303SSolomon Peachy 	u16 rxfcserrors;
617aaad4303SSolomon Peachy 	u16 rxdiscardsnobuffer;
618aaad4303SSolomon Peachy 	u16 txdiscardswrongsa;
619aaad4303SSolomon Peachy 	u16 rxdiscardswepundecr;
620aaad4303SSolomon Peachy 	u16 rxmsginmsgfrag;
621aaad4303SSolomon Peachy 	u16 rxmsginbadmsgfrag;
62207e23b67SSergio Paracuellos } __packed;
62300b3ed16SGreg Kroah-Hartman 
624b244edc6SJuliana Rodrigues struct hfa384x_comm_tallies_32 {
625aaad4303SSolomon Peachy 	u32 txunicastframes;
626aaad4303SSolomon Peachy 	u32 txmulticastframes;
627aaad4303SSolomon Peachy 	u32 txfragments;
628aaad4303SSolomon Peachy 	u32 txunicastoctets;
629aaad4303SSolomon Peachy 	u32 txmulticastoctets;
630aaad4303SSolomon Peachy 	u32 txdeferredtrans;
631aaad4303SSolomon Peachy 	u32 txsingleretryframes;
632aaad4303SSolomon Peachy 	u32 txmultipleretryframes;
633aaad4303SSolomon Peachy 	u32 txretrylimitexceeded;
634aaad4303SSolomon Peachy 	u32 txdiscards;
635aaad4303SSolomon Peachy 	u32 rxunicastframes;
636aaad4303SSolomon Peachy 	u32 rxmulticastframes;
637aaad4303SSolomon Peachy 	u32 rxfragments;
638aaad4303SSolomon Peachy 	u32 rxunicastoctets;
639aaad4303SSolomon Peachy 	u32 rxmulticastoctets;
640aaad4303SSolomon Peachy 	u32 rxfcserrors;
641aaad4303SSolomon Peachy 	u32 rxdiscardsnobuffer;
642aaad4303SSolomon Peachy 	u32 txdiscardswrongsa;
643aaad4303SSolomon Peachy 	u32 rxdiscardswepundecr;
644aaad4303SSolomon Peachy 	u32 rxmsginmsgfrag;
645aaad4303SSolomon Peachy 	u32 rxmsginbadmsgfrag;
646cfc6cb1fSSergio Paracuellos } __packed;
64700b3ed16SGreg Kroah-Hartman 
64800b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Scan Results & Subfields--*/
649b263dd5eSJuliana Rodrigues struct hfa384x_scan_result_sub {
650aaad4303SSolomon Peachy 	u16 chid;
651aaad4303SSolomon Peachy 	u16 anl;
652aaad4303SSolomon Peachy 	u16 sl;
653aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
654aaad4303SSolomon Peachy 	u16 bcnint;
655aaad4303SSolomon Peachy 	u16 capinfo;
65603c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
657aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
658aaad4303SSolomon Peachy 	u16 proberesp_rate;
6594400334bSSergio Paracuellos } __packed;
66000b3ed16SGreg Kroah-Hartman 
661040a7bd4SJuliana Rodrigues struct hfa384x_scan_result {
662aaad4303SSolomon Peachy 	u16 rsvd;
663aaad4303SSolomon Peachy 	u16 scanreason;
664b263dd5eSJuliana Rodrigues 	struct hfa384x_scan_result_sub result[HFA384x_SCANRESULT_MAX];
665dc0bb002SSergio Paracuellos } __packed;
66600b3ed16SGreg Kroah-Hartman 
66700b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
668e35baeb0SJuliana Rodrigues struct hfa384x_ch_info_result_sub {
669aaad4303SSolomon Peachy 	u16 chid;
670aaad4303SSolomon Peachy 	u16 anl;
671aaad4303SSolomon Peachy 	u16 pnl;
672aaad4303SSolomon Peachy 	u16 active;
6731bc4292aSSergio Paracuellos } __packed;
67400b3ed16SGreg Kroah-Hartman 
6757f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_BSSACTIVE	BIT(0)
6767f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_PCFACTIVE	BIT(1)
67700b3ed16SGreg Kroah-Hartman 
678c447358aSSergio Paracuellos struct hfa384x_ch_info_result {
679aaad4303SSolomon Peachy 	u16 scanchannels;
680e35baeb0SJuliana Rodrigues 	struct hfa384x_ch_info_result_sub result[HFA384x_CHINFORESULT_MAX];
6810fddae8eSSergio Paracuellos } __packed;
68200b3ed16SGreg Kroah-Hartman 
68300b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
6848f8149deSSergio Paracuellos struct hfa384x_hscan_result_sub {
685aaad4303SSolomon Peachy 	u16 chid;
686aaad4303SSolomon Peachy 	u16 anl;
687aaad4303SSolomon Peachy 	u16 sl;
688aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
689aaad4303SSolomon Peachy 	u16 bcnint;
690aaad4303SSolomon Peachy 	u16 capinfo;
69103c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
692aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
693aaad4303SSolomon Peachy 	u16 proberesp_rate;
694aaad4303SSolomon Peachy 	u16 atim;
695b353d11aSSergio Paracuellos } __packed;
69600b3ed16SGreg Kroah-Hartman 
6970e2ce9adSSergio Paracuellos struct hfa384x_hscan_result {
698aaad4303SSolomon Peachy 	u16 nresult;
699aaad4303SSolomon Peachy 	u16 rsvd;
7008f8149deSSergio Paracuellos 	struct hfa384x_hscan_result_sub result[HFA384x_HSCANRESULT_MAX];
701f8f2821eSSergio Paracuellos } __packed;
70200b3ed16SGreg Kroah-Hartman 
70300b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: LinkStatus --*/
70400b3ed16SGreg Kroah-Hartman 
705aaad4303SSolomon Peachy #define HFA384x_LINK_NOTCONNECTED	((u16)0)
706aaad4303SSolomon Peachy #define HFA384x_LINK_CONNECTED		((u16)1)
707aaad4303SSolomon Peachy #define HFA384x_LINK_DISCONNECTED	((u16)2)
708aaad4303SSolomon Peachy #define HFA384x_LINK_AP_CHANGE		((u16)3)
709aaad4303SSolomon Peachy #define HFA384x_LINK_AP_OUTOFRANGE	((u16)4)
710aaad4303SSolomon Peachy #define HFA384x_LINK_AP_INRANGE		((u16)5)
711aaad4303SSolomon Peachy #define HFA384x_LINK_ASSOCFAIL		((u16)6)
71200b3ed16SGreg Kroah-Hartman 
7137190f3f1SSergio Paracuellos struct hfa384x_link_status {
714aaad4303SSolomon Peachy 	u16 linkstatus;
715a8eb5139SSergio Paracuellos } __packed;
71600b3ed16SGreg Kroah-Hartman 
71700b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
71800b3ed16SGreg Kroah-Hartman 
719aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_STAASSOC	((u16)1)
720aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_REASSOC	((u16)2)
721aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_AUTHFAIL	((u16)5)
72200b3ed16SGreg Kroah-Hartman 
7231889b0dbSJuliana Rodrigues struct hfa384x_assoc_status {
724aaad4303SSolomon Peachy 	u16 assocstatus;
72528b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
72600b3ed16SGreg Kroah-Hartman 	/* old_ap_addr is only valid if assocstatus == 2 */
72728b17a4bSMoritz Muehlenhoff 	u8 old_ap_addr[ETH_ALEN];
728aaad4303SSolomon Peachy 	u16 reason;
729aaad4303SSolomon Peachy 	u16 reserved;
7305383f13eSSergio Paracuellos } __packed;
73100b3ed16SGreg Kroah-Hartman 
73200b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
73300b3ed16SGreg Kroah-Hartman 
734b8f55192SSergio Paracuellos struct hfa384x_auth_request {
73528b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
736aaad4303SSolomon Peachy 	u16 algorithm;
737b9820e0cSSergio Paracuellos } __packed;
73800b3ed16SGreg Kroah-Hartman 
73900b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
74000b3ed16SGreg Kroah-Hartman 
7410c3b2bd7SSergio Paracuellos struct hfa384x_ps_user_count {
742aaad4303SSolomon Peachy 	u16 usercnt;
743013e69ebSSergio Paracuellos } __packed;
74400b3ed16SGreg Kroah-Hartman 
745ab42187aSSergio Paracuellos struct hfa384x_key_id_changed {
74628b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
747aaad4303SSolomon Peachy 	u16 keyid;
74844049d81SSergio Paracuellos } __packed;
74900b3ed16SGreg Kroah-Hartman 
75000b3ed16SGreg Kroah-Hartman /*--  Collection of all Inf frames ---------------*/
751f745ea61SSergio Paracuellos union hfa384x_infodata {
7524cc454f2SSergio Paracuellos 	struct hfa384x_comm_tallies_16 commtallies16;
753b244edc6SJuliana Rodrigues 	struct hfa384x_comm_tallies_32 commtallies32;
754040a7bd4SJuliana Rodrigues 	struct hfa384x_scan_result scanresult;
755c447358aSSergio Paracuellos 	struct hfa384x_ch_info_result chinforesult;
7560e2ce9adSSergio Paracuellos 	struct hfa384x_hscan_result hscanresult;
7577190f3f1SSergio Paracuellos 	struct hfa384x_link_status linkstatus;
7581889b0dbSJuliana Rodrigues 	struct hfa384x_assoc_status assocstatus;
759b8f55192SSergio Paracuellos 	struct hfa384x_auth_request authreq;
7600c3b2bd7SSergio Paracuellos 	struct hfa384x_ps_user_count psusercnt;
761ab42187aSSergio Paracuellos 	struct hfa384x_key_id_changed keyidchanged;
762f745ea61SSergio Paracuellos } __packed;
76300b3ed16SGreg Kroah-Hartman 
76460f5f3fbSJuliana Rodrigues struct hfa384x_inf_frame {
765aaad4303SSolomon Peachy 	u16 framelen;
766aaad4303SSolomon Peachy 	u16 infotype;
767f745ea61SSergio Paracuellos 	union hfa384x_infodata info;
768f69de9e3SSergio Paracuellos } __packed;
76900b3ed16SGreg Kroah-Hartman 
77000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
7713e27dfa2SSergio Paracuellos  * USB Packet structures and constants.
7723e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
7733e27dfa2SSergio Paracuellos  */
77400b3ed16SGreg Kroah-Hartman 
77500b3ed16SGreg Kroah-Hartman /* Should be sent to the bulkout endpoint */
77600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_TXFRM	0
77700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDREQ	1
77800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDREQ	2
77900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDREQ	3
78000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMREQ	4
78100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMREQ	5
78200b3ed16SGreg Kroah-Hartman 
78300b3ed16SGreg Kroah-Hartman /* Received from the bulkin endpoint */
78400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISTXFRM(a)	(((a) & 0x9000) == 0x1000)
78500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISRXFRM(a)	(!((a) & 0x9000))
78600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_INFOFRM	0x8000
78700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDRESP	0x8001
78800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDRESP	0x8002
78900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDRESP	0x8003
79000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMRESP	0x8004
79100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMRESP	0x8005
79200b3ed16SGreg Kroah-Hartman #define HFA384x_USB_BUFAVAIL	0x8006
79300b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ERROR	0x8007
79400b3ed16SGreg Kroah-Hartman 
79500b3ed16SGreg Kroah-Hartman /*------------------------------------*/
79600b3ed16SGreg Kroah-Hartman /* Request (bulk OUT) packet contents */
79700b3ed16SGreg Kroah-Hartman 
7982f1014f7SSergio Paracuellos struct hfa384x_usb_txfrm {
799eb76afc9SSergio Paracuellos 	struct hfa384x_tx_frame desc;
800aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
8012f1014f7SSergio Paracuellos } __packed;
80200b3ed16SGreg Kroah-Hartman 
803a6dcbdfeSSergio Paracuellos struct hfa384x_usb_cmdreq {
804a18ffdf4SAdrien Descamps 	__le16 type;
805a18ffdf4SAdrien Descamps 	__le16 cmd;
806a18ffdf4SAdrien Descamps 	__le16 parm0;
807a18ffdf4SAdrien Descamps 	__le16 parm1;
808a18ffdf4SAdrien Descamps 	__le16 parm2;
809aaad4303SSolomon Peachy 	u8 pad[54];
810a6dcbdfeSSergio Paracuellos } __packed;
81100b3ed16SGreg Kroah-Hartman 
8123bc070f6SSergio Paracuellos struct hfa384x_usb_wridreq {
813a18ffdf4SAdrien Descamps 	__le16 type;
814a18ffdf4SAdrien Descamps 	__le16 frmlen;
815a18ffdf4SAdrien Descamps 	__le16 rid;
816aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
8173bc070f6SSergio Paracuellos } __packed;
81800b3ed16SGreg Kroah-Hartman 
8195b9f240eSSergio Paracuellos struct hfa384x_usb_rridreq {
820a18ffdf4SAdrien Descamps 	__le16 type;
821a18ffdf4SAdrien Descamps 	__le16 frmlen;
822a18ffdf4SAdrien Descamps 	__le16 rid;
823aaad4303SSolomon Peachy 	u8 pad[58];
8245b9f240eSSergio Paracuellos } __packed;
82500b3ed16SGreg Kroah-Hartman 
826f0e15d40SSergio Paracuellos struct hfa384x_usb_wmemreq {
827a18ffdf4SAdrien Descamps 	__le16 type;
828a18ffdf4SAdrien Descamps 	__le16 frmlen;
829a18ffdf4SAdrien Descamps 	__le16 offset;
830a18ffdf4SAdrien Descamps 	__le16 page;
831aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
832f0e15d40SSergio Paracuellos } __packed;
83300b3ed16SGreg Kroah-Hartman 
83494ec5464SSergio Paracuellos struct hfa384x_usb_rmemreq {
835a18ffdf4SAdrien Descamps 	__le16 type;
836a18ffdf4SAdrien Descamps 	__le16 frmlen;
837a18ffdf4SAdrien Descamps 	__le16 offset;
838a18ffdf4SAdrien Descamps 	__le16 page;
839aaad4303SSolomon Peachy 	u8 pad[56];
84094ec5464SSergio Paracuellos } __packed;
84100b3ed16SGreg Kroah-Hartman 
84200b3ed16SGreg Kroah-Hartman /*------------------------------------*/
84300b3ed16SGreg Kroah-Hartman /* Response (bulk IN) packet contents */
84400b3ed16SGreg Kroah-Hartman 
845684b2e08SSergio Paracuellos struct hfa384x_usb_rxfrm {
84670adf509SSergio Paracuellos 	struct hfa384x_rx_frame desc;
847aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
848684b2e08SSergio Paracuellos } __packed;
84900b3ed16SGreg Kroah-Hartman 
850e20a7ca1SSergio Paracuellos struct hfa384x_usb_infofrm {
851aaad4303SSolomon Peachy 	u16 type;
85260f5f3fbSJuliana Rodrigues 	struct hfa384x_inf_frame info;
853e20a7ca1SSergio Paracuellos } __packed;
85400b3ed16SGreg Kroah-Hartman 
855385a79dfSSergio Paracuellos struct hfa384x_usb_statusresp {
856aaad4303SSolomon Peachy 	u16 type;
857a18ffdf4SAdrien Descamps 	__le16 status;
858a18ffdf4SAdrien Descamps 	__le16 resp0;
859a18ffdf4SAdrien Descamps 	__le16 resp1;
860a18ffdf4SAdrien Descamps 	__le16 resp2;
861385a79dfSSergio Paracuellos } __packed;
86200b3ed16SGreg Kroah-Hartman 
863a988c9f3SSergio Paracuellos struct hfa384x_usb_rridresp {
864aaad4303SSolomon Peachy 	u16 type;
865a18ffdf4SAdrien Descamps 	__le16 frmlen;
866a18ffdf4SAdrien Descamps 	__le16 rid;
867aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
868a988c9f3SSergio Paracuellos } __packed;
86900b3ed16SGreg Kroah-Hartman 
8701ed54806SSergio Paracuellos struct hfa384x_usb_rmemresp {
871aaad4303SSolomon Peachy 	u16 type;
872aaad4303SSolomon Peachy 	u16 frmlen;
873aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
8741ed54806SSergio Paracuellos } __packed;
87500b3ed16SGreg Kroah-Hartman 
876c4d8a0a8SSergio Paracuellos struct hfa384x_usb_bufavail {
877aaad4303SSolomon Peachy 	u16 type;
878aaad4303SSolomon Peachy 	u16 frmlen;
879c4d8a0a8SSergio Paracuellos } __packed;
88000b3ed16SGreg Kroah-Hartman 
881d4734c30SSergio Paracuellos struct hfa384x_usb_error {
882aaad4303SSolomon Peachy 	u16 type;
883aaad4303SSolomon Peachy 	u16 errortype;
884d4734c30SSergio Paracuellos } __packed;
88500b3ed16SGreg Kroah-Hartman 
88600b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------*/
88700b3ed16SGreg Kroah-Hartman /* Unions for packaging all the known packet types together */
88800b3ed16SGreg Kroah-Hartman 
8894012684aSSergio Paracuellos union hfa384x_usbout {
890a78d1312SAsaf Vertz 	__le16 type;
8912f1014f7SSergio Paracuellos 	struct hfa384x_usb_txfrm txfrm;
892a6dcbdfeSSergio Paracuellos 	struct hfa384x_usb_cmdreq cmdreq;
8933bc070f6SSergio Paracuellos 	struct hfa384x_usb_wridreq wridreq;
8945b9f240eSSergio Paracuellos 	struct hfa384x_usb_rridreq rridreq;
895f0e15d40SSergio Paracuellos 	struct hfa384x_usb_wmemreq wmemreq;
89694ec5464SSergio Paracuellos 	struct hfa384x_usb_rmemreq rmemreq;
8974012684aSSergio Paracuellos } __packed;
89800b3ed16SGreg Kroah-Hartman 
8993e4180c3SSergio Paracuellos union hfa384x_usbin {
900a78d1312SAsaf Vertz 	__le16 type;
901684b2e08SSergio Paracuellos 	struct hfa384x_usb_rxfrm rxfrm;
9022f1014f7SSergio Paracuellos 	struct hfa384x_usb_txfrm txfrm;
903e20a7ca1SSergio Paracuellos 	struct hfa384x_usb_infofrm infofrm;
904385a79dfSSergio Paracuellos 	struct hfa384x_usb_statusresp cmdresp;
9052c8079deSSergio Paracuellos 	struct hfa384x_usb_statusresp wridresp;
906a988c9f3SSergio Paracuellos 	struct hfa384x_usb_rridresp rridresp;
907499c1cc9SSergio Paracuellos 	struct hfa384x_usb_statusresp wmemresp;
9081ed54806SSergio Paracuellos 	struct hfa384x_usb_rmemresp rmemresp;
909c4d8a0a8SSergio Paracuellos 	struct hfa384x_usb_bufavail bufavail;
910d4734c30SSergio Paracuellos 	struct hfa384x_usb_error usberror;
911aaad4303SSolomon Peachy 	u8 boguspad[3000];
9123e4180c3SSergio Paracuellos } __packed;
91300b3ed16SGreg Kroah-Hartman 
91476e3e7c4SKarl Relton /*--------------------------------------------------------------------
9153e27dfa2SSergio Paracuellos  * PD record structures.
9163e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
9173e27dfa2SSergio Paracuellos  */
91876e3e7c4SKarl Relton 
919e0696aa8SSergio Paracuellos struct hfa384x_pdr_pcb_partnum {
92076e3e7c4SKarl Relton 	u8 num[8];
921e0696aa8SSergio Paracuellos } __packed;
92276e3e7c4SKarl Relton 
923caeabb80SSergio Paracuellos struct hfa384x_pdr_pcb_tracenum {
92476e3e7c4SKarl Relton 	u8 num[8];
925caeabb80SSergio Paracuellos } __packed;
92676e3e7c4SKarl Relton 
92766e7bdb6SSergio Paracuellos struct hfa384x_pdr_nic_serial {
92876e3e7c4SKarl Relton 	u8 num[12];
92966e7bdb6SSergio Paracuellos } __packed;
93076e3e7c4SKarl Relton 
931ee9f7626SSergio Paracuellos struct hfa384x_pdr_mkk_measurements {
93276e3e7c4SKarl Relton 	double carrier_freq;
93376e3e7c4SKarl Relton 	double occupied_band;
93476e3e7c4SKarl Relton 	double power_density;
93576e3e7c4SKarl Relton 	double tx_spur_f1;
93676e3e7c4SKarl Relton 	double tx_spur_f2;
93776e3e7c4SKarl Relton 	double tx_spur_f3;
93876e3e7c4SKarl Relton 	double tx_spur_f4;
93976e3e7c4SKarl Relton 	double tx_spur_l1;
94076e3e7c4SKarl Relton 	double tx_spur_l2;
94176e3e7c4SKarl Relton 	double tx_spur_l3;
94276e3e7c4SKarl Relton 	double tx_spur_l4;
94376e3e7c4SKarl Relton 	double rx_spur_f1;
94476e3e7c4SKarl Relton 	double rx_spur_f2;
94576e3e7c4SKarl Relton 	double rx_spur_l1;
94676e3e7c4SKarl Relton 	double rx_spur_l2;
947ee9f7626SSergio Paracuellos } __packed;
94876e3e7c4SKarl Relton 
94902eebae4SSergio Paracuellos struct hfa384x_pdr_nic_ramsize {
95076e3e7c4SKarl Relton 	u8 size[12];		/* units of KB */
95102eebae4SSergio Paracuellos } __packed;
95276e3e7c4SKarl Relton 
9539127692fSSergio Paracuellos struct hfa384x_pdr_mfisuprange {
95476e3e7c4SKarl Relton 	u16 id;
95576e3e7c4SKarl Relton 	u16 variant;
95676e3e7c4SKarl Relton 	u16 bottom;
95776e3e7c4SKarl Relton 	u16 top;
9589127692fSSergio Paracuellos } __packed;
95976e3e7c4SKarl Relton 
9604ae2996fSSergio Paracuellos struct hfa384x_pdr_cfisuprange {
96176e3e7c4SKarl Relton 	u16 id;
96276e3e7c4SKarl Relton 	u16 variant;
96376e3e7c4SKarl Relton 	u16 bottom;
96476e3e7c4SKarl Relton 	u16 top;
9654ae2996fSSergio Paracuellos } __packed;
96676e3e7c4SKarl Relton 
967e9ee92c7SSergio Paracuellos struct hfa384x_pdr_nicid {
96876e3e7c4SKarl Relton 	u16 id;
96976e3e7c4SKarl Relton 	u16 variant;
97076e3e7c4SKarl Relton 	u16 major;
97176e3e7c4SKarl Relton 	u16 minor;
972e9ee92c7SSergio Paracuellos } __packed;
97376e3e7c4SKarl Relton 
9741c0c8ebaSSergio Paracuellos struct hfa384x_pdr_refdac_measurements {
97576e3e7c4SKarl Relton 	u16 value[0];
9761c0c8ebaSSergio Paracuellos } __packed;
97776e3e7c4SKarl Relton 
978de95929cSSergio Paracuellos struct hfa384x_pdr_vgdac_measurements {
97976e3e7c4SKarl Relton 	u16 value[0];
980de95929cSSergio Paracuellos } __packed;
98176e3e7c4SKarl Relton 
982dac1445dSSergio Paracuellos struct hfa384x_pdr_level_comp_measurements {
98376e3e7c4SKarl Relton 	u16 value[0];
984dac1445dSSergio Paracuellos } __packed;
98576e3e7c4SKarl Relton 
98629f1e44eSSergio Paracuellos struct hfa384x_pdr_mac_address {
98776e3e7c4SKarl Relton 	u8 addr[6];
98829f1e44eSSergio Paracuellos } __packed;
98976e3e7c4SKarl Relton 
990f9699553SSergio Paracuellos struct hfa384x_pdr_mkk_callname {
99176e3e7c4SKarl Relton 	u8 callname[8];
992f9699553SSergio Paracuellos } __packed;
99376e3e7c4SKarl Relton 
9940970a33dSSergio Paracuellos struct hfa384x_pdr_regdomain {
99576e3e7c4SKarl Relton 	u16 numdomains;
99676e3e7c4SKarl Relton 	u16 domain[5];
9970970a33dSSergio Paracuellos } __packed;
99876e3e7c4SKarl Relton 
999e0322d1bSSergio Paracuellos struct hfa384x_pdr_allowed_channel {
100076e3e7c4SKarl Relton 	u16 ch_bitmap;
1001e0322d1bSSergio Paracuellos } __packed;
100276e3e7c4SKarl Relton 
1003892b51ecSSergio Paracuellos struct hfa384x_pdr_default_channel {
100476e3e7c4SKarl Relton 	u16 channel;
1005892b51ecSSergio Paracuellos } __packed;
100676e3e7c4SKarl Relton 
10072c1759beSSergio Paracuellos struct hfa384x_pdr_privacy_option {
100876e3e7c4SKarl Relton 	u16 available;
10092c1759beSSergio Paracuellos } __packed;
101076e3e7c4SKarl Relton 
10110c350461SSergio Paracuellos struct hfa384x_pdr_temptype {
101276e3e7c4SKarl Relton 	u16 type;
10130c350461SSergio Paracuellos } __packed;
101476e3e7c4SKarl Relton 
10153c92d65dSSergio Paracuellos struct hfa384x_pdr_refdac_setup {
101676e3e7c4SKarl Relton 	u16 ch_value[14];
10173c92d65dSSergio Paracuellos } __packed;
101876e3e7c4SKarl Relton 
1019dce6c283SSergio Paracuellos struct hfa384x_pdr_vgdac_setup {
102076e3e7c4SKarl Relton 	u16 ch_value[14];
1021dce6c283SSergio Paracuellos } __packed;
102276e3e7c4SKarl Relton 
102329aef6bbSSergio Paracuellos struct hfa384x_pdr_level_comp_setup {
102476e3e7c4SKarl Relton 	u16 ch_value[14];
102529aef6bbSSergio Paracuellos } __packed;
102676e3e7c4SKarl Relton 
1027a98f8609SSergio Paracuellos struct hfa384x_pdr_trimdac_setup {
102876e3e7c4SKarl Relton 	u16 trimidac;
102976e3e7c4SKarl Relton 	u16 trimqdac;
1030a98f8609SSergio Paracuellos } __packed;
103176e3e7c4SKarl Relton 
10323d235885SSergio Paracuellos struct hfa384x_pdr_ifr_setting {
103376e3e7c4SKarl Relton 	u16 value[3];
10343d235885SSergio Paracuellos } __packed;
103576e3e7c4SKarl Relton 
1036da79fe4aSSergio Paracuellos struct hfa384x_pdr_rfr_setting {
103776e3e7c4SKarl Relton 	u16 value[3];
1038da79fe4aSSergio Paracuellos } __packed;
103976e3e7c4SKarl Relton 
1040b4547dc5SSergio Paracuellos struct hfa384x_pdr_hfa3861_baseline {
104176e3e7c4SKarl Relton 	u16 value[50];
1042b4547dc5SSergio Paracuellos } __packed;
104376e3e7c4SKarl Relton 
10440dbc2e46SSergio Paracuellos struct hfa384x_pdr_hfa3861_shadow {
104576e3e7c4SKarl Relton 	u32 value[32];
10460dbc2e46SSergio Paracuellos } __packed;
104776e3e7c4SKarl Relton 
10481755c01bSSergio Paracuellos struct hfa384x_pdr_hfa3861_ifrf {
104976e3e7c4SKarl Relton 	u32 value[20];
10501755c01bSSergio Paracuellos } __packed;
105176e3e7c4SKarl Relton 
1052788c9732SSergio Paracuellos struct hfa384x_pdr_hfa3861_chcalsp {
105376e3e7c4SKarl Relton 	u16 value[14];
1054788c9732SSergio Paracuellos } __packed;
105576e3e7c4SKarl Relton 
1056b94425ffSSergio Paracuellos struct hfa384x_pdr_hfa3861_chcali {
105776e3e7c4SKarl Relton 	u16 value[17];
1058b94425ffSSergio Paracuellos } __packed;
105976e3e7c4SKarl Relton 
1060bd84b588SSergio Paracuellos struct hfa384x_pdr_hfa3861_nic_config {
106176e3e7c4SKarl Relton 	u16 config_bitmap;
1062bd84b588SSergio Paracuellos } __packed;
106376e3e7c4SKarl Relton 
10649408a44cSSergio Paracuellos struct hfa384x_pdr_hfo_delay {
106576e3e7c4SKarl Relton 	u8 hfo_delay;
10669408a44cSSergio Paracuellos } __packed;
106776e3e7c4SKarl Relton 
10680960d2e1SSergio Paracuellos struct hfa384x_pdr_hfa3861_manf_testsp {
106976e3e7c4SKarl Relton 	u16 value[30];
10700960d2e1SSergio Paracuellos } __packed;
107176e3e7c4SKarl Relton 
10725a4a5823SSergio Paracuellos struct hfa384x_pdr_hfa3861_manf_testi {
107376e3e7c4SKarl Relton 	u16 value[30];
10745a4a5823SSergio Paracuellos } __packed;
107576e3e7c4SKarl Relton 
1076b26ce5f6SSergio Paracuellos struct hfa384x_pdr_end_of_pda {
107776e3e7c4SKarl Relton 	u16 crc;
1078b26ce5f6SSergio Paracuellos } __packed;
107976e3e7c4SKarl Relton 
10804f026e89SSergio Paracuellos struct hfa384x_pdrec {
108176e3e7c4SKarl Relton 	u16 len;		/* in words */
108276e3e7c4SKarl Relton 	u16 code;
108376e3e7c4SKarl Relton 	union pdr {
1084e0696aa8SSergio Paracuellos 		struct hfa384x_pdr_pcb_partnum pcb_partnum;
1085caeabb80SSergio Paracuellos 		struct hfa384x_pdr_pcb_tracenum pcb_tracenum;
108666e7bdb6SSergio Paracuellos 		struct hfa384x_pdr_nic_serial nic_serial;
1087ee9f7626SSergio Paracuellos 		struct hfa384x_pdr_mkk_measurements mkk_measurements;
108802eebae4SSergio Paracuellos 		struct hfa384x_pdr_nic_ramsize nic_ramsize;
10899127692fSSergio Paracuellos 		struct hfa384x_pdr_mfisuprange mfisuprange;
10904ae2996fSSergio Paracuellos 		struct hfa384x_pdr_cfisuprange cfisuprange;
1091e9ee92c7SSergio Paracuellos 		struct hfa384x_pdr_nicid nicid;
10921c0c8ebaSSergio Paracuellos 		struct hfa384x_pdr_refdac_measurements refdac_measurements;
1093de95929cSSergio Paracuellos 		struct hfa384x_pdr_vgdac_measurements vgdac_measurements;
1094dac1445dSSergio Paracuellos 		struct hfa384x_pdr_level_comp_measurements level_compc_measurements;
109529f1e44eSSergio Paracuellos 		struct hfa384x_pdr_mac_address mac_address;
1096f9699553SSergio Paracuellos 		struct hfa384x_pdr_mkk_callname mkk_callname;
10970970a33dSSergio Paracuellos 		struct hfa384x_pdr_regdomain regdomain;
1098e0322d1bSSergio Paracuellos 		struct hfa384x_pdr_allowed_channel allowed_channel;
1099892b51ecSSergio Paracuellos 		struct hfa384x_pdr_default_channel default_channel;
11002c1759beSSergio Paracuellos 		struct hfa384x_pdr_privacy_option privacy_option;
11010c350461SSergio Paracuellos 		struct hfa384x_pdr_temptype temptype;
11023c92d65dSSergio Paracuellos 		struct hfa384x_pdr_refdac_setup refdac_setup;
1103dce6c283SSergio Paracuellos 		struct hfa384x_pdr_vgdac_setup vgdac_setup;
110429aef6bbSSergio Paracuellos 		struct hfa384x_pdr_level_comp_setup level_comp_setup;
1105a98f8609SSergio Paracuellos 		struct hfa384x_pdr_trimdac_setup trimdac_setup;
11063d235885SSergio Paracuellos 		struct hfa384x_pdr_ifr_setting ifr_setting;
1107da79fe4aSSergio Paracuellos 		struct hfa384x_pdr_rfr_setting rfr_setting;
1108b4547dc5SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_baseline hfa3861_baseline;
11090dbc2e46SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_shadow hfa3861_shadow;
11101755c01bSSergio Paracuellos 		struct hfa384x_pdr_hfa3861_ifrf hfa3861_ifrf;
1111788c9732SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_chcalsp hfa3861_chcalsp;
1112b94425ffSSergio Paracuellos 		struct hfa384x_pdr_hfa3861_chcali hfa3861_chcali;
1113bd84b588SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_nic_config nic_config;
11149408a44cSSergio Paracuellos 		struct hfa384x_pdr_hfo_delay hfo_delay;
11150960d2e1SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_manf_testsp hfa3861_manf_testsp;
11165a4a5823SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_manf_testi hfa3861_manf_testi;
1117b26ce5f6SSergio Paracuellos 		struct hfa384x_pdr_end_of_pda end_of_pda;
111876e3e7c4SKarl Relton 
111976e3e7c4SKarl Relton 	} data;
11204f026e89SSergio Paracuellos } __packed;
112176e3e7c4SKarl Relton 
112200b3ed16SGreg Kroah-Hartman #ifdef __KERNEL__
112300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
11243e27dfa2SSergio Paracuellos  * ---  MAC state structure, argument to all functions --
11253e27dfa2SSergio Paracuellos  * ---  Also, a collection of support types --
11263e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
11273e27dfa2SSergio Paracuellos  */
1128501f5f96SSergio Paracuellos struct hfa384x_cmdresult {
1129aaad4303SSolomon Peachy 	u16 status;
1130aaad4303SSolomon Peachy 	u16 resp0;
1131aaad4303SSolomon Peachy 	u16 resp1;
1132aaad4303SSolomon Peachy 	u16 resp2;
1133501f5f96SSergio Paracuellos };
113400b3ed16SGreg Kroah-Hartman 
113500b3ed16SGreg Kroah-Hartman /* USB Control Exchange (CTLX):
113600b3ed16SGreg Kroah-Hartman  *  A queue of the structure below is maintained for all of the
113700b3ed16SGreg Kroah-Hartman  *  Request/Response type USB packets supported by Prism2.
113800b3ed16SGreg Kroah-Hartman  */
113900b3ed16SGreg Kroah-Hartman /* The following hfa384x_* structures are arguments to
114000b3ed16SGreg Kroah-Hartman  * the usercb() for the different CTLX types.
114100b3ed16SGreg Kroah-Hartman  */
1142b3fd890eSSergio Paracuellos struct hfa384x_rridresult {
1143aaad4303SSolomon Peachy 	u16 rid;
114400b3ed16SGreg Kroah-Hartman 	const void *riddata;
1145aaad4303SSolomon Peachy 	unsigned int riddata_len;
1146b3fd890eSSergio Paracuellos };
114700b3ed16SGreg Kroah-Hartman 
114800b3ed16SGreg Kroah-Hartman enum ctlx_state {
114900b3ed16SGreg Kroah-Hartman 	CTLX_START = 0,		/* Start state, not queued */
115000b3ed16SGreg Kroah-Hartman 
115100b3ed16SGreg Kroah-Hartman 	CTLX_COMPLETE,		/* CTLX successfully completed */
115200b3ed16SGreg Kroah-Hartman 	CTLX_REQ_FAILED,	/* OUT URB completed w/ error */
115300b3ed16SGreg Kroah-Hartman 
115400b3ed16SGreg Kroah-Hartman 	CTLX_PENDING,		/* Queued, data valid */
115500b3ed16SGreg Kroah-Hartman 	CTLX_REQ_SUBMITTED,	/* OUT URB submitted */
115600b3ed16SGreg Kroah-Hartman 	CTLX_REQ_COMPLETE,	/* OUT URB complete */
115700b3ed16SGreg Kroah-Hartman 	CTLX_RESP_COMPLETE	/* IN URB received */
115800b3ed16SGreg Kroah-Hartman };
115900b3ed16SGreg Kroah-Hartman 
116000b3ed16SGreg Kroah-Hartman struct hfa384x_usbctlx;
116100b3ed16SGreg Kroah-Hartman struct hfa384x;
116200b3ed16SGreg Kroah-Hartman 
116300b3ed16SGreg Kroah-Hartman typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);
116400b3ed16SGreg Kroah-Hartman 
1165e573aaa4SMoritz Muehlenhoff typedef void (*ctlx_usercb_t) (struct hfa384x *hw,
1166e573aaa4SMoritz Muehlenhoff 			       void *ctlxresult, void *usercb_data);
116700b3ed16SGreg Kroah-Hartman 
1168a10d36b0SSergio Paracuellos struct hfa384x_usbctlx {
116900b3ed16SGreg Kroah-Hartman 	struct list_head list;
117000b3ed16SGreg Kroah-Hartman 
117100b3ed16SGreg Kroah-Hartman 	size_t outbufsize;
11724012684aSSergio Paracuellos 	union hfa384x_usbout outbuf;	/* pkt buf for OUT */
11733e4180c3SSergio Paracuellos 	union hfa384x_usbin inbuf;	/* pkt buf for IN(a copy) */
117400b3ed16SGreg Kroah-Hartman 
1175173bf7e3SSergio Paracuellos 	enum ctlx_state state;	/* Tracks running state */
117600b3ed16SGreg Kroah-Hartman 
117700b3ed16SGreg Kroah-Hartman 	struct completion done;
117800b3ed16SGreg Kroah-Hartman 	volatile int reapable;	/* Food for the reaper task */
117900b3ed16SGreg Kroah-Hartman 
118000b3ed16SGreg Kroah-Hartman 	ctlx_cmdcb_t cmdcb;	/* Async command callback */
118100b3ed16SGreg Kroah-Hartman 	ctlx_usercb_t usercb;	/* Async user callback, */
118200b3ed16SGreg Kroah-Hartman 	void *usercb_data;	/*  at CTLX completion  */
118300b3ed16SGreg Kroah-Hartman 
118400b3ed16SGreg Kroah-Hartman 	int variant;		/* Identifies cmd variant */
1185a10d36b0SSergio Paracuellos };
118600b3ed16SGreg Kroah-Hartman 
11873df38936SSergio Paracuellos struct hfa384x_usbctlxq {
118800b3ed16SGreg Kroah-Hartman 	spinlock_t lock;
118900b3ed16SGreg Kroah-Hartman 	struct list_head pending;
119000b3ed16SGreg Kroah-Hartman 	struct list_head active;
119100b3ed16SGreg Kroah-Hartman 	struct list_head completing;
119200b3ed16SGreg Kroah-Hartman 	struct list_head reapable;
11933df38936SSergio Paracuellos };
119400b3ed16SGreg Kroah-Hartman 
1195e2f503c4SSergio Paracuellos struct hfa384x_metacmd {
1196aaad4303SSolomon Peachy 	u16 cmd;
119700b3ed16SGreg Kroah-Hartman 
1198aaad4303SSolomon Peachy 	u16 parm0;
1199aaad4303SSolomon Peachy 	u16 parm1;
1200aaad4303SSolomon Peachy 	u16 parm2;
120100b3ed16SGreg Kroah-Hartman 
1202501f5f96SSergio Paracuellos 	struct hfa384x_cmdresult result;
1203e2f503c4SSergio Paracuellos };
120400b3ed16SGreg Kroah-Hartman 
120500b3ed16SGreg Kroah-Hartman #define	MAX_GRP_ADDR		32
120600b3ed16SGreg Kroah-Hartman #define WLAN_COMMENT_MAX	80  /* Max. length of user comment string. */
120700b3ed16SGreg Kroah-Hartman 
120800b3ed16SGreg Kroah-Hartman #define WLAN_AUTH_MAX           60  /* Max. # of authenticated stations. */
120900b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_MAX		60  /* Max. # of stations in an access list. */
121000b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_NONE	0   /* No stations may be authenticated. */
121100b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALL		1   /* All stations may be authenticated. */
121200b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALLOW	2   /* Authenticate only "allowed" stations. */
121300b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_DENY	3   /* Do not authenticate "denied" stations. */
121400b3ed16SGreg Kroah-Hartman 
121500b3ed16SGreg Kroah-Hartman /* XXX These are going away ASAP */
1216c84b528cSVatika Harlalka struct prism2sta_authlist {
1217aaad4303SSolomon Peachy 	unsigned int cnt;
121828b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_AUTH_MAX][ETH_ALEN];
1219aaad4303SSolomon Peachy 	u8 assoc[WLAN_AUTH_MAX];
1220c84b528cSVatika Harlalka };
122100b3ed16SGreg Kroah-Hartman 
12224d10ece3SVatika Harlalka struct prism2sta_accesslist {
1223aaad4303SSolomon Peachy 	unsigned int modify;
1224aaad4303SSolomon Peachy 	unsigned int cnt;
122528b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_ACCESS_MAX][ETH_ALEN];
1226aaad4303SSolomon Peachy 	unsigned int cnt1;
122728b17a4bSMoritz Muehlenhoff 	u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN];
12284d10ece3SVatika Harlalka };
122900b3ed16SGreg Kroah-Hartman 
12305a2214e2SSergio Paracuellos struct hfa384x {
123100b3ed16SGreg Kroah-Hartman 	/* USB support data */
123200b3ed16SGreg Kroah-Hartman 	struct usb_device *usb;
123300b3ed16SGreg Kroah-Hartman 	struct urb rx_urb;
123400b3ed16SGreg Kroah-Hartman 	struct sk_buff *rx_urb_skb;
123500b3ed16SGreg Kroah-Hartman 	struct urb tx_urb;
123600b3ed16SGreg Kroah-Hartman 	struct urb ctlx_urb;
12374012684aSSergio Paracuellos 	union hfa384x_usbout txbuff;
12383df38936SSergio Paracuellos 	struct hfa384x_usbctlxq ctlxq;
123900b3ed16SGreg Kroah-Hartman 	struct timer_list reqtimer;
124000b3ed16SGreg Kroah-Hartman 	struct timer_list resptimer;
124100b3ed16SGreg Kroah-Hartman 
124200b3ed16SGreg Kroah-Hartman 	struct timer_list throttle;
124300b3ed16SGreg Kroah-Hartman 
124400b3ed16SGreg Kroah-Hartman 	struct tasklet_struct reaper_bh;
124500b3ed16SGreg Kroah-Hartman 	struct tasklet_struct completion_bh;
124600b3ed16SGreg Kroah-Hartman 
124700b3ed16SGreg Kroah-Hartman 	struct work_struct usb_work;
124800b3ed16SGreg Kroah-Hartman 
124900b3ed16SGreg Kroah-Hartman 	unsigned long usb_flags;
125000b3ed16SGreg Kroah-Hartman #define THROTTLE_RX	0
125100b3ed16SGreg Kroah-Hartman #define THROTTLE_TX	1
125200b3ed16SGreg Kroah-Hartman #define WORK_RX_HALT	2
125300b3ed16SGreg Kroah-Hartman #define WORK_TX_HALT	3
125400b3ed16SGreg Kroah-Hartman #define WORK_RX_RESUME	4
125500b3ed16SGreg Kroah-Hartman #define WORK_TX_RESUME	5
125600b3ed16SGreg Kroah-Hartman 
125700b3ed16SGreg Kroah-Hartman 	unsigned short req_timer_done:1;
125800b3ed16SGreg Kroah-Hartman 	unsigned short resp_timer_done:1;
125900b3ed16SGreg Kroah-Hartman 
126000b3ed16SGreg Kroah-Hartman 	int endp_in;
126100b3ed16SGreg Kroah-Hartman 	int endp_out;
126200b3ed16SGreg Kroah-Hartman 
126300b3ed16SGreg Kroah-Hartman 	int sniff_fcs;
126400b3ed16SGreg Kroah-Hartman 	int sniff_channel;
126500b3ed16SGreg Kroah-Hartman 	int sniff_truncate;
126600b3ed16SGreg Kroah-Hartman 	int sniffhdr;
126700b3ed16SGreg Kroah-Hartman 
126800b3ed16SGreg Kroah-Hartman 	wait_queue_head_t cmdq;	/* wait queue itself */
126900b3ed16SGreg Kroah-Hartman 
127000b3ed16SGreg Kroah-Hartman 	/* Controller state */
1271aaad4303SSolomon Peachy 	u32 state;
1272aaad4303SSolomon Peachy 	u32 isap;
1273aaad4303SSolomon Peachy 	u8 port_enabled[HFA384x_NUMPORTS_MAX];
127400b3ed16SGreg Kroah-Hartman 
127500b3ed16SGreg Kroah-Hartman 	/* Download support */
1276aaad4303SSolomon Peachy 	unsigned int dlstate;
1277b71db740SSergio Paracuellos 	struct hfa384x_downloadbuffer bufinfo;
1278aaad4303SSolomon Peachy 	u16 dltimeout;
127900b3ed16SGreg Kroah-Hartman 
12801a6dfce7SMasanari Iida 	int scanflag;		/* to signal scan complete */
128100b3ed16SGreg Kroah-Hartman 	int join_ap;		/* are we joined to a specific ap */
128200b3ed16SGreg Kroah-Hartman 	int join_retries;	/* number of join retries till we fail */
1283de3dc47cSJuliana Rodrigues 	struct hfa384x_join_request_data joinreq;/* join request saved data */
128400b3ed16SGreg Kroah-Hartman 
1285c9573a8dSsayli karnik 	struct wlandevice *wlandev;
128600b3ed16SGreg Kroah-Hartman 	/* Timer to allow for the deferred processing of linkstatus messages */
128700b3ed16SGreg Kroah-Hartman 	struct work_struct link_bh;
128800b3ed16SGreg Kroah-Hartman 
128900b3ed16SGreg Kroah-Hartman 	struct work_struct commsqual_bh;
1290a1e95045SSergio Paracuellos 	struct hfa384x_commsquality qual;
129100b3ed16SGreg Kroah-Hartman 	struct timer_list commsqual_timer;
129200b3ed16SGreg Kroah-Hartman 
1293aaad4303SSolomon Peachy 	u16 link_status;
1294aaad4303SSolomon Peachy 	u16 link_status_new;
129500b3ed16SGreg Kroah-Hartman 	struct sk_buff_head authq;
129600b3ed16SGreg Kroah-Hartman 
1297cb3126e6SKarl Relton 	u32 txrate;
1298cb3126e6SKarl Relton 
129900b3ed16SGreg Kroah-Hartman 	/* And here we have stuff that used to be in priv */
130000b3ed16SGreg Kroah-Hartman 
130100b3ed16SGreg Kroah-Hartman 	/* State variables */
1302aaad4303SSolomon Peachy 	unsigned int presniff_port_type;
1303aaad4303SSolomon Peachy 	u16 presniff_wepflags;
1304aaad4303SSolomon Peachy 	u32 dot11_desired_bss_type;
130500b3ed16SGreg Kroah-Hartman 
130600b3ed16SGreg Kroah-Hartman 	int dbmadjust;
130700b3ed16SGreg Kroah-Hartman 
130800b3ed16SGreg Kroah-Hartman 	/* Group Addresses - right now, there are up to a total
13095f0730fdSJuliana Rodrigues 	 * of MAX_GRP_ADDR group addresses
13105f0730fdSJuliana Rodrigues 	 */
131128b17a4bSMoritz Muehlenhoff 	u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN];
1312aaad4303SSolomon Peachy 	unsigned int dot11_grpcnt;
131300b3ed16SGreg Kroah-Hartman 
131400b3ed16SGreg Kroah-Hartman 	/* Component Identities */
13155f046456SSergio Paracuellos 	struct hfa384x_compident ident_nic;
13165f046456SSergio Paracuellos 	struct hfa384x_compident ident_pri_fw;
13175f046456SSergio Paracuellos 	struct hfa384x_compident ident_sta_fw;
13185f046456SSergio Paracuellos 	struct hfa384x_compident ident_ap_fw;
1319aaad4303SSolomon Peachy 	u16 mm_mods;
132000b3ed16SGreg Kroah-Hartman 
132100b3ed16SGreg Kroah-Hartman 	/* Supplier compatibility ranges */
132265f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_mfi;
132365f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_cfi;
132465f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_pri;
132565f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_sta;
132665f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_ap;
132700b3ed16SGreg Kroah-Hartman 
132800b3ed16SGreg Kroah-Hartman 	/* Actor compatibility ranges */
132965f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_pri_cfi; /*
133071508ee4SAlessandro Ghedini 						  * pri f/w to controller
133171508ee4SAlessandro Ghedini 						  * interface
133271508ee4SAlessandro Ghedini 						  */
133371508ee4SAlessandro Ghedini 
133465f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_sta_cfi; /*
133571508ee4SAlessandro Ghedini 						  * sta f/w to controller
133671508ee4SAlessandro Ghedini 						  * interface
133771508ee4SAlessandro Ghedini 						  */
133871508ee4SAlessandro Ghedini 
133965f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_sta_mfi; /* sta f/w to modem interface */
134071508ee4SAlessandro Ghedini 
134165f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_ap_cfi;	/*
134271508ee4SAlessandro Ghedini 						 * ap f/w to controller
134371508ee4SAlessandro Ghedini 						 * interface
134471508ee4SAlessandro Ghedini 						 */
134571508ee4SAlessandro Ghedini 
134665f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_ap_mfi;	/* ap f/w to modem interface */
134700b3ed16SGreg Kroah-Hartman 
1348aaad4303SSolomon Peachy 	u32 psusercount;	/* Power save user count. */
1349b244edc6SJuliana Rodrigues 	struct hfa384x_comm_tallies_32 tallies;	/* Communication tallies. */
1350aaad4303SSolomon Peachy 	u8 comment[WLAN_COMMENT_MAX + 1];	/* User comment */
135100b3ed16SGreg Kroah-Hartman 
135200b3ed16SGreg Kroah-Hartman 	/* Channel Info request results (AP only) */
135300b3ed16SGreg Kroah-Hartman 	struct {
135400b3ed16SGreg Kroah-Hartman 		atomic_t done;
1355aaad4303SSolomon Peachy 		u8 count;
1356c447358aSSergio Paracuellos 		struct hfa384x_ch_info_result results;
135700b3ed16SGreg Kroah-Hartman 	} channel_info;
135800b3ed16SGreg Kroah-Hartman 
135960f5f3fbSJuliana Rodrigues 	struct hfa384x_inf_frame *scanresults;
136000b3ed16SGreg Kroah-Hartman 
1361c84b528cSVatika Harlalka 	struct prism2sta_authlist authlist;	/* Authenticated station list. */
1362aaad4303SSolomon Peachy 	unsigned int accessmode;		/* Access mode. */
13634d10ece3SVatika Harlalka 	struct prism2sta_accesslist allow;	/* Allowed station list. */
13644d10ece3SVatika Harlalka 	struct prism2sta_accesslist deny;	/* Denied station list. */
136500b3ed16SGreg Kroah-Hartman 
13665a2214e2SSergio Paracuellos };
136700b3ed16SGreg Kroah-Hartman 
13685a2214e2SSergio Paracuellos void hfa384x_create(struct hfa384x *hw, struct usb_device *usb);
13695a2214e2SSergio Paracuellos void hfa384x_destroy(struct hfa384x *hw);
137000b3ed16SGreg Kroah-Hartman 
137100b3ed16SGreg Kroah-Hartman int
13725a2214e2SSergio Paracuellos hfa384x_corereset(struct hfa384x *hw, int holdtime, int settletime, int genesis);
13735a2214e2SSergio Paracuellos int hfa384x_drvr_disable(struct hfa384x *hw, u16 macport);
13745a2214e2SSergio Paracuellos int hfa384x_drvr_enable(struct hfa384x *hw, u16 macport);
13755a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_enable(struct hfa384x *hw);
13765a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_disable(struct hfa384x *hw);
13775a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
13785a2214e2SSergio Paracuellos int hfa384x_drvr_getconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
13795a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_enable(struct hfa384x *hw, u32 exeaddr);
13805a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_disable(struct hfa384x *hw);
13815a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
13825a2214e2SSergio Paracuellos int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len);
13835a2214e2SSergio Paracuellos int hfa384x_drvr_setconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
138400b3ed16SGreg Kroah-Hartman 
13855a2214e2SSergio Paracuellos static inline int hfa384x_drvr_getconfig16(struct hfa384x *hw, u16 rid, void *val)
138600b3ed16SGreg Kroah-Hartman {
138700b3ed16SGreg Kroah-Hartman 	int result = 0;
13887489df36SVeronika Kabatova 
1389aaad4303SSolomon Peachy 	result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
1390e573aaa4SMoritz Muehlenhoff 	if (result == 0)
1391e996024fSEric Salem 		le16_to_cpus(val);
139200b3ed16SGreg Kroah-Hartman 	return result;
139300b3ed16SGreg Kroah-Hartman }
139400b3ed16SGreg Kroah-Hartman 
13955a2214e2SSergio Paracuellos static inline int hfa384x_drvr_setconfig16(struct hfa384x *hw, u16 rid, u16 val)
139600b3ed16SGreg Kroah-Hartman {
1397e996024fSEric Salem 	__le16 value = cpu_to_le16(val);
13987489df36SVeronika Kabatova 
139900b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
140000b3ed16SGreg Kroah-Hartman }
140100b3ed16SGreg Kroah-Hartman 
140200b3ed16SGreg Kroah-Hartman int
14035a2214e2SSergio Paracuellos hfa384x_drvr_setconfig_async(struct hfa384x *hw,
1404aaad4303SSolomon Peachy 			     u16 rid,
140500b3ed16SGreg Kroah-Hartman 			     void *buf,
1406e573aaa4SMoritz Muehlenhoff 			     u16 len, ctlx_usercb_t usercb, void *usercb_data);
140700b3ed16SGreg Kroah-Hartman 
140800b3ed16SGreg Kroah-Hartman static inline int
14095a2214e2SSergio Paracuellos hfa384x_drvr_setconfig16_async(struct hfa384x *hw, u16 rid, u16 val)
141000b3ed16SGreg Kroah-Hartman {
1411a18ffdf4SAdrien Descamps 	__le16 value = cpu_to_le16(val);
14127489df36SVeronika Kabatova 
141300b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
141400b3ed16SGreg Kroah-Hartman 					    NULL, NULL);
141500b3ed16SGreg Kroah-Hartman }
141600b3ed16SGreg Kroah-Hartman 
14175a2214e2SSergio Paracuellos int hfa384x_drvr_start(struct hfa384x *hw);
14185a2214e2SSergio Paracuellos int hfa384x_drvr_stop(struct hfa384x *hw);
141900b3ed16SGreg Kroah-Hartman int
14205a2214e2SSergio Paracuellos hfa384x_drvr_txframe(struct hfa384x *hw, struct sk_buff *skb,
1421f6b43c2eSSven Dziadek 		     union p80211_hdr *p80211_hdr,
1422f6b43c2eSSven Dziadek 		     struct p80211_metawep *p80211_wep);
1423c9573a8dSsayli karnik void hfa384x_tx_timeout(struct wlandevice *wlandev);
142400b3ed16SGreg Kroah-Hartman 
14255a2214e2SSergio Paracuellos int hfa384x_cmd_initialize(struct hfa384x *hw);
14265a2214e2SSergio Paracuellos int hfa384x_cmd_enable(struct hfa384x *hw, u16 macport);
14275a2214e2SSergio Paracuellos int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport);
14285a2214e2SSergio Paracuellos int hfa384x_cmd_allocate(struct hfa384x *hw, u16 len);
14295a2214e2SSergio Paracuellos int hfa384x_cmd_monitor(struct hfa384x *hw, u16 enable);
143000b3ed16SGreg Kroah-Hartman int
14315a2214e2SSergio Paracuellos hfa384x_cmd_download(struct hfa384x *hw,
1432e573aaa4SMoritz Muehlenhoff 		     u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
143300b3ed16SGreg Kroah-Hartman 
143400b3ed16SGreg Kroah-Hartman #endif /*__KERNEL__ */
143500b3ed16SGreg Kroah-Hartman 
143600b3ed16SGreg Kroah-Hartman #endif /*_HFA384x_H */
1437