13fb28ae7STim Collier /* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */
200b3ed16SGreg Kroah-Hartman /* hfa384x.h
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  *   The contents of this file are subject to the Mozilla Public
1200b3ed16SGreg Kroah-Hartman  *   License Version 1.1 (the "License"); you may not use this file
1300b3ed16SGreg Kroah-Hartman  *   except in compliance with the License. You may obtain a copy of
1400b3ed16SGreg Kroah-Hartman  *   the License at http://www.mozilla.org/MPL/
1500b3ed16SGreg Kroah-Hartman  *
1600b3ed16SGreg Kroah-Hartman  *   Software distributed under the License is distributed on an "AS
1700b3ed16SGreg Kroah-Hartman  *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
1800b3ed16SGreg Kroah-Hartman  *    implied. See the License for the specific language governing
1900b3ed16SGreg Kroah-Hartman  *   rights and limitations under the License.
2000b3ed16SGreg Kroah-Hartman  *
2100b3ed16SGreg Kroah-Hartman  *   Alternatively, the contents of this file may be used under the
2200b3ed16SGreg Kroah-Hartman  *   terms of the GNU Public License version 2 (the "GPL"), in which
2300b3ed16SGreg Kroah-Hartman  *   case the provisions of the GPL are applicable instead of the
2400b3ed16SGreg Kroah-Hartman  *   above.  If you wish to allow the use of your version of this file
2500b3ed16SGreg Kroah-Hartman  *   only under the terms of the GPL and not to allow others to use
2600b3ed16SGreg Kroah-Hartman  *   your version of this file under the MPL, indicate your decision
2700b3ed16SGreg Kroah-Hartman  *   by deleting the provisions above and replace them with the notice
2800b3ed16SGreg Kroah-Hartman  *   and other provisions required by the GPL.  If you do not delete
2900b3ed16SGreg Kroah-Hartman  *   the provisions above, a recipient may use your version of this
3000b3ed16SGreg Kroah-Hartman  *   file under either the MPL or the GPL.
3100b3ed16SGreg Kroah-Hartman  *
3200b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
3300b3ed16SGreg Kroah-Hartman  *
3400b3ed16SGreg Kroah-Hartman  * Inquiries regarding the linux-wlan Open Source project can be
3500b3ed16SGreg Kroah-Hartman  * made directly to:
3600b3ed16SGreg Kroah-Hartman  *
3700b3ed16SGreg Kroah-Hartman  * AbsoluteValue Systems Inc.
3800b3ed16SGreg Kroah-Hartman  * info@linux-wlan.com
3900b3ed16SGreg Kroah-Hartman  * http://www.linux-wlan.com
4000b3ed16SGreg Kroah-Hartman  *
4100b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
4200b3ed16SGreg Kroah-Hartman  *
4300b3ed16SGreg Kroah-Hartman  * Portions of the development of this software were funded by
4400b3ed16SGreg Kroah-Hartman  * Intersil Corporation as part of PRISM(R) chipset product development.
4500b3ed16SGreg Kroah-Hartman  *
4600b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
4700b3ed16SGreg Kroah-Hartman  *
4800b3ed16SGreg Kroah-Hartman  *   [Implementation and usage notes]
4900b3ed16SGreg Kroah-Hartman  *
5000b3ed16SGreg Kroah-Hartman  *   [References]
5100b3ed16SGreg Kroah-Hartman  *	CW10 Programmer's Manual v1.5
5200b3ed16SGreg Kroah-Hartman  *	IEEE 802.11 D10.0
5300b3ed16SGreg Kroah-Hartman  *
5400b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
5500b3ed16SGreg Kroah-Hartman  */
5600b3ed16SGreg Kroah-Hartman 
5700b3ed16SGreg Kroah-Hartman #ifndef _HFA384x_H
5800b3ed16SGreg Kroah-Hartman #define _HFA384x_H
5900b3ed16SGreg Kroah-Hartman 
6000b3ed16SGreg Kroah-Hartman #define HFA384x_FIRMWARE_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
6100b3ed16SGreg Kroah-Hartman 
6228b17a4bSMoritz Muehlenhoff #include <linux/if_ether.h>
632e380275SKumar Amit Mehta #include <linux/usb.h>
6428b17a4bSMoritz Muehlenhoff 
6500b3ed16SGreg Kroah-Hartman /*--- Mins & Maxs -----------------------------------*/
66aaad4303SSolomon Peachy #define	HFA384x_PORTID_MAX		((u16)7)
67aaad4303SSolomon Peachy #define	HFA384x_NUMPORTS_MAX		((u16)(HFA384x_PORTID_MAX + 1))
68aaad4303SSolomon Peachy #define	HFA384x_PDR_LEN_MAX		((u16)512) /* in bytes, from EK */
6976e3e7c4SKarl Relton #define	HFA384x_PDA_RECS_MAX		((u16)200) /* a guess */
70aaad4303SSolomon Peachy #define	HFA384x_PDA_LEN_MAX		((u16)1024) /* in bytes, from EK*/
71aaad4303SSolomon Peachy #define	HFA384x_SCANRESULT_MAX		((u16)31)
72aaad4303SSolomon Peachy #define	HFA384x_HSCANRESULT_MAX		((u16)31)
73aaad4303SSolomon Peachy #define	HFA384x_CHINFORESULT_MAX	((u16)16)
7400b3ed16SGreg Kroah-Hartman #define	HFA384x_RID_GUESSING_MAXLEN	2048	/* I'm not really sure */
7500b3ed16SGreg Kroah-Hartman #define	HFA384x_RIDDATA_MAXLEN		HFA384x_RID_GUESSING_MAXLEN
7600b3ed16SGreg Kroah-Hartman #define	HFA384x_USB_RWMEM_MAXLEN	2048
7700b3ed16SGreg Kroah-Hartman 
7800b3ed16SGreg Kroah-Hartman /*--- Support Constants -----------------------------*/
79aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_IBSS			((u16)0)
80aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_BSS			((u16)1)
81aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_PSUEDOIBSS		((u16)3)
827f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_PRIVINVOKED		((u16)BIT(0))
837f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_EXCLUDE		((u16)BIT(1))
847f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_DISABLE_TXCRYPT	((u16)BIT(4))
857f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_DISABLE_RXCRYPT	((u16)BIT(7))
86aaad4303SSolomon Peachy #define		HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM	((u16)3)
87aaad4303SSolomon Peachy #define		HFA384x_PORTSTATUS_DISABLED		((u16)1)
88aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_1			((u16)1)
89aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_2			((u16)2)
90aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_5dot5			((u16)4)
91aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_11			((u16)8)
9200b3ed16SGreg Kroah-Hartman 
9300b3ed16SGreg Kroah-Hartman /*--- MAC Internal memory constants and macros ------*/
9400b3ed16SGreg Kroah-Hartman /* masks and macros used to manipulate MAC internal memory addresses. */
9500b3ed16SGreg Kroah-Hartman /* MAC internal memory addresses are 23 bit quantities.  The MAC uses
9600b3ed16SGreg Kroah-Hartman  * a paged address space where the upper 16 bits are the page number
9700b3ed16SGreg Kroah-Hartman  * and the lower 7 bits are the offset.  There are various Host API
9800b3ed16SGreg Kroah-Hartman  * elements that require two 16-bit quantities to specify a MAC
9900b3ed16SGreg Kroah-Hartman  * internal memory address.  Unfortunately, some of the API's use a
10000b3ed16SGreg Kroah-Hartman  * page/offset format where the offset value is JUST the lower seven
10100b3ed16SGreg Kroah-Hartman  * bits and the page is  the remaining 16 bits.  Some of the API's
10200b3ed16SGreg Kroah-Hartman  * assume that the 23 bit address has been split at the 16th bit.  We
10300b3ed16SGreg Kroah-Hartman  * refer to these two formats as AUX format and CMD format.  The
10400b3ed16SGreg Kroah-Hartman  * macros below help handle some of this.
10500b3ed16SGreg Kroah-Hartman  */
10600b3ed16SGreg Kroah-Hartman 
10700b3ed16SGreg Kroah-Hartman /* Mask bits for discarding unwanted pieces in a flat address */
10800b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_AUX_PAGE_MASK	(0x007fff80)
10900b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_AUX_OFF_MASK	(0x0000007f)
11000b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_CMD_PAGE_MASK	(0xffff0000)
11100b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_CMD_OFF_MASK	(0x0000ffff)
11200b3ed16SGreg Kroah-Hartman 
113e573aaa4SMoritz Muehlenhoff /* Mask bits for discarding unwanted pieces in AUX format
11495842bc9SJuliana Rodrigues  * 16-bit address parts
11595842bc9SJuliana Rodrigues  */
11600b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_PAGE_MASK	(0xffff)
11700b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_OFF_MASK	(0x007f)
11800b3ed16SGreg Kroah-Hartman 
11900b3ed16SGreg Kroah-Hartman /* Make a 32-bit flat address from AUX format 16-bit page and offset */
12000b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_MKFLAT(p, o)	\
1215dd8acc8SSvenne Krap 		((((u32)(((u16)(p)) & HFA384x_ADDR_AUX_PAGE_MASK)) << 7) | \
1225dd8acc8SSvenne Krap 		((u32)(((u16)(o)) & HFA384x_ADDR_AUX_OFF_MASK)))
12300b3ed16SGreg Kroah-Hartman 
12400b3ed16SGreg Kroah-Hartman /* Make CMD format offset and page from a 32-bit flat address */
12500b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_CMD_MKPAGE(f) \
126aaad4303SSolomon Peachy 		((u16)((((u32)(f)) & HFA384x_ADDR_FLAT_CMD_PAGE_MASK) >> 16))
12700b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_CMD_MKOFF(f) \
128aaad4303SSolomon Peachy 		((u16)(((u32)(f)) & HFA384x_ADDR_FLAT_CMD_OFF_MASK))
12900b3ed16SGreg Kroah-Hartman 
13000b3ed16SGreg Kroah-Hartman /*--- Controller Memory addresses -------------------*/
13100b3ed16SGreg Kroah-Hartman #define		HFA3842_PDA_BASE	(0x007f0000UL)
13200b3ed16SGreg Kroah-Hartman #define		HFA3841_PDA_BASE	(0x003f0000UL)
13300b3ed16SGreg Kroah-Hartman #define		HFA3841_PDA_BOGUS_BASE	(0x00390000UL)
13400b3ed16SGreg Kroah-Hartman 
13500b3ed16SGreg Kroah-Hartman /*--- Driver Download states  -----------------------*/
13600b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_DISABLED		0
13700b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_RAMENABLED		1
13800b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_FLASHENABLED		2
13900b3ed16SGreg Kroah-Hartman 
14000b3ed16SGreg Kroah-Hartman /*--- Register Field Masks --------------------------*/
141d349883fSSergio Paracuellos #define		HFA384x_CMD_AINFO		((u16)GENMASK(14, 8))
142d349883fSSergio Paracuellos #define		HFA384x_CMD_MACPORT		((u16)GENMASK(10, 8))
143d349883fSSergio Paracuellos #define		HFA384x_CMD_PROGMODE		((u16)GENMASK(9, 8))
144d349883fSSergio Paracuellos #define		HFA384x_CMD_CMDCODE		((u16)GENMASK(5, 0))
145d349883fSSergio Paracuellos #define		HFA384x_STATUS_RESULT		((u16)GENMASK(14, 8))
14600b3ed16SGreg Kroah-Hartman 
14700b3ed16SGreg Kroah-Hartman /*--- Command Code Constants --------------------------*/
14800b3ed16SGreg Kroah-Hartman /*--- Controller Commands --------------------------*/
149aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INIT		((u16)0x00)
150aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_ENABLE		((u16)0x01)
151aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DISABLE		((u16)0x02)
15200b3ed16SGreg Kroah-Hartman 
15300b3ed16SGreg Kroah-Hartman /*--- Regulate Commands --------------------------*/
154aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INQ		((u16)0x11)
15500b3ed16SGreg Kroah-Hartman 
15600b3ed16SGreg Kroah-Hartman /*--- Configure Commands --------------------------*/
157aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DOWNLD		((u16)0x22)
15800b3ed16SGreg Kroah-Hartman 
15900b3ed16SGreg Kroah-Hartman /*--- Debugging Commands -----------------------------*/
160aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_MONITOR		((u16)(0x38))
161aaad4303SSolomon Peachy #define		HFA384x_MONITOR_ENABLE		((u16)(0x0b))
162aaad4303SSolomon Peachy #define		HFA384x_MONITOR_DISABLE		((u16)(0x0f))
16300b3ed16SGreg Kroah-Hartman 
16400b3ed16SGreg Kroah-Hartman /*--- Result Codes --------------------------*/
165aaad4303SSolomon Peachy #define		HFA384x_CMD_ERR			((u16)(0x7F))
16600b3ed16SGreg Kroah-Hartman 
16700b3ed16SGreg Kroah-Hartman /*--- Programming Modes --------------------------
1683e27dfa2SSergio Paracuellos  *	MODE 0: Disable programming
1693e27dfa2SSergio Paracuellos  *	MODE 1: Enable volatile memory programming
1703e27dfa2SSergio Paracuellos  *	MODE 2: Enable non-volatile memory programming
1713e27dfa2SSergio Paracuellos  *	MODE 3: Program non-volatile memory section
1723e27dfa2SSergio Paracuellos  *-------------------------------------------------
1733e27dfa2SSergio Paracuellos  */
174aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_DISABLE	((u16)0x00)
175aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_RAM		((u16)0x01)
176aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NV		((u16)0x02)
177aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NVWRITE	((u16)0x03)
17800b3ed16SGreg Kroah-Hartman 
17900b3ed16SGreg Kroah-Hartman /*--- Record ID Constants --------------------------*/
18000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
1813e27dfa2SSergio Paracuellos  * Configuration RIDs: Network Parameters, Static Configuration Entities
1823e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
1833e27dfa2SSergio Paracuellos  */
184aaad4303SSolomon Peachy #define		HFA384x_RID_CNFPORTTYPE		((u16)0xFC00)
185aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR	((u16)0xFC01)
186aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID	((u16)0xFC02)
187aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNCHANNEL	((u16)0xFC03)
188aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID		((u16)0xFC04)
189aaad4303SSolomon Peachy #define		HFA384x_RID_CNFMAXDATALEN	((u16)0xFC07)
19000b3ed16SGreg Kroah-Hartman 
19100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
1923e27dfa2SSergio Paracuellos  * Configuration RID lengths: Network Params, Static Config Entities
1933e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
1943e27dfa2SSergio Paracuellos  * include the len or code fields)
1953e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
1963e27dfa2SSergio Paracuellos  */
197aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR_LEN	((u16)6)
198aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID_LEN	((u16)34)
199aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID_LEN	((u16)34)
20000b3ed16SGreg Kroah-Hartman 
20100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2023e27dfa2SSergio Paracuellos  * Configuration RIDs: Network Parameters, Dynamic Configuration Entities
2033e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2043e27dfa2SSergio Paracuellos  */
205aaad4303SSolomon Peachy #define		HFA384x_RID_CREATEIBSS		((u16)0xFC81)
206aaad4303SSolomon Peachy #define		HFA384x_RID_FRAGTHRESH		((u16)0xFC82)
207aaad4303SSolomon Peachy #define		HFA384x_RID_RTSTHRESH		((u16)0xFC83)
208aaad4303SSolomon Peachy #define		HFA384x_RID_TXRATECNTL		((u16)0xFC84)
209aaad4303SSolomon Peachy #define		HFA384x_RID_PROMISCMODE		((u16)0xFC85)
21000b3ed16SGreg Kroah-Hartman 
21100b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
2123e27dfa2SSergio Paracuellos  * Information RIDs: NIC Information
2133e27dfa2SSergio Paracuellos  *----------------------------------------------------------------------
2143e27dfa2SSergio Paracuellos  */
215aaad4303SSolomon Peachy #define		HFA384x_RID_MAXLOADTIME		((u16)0xFD00)
216aaad4303SSolomon Peachy #define		HFA384x_RID_DOWNLOADBUFFER	((u16)0xFD01)
217aaad4303SSolomon Peachy #define		HFA384x_RID_PRIIDENTITY		((u16)0xFD02)
218aaad4303SSolomon Peachy #define		HFA384x_RID_PRISUPRANGE		((u16)0xFD03)
219aaad4303SSolomon Peachy #define		HFA384x_RID_PRI_CFIACTRANGES	((u16)0xFD04)
220aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER	((u16)0xFD0A)
221aaad4303SSolomon Peachy #define		HFA384x_RID_NICIDENTITY		((u16)0xFD0B)
222aaad4303SSolomon Peachy #define		HFA384x_RID_MFISUPRANGE		((u16)0xFD0C)
223aaad4303SSolomon Peachy #define		HFA384x_RID_CFISUPRANGE		((u16)0xFD0D)
224aaad4303SSolomon Peachy #define		HFA384x_RID_STAIDENTITY		((u16)0xFD20)
225aaad4303SSolomon Peachy #define		HFA384x_RID_STASUPRANGE		((u16)0xFD21)
226aaad4303SSolomon Peachy #define		HFA384x_RID_STA_MFIACTRANGES	((u16)0xFD22)
227aaad4303SSolomon Peachy #define		HFA384x_RID_STA_CFIACTRANGES	((u16)0xFD23)
22800b3ed16SGreg Kroah-Hartman 
22900b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
2303e27dfa2SSergio Paracuellos  * Information RID Lengths: NIC Information
2313e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
2323e27dfa2SSergio Paracuellos  * include the len or code fields)
2333e27dfa2SSergio Paracuellos  *---------------------------------------------------------------------
2343e27dfa2SSergio Paracuellos  */
235aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER_LEN		((u16)12)
23600b3ed16SGreg Kroah-Hartman 
23700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2383e27dfa2SSergio Paracuellos  * Information RIDs:  MAC Information
2393e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2403e27dfa2SSergio Paracuellos  */
241aaad4303SSolomon Peachy #define		HFA384x_RID_PORTSTATUS		((u16)0xFD40)
242aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTSSID		((u16)0xFD41)
243aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTBSSID	((u16)0xFD42)
244aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTTXRATE	((u16)0xFD44)
245aaad4303SSolomon Peachy #define		HFA384x_RID_SHORTRETRYLIMIT	((u16)0xFD48)
246aaad4303SSolomon Peachy #define		HFA384x_RID_LONGRETRYLIMIT	((u16)0xFD49)
247aaad4303SSolomon Peachy #define		HFA384x_RID_MAXTXLIFETIME	((u16)0xFD4A)
248aaad4303SSolomon Peachy #define		HFA384x_RID_PRIVACYOPTIMP	((u16)0xFD4F)
249aaad4303SSolomon Peachy #define		HFA384x_RID_DBMCOMMSQUALITY	((u16)0xFD51)
25000b3ed16SGreg Kroah-Hartman 
25100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2523e27dfa2SSergio Paracuellos  * Information RID Lengths:  MAC Information
2533e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
2543e27dfa2SSergio Paracuellos  * include the len or code fields)
2553e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2563e27dfa2SSergio Paracuellos  */
25771508ee4SAlessandro Ghedini #define		HFA384x_RID_DBMCOMMSQUALITY_LEN	 \
25862e493c4SSergio Paracuellos 	((u16)sizeof(struct hfa384x_dbmcommsquality))
25971508ee4SAlessandro Ghedini #define		HFA384x_RID_JOINREQUEST_LEN \
260de3dc47cSJuliana Rodrigues 	((u16)sizeof(struct hfa384x_join_request_data))
26140a67411SMoritz Muehlenhoff 
26200b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2633e27dfa2SSergio Paracuellos  * Information RIDs:  Modem Information
2643e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2653e27dfa2SSergio Paracuellos  */
266aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTCHANNEL	((u16)0xFDC1)
26700b3ed16SGreg Kroah-Hartman 
26800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2693e27dfa2SSergio Paracuellos  * API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
2703e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2713e27dfa2SSergio Paracuellos  */
272aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEYID	((u16)0xFC23)
273aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY0	((u16)0xFC24)
274aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY1	((u16)0xFC25)
275aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY2	((u16)0xFC26)
276aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY3	((u16)0xFC27)
277aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPFLAGS		((u16)0xFC28)
278aaad4303SSolomon Peachy #define		HFA384x_RID_CNFAUTHENTICATION	((u16)0xFC2A)
279aaad4303SSolomon Peachy #define		HFA384x_RID_CNFROAMINGMODE	((u16)0xFC2D)
280b937612fSSergio Paracuellos #define		HFA384x_RID_CNFAPBCNINT		((u16)0xFC33)
281e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFDBMADJUST	((u16)0xFC46)
282e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFWPADATA		((u16)0xFC48)
283aaad4303SSolomon Peachy #define		HFA384x_RID_CNFBASICRATES	((u16)0xFCB3)
284aaad4303SSolomon Peachy #define		HFA384x_RID_CNFSUPPRATES	((u16)0xFCB4)
285e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFPASSIVESCANCTRL	((u16)0xFCBA)
286e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_TXPOWERMAX		((u16)0xFCBE)
287aaad4303SSolomon Peachy #define		HFA384x_RID_JOINREQUEST		((u16)0xFCE2)
288aaad4303SSolomon Peachy #define		HFA384x_RID_AUTHENTICATESTA	((u16)0xFCE3)
289e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_HOSTSCAN		((u16)0xFCE5)
29000b3ed16SGreg Kroah-Hartman 
291aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY_LEN	((u16)6)
292aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEP128DEFAULTKEY_LEN	((u16)14)
29340a67411SMoritz Muehlenhoff 
29400b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2953e27dfa2SSergio Paracuellos  * PD Record codes
2963e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2973e27dfa2SSergio Paracuellos  */
298aaad4303SSolomon Peachy #define HFA384x_PDR_PCB_PARTNUM		((u16)0x0001)
299aaad4303SSolomon Peachy #define HFA384x_PDR_PDAVER		((u16)0x0002)
300aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_SERIAL		((u16)0x0003)
301aaad4303SSolomon Peachy #define HFA384x_PDR_MKK_MEASUREMENTS	((u16)0x0004)
302aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_RAMSIZE		((u16)0x0005)
303aaad4303SSolomon Peachy #define HFA384x_PDR_MFISUPRANGE		((u16)0x0006)
304aaad4303SSolomon Peachy #define HFA384x_PDR_CFISUPRANGE		((u16)0x0007)
305aaad4303SSolomon Peachy #define HFA384x_PDR_NICID		((u16)0x0008)
306aaad4303SSolomon Peachy #define HFA384x_PDR_MAC_ADDRESS		((u16)0x0101)
307aaad4303SSolomon Peachy #define HFA384x_PDR_REGDOMAIN		((u16)0x0103)
308aaad4303SSolomon Peachy #define HFA384x_PDR_ALLOWED_CHANNEL	((u16)0x0104)
309aaad4303SSolomon Peachy #define HFA384x_PDR_DEFAULT_CHANNEL	((u16)0x0105)
310aaad4303SSolomon Peachy #define HFA384x_PDR_TEMPTYPE		((u16)0x0107)
311aaad4303SSolomon Peachy #define HFA384x_PDR_IFR_SETTING		((u16)0x0200)
312aaad4303SSolomon Peachy #define HFA384x_PDR_RFR_SETTING		((u16)0x0201)
313aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_BASELINE	((u16)0x0202)
314aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_SHADOW	((u16)0x0203)
315aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_IFRF	((u16)0x0204)
316aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALSP	((u16)0x0300)
317aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALI	((u16)0x0301)
318aaad4303SSolomon Peachy #define HFA384x_PDR_MAX_TX_POWER	((u16)0x0302)
319aaad4303SSolomon Peachy #define HFA384x_PDR_MASTER_CHAN_LIST	((u16)0x0303)
320aaad4303SSolomon Peachy #define HFA384x_PDR_3842_NIC_CONFIG	((u16)0x0400)
321aaad4303SSolomon Peachy #define HFA384x_PDR_USB_ID		((u16)0x0401)
322aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_ID		((u16)0x0402)
323aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_IFCONF		((u16)0x0403)
324aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_PMCONF		((u16)0x0404)
325aaad4303SSolomon Peachy #define HFA384x_PDR_RFENRGY		((u16)0x0406)
326aaad4303SSolomon Peachy #define HFA384x_PDR_USB_POWER_TYPE      ((u16)0x0407)
327aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MAX_POWER	((u16)0x0409)
328aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MANUFACTURER	((u16)0x0410)
329aaad4303SSolomon Peachy #define HFA384x_PDR_USB_PRODUCT		((u16)0x0411)
330aaad4303SSolomon Peachy #define HFA384x_PDR_ANT_DIVERSITY	((u16)0x0412)
331aaad4303SSolomon Peachy #define HFA384x_PDR_HFO_DELAY		((u16)0x0413)
332aaad4303SSolomon Peachy #define HFA384x_PDR_SCALE_THRESH	((u16)0x0414)
33300b3ed16SGreg Kroah-Hartman 
334aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTSP	((u16)0x0900)
335aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTI	((u16)0x0901)
336aaad4303SSolomon Peachy #define HFA384x_PDR_END_OF_PDA		((u16)0x0000)
33700b3ed16SGreg Kroah-Hartman 
33800b3ed16SGreg Kroah-Hartman /*--- Register Test/Get/Set Field macros ------------------------*/
33900b3ed16SGreg Kroah-Hartman 
340aaad4303SSolomon Peachy #define		HFA384x_CMD_AINFO_SET(value)	((u16)((u16)(value) << 8))
34171508ee4SAlessandro Ghedini #define		HFA384x_CMD_MACPORT_SET(value)	\
34271508ee4SAlessandro Ghedini 			((u16)HFA384x_CMD_AINFO_SET(value))
34371508ee4SAlessandro Ghedini #define		HFA384x_CMD_PROGMODE_SET(value)	\
34471508ee4SAlessandro Ghedini 			((u16)HFA384x_CMD_AINFO_SET((u16)value))
345aaad4303SSolomon Peachy #define		HFA384x_CMD_CMDCODE_SET(value)		((u16)(value))
34600b3ed16SGreg Kroah-Hartman 
347aaad4303SSolomon Peachy #define		HFA384x_STATUS_RESULT_SET(value)	(((u16)(value)) << 8)
34800b3ed16SGreg Kroah-Hartman 
34900b3ed16SGreg Kroah-Hartman /* Host Maintained State Info */
35000b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_PREINIT	0
35100b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_INIT	1
35200b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_RUNNING	2
35300b3ed16SGreg Kroah-Hartman 
35400b3ed16SGreg Kroah-Hartman /*-------------------------------------------------------------*/
35500b3ed16SGreg Kroah-Hartman /* Commonly used basic types */
356b2119911SHimangi Saraogi struct hfa384x_bytestr {
3570a3bbcbdSOlav Haugan 	__le16 len;
3585979afa2SGustavo A. R. Silva 	u8 data[];
359b2119911SHimangi Saraogi } __packed;
36000b3ed16SGreg Kroah-Hartman 
36103c2975bSSergio Paracuellos struct hfa384x_bytestr32 {
36218cd9021SSuniel Mahesh 	__le16 len;
363aaad4303SSolomon Peachy 	u8 data[32];
36403c2975bSSergio Paracuellos } __packed;
36500b3ed16SGreg Kroah-Hartman 
36600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
3673e27dfa2SSergio Paracuellos  * Configuration Record Structures:
3683e27dfa2SSergio Paracuellos  *	Network Parameters, Static Configuration Entities
3693e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
3703e27dfa2SSergio Paracuellos  */
37100b3ed16SGreg Kroah-Hartman 
37200b3ed16SGreg Kroah-Hartman /*-- Hardware/Firmware Component Information ----------*/
3735f046456SSergio Paracuellos struct hfa384x_compident {
374aaad4303SSolomon Peachy 	u16 id;
375aaad4303SSolomon Peachy 	u16 variant;
376aaad4303SSolomon Peachy 	u16 major;
377aaad4303SSolomon Peachy 	u16 minor;
3785f046456SSergio Paracuellos } __packed;
37900b3ed16SGreg Kroah-Hartman 
38065f170c6SSergio Paracuellos struct hfa384x_caplevel {
381aaad4303SSolomon Peachy 	u16 role;
382aaad4303SSolomon Peachy 	u16 id;
383aaad4303SSolomon Peachy 	u16 variant;
384aaad4303SSolomon Peachy 	u16 bottom;
385aaad4303SSolomon Peachy 	u16 top;
38665f170c6SSergio Paracuellos } __packed;
38700b3ed16SGreg Kroah-Hartman 
38800b3ed16SGreg Kroah-Hartman /*-- Configuration Record: cnfAuthentication --*/
38900b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM	0x0001
39000b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_SHAREDKEY	0x0002
39100b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_LEAP		0x0004
39200b3ed16SGreg Kroah-Hartman 
39300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
3943e27dfa2SSergio Paracuellos  * Configuration Record Structures:
3953e27dfa2SSergio Paracuellos  *	Network Parameters, Dynamic Configuration Entities
3963e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
3973e27dfa2SSergio Paracuellos  */
39800b3ed16SGreg Kroah-Hartman 
39900b3ed16SGreg Kroah-Hartman #define HFA384x_CREATEIBSS_JOINCREATEIBSS          0
40000b3ed16SGreg Kroah-Hartman 
40100b3ed16SGreg Kroah-Hartman /*-- Configuration Record: HostScanRequest (data portion only) --*/
402e474b4d4SSergio Paracuellos struct hfa384x_host_scan_request_data {
40318cd9021SSuniel Mahesh 	__le16 channel_list;
40418cd9021SSuniel Mahesh 	__le16 tx_rate;
40503c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
406935cbfb2SSergio Paracuellos } __packed;
40700b3ed16SGreg Kroah-Hartman 
40800b3ed16SGreg Kroah-Hartman /*-- Configuration Record: JoinRequest (data portion only) --*/
409de3dc47cSJuliana Rodrigues struct hfa384x_join_request_data {
410aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
411aaad4303SSolomon Peachy 	u16 channel;
412f0ffa0e2SSergio Paracuellos } __packed;
41300b3ed16SGreg Kroah-Hartman 
41400b3ed16SGreg Kroah-Hartman /*-- Configuration Record: authenticateStation (data portion only) --*/
4154c976b16SJuliana Rodrigues struct hfa384x_authenticate_station_data {
41628b17a4bSMoritz Muehlenhoff 	u8 address[ETH_ALEN];
417e708d2c7SAviv Palivoda 	__le16 status;
418e708d2c7SAviv Palivoda 	__le16 algorithm;
41917fb19f0SSergio Paracuellos } __packed;
42000b3ed16SGreg Kroah-Hartman 
42100b3ed16SGreg Kroah-Hartman /*-- Configuration Record: WPAData       (data portion only) --*/
422162da263SSergio Paracuellos struct hfa384x_wpa_data {
4230a3bbcbdSOlav Haugan 	__le16 datalen;
4245979afa2SGustavo A. R. Silva 	u8 data[];		/* max 80 */
425a2a44803SSergio Paracuellos } __packed;
42600b3ed16SGreg Kroah-Hartman 
42700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4283e27dfa2SSergio Paracuellos  * Information Record Structures: NIC Information
4293e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4303e27dfa2SSergio Paracuellos  */
43100b3ed16SGreg Kroah-Hartman 
43200b3ed16SGreg Kroah-Hartman /*-- Information Record: DownLoadBuffer --*/
43300b3ed16SGreg Kroah-Hartman /* NOTE: The page and offset are in AUX format */
434b71db740SSergio Paracuellos struct hfa384x_downloadbuffer {
435aaad4303SSolomon Peachy 	u16 page;
436aaad4303SSolomon Peachy 	u16 offset;
437aaad4303SSolomon Peachy 	u16 len;
438b71db740SSergio Paracuellos } __packed;
43900b3ed16SGreg Kroah-Hartman 
44000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4413e27dfa2SSergio Paracuellos  * Information Record Structures: NIC Information
4423e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4433e27dfa2SSergio Paracuellos  */
44400b3ed16SGreg Kroah-Hartman 
445aaad4303SSolomon Peachy #define HFA384x_PSTATUS_CONN_IBSS	((u16)3)
44600b3ed16SGreg Kroah-Hartman 
44700b3ed16SGreg Kroah-Hartman /*-- Information Record: commsquality --*/
448a1e95045SSergio Paracuellos struct hfa384x_commsquality {
4497d647bcfSVitali Liaukovich 	__le16 cq_curr_bss;
4507d647bcfSVitali Liaukovich 	__le16 asl_curr_bss;
4517d647bcfSVitali Liaukovich 	__le16 anl_curr_fc;
452a1e95045SSergio Paracuellos } __packed;
45300b3ed16SGreg Kroah-Hartman 
45400b3ed16SGreg Kroah-Hartman /*-- Information Record: dmbcommsquality --*/
45562e493c4SSergio Paracuellos struct hfa384x_dbmcommsquality {
456c08510e1SSergio Paracuellos 	u16 cq_dbm_curr_bss;
457c08510e1SSergio Paracuellos 	u16 asl_dbm_curr_bss;
458c08510e1SSergio Paracuellos 	u16 anl_dbm_curr_fc;
45962e493c4SSergio Paracuellos } __packed;
46000b3ed16SGreg Kroah-Hartman 
46100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4623e27dfa2SSergio Paracuellos  * FRAME STRUCTURES: Communication Frames
4633e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4643e27dfa2SSergio Paracuellos  * Communication Frames: Transmit Frames
4653e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4663e27dfa2SSergio Paracuellos  */
46700b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Transmit Frame Structure --*/
468eb76afc9SSergio Paracuellos struct hfa384x_tx_frame {
469aaad4303SSolomon Peachy 	u16 status;
470aaad4303SSolomon Peachy 	u16 reserved1;
471aaad4303SSolomon Peachy 	u16 reserved2;
472aaad4303SSolomon Peachy 	u32 sw_support;
473aaad4303SSolomon Peachy 	u8 tx_retrycount;
474aaad4303SSolomon Peachy 	u8 tx_rate;
475aaad4303SSolomon Peachy 	u16 tx_control;
47600b3ed16SGreg Kroah-Hartman 
47700b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information --*/
47800b3ed16SGreg Kroah-Hartman 
479aaad4303SSolomon Peachy 	u16 frame_control;
480aaad4303SSolomon Peachy 	u16 duration_id;
481aaad4303SSolomon Peachy 	u8 address1[6];
482aaad4303SSolomon Peachy 	u8 address2[6];
483aaad4303SSolomon Peachy 	u8 address3[6];
484aaad4303SSolomon Peachy 	u16 sequence_control;
485aaad4303SSolomon Peachy 	u8 address4[6];
486a18ffdf4SAdrien Descamps 	__le16 data_len;		/* little endian format */
48700b3ed16SGreg Kroah-Hartman 
48800b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
48900b3ed16SGreg Kroah-Hartman 
490aaad4303SSolomon Peachy 	u8 dest_addr[6];
491aaad4303SSolomon Peachy 	u8 src_addr[6];
492aaad4303SSolomon Peachy 	u16 data_length;	/* big endian format */
493eb76afc9SSergio Paracuellos } __packed;
49400b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4953e27dfa2SSergio Paracuellos  * Communication Frames: Field Masks for Transmit Frames
4963e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4973e27dfa2SSergio Paracuellos  */
49800b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
4997f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_ACKERR			((u16)BIT(5))
5007f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_FORMERR		((u16)BIT(3))
5017f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_DISCON			((u16)BIT(2))
5027f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_AGEDERR		((u16)BIT(1))
5037f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_RETRYERR		((u16)BIT(0))
50400b3ed16SGreg Kroah-Hartman /*-- Transmit Control Field --*/
505d349883fSSergio Paracuellos #define		HFA384x_TX_MACPORT			((u16)GENMASK(10, 8))
506d349883fSSergio Paracuellos #define		HFA384x_TX_STRUCTYPE			((u16)GENMASK(4, 3))
5077f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXEX				((u16)BIT(2))
5087f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXOK				((u16)BIT(1))
50900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5103e27dfa2SSergio Paracuellos  * Communication Frames: Test/Get/Set Field Values for Transmit Frames
5113e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5123e27dfa2SSergio Paracuellos  */
51300b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
51400b3ed16SGreg Kroah-Hartman #define HFA384x_TXSTATUS_ISERROR(v)	\
515aaad4303SSolomon Peachy 	(((u16)(v)) & \
51600b3ed16SGreg Kroah-Hartman 	(HFA384x_TXSTATUS_ACKERR | HFA384x_TXSTATUS_FORMERR | \
51700b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_DISCON | HFA384x_TXSTATUS_AGEDERR | \
51800b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_RETRYERR))
51900b3ed16SGreg Kroah-Hartman 
520aaad4303SSolomon Peachy #define	HFA384x_TX_SET(v, m, s)		((((u16)(v)) << ((u16)(s))) & ((u16)(m)))
52100b3ed16SGreg Kroah-Hartman 
52200b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_MACPORT_SET(v)	HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
52371508ee4SAlessandro Ghedini #define	HFA384x_TX_STRUCTYPE_SET(v)	HFA384x_TX_SET(v, \
52471508ee4SAlessandro Ghedini 						HFA384x_TX_STRUCTYPE, 3)
52500b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXEX_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
52600b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXOK_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
52700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5283e27dfa2SSergio Paracuellos  * Communication Frames: Receive Frames
5293e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5303e27dfa2SSergio Paracuellos  */
53100b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Receive Frame Structure --*/
53270adf509SSergio Paracuellos struct hfa384x_rx_frame {
53300b3ed16SGreg Kroah-Hartman 	/*-- MAC rx descriptor (hfa384x byte order) --*/
534aaad4303SSolomon Peachy 	u16 status;
535aaad4303SSolomon Peachy 	u32 time;
536aaad4303SSolomon Peachy 	u8 silence;
537aaad4303SSolomon Peachy 	u8 signal;
538aaad4303SSolomon Peachy 	u8 rate;
539aaad4303SSolomon Peachy 	u8 rx_flow;
540aaad4303SSolomon Peachy 	u16 reserved1;
541aaad4303SSolomon Peachy 	u16 reserved2;
54200b3ed16SGreg Kroah-Hartman 
54300b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information (802.11 byte order) --*/
5448cbe56e0SHimangi Saraogi 	__le16 frame_control;
545aaad4303SSolomon Peachy 	u16 duration_id;
546aaad4303SSolomon Peachy 	u8 address1[6];
547aaad4303SSolomon Peachy 	u8 address2[6];
548aaad4303SSolomon Peachy 	u8 address3[6];
549aaad4303SSolomon Peachy 	u16 sequence_control;
550aaad4303SSolomon Peachy 	u8 address4[6];
5518cbe56e0SHimangi Saraogi 	__le16 data_len;		/* hfa384x (little endian) format */
55200b3ed16SGreg Kroah-Hartman 
55300b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
554aaad4303SSolomon Peachy 	u8 dest_addr[6];
555aaad4303SSolomon Peachy 	u8 src_addr[6];
556aaad4303SSolomon Peachy 	u16 data_length;	/* IEEE? (big endian) format */
55770adf509SSergio Paracuellos } __packed;
55800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5593e27dfa2SSergio Paracuellos  * Communication Frames: Field Masks for Receive Frames
5603e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5613e27dfa2SSergio Paracuellos  */
56200b3ed16SGreg Kroah-Hartman 
56300b3ed16SGreg Kroah-Hartman /*-- Status Fields --*/
564d349883fSSergio Paracuellos #define		HFA384x_RXSTATUS_MACPORT		((u16)GENMASK(10, 8))
5657f6e0e44SMoritz Muehlenhoff #define		HFA384x_RXSTATUS_FCSERR			((u16)BIT(0))
56600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5673e27dfa2SSergio Paracuellos  * Communication Frames: Test/Get/Set Field Values for Receive Frames
5683e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5693e27dfa2SSergio Paracuellos  */
57071508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_MACPORT_GET(value)	((u16)((((u16)(value)) \
57171508ee4SAlessandro Ghedini 					    & HFA384x_RXSTATUS_MACPORT) >> 8))
57271508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_ISFCSERR(value)	((u16)(((u16)(value)) \
57371508ee4SAlessandro Ghedini 						  & HFA384x_RXSTATUS_FCSERR))
57400b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5753e27dfa2SSergio Paracuellos  * FRAME STRUCTURES: Information Types and Information Frame Structures
5763e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5773e27dfa2SSergio Paracuellos  * Information Types
5783e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5793e27dfa2SSergio Paracuellos  */
580aaad4303SSolomon Peachy #define		HFA384x_IT_HANDOVERADDR			((u16)0xF000UL)
581aaad4303SSolomon Peachy #define		HFA384x_IT_COMMTALLIES			((u16)0xF100UL)
582aaad4303SSolomon Peachy #define		HFA384x_IT_SCANRESULTS			((u16)0xF101UL)
583aaad4303SSolomon Peachy #define		HFA384x_IT_CHINFORESULTS		((u16)0xF102UL)
584aaad4303SSolomon Peachy #define		HFA384x_IT_HOSTSCANRESULTS		((u16)0xF103UL)
585aaad4303SSolomon Peachy #define		HFA384x_IT_LINKSTATUS			((u16)0xF200UL)
586aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCSTATUS			((u16)0xF201UL)
587aaad4303SSolomon Peachy #define		HFA384x_IT_AUTHREQ			((u16)0xF202UL)
588aaad4303SSolomon Peachy #define		HFA384x_IT_PSUSERCNT			((u16)0xF203UL)
589aaad4303SSolomon Peachy #define		HFA384x_IT_KEYIDCHANGED			((u16)0xF204UL)
590aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCREQ			((u16)0xF205UL)
591aaad4303SSolomon Peachy #define		HFA384x_IT_MICFAILURE			((u16)0xF206UL)
59200b3ed16SGreg Kroah-Hartman 
59300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5943e27dfa2SSergio Paracuellos  * Information Frames Structures
5953e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5963e27dfa2SSergio Paracuellos  * Information Frames: Notification Frame Structures
5973e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5983e27dfa2SSergio Paracuellos  */
59900b3ed16SGreg Kroah-Hartman 
60000b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Communication Tallies --*/
6014cc454f2SSergio Paracuellos struct hfa384x_comm_tallies_16 {
6025551ad1eSChristopher H Pezley 	__le16 txunicastframes;
6035551ad1eSChristopher H Pezley 	__le16 txmulticastframes;
6045551ad1eSChristopher H Pezley 	__le16 txfragments;
6055551ad1eSChristopher H Pezley 	__le16 txunicastoctets;
6065551ad1eSChristopher H Pezley 	__le16 txmulticastoctets;
6075551ad1eSChristopher H Pezley 	__le16 txdeferredtrans;
6085551ad1eSChristopher H Pezley 	__le16 txsingleretryframes;
6095551ad1eSChristopher H Pezley 	__le16 txmultipleretryframes;
6105551ad1eSChristopher H Pezley 	__le16 txretrylimitexceeded;
6115551ad1eSChristopher H Pezley 	__le16 txdiscards;
6125551ad1eSChristopher H Pezley 	__le16 rxunicastframes;
6135551ad1eSChristopher H Pezley 	__le16 rxmulticastframes;
6145551ad1eSChristopher H Pezley 	__le16 rxfragments;
6155551ad1eSChristopher H Pezley 	__le16 rxunicastoctets;
6165551ad1eSChristopher H Pezley 	__le16 rxmulticastoctets;
6175551ad1eSChristopher H Pezley 	__le16 rxfcserrors;
6185551ad1eSChristopher H Pezley 	__le16 rxdiscardsnobuffer;
6195551ad1eSChristopher H Pezley 	__le16 txdiscardswrongsa;
6205551ad1eSChristopher H Pezley 	__le16 rxdiscardswepundecr;
6215551ad1eSChristopher H Pezley 	__le16 rxmsginmsgfrag;
6225551ad1eSChristopher H Pezley 	__le16 rxmsginbadmsgfrag;
62307e23b67SSergio Paracuellos } __packed;
62400b3ed16SGreg Kroah-Hartman 
625b244edc6SJuliana Rodrigues struct hfa384x_comm_tallies_32 {
6265551ad1eSChristopher H Pezley 	__le32 txunicastframes;
6275551ad1eSChristopher H Pezley 	__le32 txmulticastframes;
6285551ad1eSChristopher H Pezley 	__le32 txfragments;
6295551ad1eSChristopher H Pezley 	__le32 txunicastoctets;
6305551ad1eSChristopher H Pezley 	__le32 txmulticastoctets;
6315551ad1eSChristopher H Pezley 	__le32 txdeferredtrans;
6325551ad1eSChristopher H Pezley 	__le32 txsingleretryframes;
6335551ad1eSChristopher H Pezley 	__le32 txmultipleretryframes;
6345551ad1eSChristopher H Pezley 	__le32 txretrylimitexceeded;
6355551ad1eSChristopher H Pezley 	__le32 txdiscards;
6365551ad1eSChristopher H Pezley 	__le32 rxunicastframes;
6375551ad1eSChristopher H Pezley 	__le32 rxmulticastframes;
6385551ad1eSChristopher H Pezley 	__le32 rxfragments;
6395551ad1eSChristopher H Pezley 	__le32 rxunicastoctets;
6405551ad1eSChristopher H Pezley 	__le32 rxmulticastoctets;
6415551ad1eSChristopher H Pezley 	__le32 rxfcserrors;
6425551ad1eSChristopher H Pezley 	__le32 rxdiscardsnobuffer;
6435551ad1eSChristopher H Pezley 	__le32 txdiscardswrongsa;
6445551ad1eSChristopher H Pezley 	__le32 rxdiscardswepundecr;
6455551ad1eSChristopher H Pezley 	__le32 rxmsginmsgfrag;
6465551ad1eSChristopher H Pezley 	__le32 rxmsginbadmsgfrag;
647cfc6cb1fSSergio Paracuellos } __packed;
64800b3ed16SGreg Kroah-Hartman 
64900b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Scan Results & Subfields--*/
650b263dd5eSJuliana Rodrigues struct hfa384x_scan_result_sub {
651aaad4303SSolomon Peachy 	u16 chid;
652aaad4303SSolomon Peachy 	u16 anl;
653aaad4303SSolomon Peachy 	u16 sl;
654aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
655aaad4303SSolomon Peachy 	u16 bcnint;
656aaad4303SSolomon Peachy 	u16 capinfo;
65703c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
658aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
659aaad4303SSolomon Peachy 	u16 proberesp_rate;
6604400334bSSergio Paracuellos } __packed;
66100b3ed16SGreg Kroah-Hartman 
662040a7bd4SJuliana Rodrigues struct hfa384x_scan_result {
663aaad4303SSolomon Peachy 	u16 rsvd;
664aaad4303SSolomon Peachy 	u16 scanreason;
665b263dd5eSJuliana Rodrigues 	struct hfa384x_scan_result_sub result[HFA384x_SCANRESULT_MAX];
666dc0bb002SSergio Paracuellos } __packed;
66700b3ed16SGreg Kroah-Hartman 
66800b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
669e35baeb0SJuliana Rodrigues struct hfa384x_ch_info_result_sub {
670aaad4303SSolomon Peachy 	u16 chid;
671aaad4303SSolomon Peachy 	u16 anl;
672aaad4303SSolomon Peachy 	u16 pnl;
673aaad4303SSolomon Peachy 	u16 active;
6741bc4292aSSergio Paracuellos } __packed;
67500b3ed16SGreg Kroah-Hartman 
6767f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_BSSACTIVE	BIT(0)
6777f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_PCFACTIVE	BIT(1)
67800b3ed16SGreg Kroah-Hartman 
679c447358aSSergio Paracuellos struct hfa384x_ch_info_result {
680aaad4303SSolomon Peachy 	u16 scanchannels;
681e35baeb0SJuliana Rodrigues 	struct hfa384x_ch_info_result_sub result[HFA384x_CHINFORESULT_MAX];
6820fddae8eSSergio Paracuellos } __packed;
68300b3ed16SGreg Kroah-Hartman 
68400b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
6858f8149deSSergio Paracuellos struct hfa384x_hscan_result_sub {
68618cd9021SSuniel Mahesh 	__le16 chid;
68718cd9021SSuniel Mahesh 	__le16 anl;
68818cd9021SSuniel Mahesh 	__le16 sl;
689aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
69018cd9021SSuniel Mahesh 	__le16 bcnint;
69118cd9021SSuniel Mahesh 	__le16 capinfo;
69203c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
693aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
694aaad4303SSolomon Peachy 	u16 proberesp_rate;
69518cd9021SSuniel Mahesh 	__le16 atim;
696b353d11aSSergio Paracuellos } __packed;
69700b3ed16SGreg Kroah-Hartman 
6980e2ce9adSSergio Paracuellos struct hfa384x_hscan_result {
699aaad4303SSolomon Peachy 	u16 nresult;
700aaad4303SSolomon Peachy 	u16 rsvd;
7018f8149deSSergio Paracuellos 	struct hfa384x_hscan_result_sub result[HFA384x_HSCANRESULT_MAX];
702f8f2821eSSergio Paracuellos } __packed;
70300b3ed16SGreg Kroah-Hartman 
70400b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: LinkStatus --*/
70500b3ed16SGreg Kroah-Hartman 
706aaad4303SSolomon Peachy #define HFA384x_LINK_NOTCONNECTED	((u16)0)
707aaad4303SSolomon Peachy #define HFA384x_LINK_CONNECTED		((u16)1)
708aaad4303SSolomon Peachy #define HFA384x_LINK_DISCONNECTED	((u16)2)
709aaad4303SSolomon Peachy #define HFA384x_LINK_AP_CHANGE		((u16)3)
710aaad4303SSolomon Peachy #define HFA384x_LINK_AP_OUTOFRANGE	((u16)4)
711aaad4303SSolomon Peachy #define HFA384x_LINK_AP_INRANGE		((u16)5)
712aaad4303SSolomon Peachy #define HFA384x_LINK_ASSOCFAIL		((u16)6)
71300b3ed16SGreg Kroah-Hartman 
7147190f3f1SSergio Paracuellos struct hfa384x_link_status {
715e0384407SRicardo Silva 	__le16 linkstatus;
716a8eb5139SSergio Paracuellos } __packed;
71700b3ed16SGreg Kroah-Hartman 
71800b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
71900b3ed16SGreg Kroah-Hartman 
720aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_STAASSOC	((u16)1)
721aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_REASSOC	((u16)2)
722aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_AUTHFAIL	((u16)5)
72300b3ed16SGreg Kroah-Hartman 
7241889b0dbSJuliana Rodrigues struct hfa384x_assoc_status {
725aaad4303SSolomon Peachy 	u16 assocstatus;
72628b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
72700b3ed16SGreg Kroah-Hartman 	/* old_ap_addr is only valid if assocstatus == 2 */
72828b17a4bSMoritz Muehlenhoff 	u8 old_ap_addr[ETH_ALEN];
729aaad4303SSolomon Peachy 	u16 reason;
730aaad4303SSolomon Peachy 	u16 reserved;
7315383f13eSSergio Paracuellos } __packed;
73200b3ed16SGreg Kroah-Hartman 
73300b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
73400b3ed16SGreg Kroah-Hartman 
735b8f55192SSergio Paracuellos struct hfa384x_auth_request {
73628b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
737e708d2c7SAviv Palivoda 	__le16 algorithm;
738b9820e0cSSergio Paracuellos } __packed;
73900b3ed16SGreg Kroah-Hartman 
74000b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
74100b3ed16SGreg Kroah-Hartman 
7420c3b2bd7SSergio Paracuellos struct hfa384x_ps_user_count {
7438cd924a2SManny Vindiola 	__le16 usercnt;
744013e69ebSSergio Paracuellos } __packed;
74500b3ed16SGreg Kroah-Hartman 
746ab42187aSSergio Paracuellos struct hfa384x_key_id_changed {
74728b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
748aaad4303SSolomon Peachy 	u16 keyid;
74944049d81SSergio Paracuellos } __packed;
75000b3ed16SGreg Kroah-Hartman 
75100b3ed16SGreg Kroah-Hartman /*--  Collection of all Inf frames ---------------*/
752f745ea61SSergio Paracuellos union hfa384x_infodata {
7534cc454f2SSergio Paracuellos 	struct hfa384x_comm_tallies_16 commtallies16;
754b244edc6SJuliana Rodrigues 	struct hfa384x_comm_tallies_32 commtallies32;
755040a7bd4SJuliana Rodrigues 	struct hfa384x_scan_result scanresult;
756c447358aSSergio Paracuellos 	struct hfa384x_ch_info_result chinforesult;
7570e2ce9adSSergio Paracuellos 	struct hfa384x_hscan_result hscanresult;
7587190f3f1SSergio Paracuellos 	struct hfa384x_link_status linkstatus;
7591889b0dbSJuliana Rodrigues 	struct hfa384x_assoc_status assocstatus;
760b8f55192SSergio Paracuellos 	struct hfa384x_auth_request authreq;
7610c3b2bd7SSergio Paracuellos 	struct hfa384x_ps_user_count psusercnt;
762ab42187aSSergio Paracuellos 	struct hfa384x_key_id_changed keyidchanged;
763f745ea61SSergio Paracuellos } __packed;
76400b3ed16SGreg Kroah-Hartman 
76560f5f3fbSJuliana Rodrigues struct hfa384x_inf_frame {
766aaad4303SSolomon Peachy 	u16 framelen;
767aaad4303SSolomon Peachy 	u16 infotype;
768f745ea61SSergio Paracuellos 	union hfa384x_infodata info;
769f69de9e3SSergio Paracuellos } __packed;
77000b3ed16SGreg Kroah-Hartman 
77100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
7723e27dfa2SSergio Paracuellos  * USB Packet structures and constants.
7733e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
7743e27dfa2SSergio Paracuellos  */
77500b3ed16SGreg Kroah-Hartman 
77600b3ed16SGreg Kroah-Hartman /* Should be sent to the bulkout endpoint */
77700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_TXFRM	0
77800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDREQ	1
77900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDREQ	2
78000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDREQ	3
78100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMREQ	4
78200b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMREQ	5
78300b3ed16SGreg Kroah-Hartman 
78400b3ed16SGreg Kroah-Hartman /* Received from the bulkin endpoint */
78500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISTXFRM(a)	(((a) & 0x9000) == 0x1000)
78600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISRXFRM(a)	(!((a) & 0x9000))
78700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_INFOFRM	0x8000
78800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDRESP	0x8001
78900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDRESP	0x8002
79000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDRESP	0x8003
79100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMRESP	0x8004
79200b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMRESP	0x8005
79300b3ed16SGreg Kroah-Hartman #define HFA384x_USB_BUFAVAIL	0x8006
79400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ERROR	0x8007
79500b3ed16SGreg Kroah-Hartman 
79600b3ed16SGreg Kroah-Hartman /*------------------------------------*/
79700b3ed16SGreg Kroah-Hartman /* Request (bulk OUT) packet contents */
79800b3ed16SGreg Kroah-Hartman 
7992f1014f7SSergio Paracuellos struct hfa384x_usb_txfrm {
800eb76afc9SSergio Paracuellos 	struct hfa384x_tx_frame desc;
801aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
8022f1014f7SSergio Paracuellos } __packed;
80300b3ed16SGreg Kroah-Hartman 
804a6dcbdfeSSergio Paracuellos struct hfa384x_usb_cmdreq {
805a18ffdf4SAdrien Descamps 	__le16 type;
806a18ffdf4SAdrien Descamps 	__le16 cmd;
807a18ffdf4SAdrien Descamps 	__le16 parm0;
808a18ffdf4SAdrien Descamps 	__le16 parm1;
809a18ffdf4SAdrien Descamps 	__le16 parm2;
810aaad4303SSolomon Peachy 	u8 pad[54];
811a6dcbdfeSSergio Paracuellos } __packed;
81200b3ed16SGreg Kroah-Hartman 
8133bc070f6SSergio Paracuellos struct hfa384x_usb_wridreq {
814a18ffdf4SAdrien Descamps 	__le16 type;
815a18ffdf4SAdrien Descamps 	__le16 frmlen;
816a18ffdf4SAdrien Descamps 	__le16 rid;
817aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
8183bc070f6SSergio Paracuellos } __packed;
81900b3ed16SGreg Kroah-Hartman 
8205b9f240eSSergio Paracuellos struct hfa384x_usb_rridreq {
821a18ffdf4SAdrien Descamps 	__le16 type;
822a18ffdf4SAdrien Descamps 	__le16 frmlen;
823a18ffdf4SAdrien Descamps 	__le16 rid;
824aaad4303SSolomon Peachy 	u8 pad[58];
8255b9f240eSSergio Paracuellos } __packed;
82600b3ed16SGreg Kroah-Hartman 
827f0e15d40SSergio Paracuellos struct hfa384x_usb_wmemreq {
828a18ffdf4SAdrien Descamps 	__le16 type;
829a18ffdf4SAdrien Descamps 	__le16 frmlen;
830a18ffdf4SAdrien Descamps 	__le16 offset;
831a18ffdf4SAdrien Descamps 	__le16 page;
832aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
833f0e15d40SSergio Paracuellos } __packed;
83400b3ed16SGreg Kroah-Hartman 
83594ec5464SSergio Paracuellos struct hfa384x_usb_rmemreq {
836a18ffdf4SAdrien Descamps 	__le16 type;
837a18ffdf4SAdrien Descamps 	__le16 frmlen;
838a18ffdf4SAdrien Descamps 	__le16 offset;
839a18ffdf4SAdrien Descamps 	__le16 page;
840aaad4303SSolomon Peachy 	u8 pad[56];
84194ec5464SSergio Paracuellos } __packed;
84200b3ed16SGreg Kroah-Hartman 
84300b3ed16SGreg Kroah-Hartman /*------------------------------------*/
84400b3ed16SGreg Kroah-Hartman /* Response (bulk IN) packet contents */
84500b3ed16SGreg Kroah-Hartman 
846684b2e08SSergio Paracuellos struct hfa384x_usb_rxfrm {
84770adf509SSergio Paracuellos 	struct hfa384x_rx_frame desc;
848aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
849684b2e08SSergio Paracuellos } __packed;
85000b3ed16SGreg Kroah-Hartman 
851e20a7ca1SSergio Paracuellos struct hfa384x_usb_infofrm {
852aaad4303SSolomon Peachy 	u16 type;
85360f5f3fbSJuliana Rodrigues 	struct hfa384x_inf_frame info;
854e20a7ca1SSergio Paracuellos } __packed;
85500b3ed16SGreg Kroah-Hartman 
856385a79dfSSergio Paracuellos struct hfa384x_usb_statusresp {
857aaad4303SSolomon Peachy 	u16 type;
858a18ffdf4SAdrien Descamps 	__le16 status;
859a18ffdf4SAdrien Descamps 	__le16 resp0;
860a18ffdf4SAdrien Descamps 	__le16 resp1;
861a18ffdf4SAdrien Descamps 	__le16 resp2;
862385a79dfSSergio Paracuellos } __packed;
86300b3ed16SGreg Kroah-Hartman 
864a988c9f3SSergio Paracuellos struct hfa384x_usb_rridresp {
865aaad4303SSolomon Peachy 	u16 type;
866a18ffdf4SAdrien Descamps 	__le16 frmlen;
867a18ffdf4SAdrien Descamps 	__le16 rid;
868aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
869a988c9f3SSergio Paracuellos } __packed;
87000b3ed16SGreg Kroah-Hartman 
8711ed54806SSergio Paracuellos struct hfa384x_usb_rmemresp {
872aaad4303SSolomon Peachy 	u16 type;
873aaad4303SSolomon Peachy 	u16 frmlen;
874aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
8751ed54806SSergio Paracuellos } __packed;
87600b3ed16SGreg Kroah-Hartman 
877c4d8a0a8SSergio Paracuellos struct hfa384x_usb_bufavail {
878aaad4303SSolomon Peachy 	u16 type;
879aaad4303SSolomon Peachy 	u16 frmlen;
880c4d8a0a8SSergio Paracuellos } __packed;
88100b3ed16SGreg Kroah-Hartman 
882d4734c30SSergio Paracuellos struct hfa384x_usb_error {
883aaad4303SSolomon Peachy 	u16 type;
884aaad4303SSolomon Peachy 	u16 errortype;
885d4734c30SSergio Paracuellos } __packed;
88600b3ed16SGreg Kroah-Hartman 
88700b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------*/
88800b3ed16SGreg Kroah-Hartman /* Unions for packaging all the known packet types together */
88900b3ed16SGreg Kroah-Hartman 
8904012684aSSergio Paracuellos union hfa384x_usbout {
891a78d1312SAsaf Vertz 	__le16 type;
8922f1014f7SSergio Paracuellos 	struct hfa384x_usb_txfrm txfrm;
893a6dcbdfeSSergio Paracuellos 	struct hfa384x_usb_cmdreq cmdreq;
8943bc070f6SSergio Paracuellos 	struct hfa384x_usb_wridreq wridreq;
8955b9f240eSSergio Paracuellos 	struct hfa384x_usb_rridreq rridreq;
896f0e15d40SSergio Paracuellos 	struct hfa384x_usb_wmemreq wmemreq;
89794ec5464SSergio Paracuellos 	struct hfa384x_usb_rmemreq rmemreq;
8984012684aSSergio Paracuellos } __packed;
89900b3ed16SGreg Kroah-Hartman 
9003e4180c3SSergio Paracuellos union hfa384x_usbin {
901a78d1312SAsaf Vertz 	__le16 type;
902684b2e08SSergio Paracuellos 	struct hfa384x_usb_rxfrm rxfrm;
9032f1014f7SSergio Paracuellos 	struct hfa384x_usb_txfrm txfrm;
904e20a7ca1SSergio Paracuellos 	struct hfa384x_usb_infofrm infofrm;
905385a79dfSSergio Paracuellos 	struct hfa384x_usb_statusresp cmdresp;
9062c8079deSSergio Paracuellos 	struct hfa384x_usb_statusresp wridresp;
907a988c9f3SSergio Paracuellos 	struct hfa384x_usb_rridresp rridresp;
908499c1cc9SSergio Paracuellos 	struct hfa384x_usb_statusresp wmemresp;
9091ed54806SSergio Paracuellos 	struct hfa384x_usb_rmemresp rmemresp;
910c4d8a0a8SSergio Paracuellos 	struct hfa384x_usb_bufavail bufavail;
911d4734c30SSergio Paracuellos 	struct hfa384x_usb_error usberror;
912aaad4303SSolomon Peachy 	u8 boguspad[3000];
9133e4180c3SSergio Paracuellos } __packed;
91400b3ed16SGreg Kroah-Hartman 
91576e3e7c4SKarl Relton /*--------------------------------------------------------------------
9163e27dfa2SSergio Paracuellos  * PD record structures.
9173e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
9183e27dfa2SSergio Paracuellos  */
91976e3e7c4SKarl Relton 
920e0696aa8SSergio Paracuellos struct hfa384x_pdr_pcb_partnum {
92176e3e7c4SKarl Relton 	u8 num[8];
922e0696aa8SSergio Paracuellos } __packed;
92376e3e7c4SKarl Relton 
924caeabb80SSergio Paracuellos struct hfa384x_pdr_pcb_tracenum {
92576e3e7c4SKarl Relton 	u8 num[8];
926caeabb80SSergio Paracuellos } __packed;
92776e3e7c4SKarl Relton 
92866e7bdb6SSergio Paracuellos struct hfa384x_pdr_nic_serial {
92976e3e7c4SKarl Relton 	u8 num[12];
93066e7bdb6SSergio Paracuellos } __packed;
93176e3e7c4SKarl Relton 
932ee9f7626SSergio Paracuellos struct hfa384x_pdr_mkk_measurements {
93376e3e7c4SKarl Relton 	double carrier_freq;
93476e3e7c4SKarl Relton 	double occupied_band;
93576e3e7c4SKarl Relton 	double power_density;
93676e3e7c4SKarl Relton 	double tx_spur_f1;
93776e3e7c4SKarl Relton 	double tx_spur_f2;
93876e3e7c4SKarl Relton 	double tx_spur_f3;
93976e3e7c4SKarl Relton 	double tx_spur_f4;
94076e3e7c4SKarl Relton 	double tx_spur_l1;
94176e3e7c4SKarl Relton 	double tx_spur_l2;
94276e3e7c4SKarl Relton 	double tx_spur_l3;
94376e3e7c4SKarl Relton 	double tx_spur_l4;
94476e3e7c4SKarl Relton 	double rx_spur_f1;
94576e3e7c4SKarl Relton 	double rx_spur_f2;
94676e3e7c4SKarl Relton 	double rx_spur_l1;
94776e3e7c4SKarl Relton 	double rx_spur_l2;
948ee9f7626SSergio Paracuellos } __packed;
94976e3e7c4SKarl Relton 
95002eebae4SSergio Paracuellos struct hfa384x_pdr_nic_ramsize {
95176e3e7c4SKarl Relton 	u8 size[12];		/* units of KB */
95202eebae4SSergio Paracuellos } __packed;
95376e3e7c4SKarl Relton 
9549127692fSSergio Paracuellos struct hfa384x_pdr_mfisuprange {
95576e3e7c4SKarl Relton 	u16 id;
95676e3e7c4SKarl Relton 	u16 variant;
95776e3e7c4SKarl Relton 	u16 bottom;
95876e3e7c4SKarl Relton 	u16 top;
9599127692fSSergio Paracuellos } __packed;
96076e3e7c4SKarl Relton 
9614ae2996fSSergio Paracuellos struct hfa384x_pdr_cfisuprange {
96276e3e7c4SKarl Relton 	u16 id;
96376e3e7c4SKarl Relton 	u16 variant;
96476e3e7c4SKarl Relton 	u16 bottom;
96576e3e7c4SKarl Relton 	u16 top;
9664ae2996fSSergio Paracuellos } __packed;
96776e3e7c4SKarl Relton 
968e9ee92c7SSergio Paracuellos struct hfa384x_pdr_nicid {
96976e3e7c4SKarl Relton 	u16 id;
97076e3e7c4SKarl Relton 	u16 variant;
97176e3e7c4SKarl Relton 	u16 major;
97276e3e7c4SKarl Relton 	u16 minor;
973e9ee92c7SSergio Paracuellos } __packed;
97476e3e7c4SKarl Relton 
9751c0c8ebaSSergio Paracuellos struct hfa384x_pdr_refdac_measurements {
97676e3e7c4SKarl Relton 	u16 value[0];
9771c0c8ebaSSergio Paracuellos } __packed;
97876e3e7c4SKarl Relton 
979de95929cSSergio Paracuellos struct hfa384x_pdr_vgdac_measurements {
98076e3e7c4SKarl Relton 	u16 value[0];
981de95929cSSergio Paracuellos } __packed;
98276e3e7c4SKarl Relton 
983dac1445dSSergio Paracuellos struct hfa384x_pdr_level_comp_measurements {
98476e3e7c4SKarl Relton 	u16 value[0];
985dac1445dSSergio Paracuellos } __packed;
98676e3e7c4SKarl Relton 
98729f1e44eSSergio Paracuellos struct hfa384x_pdr_mac_address {
98876e3e7c4SKarl Relton 	u8 addr[6];
98929f1e44eSSergio Paracuellos } __packed;
99076e3e7c4SKarl Relton 
991f9699553SSergio Paracuellos struct hfa384x_pdr_mkk_callname {
99276e3e7c4SKarl Relton 	u8 callname[8];
993f9699553SSergio Paracuellos } __packed;
99476e3e7c4SKarl Relton 
9950970a33dSSergio Paracuellos struct hfa384x_pdr_regdomain {
99676e3e7c4SKarl Relton 	u16 numdomains;
99776e3e7c4SKarl Relton 	u16 domain[5];
9980970a33dSSergio Paracuellos } __packed;
99976e3e7c4SKarl Relton 
1000e0322d1bSSergio Paracuellos struct hfa384x_pdr_allowed_channel {
100176e3e7c4SKarl Relton 	u16 ch_bitmap;
1002e0322d1bSSergio Paracuellos } __packed;
100376e3e7c4SKarl Relton 
1004892b51ecSSergio Paracuellos struct hfa384x_pdr_default_channel {
100576e3e7c4SKarl Relton 	u16 channel;
1006892b51ecSSergio Paracuellos } __packed;
100776e3e7c4SKarl Relton 
10082c1759beSSergio Paracuellos struct hfa384x_pdr_privacy_option {
100976e3e7c4SKarl Relton 	u16 available;
10102c1759beSSergio Paracuellos } __packed;
101176e3e7c4SKarl Relton 
10120c350461SSergio Paracuellos struct hfa384x_pdr_temptype {
101376e3e7c4SKarl Relton 	u16 type;
10140c350461SSergio Paracuellos } __packed;
101576e3e7c4SKarl Relton 
10163c92d65dSSergio Paracuellos struct hfa384x_pdr_refdac_setup {
101776e3e7c4SKarl Relton 	u16 ch_value[14];
10183c92d65dSSergio Paracuellos } __packed;
101976e3e7c4SKarl Relton 
1020dce6c283SSergio Paracuellos struct hfa384x_pdr_vgdac_setup {
102176e3e7c4SKarl Relton 	u16 ch_value[14];
1022dce6c283SSergio Paracuellos } __packed;
102376e3e7c4SKarl Relton 
102429aef6bbSSergio Paracuellos struct hfa384x_pdr_level_comp_setup {
102576e3e7c4SKarl Relton 	u16 ch_value[14];
102629aef6bbSSergio Paracuellos } __packed;
102776e3e7c4SKarl Relton 
1028a98f8609SSergio Paracuellos struct hfa384x_pdr_trimdac_setup {
102976e3e7c4SKarl Relton 	u16 trimidac;
103076e3e7c4SKarl Relton 	u16 trimqdac;
1031a98f8609SSergio Paracuellos } __packed;
103276e3e7c4SKarl Relton 
10333d235885SSergio Paracuellos struct hfa384x_pdr_ifr_setting {
103476e3e7c4SKarl Relton 	u16 value[3];
10353d235885SSergio Paracuellos } __packed;
103676e3e7c4SKarl Relton 
1037da79fe4aSSergio Paracuellos struct hfa384x_pdr_rfr_setting {
103876e3e7c4SKarl Relton 	u16 value[3];
1039da79fe4aSSergio Paracuellos } __packed;
104076e3e7c4SKarl Relton 
1041b4547dc5SSergio Paracuellos struct hfa384x_pdr_hfa3861_baseline {
104276e3e7c4SKarl Relton 	u16 value[50];
1043b4547dc5SSergio Paracuellos } __packed;
104476e3e7c4SKarl Relton 
10450dbc2e46SSergio Paracuellos struct hfa384x_pdr_hfa3861_shadow {
104676e3e7c4SKarl Relton 	u32 value[32];
10470dbc2e46SSergio Paracuellos } __packed;
104876e3e7c4SKarl Relton 
10491755c01bSSergio Paracuellos struct hfa384x_pdr_hfa3861_ifrf {
105076e3e7c4SKarl Relton 	u32 value[20];
10511755c01bSSergio Paracuellos } __packed;
105276e3e7c4SKarl Relton 
1053788c9732SSergio Paracuellos struct hfa384x_pdr_hfa3861_chcalsp {
105476e3e7c4SKarl Relton 	u16 value[14];
1055788c9732SSergio Paracuellos } __packed;
105676e3e7c4SKarl Relton 
1057b94425ffSSergio Paracuellos struct hfa384x_pdr_hfa3861_chcali {
105876e3e7c4SKarl Relton 	u16 value[17];
1059b94425ffSSergio Paracuellos } __packed;
106076e3e7c4SKarl Relton 
1061bd84b588SSergio Paracuellos struct hfa384x_pdr_hfa3861_nic_config {
106276e3e7c4SKarl Relton 	u16 config_bitmap;
1063bd84b588SSergio Paracuellos } __packed;
106476e3e7c4SKarl Relton 
10659408a44cSSergio Paracuellos struct hfa384x_pdr_hfo_delay {
106676e3e7c4SKarl Relton 	u8 hfo_delay;
10679408a44cSSergio Paracuellos } __packed;
106876e3e7c4SKarl Relton 
10690960d2e1SSergio Paracuellos struct hfa384x_pdr_hfa3861_manf_testsp {
107076e3e7c4SKarl Relton 	u16 value[30];
10710960d2e1SSergio Paracuellos } __packed;
107276e3e7c4SKarl Relton 
10735a4a5823SSergio Paracuellos struct hfa384x_pdr_hfa3861_manf_testi {
107476e3e7c4SKarl Relton 	u16 value[30];
10755a4a5823SSergio Paracuellos } __packed;
107676e3e7c4SKarl Relton 
1077b26ce5f6SSergio Paracuellos struct hfa384x_pdr_end_of_pda {
107876e3e7c4SKarl Relton 	u16 crc;
1079b26ce5f6SSergio Paracuellos } __packed;
108076e3e7c4SKarl Relton 
10814f026e89SSergio Paracuellos struct hfa384x_pdrec {
108276b4580bSMaciek Borzecki 	__le16 len;		/* in words */
108376b4580bSMaciek Borzecki 	__le16 code;
108476e3e7c4SKarl Relton 	union pdr {
1085e0696aa8SSergio Paracuellos 		struct hfa384x_pdr_pcb_partnum pcb_partnum;
1086caeabb80SSergio Paracuellos 		struct hfa384x_pdr_pcb_tracenum pcb_tracenum;
108766e7bdb6SSergio Paracuellos 		struct hfa384x_pdr_nic_serial nic_serial;
1088ee9f7626SSergio Paracuellos 		struct hfa384x_pdr_mkk_measurements mkk_measurements;
108902eebae4SSergio Paracuellos 		struct hfa384x_pdr_nic_ramsize nic_ramsize;
10909127692fSSergio Paracuellos 		struct hfa384x_pdr_mfisuprange mfisuprange;
10914ae2996fSSergio Paracuellos 		struct hfa384x_pdr_cfisuprange cfisuprange;
1092e9ee92c7SSergio Paracuellos 		struct hfa384x_pdr_nicid nicid;
10931c0c8ebaSSergio Paracuellos 		struct hfa384x_pdr_refdac_measurements refdac_measurements;
1094de95929cSSergio Paracuellos 		struct hfa384x_pdr_vgdac_measurements vgdac_measurements;
1095dac1445dSSergio Paracuellos 		struct hfa384x_pdr_level_comp_measurements level_compc_measurements;
109629f1e44eSSergio Paracuellos 		struct hfa384x_pdr_mac_address mac_address;
1097f9699553SSergio Paracuellos 		struct hfa384x_pdr_mkk_callname mkk_callname;
10980970a33dSSergio Paracuellos 		struct hfa384x_pdr_regdomain regdomain;
1099e0322d1bSSergio Paracuellos 		struct hfa384x_pdr_allowed_channel allowed_channel;
1100892b51ecSSergio Paracuellos 		struct hfa384x_pdr_default_channel default_channel;
11012c1759beSSergio Paracuellos 		struct hfa384x_pdr_privacy_option privacy_option;
11020c350461SSergio Paracuellos 		struct hfa384x_pdr_temptype temptype;
11033c92d65dSSergio Paracuellos 		struct hfa384x_pdr_refdac_setup refdac_setup;
1104dce6c283SSergio Paracuellos 		struct hfa384x_pdr_vgdac_setup vgdac_setup;
110529aef6bbSSergio Paracuellos 		struct hfa384x_pdr_level_comp_setup level_comp_setup;
1106a98f8609SSergio Paracuellos 		struct hfa384x_pdr_trimdac_setup trimdac_setup;
11073d235885SSergio Paracuellos 		struct hfa384x_pdr_ifr_setting ifr_setting;
1108da79fe4aSSergio Paracuellos 		struct hfa384x_pdr_rfr_setting rfr_setting;
1109b4547dc5SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_baseline hfa3861_baseline;
11100dbc2e46SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_shadow hfa3861_shadow;
11111755c01bSSergio Paracuellos 		struct hfa384x_pdr_hfa3861_ifrf hfa3861_ifrf;
1112788c9732SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_chcalsp hfa3861_chcalsp;
1113b94425ffSSergio Paracuellos 		struct hfa384x_pdr_hfa3861_chcali hfa3861_chcali;
1114bd84b588SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_nic_config nic_config;
11159408a44cSSergio Paracuellos 		struct hfa384x_pdr_hfo_delay hfo_delay;
11160960d2e1SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_manf_testsp hfa3861_manf_testsp;
11175a4a5823SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_manf_testi hfa3861_manf_testi;
1118b26ce5f6SSergio Paracuellos 		struct hfa384x_pdr_end_of_pda end_of_pda;
111976e3e7c4SKarl Relton 
112076e3e7c4SKarl Relton 	} data;
11214f026e89SSergio Paracuellos } __packed;
112276e3e7c4SKarl Relton 
112300b3ed16SGreg Kroah-Hartman #ifdef __KERNEL__
112400b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
11253e27dfa2SSergio Paracuellos  * ---  MAC state structure, argument to all functions --
11263e27dfa2SSergio Paracuellos  * ---  Also, a collection of support types --
11273e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
11283e27dfa2SSergio Paracuellos  */
1129501f5f96SSergio Paracuellos struct hfa384x_cmdresult {
1130aaad4303SSolomon Peachy 	u16 status;
1131aaad4303SSolomon Peachy 	u16 resp0;
1132aaad4303SSolomon Peachy 	u16 resp1;
1133aaad4303SSolomon Peachy 	u16 resp2;
1134501f5f96SSergio Paracuellos };
113500b3ed16SGreg Kroah-Hartman 
113600b3ed16SGreg Kroah-Hartman /* USB Control Exchange (CTLX):
113700b3ed16SGreg Kroah-Hartman  *  A queue of the structure below is maintained for all of the
113800b3ed16SGreg Kroah-Hartman  *  Request/Response type USB packets supported by Prism2.
113900b3ed16SGreg Kroah-Hartman  */
114000b3ed16SGreg Kroah-Hartman /* The following hfa384x_* structures are arguments to
114100b3ed16SGreg Kroah-Hartman  * the usercb() for the different CTLX types.
114200b3ed16SGreg Kroah-Hartman  */
1143b3fd890eSSergio Paracuellos struct hfa384x_rridresult {
1144aaad4303SSolomon Peachy 	u16 rid;
114500b3ed16SGreg Kroah-Hartman 	const void *riddata;
1146aaad4303SSolomon Peachy 	unsigned int riddata_len;
1147b3fd890eSSergio Paracuellos };
114800b3ed16SGreg Kroah-Hartman 
114900b3ed16SGreg Kroah-Hartman enum ctlx_state {
115000b3ed16SGreg Kroah-Hartman 	CTLX_START = 0,		/* Start state, not queued */
115100b3ed16SGreg Kroah-Hartman 
115200b3ed16SGreg Kroah-Hartman 	CTLX_COMPLETE,		/* CTLX successfully completed */
115300b3ed16SGreg Kroah-Hartman 	CTLX_REQ_FAILED,	/* OUT URB completed w/ error */
115400b3ed16SGreg Kroah-Hartman 
115500b3ed16SGreg Kroah-Hartman 	CTLX_PENDING,		/* Queued, data valid */
115600b3ed16SGreg Kroah-Hartman 	CTLX_REQ_SUBMITTED,	/* OUT URB submitted */
115700b3ed16SGreg Kroah-Hartman 	CTLX_REQ_COMPLETE,	/* OUT URB complete */
115800b3ed16SGreg Kroah-Hartman 	CTLX_RESP_COMPLETE	/* IN URB received */
115900b3ed16SGreg Kroah-Hartman };
116000b3ed16SGreg Kroah-Hartman 
116100b3ed16SGreg Kroah-Hartman struct hfa384x_usbctlx;
116200b3ed16SGreg Kroah-Hartman struct hfa384x;
116300b3ed16SGreg Kroah-Hartman 
116400b3ed16SGreg Kroah-Hartman typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);
116500b3ed16SGreg Kroah-Hartman 
1166e573aaa4SMoritz Muehlenhoff typedef void (*ctlx_usercb_t) (struct hfa384x *hw,
1167e573aaa4SMoritz Muehlenhoff 			       void *ctlxresult, void *usercb_data);
116800b3ed16SGreg Kroah-Hartman 
1169a10d36b0SSergio Paracuellos struct hfa384x_usbctlx {
117000b3ed16SGreg Kroah-Hartman 	struct list_head list;
117100b3ed16SGreg Kroah-Hartman 
117200b3ed16SGreg Kroah-Hartman 	size_t outbufsize;
11734012684aSSergio Paracuellos 	union hfa384x_usbout outbuf;	/* pkt buf for OUT */
11743e4180c3SSergio Paracuellos 	union hfa384x_usbin inbuf;	/* pkt buf for IN(a copy) */
117500b3ed16SGreg Kroah-Hartman 
1176173bf7e3SSergio Paracuellos 	enum ctlx_state state;	/* Tracks running state */
117700b3ed16SGreg Kroah-Hartman 
117800b3ed16SGreg Kroah-Hartman 	struct completion done;
1179318c66d4STim Collier 	int reapable;		/* Food for the reaper task */
118000b3ed16SGreg Kroah-Hartman 
118100b3ed16SGreg Kroah-Hartman 	ctlx_cmdcb_t cmdcb;	/* Async command callback */
118200b3ed16SGreg Kroah-Hartman 	ctlx_usercb_t usercb;	/* Async user callback, */
118300b3ed16SGreg Kroah-Hartman 	void *usercb_data;	/*  at CTLX completion  */
1184a10d36b0SSergio Paracuellos };
118500b3ed16SGreg Kroah-Hartman 
11863df38936SSergio Paracuellos struct hfa384x_usbctlxq {
118700b3ed16SGreg Kroah-Hartman 	spinlock_t lock;
118800b3ed16SGreg Kroah-Hartman 	struct list_head pending;
118900b3ed16SGreg Kroah-Hartman 	struct list_head active;
119000b3ed16SGreg Kroah-Hartman 	struct list_head completing;
119100b3ed16SGreg Kroah-Hartman 	struct list_head reapable;
11923df38936SSergio Paracuellos };
119300b3ed16SGreg Kroah-Hartman 
1194e2f503c4SSergio Paracuellos struct hfa384x_metacmd {
1195aaad4303SSolomon Peachy 	u16 cmd;
119600b3ed16SGreg Kroah-Hartman 
1197aaad4303SSolomon Peachy 	u16 parm0;
1198aaad4303SSolomon Peachy 	u16 parm1;
1199aaad4303SSolomon Peachy 	u16 parm2;
120000b3ed16SGreg Kroah-Hartman 
1201501f5f96SSergio Paracuellos 	struct hfa384x_cmdresult result;
1202e2f503c4SSergio Paracuellos };
120300b3ed16SGreg Kroah-Hartman 
120400b3ed16SGreg Kroah-Hartman #define	MAX_GRP_ADDR		32
120500b3ed16SGreg Kroah-Hartman #define WLAN_COMMENT_MAX	80  /* Max. length of user comment string. */
120600b3ed16SGreg Kroah-Hartman 
120700b3ed16SGreg Kroah-Hartman #define WLAN_AUTH_MAX           60  /* Max. # of authenticated stations. */
120800b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_MAX		60  /* Max. # of stations in an access list. */
120900b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_NONE	0   /* No stations may be authenticated. */
121000b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALL		1   /* All stations may be authenticated. */
121100b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALLOW	2   /* Authenticate only "allowed" stations. */
121200b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_DENY	3   /* Do not authenticate "denied" stations. */
121300b3ed16SGreg Kroah-Hartman 
121400b3ed16SGreg Kroah-Hartman /* XXX These are going away ASAP */
1215c84b528cSVatika Harlalka struct prism2sta_authlist {
1216aaad4303SSolomon Peachy 	unsigned int cnt;
121728b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_AUTH_MAX][ETH_ALEN];
1218aaad4303SSolomon Peachy 	u8 assoc[WLAN_AUTH_MAX];
1219c84b528cSVatika Harlalka };
122000b3ed16SGreg Kroah-Hartman 
12214d10ece3SVatika Harlalka struct prism2sta_accesslist {
1222aaad4303SSolomon Peachy 	unsigned int modify;
1223aaad4303SSolomon Peachy 	unsigned int cnt;
122428b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_ACCESS_MAX][ETH_ALEN];
1225aaad4303SSolomon Peachy 	unsigned int cnt1;
122628b17a4bSMoritz Muehlenhoff 	u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN];
12274d10ece3SVatika Harlalka };
122800b3ed16SGreg Kroah-Hartman 
12295a2214e2SSergio Paracuellos struct hfa384x {
123000b3ed16SGreg Kroah-Hartman 	/* USB support data */
123100b3ed16SGreg Kroah-Hartman 	struct usb_device *usb;
123200b3ed16SGreg Kroah-Hartman 	struct urb rx_urb;
123300b3ed16SGreg Kroah-Hartman 	struct sk_buff *rx_urb_skb;
123400b3ed16SGreg Kroah-Hartman 	struct urb tx_urb;
123500b3ed16SGreg Kroah-Hartman 	struct urb ctlx_urb;
12364012684aSSergio Paracuellos 	union hfa384x_usbout txbuff;
12373df38936SSergio Paracuellos 	struct hfa384x_usbctlxq ctlxq;
123800b3ed16SGreg Kroah-Hartman 	struct timer_list reqtimer;
123900b3ed16SGreg Kroah-Hartman 	struct timer_list resptimer;
124000b3ed16SGreg Kroah-Hartman 
124100b3ed16SGreg Kroah-Hartman 	struct timer_list throttle;
124200b3ed16SGreg Kroah-Hartman 
124300b3ed16SGreg Kroah-Hartman 	struct tasklet_struct reaper_bh;
124400b3ed16SGreg Kroah-Hartman 	struct tasklet_struct completion_bh;
124500b3ed16SGreg Kroah-Hartman 
124600b3ed16SGreg Kroah-Hartman 	struct work_struct usb_work;
124700b3ed16SGreg Kroah-Hartman 
124800b3ed16SGreg Kroah-Hartman 	unsigned long usb_flags;
124900b3ed16SGreg Kroah-Hartman #define THROTTLE_RX	0
125000b3ed16SGreg Kroah-Hartman #define THROTTLE_TX	1
125100b3ed16SGreg Kroah-Hartman #define WORK_RX_HALT	2
125200b3ed16SGreg Kroah-Hartman #define WORK_TX_HALT	3
125300b3ed16SGreg Kroah-Hartman #define WORK_RX_RESUME	4
125400b3ed16SGreg Kroah-Hartman #define WORK_TX_RESUME	5
125500b3ed16SGreg Kroah-Hartman 
125600b3ed16SGreg Kroah-Hartman 	unsigned short req_timer_done:1;
125700b3ed16SGreg Kroah-Hartman 	unsigned short resp_timer_done:1;
125800b3ed16SGreg Kroah-Hartman 
125900b3ed16SGreg Kroah-Hartman 	int endp_in;
126000b3ed16SGreg Kroah-Hartman 	int endp_out;
126100b3ed16SGreg Kroah-Hartman 
126200b3ed16SGreg Kroah-Hartman 	int sniff_fcs;
126300b3ed16SGreg Kroah-Hartman 	int sniff_channel;
126400b3ed16SGreg Kroah-Hartman 	int sniff_truncate;
126500b3ed16SGreg Kroah-Hartman 	int sniffhdr;
126600b3ed16SGreg Kroah-Hartman 
126700b3ed16SGreg Kroah-Hartman 	wait_queue_head_t cmdq;	/* wait queue itself */
126800b3ed16SGreg Kroah-Hartman 
126900b3ed16SGreg Kroah-Hartman 	/* Controller state */
1270aaad4303SSolomon Peachy 	u32 state;
1271aaad4303SSolomon Peachy 	u32 isap;
1272aaad4303SSolomon Peachy 	u8 port_enabled[HFA384x_NUMPORTS_MAX];
127300b3ed16SGreg Kroah-Hartman 
127400b3ed16SGreg Kroah-Hartman 	/* Download support */
1275aaad4303SSolomon Peachy 	unsigned int dlstate;
1276b71db740SSergio Paracuellos 	struct hfa384x_downloadbuffer bufinfo;
1277aaad4303SSolomon Peachy 	u16 dltimeout;
127800b3ed16SGreg Kroah-Hartman 
12791a6dfce7SMasanari Iida 	int scanflag;		/* to signal scan complete */
128000b3ed16SGreg Kroah-Hartman 	int join_ap;		/* are we joined to a specific ap */
128100b3ed16SGreg Kroah-Hartman 	int join_retries;	/* number of join retries till we fail */
1282de3dc47cSJuliana Rodrigues 	struct hfa384x_join_request_data joinreq;/* join request saved data */
128300b3ed16SGreg Kroah-Hartman 
1284c9573a8dSsayli karnik 	struct wlandevice *wlandev;
128500b3ed16SGreg Kroah-Hartman 	/* Timer to allow for the deferred processing of linkstatus messages */
128600b3ed16SGreg Kroah-Hartman 	struct work_struct link_bh;
128700b3ed16SGreg Kroah-Hartman 
128800b3ed16SGreg Kroah-Hartman 	struct work_struct commsqual_bh;
1289a1e95045SSergio Paracuellos 	struct hfa384x_commsquality qual;
129000b3ed16SGreg Kroah-Hartman 	struct timer_list commsqual_timer;
129100b3ed16SGreg Kroah-Hartman 
1292aaad4303SSolomon Peachy 	u16 link_status;
1293aaad4303SSolomon Peachy 	u16 link_status_new;
129400b3ed16SGreg Kroah-Hartman 	struct sk_buff_head authq;
129500b3ed16SGreg Kroah-Hartman 
1296cb3126e6SKarl Relton 	u32 txrate;
1297cb3126e6SKarl Relton 
129800b3ed16SGreg Kroah-Hartman 	/* And here we have stuff that used to be in priv */
129900b3ed16SGreg Kroah-Hartman 
130000b3ed16SGreg Kroah-Hartman 	/* State variables */
1301aaad4303SSolomon Peachy 	unsigned int presniff_port_type;
1302aaad4303SSolomon Peachy 	u16 presniff_wepflags;
1303aaad4303SSolomon Peachy 	u32 dot11_desired_bss_type;
130400b3ed16SGreg Kroah-Hartman 
130500b3ed16SGreg Kroah-Hartman 	int dbmadjust;
130600b3ed16SGreg Kroah-Hartman 
130700b3ed16SGreg Kroah-Hartman 	/* Group Addresses - right now, there are up to a total
13085f0730fdSJuliana Rodrigues 	 * of MAX_GRP_ADDR group addresses
13095f0730fdSJuliana Rodrigues 	 */
131028b17a4bSMoritz Muehlenhoff 	u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN];
1311aaad4303SSolomon Peachy 	unsigned int dot11_grpcnt;
131200b3ed16SGreg Kroah-Hartman 
131300b3ed16SGreg Kroah-Hartman 	/* Component Identities */
13145f046456SSergio Paracuellos 	struct hfa384x_compident ident_nic;
13155f046456SSergio Paracuellos 	struct hfa384x_compident ident_pri_fw;
13165f046456SSergio Paracuellos 	struct hfa384x_compident ident_sta_fw;
13175f046456SSergio Paracuellos 	struct hfa384x_compident ident_ap_fw;
1318aaad4303SSolomon Peachy 	u16 mm_mods;
131900b3ed16SGreg Kroah-Hartman 
132000b3ed16SGreg Kroah-Hartman 	/* Supplier compatibility ranges */
132165f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_mfi;
132265f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_cfi;
132365f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_pri;
132465f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_sta;
132565f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_ap;
132600b3ed16SGreg Kroah-Hartman 
132700b3ed16SGreg Kroah-Hartman 	/* Actor compatibility ranges */
132865f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_pri_cfi; /*
132971508ee4SAlessandro Ghedini 						  * pri f/w to controller
133071508ee4SAlessandro Ghedini 						  * interface
133171508ee4SAlessandro Ghedini 						  */
133271508ee4SAlessandro Ghedini 
133365f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_sta_cfi; /*
133471508ee4SAlessandro Ghedini 						  * sta f/w to controller
133571508ee4SAlessandro Ghedini 						  * interface
133671508ee4SAlessandro Ghedini 						  */
133771508ee4SAlessandro Ghedini 
13387003e01aSTim Collier 	struct hfa384x_caplevel cap_act_sta_mfi; /*
13397003e01aSTim Collier 						  * sta f/w to modem interface
13407003e01aSTim Collier 						  */
134171508ee4SAlessandro Ghedini 
134265f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_ap_cfi;	/*
134371508ee4SAlessandro Ghedini 						 * ap f/w to controller
134471508ee4SAlessandro Ghedini 						 * interface
134571508ee4SAlessandro Ghedini 						 */
134671508ee4SAlessandro Ghedini 
134765f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_ap_mfi;	/* ap f/w to modem interface */
134800b3ed16SGreg Kroah-Hartman 
1349aaad4303SSolomon Peachy 	u32 psusercount;	/* Power save user count. */
1350b244edc6SJuliana Rodrigues 	struct hfa384x_comm_tallies_32 tallies;	/* Communication tallies. */
1351aaad4303SSolomon Peachy 	u8 comment[WLAN_COMMENT_MAX + 1];	/* User comment */
135200b3ed16SGreg Kroah-Hartman 
135300b3ed16SGreg Kroah-Hartman 	/* Channel Info request results (AP only) */
135400b3ed16SGreg Kroah-Hartman 	struct {
135500b3ed16SGreg Kroah-Hartman 		atomic_t done;
1356aaad4303SSolomon Peachy 		u8 count;
1357c447358aSSergio Paracuellos 		struct hfa384x_ch_info_result results;
135800b3ed16SGreg Kroah-Hartman 	} channel_info;
135900b3ed16SGreg Kroah-Hartman 
136060f5f3fbSJuliana Rodrigues 	struct hfa384x_inf_frame *scanresults;
136100b3ed16SGreg Kroah-Hartman 
13627003e01aSTim Collier 	struct prism2sta_authlist authlist;	/*
13637003e01aSTim Collier 						 * Authenticated station list.
13647003e01aSTim Collier 						 */
1365aaad4303SSolomon Peachy 	unsigned int accessmode;		/* Access mode. */
13664d10ece3SVatika Harlalka 	struct prism2sta_accesslist allow;	/* Allowed station list. */
13674d10ece3SVatika Harlalka 	struct prism2sta_accesslist deny;	/* Denied station list. */
136800b3ed16SGreg Kroah-Hartman 
13695a2214e2SSergio Paracuellos };
137000b3ed16SGreg Kroah-Hartman 
13715a2214e2SSergio Paracuellos void hfa384x_create(struct hfa384x *hw, struct usb_device *usb);
13725a2214e2SSergio Paracuellos void hfa384x_destroy(struct hfa384x *hw);
137300b3ed16SGreg Kroah-Hartman 
1374ffe5a0a1SBranden Bonaby int hfa384x_corereset(struct hfa384x *hw, int holdtime, int settletime,
1375ffe5a0a1SBranden Bonaby 		      int genesis);
13765a2214e2SSergio Paracuellos int hfa384x_drvr_disable(struct hfa384x *hw, u16 macport);
13775a2214e2SSergio Paracuellos int hfa384x_drvr_enable(struct hfa384x *hw, u16 macport);
13785a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_enable(struct hfa384x *hw);
13795a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_disable(struct hfa384x *hw);
13807003e01aSTim Collier int hfa384x_drvr_flashdl_write(struct hfa384x *hw, u32 daddr, void *buf,
13817003e01aSTim Collier 			       u32 len);
13825a2214e2SSergio Paracuellos int hfa384x_drvr_getconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
13835a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_enable(struct hfa384x *hw, u32 exeaddr);
13845a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_disable(struct hfa384x *hw);
13855a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
13865a2214e2SSergio Paracuellos int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len);
13875a2214e2SSergio Paracuellos int hfa384x_drvr_setconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
138800b3ed16SGreg Kroah-Hartman 
13897003e01aSTim Collier static inline int
13907003e01aSTim Collier hfa384x_drvr_getconfig16(struct hfa384x *hw, u16 rid, void *val)
139100b3ed16SGreg Kroah-Hartman {
139200b3ed16SGreg Kroah-Hartman 	int result = 0;
13937489df36SVeronika Kabatova 
1394aaad4303SSolomon Peachy 	result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
1395e573aaa4SMoritz Muehlenhoff 	if (result == 0)
1396e996024fSEric Salem 		le16_to_cpus(val);
139700b3ed16SGreg Kroah-Hartman 	return result;
139800b3ed16SGreg Kroah-Hartman }
139900b3ed16SGreg Kroah-Hartman 
14005a2214e2SSergio Paracuellos static inline int hfa384x_drvr_setconfig16(struct hfa384x *hw, u16 rid, u16 val)
140100b3ed16SGreg Kroah-Hartman {
1402e996024fSEric Salem 	__le16 value = cpu_to_le16(val);
14037489df36SVeronika Kabatova 
140400b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
140500b3ed16SGreg Kroah-Hartman }
140600b3ed16SGreg Kroah-Hartman 
140700b3ed16SGreg Kroah-Hartman int
14085a2214e2SSergio Paracuellos hfa384x_drvr_setconfig_async(struct hfa384x *hw,
1409aaad4303SSolomon Peachy 			     u16 rid,
141000b3ed16SGreg Kroah-Hartman 			     void *buf,
1411e573aaa4SMoritz Muehlenhoff 			     u16 len, ctlx_usercb_t usercb, void *usercb_data);
141200b3ed16SGreg Kroah-Hartman 
141300b3ed16SGreg Kroah-Hartman static inline int
14145a2214e2SSergio Paracuellos hfa384x_drvr_setconfig16_async(struct hfa384x *hw, u16 rid, u16 val)
141500b3ed16SGreg Kroah-Hartman {
1416a18ffdf4SAdrien Descamps 	__le16 value = cpu_to_le16(val);
14177489df36SVeronika Kabatova 
141800b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
141900b3ed16SGreg Kroah-Hartman 					    NULL, NULL);
142000b3ed16SGreg Kroah-Hartman }
142100b3ed16SGreg Kroah-Hartman 
14225a2214e2SSergio Paracuellos int hfa384x_drvr_start(struct hfa384x *hw);
14235a2214e2SSergio Paracuellos int hfa384x_drvr_stop(struct hfa384x *hw);
142400b3ed16SGreg Kroah-Hartman int
14255a2214e2SSergio Paracuellos hfa384x_drvr_txframe(struct hfa384x *hw, struct sk_buff *skb,
1426f6b43c2eSSven Dziadek 		     union p80211_hdr *p80211_hdr,
1427f6b43c2eSSven Dziadek 		     struct p80211_metawep *p80211_wep);
1428c9573a8dSsayli karnik void hfa384x_tx_timeout(struct wlandevice *wlandev);
142900b3ed16SGreg Kroah-Hartman 
14305a2214e2SSergio Paracuellos int hfa384x_cmd_initialize(struct hfa384x *hw);
14315a2214e2SSergio Paracuellos int hfa384x_cmd_enable(struct hfa384x *hw, u16 macport);
14325a2214e2SSergio Paracuellos int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport);
14335a2214e2SSergio Paracuellos int hfa384x_cmd_allocate(struct hfa384x *hw, u16 len);
14345a2214e2SSergio Paracuellos int hfa384x_cmd_monitor(struct hfa384x *hw, u16 enable);
143500b3ed16SGreg Kroah-Hartman int
14365a2214e2SSergio Paracuellos hfa384x_cmd_download(struct hfa384x *hw,
1437e573aaa4SMoritz Muehlenhoff 		     u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
143800b3ed16SGreg Kroah-Hartman 
143900b3ed16SGreg Kroah-Hartman #endif /*__KERNEL__ */
144000b3ed16SGreg Kroah-Hartman 
144100b3ed16SGreg Kroah-Hartman #endif /*_HFA384x_H */
1442