13fb28ae7STim Collier /* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */
28ffd91d9SAldas Taraškevičius /*
300b3ed16SGreg Kroah-Hartman  *
400b3ed16SGreg Kroah-Hartman  * Defines the constants and data structures for the hfa384x
500b3ed16SGreg Kroah-Hartman  *
600b3ed16SGreg Kroah-Hartman  * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
700b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
800b3ed16SGreg Kroah-Hartman  *
900b3ed16SGreg Kroah-Hartman  * linux-wlan
1000b3ed16SGreg Kroah-Hartman  *
1100b3ed16SGreg Kroah-Hartman  *   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 --*/
47886a0727bSKees Cook 	struct p80211_hdr hdr;
479a18ffdf4SAdrien Descamps 	__le16 data_len;		/* little endian format */
48000b3ed16SGreg Kroah-Hartman 
48100b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
48200b3ed16SGreg Kroah-Hartman 
483aaad4303SSolomon Peachy 	u8 dest_addr[6];
484aaad4303SSolomon Peachy 	u8 src_addr[6];
485aaad4303SSolomon Peachy 	u16 data_length;	/* big endian format */
486eb76afc9SSergio Paracuellos } __packed;
48700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4883e27dfa2SSergio Paracuellos  * Communication Frames: Field Masks for Transmit Frames
4893e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4903e27dfa2SSergio Paracuellos  */
49100b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
4927f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_ACKERR			((u16)BIT(5))
4937f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_FORMERR		((u16)BIT(3))
4947f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_DISCON			((u16)BIT(2))
4957f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_AGEDERR		((u16)BIT(1))
4967f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_RETRYERR		((u16)BIT(0))
49700b3ed16SGreg Kroah-Hartman /*-- Transmit Control Field --*/
498d349883fSSergio Paracuellos #define		HFA384x_TX_MACPORT			((u16)GENMASK(10, 8))
499d349883fSSergio Paracuellos #define		HFA384x_TX_STRUCTYPE			((u16)GENMASK(4, 3))
5007f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXEX				((u16)BIT(2))
5017f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXOK				((u16)BIT(1))
50200b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5033e27dfa2SSergio Paracuellos  * Communication Frames: Test/Get/Set Field Values for Transmit Frames
5043e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5053e27dfa2SSergio Paracuellos  */
50600b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
50700b3ed16SGreg Kroah-Hartman #define HFA384x_TXSTATUS_ISERROR(v)	\
508aaad4303SSolomon Peachy 	(((u16)(v)) & \
50900b3ed16SGreg Kroah-Hartman 	(HFA384x_TXSTATUS_ACKERR | HFA384x_TXSTATUS_FORMERR | \
51000b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_DISCON | HFA384x_TXSTATUS_AGEDERR | \
51100b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_RETRYERR))
51200b3ed16SGreg Kroah-Hartman 
513aaad4303SSolomon Peachy #define	HFA384x_TX_SET(v, m, s)		((((u16)(v)) << ((u16)(s))) & ((u16)(m)))
51400b3ed16SGreg Kroah-Hartman 
51500b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_MACPORT_SET(v)	HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
51671508ee4SAlessandro Ghedini #define	HFA384x_TX_STRUCTYPE_SET(v)	HFA384x_TX_SET(v, \
51771508ee4SAlessandro Ghedini 						HFA384x_TX_STRUCTYPE, 3)
51800b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXEX_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
51900b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXOK_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
52000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5213e27dfa2SSergio Paracuellos  * Communication Frames: Receive Frames
5223e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5233e27dfa2SSergio Paracuellos  */
52400b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Receive Frame Structure --*/
52570adf509SSergio Paracuellos struct hfa384x_rx_frame {
52600b3ed16SGreg Kroah-Hartman 	/*-- MAC rx descriptor (hfa384x byte order) --*/
527aaad4303SSolomon Peachy 	u16 status;
528aaad4303SSolomon Peachy 	u32 time;
529aaad4303SSolomon Peachy 	u8 silence;
530aaad4303SSolomon Peachy 	u8 signal;
531aaad4303SSolomon Peachy 	u8 rate;
532aaad4303SSolomon Peachy 	u8 rx_flow;
533aaad4303SSolomon Peachy 	u16 reserved1;
534aaad4303SSolomon Peachy 	u16 reserved2;
53500b3ed16SGreg Kroah-Hartman 
53600b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information (802.11 byte order) --*/
53786a0727bSKees Cook 	struct p80211_hdr hdr;
5388cbe56e0SHimangi Saraogi 	__le16 data_len;		/* hfa384x (little endian) format */
53900b3ed16SGreg Kroah-Hartman 
54000b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
541aaad4303SSolomon Peachy 	u8 dest_addr[6];
542aaad4303SSolomon Peachy 	u8 src_addr[6];
543aaad4303SSolomon Peachy 	u16 data_length;	/* IEEE? (big endian) format */
54470adf509SSergio Paracuellos } __packed;
54500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5463e27dfa2SSergio Paracuellos  * Communication Frames: Field Masks for Receive Frames
5473e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5483e27dfa2SSergio Paracuellos  */
54900b3ed16SGreg Kroah-Hartman 
55000b3ed16SGreg Kroah-Hartman /*-- Status Fields --*/
551d349883fSSergio Paracuellos #define		HFA384x_RXSTATUS_MACPORT		((u16)GENMASK(10, 8))
5527f6e0e44SMoritz Muehlenhoff #define		HFA384x_RXSTATUS_FCSERR			((u16)BIT(0))
55300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5543e27dfa2SSergio Paracuellos  * Communication Frames: Test/Get/Set Field Values for Receive Frames
5553e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5563e27dfa2SSergio Paracuellos  */
55771508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_MACPORT_GET(value)	((u16)((((u16)(value)) \
55871508ee4SAlessandro Ghedini 					    & HFA384x_RXSTATUS_MACPORT) >> 8))
55971508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_ISFCSERR(value)	((u16)(((u16)(value)) \
56071508ee4SAlessandro Ghedini 						  & HFA384x_RXSTATUS_FCSERR))
56100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5623e27dfa2SSergio Paracuellos  * FRAME STRUCTURES: Information Types and Information Frame Structures
5633e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5643e27dfa2SSergio Paracuellos  * Information Types
5653e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5663e27dfa2SSergio Paracuellos  */
567aaad4303SSolomon Peachy #define		HFA384x_IT_HANDOVERADDR			((u16)0xF000UL)
568aaad4303SSolomon Peachy #define		HFA384x_IT_COMMTALLIES			((u16)0xF100UL)
569aaad4303SSolomon Peachy #define		HFA384x_IT_SCANRESULTS			((u16)0xF101UL)
570aaad4303SSolomon Peachy #define		HFA384x_IT_CHINFORESULTS		((u16)0xF102UL)
571aaad4303SSolomon Peachy #define		HFA384x_IT_HOSTSCANRESULTS		((u16)0xF103UL)
572aaad4303SSolomon Peachy #define		HFA384x_IT_LINKSTATUS			((u16)0xF200UL)
573aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCSTATUS			((u16)0xF201UL)
574aaad4303SSolomon Peachy #define		HFA384x_IT_AUTHREQ			((u16)0xF202UL)
575aaad4303SSolomon Peachy #define		HFA384x_IT_PSUSERCNT			((u16)0xF203UL)
576aaad4303SSolomon Peachy #define		HFA384x_IT_KEYIDCHANGED			((u16)0xF204UL)
577aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCREQ			((u16)0xF205UL)
578aaad4303SSolomon Peachy #define		HFA384x_IT_MICFAILURE			((u16)0xF206UL)
57900b3ed16SGreg Kroah-Hartman 
58000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5813e27dfa2SSergio Paracuellos  * Information Frames Structures
5823e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5833e27dfa2SSergio Paracuellos  * Information Frames: Notification Frame Structures
5843e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5853e27dfa2SSergio Paracuellos  */
58600b3ed16SGreg Kroah-Hartman 
58700b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Communication Tallies --*/
5884cc454f2SSergio Paracuellos struct hfa384x_comm_tallies_16 {
5895551ad1eSChristopher H Pezley 	__le16 txunicastframes;
5905551ad1eSChristopher H Pezley 	__le16 txmulticastframes;
5915551ad1eSChristopher H Pezley 	__le16 txfragments;
5925551ad1eSChristopher H Pezley 	__le16 txunicastoctets;
5935551ad1eSChristopher H Pezley 	__le16 txmulticastoctets;
5945551ad1eSChristopher H Pezley 	__le16 txdeferredtrans;
5955551ad1eSChristopher H Pezley 	__le16 txsingleretryframes;
5965551ad1eSChristopher H Pezley 	__le16 txmultipleretryframes;
5975551ad1eSChristopher H Pezley 	__le16 txretrylimitexceeded;
5985551ad1eSChristopher H Pezley 	__le16 txdiscards;
5995551ad1eSChristopher H Pezley 	__le16 rxunicastframes;
6005551ad1eSChristopher H Pezley 	__le16 rxmulticastframes;
6015551ad1eSChristopher H Pezley 	__le16 rxfragments;
6025551ad1eSChristopher H Pezley 	__le16 rxunicastoctets;
6035551ad1eSChristopher H Pezley 	__le16 rxmulticastoctets;
6045551ad1eSChristopher H Pezley 	__le16 rxfcserrors;
6055551ad1eSChristopher H Pezley 	__le16 rxdiscardsnobuffer;
6065551ad1eSChristopher H Pezley 	__le16 txdiscardswrongsa;
6075551ad1eSChristopher H Pezley 	__le16 rxdiscardswepundecr;
6085551ad1eSChristopher H Pezley 	__le16 rxmsginmsgfrag;
6095551ad1eSChristopher H Pezley 	__le16 rxmsginbadmsgfrag;
61007e23b67SSergio Paracuellos } __packed;
61100b3ed16SGreg Kroah-Hartman 
612b244edc6SJuliana Rodrigues struct hfa384x_comm_tallies_32 {
6135551ad1eSChristopher H Pezley 	__le32 txunicastframes;
6145551ad1eSChristopher H Pezley 	__le32 txmulticastframes;
6155551ad1eSChristopher H Pezley 	__le32 txfragments;
6165551ad1eSChristopher H Pezley 	__le32 txunicastoctets;
6175551ad1eSChristopher H Pezley 	__le32 txmulticastoctets;
6185551ad1eSChristopher H Pezley 	__le32 txdeferredtrans;
6195551ad1eSChristopher H Pezley 	__le32 txsingleretryframes;
6205551ad1eSChristopher H Pezley 	__le32 txmultipleretryframes;
6215551ad1eSChristopher H Pezley 	__le32 txretrylimitexceeded;
6225551ad1eSChristopher H Pezley 	__le32 txdiscards;
6235551ad1eSChristopher H Pezley 	__le32 rxunicastframes;
6245551ad1eSChristopher H Pezley 	__le32 rxmulticastframes;
6255551ad1eSChristopher H Pezley 	__le32 rxfragments;
6265551ad1eSChristopher H Pezley 	__le32 rxunicastoctets;
6275551ad1eSChristopher H Pezley 	__le32 rxmulticastoctets;
6285551ad1eSChristopher H Pezley 	__le32 rxfcserrors;
6295551ad1eSChristopher H Pezley 	__le32 rxdiscardsnobuffer;
6305551ad1eSChristopher H Pezley 	__le32 txdiscardswrongsa;
6315551ad1eSChristopher H Pezley 	__le32 rxdiscardswepundecr;
6325551ad1eSChristopher H Pezley 	__le32 rxmsginmsgfrag;
6335551ad1eSChristopher H Pezley 	__le32 rxmsginbadmsgfrag;
634cfc6cb1fSSergio Paracuellos } __packed;
63500b3ed16SGreg Kroah-Hartman 
63600b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Scan Results & Subfields--*/
637b263dd5eSJuliana Rodrigues struct hfa384x_scan_result_sub {
638aaad4303SSolomon Peachy 	u16 chid;
639aaad4303SSolomon Peachy 	u16 anl;
640aaad4303SSolomon Peachy 	u16 sl;
641aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
642aaad4303SSolomon Peachy 	u16 bcnint;
643aaad4303SSolomon Peachy 	u16 capinfo;
64403c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
645aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
646aaad4303SSolomon Peachy 	u16 proberesp_rate;
6474400334bSSergio Paracuellos } __packed;
64800b3ed16SGreg Kroah-Hartman 
649040a7bd4SJuliana Rodrigues struct hfa384x_scan_result {
650aaad4303SSolomon Peachy 	u16 rsvd;
651aaad4303SSolomon Peachy 	u16 scanreason;
652b263dd5eSJuliana Rodrigues 	struct hfa384x_scan_result_sub result[HFA384x_SCANRESULT_MAX];
653dc0bb002SSergio Paracuellos } __packed;
65400b3ed16SGreg Kroah-Hartman 
65500b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
656e35baeb0SJuliana Rodrigues struct hfa384x_ch_info_result_sub {
657aaad4303SSolomon Peachy 	u16 chid;
658aaad4303SSolomon Peachy 	u16 anl;
659aaad4303SSolomon Peachy 	u16 pnl;
660aaad4303SSolomon Peachy 	u16 active;
6611bc4292aSSergio Paracuellos } __packed;
66200b3ed16SGreg Kroah-Hartman 
6637f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_BSSACTIVE	BIT(0)
6647f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_PCFACTIVE	BIT(1)
66500b3ed16SGreg Kroah-Hartman 
666c447358aSSergio Paracuellos struct hfa384x_ch_info_result {
667aaad4303SSolomon Peachy 	u16 scanchannels;
668e35baeb0SJuliana Rodrigues 	struct hfa384x_ch_info_result_sub result[HFA384x_CHINFORESULT_MAX];
6690fddae8eSSergio Paracuellos } __packed;
67000b3ed16SGreg Kroah-Hartman 
67100b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
6728f8149deSSergio Paracuellos struct hfa384x_hscan_result_sub {
67318cd9021SSuniel Mahesh 	__le16 chid;
67418cd9021SSuniel Mahesh 	__le16 anl;
67518cd9021SSuniel Mahesh 	__le16 sl;
676aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
67718cd9021SSuniel Mahesh 	__le16 bcnint;
67818cd9021SSuniel Mahesh 	__le16 capinfo;
67903c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
680aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
681aaad4303SSolomon Peachy 	u16 proberesp_rate;
68218cd9021SSuniel Mahesh 	__le16 atim;
683b353d11aSSergio Paracuellos } __packed;
68400b3ed16SGreg Kroah-Hartman 
6850e2ce9adSSergio Paracuellos struct hfa384x_hscan_result {
686aaad4303SSolomon Peachy 	u16 nresult;
687aaad4303SSolomon Peachy 	u16 rsvd;
6888f8149deSSergio Paracuellos 	struct hfa384x_hscan_result_sub result[HFA384x_HSCANRESULT_MAX];
689f8f2821eSSergio Paracuellos } __packed;
69000b3ed16SGreg Kroah-Hartman 
69100b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: LinkStatus --*/
69200b3ed16SGreg Kroah-Hartman 
693aaad4303SSolomon Peachy #define HFA384x_LINK_NOTCONNECTED	((u16)0)
694aaad4303SSolomon Peachy #define HFA384x_LINK_CONNECTED		((u16)1)
695aaad4303SSolomon Peachy #define HFA384x_LINK_DISCONNECTED	((u16)2)
696aaad4303SSolomon Peachy #define HFA384x_LINK_AP_CHANGE		((u16)3)
697aaad4303SSolomon Peachy #define HFA384x_LINK_AP_OUTOFRANGE	((u16)4)
698aaad4303SSolomon Peachy #define HFA384x_LINK_AP_INRANGE		((u16)5)
699aaad4303SSolomon Peachy #define HFA384x_LINK_ASSOCFAIL		((u16)6)
70000b3ed16SGreg Kroah-Hartman 
7017190f3f1SSergio Paracuellos struct hfa384x_link_status {
702e0384407SRicardo Silva 	__le16 linkstatus;
703a8eb5139SSergio Paracuellos } __packed;
70400b3ed16SGreg Kroah-Hartman 
70500b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
70600b3ed16SGreg Kroah-Hartman 
707aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_STAASSOC	((u16)1)
708aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_REASSOC	((u16)2)
709aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_AUTHFAIL	((u16)5)
71000b3ed16SGreg Kroah-Hartman 
7111889b0dbSJuliana Rodrigues struct hfa384x_assoc_status {
712aaad4303SSolomon Peachy 	u16 assocstatus;
71328b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
71400b3ed16SGreg Kroah-Hartman 	/* old_ap_addr is only valid if assocstatus == 2 */
71528b17a4bSMoritz Muehlenhoff 	u8 old_ap_addr[ETH_ALEN];
716aaad4303SSolomon Peachy 	u16 reason;
717aaad4303SSolomon Peachy 	u16 reserved;
7185383f13eSSergio Paracuellos } __packed;
71900b3ed16SGreg Kroah-Hartman 
72000b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
72100b3ed16SGreg Kroah-Hartman 
722b8f55192SSergio Paracuellos struct hfa384x_auth_request {
72328b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
724e708d2c7SAviv Palivoda 	__le16 algorithm;
725b9820e0cSSergio Paracuellos } __packed;
72600b3ed16SGreg Kroah-Hartman 
72700b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
72800b3ed16SGreg Kroah-Hartman 
7290c3b2bd7SSergio Paracuellos struct hfa384x_ps_user_count {
7308cd924a2SManny Vindiola 	__le16 usercnt;
731013e69ebSSergio Paracuellos } __packed;
73200b3ed16SGreg Kroah-Hartman 
733ab42187aSSergio Paracuellos struct hfa384x_key_id_changed {
73428b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
735aaad4303SSolomon Peachy 	u16 keyid;
73644049d81SSergio Paracuellos } __packed;
73700b3ed16SGreg Kroah-Hartman 
73800b3ed16SGreg Kroah-Hartman /*--  Collection of all Inf frames ---------------*/
739f745ea61SSergio Paracuellos union hfa384x_infodata {
7404cc454f2SSergio Paracuellos 	struct hfa384x_comm_tallies_16 commtallies16;
741b244edc6SJuliana Rodrigues 	struct hfa384x_comm_tallies_32 commtallies32;
742040a7bd4SJuliana Rodrigues 	struct hfa384x_scan_result scanresult;
743c447358aSSergio Paracuellos 	struct hfa384x_ch_info_result chinforesult;
7440e2ce9adSSergio Paracuellos 	struct hfa384x_hscan_result hscanresult;
7457190f3f1SSergio Paracuellos 	struct hfa384x_link_status linkstatus;
7461889b0dbSJuliana Rodrigues 	struct hfa384x_assoc_status assocstatus;
747b8f55192SSergio Paracuellos 	struct hfa384x_auth_request authreq;
7480c3b2bd7SSergio Paracuellos 	struct hfa384x_ps_user_count psusercnt;
749ab42187aSSergio Paracuellos 	struct hfa384x_key_id_changed keyidchanged;
750f745ea61SSergio Paracuellos } __packed;
75100b3ed16SGreg Kroah-Hartman 
75260f5f3fbSJuliana Rodrigues struct hfa384x_inf_frame {
753aaad4303SSolomon Peachy 	u16 framelen;
754aaad4303SSolomon Peachy 	u16 infotype;
755f745ea61SSergio Paracuellos 	union hfa384x_infodata info;
756f69de9e3SSergio Paracuellos } __packed;
75700b3ed16SGreg Kroah-Hartman 
75800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
7593e27dfa2SSergio Paracuellos  * USB Packet structures and constants.
7603e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
7613e27dfa2SSergio Paracuellos  */
76200b3ed16SGreg Kroah-Hartman 
76300b3ed16SGreg Kroah-Hartman /* Should be sent to the bulkout endpoint */
76400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_TXFRM	0
76500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDREQ	1
76600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDREQ	2
76700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDREQ	3
76800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMREQ	4
76900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMREQ	5
77000b3ed16SGreg Kroah-Hartman 
77100b3ed16SGreg Kroah-Hartman /* Received from the bulkin endpoint */
77200b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISTXFRM(a)	(((a) & 0x9000) == 0x1000)
77300b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISRXFRM(a)	(!((a) & 0x9000))
77400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_INFOFRM	0x8000
77500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDRESP	0x8001
77600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDRESP	0x8002
77700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDRESP	0x8003
77800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMRESP	0x8004
77900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMRESP	0x8005
78000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_BUFAVAIL	0x8006
78100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ERROR	0x8007
78200b3ed16SGreg Kroah-Hartman 
78300b3ed16SGreg Kroah-Hartman /*------------------------------------*/
78400b3ed16SGreg Kroah-Hartman /* Request (bulk OUT) packet contents */
78500b3ed16SGreg Kroah-Hartman 
7862f1014f7SSergio Paracuellos struct hfa384x_usb_txfrm {
787eb76afc9SSergio Paracuellos 	struct hfa384x_tx_frame desc;
788aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
7892f1014f7SSergio Paracuellos } __packed;
79000b3ed16SGreg Kroah-Hartman 
791a6dcbdfeSSergio Paracuellos struct hfa384x_usb_cmdreq {
792a18ffdf4SAdrien Descamps 	__le16 type;
793a18ffdf4SAdrien Descamps 	__le16 cmd;
794a18ffdf4SAdrien Descamps 	__le16 parm0;
795a18ffdf4SAdrien Descamps 	__le16 parm1;
796a18ffdf4SAdrien Descamps 	__le16 parm2;
797aaad4303SSolomon Peachy 	u8 pad[54];
798a6dcbdfeSSergio Paracuellos } __packed;
79900b3ed16SGreg Kroah-Hartman 
8003bc070f6SSergio Paracuellos struct hfa384x_usb_wridreq {
801a18ffdf4SAdrien Descamps 	__le16 type;
802a18ffdf4SAdrien Descamps 	__le16 frmlen;
803a18ffdf4SAdrien Descamps 	__le16 rid;
804aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
8053bc070f6SSergio Paracuellos } __packed;
80600b3ed16SGreg Kroah-Hartman 
8075b9f240eSSergio Paracuellos struct hfa384x_usb_rridreq {
808a18ffdf4SAdrien Descamps 	__le16 type;
809a18ffdf4SAdrien Descamps 	__le16 frmlen;
810a18ffdf4SAdrien Descamps 	__le16 rid;
811aaad4303SSolomon Peachy 	u8 pad[58];
8125b9f240eSSergio Paracuellos } __packed;
81300b3ed16SGreg Kroah-Hartman 
814f0e15d40SSergio Paracuellos struct hfa384x_usb_wmemreq {
815a18ffdf4SAdrien Descamps 	__le16 type;
816a18ffdf4SAdrien Descamps 	__le16 frmlen;
817a18ffdf4SAdrien Descamps 	__le16 offset;
818a18ffdf4SAdrien Descamps 	__le16 page;
819aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
820f0e15d40SSergio Paracuellos } __packed;
82100b3ed16SGreg Kroah-Hartman 
82294ec5464SSergio Paracuellos struct hfa384x_usb_rmemreq {
823a18ffdf4SAdrien Descamps 	__le16 type;
824a18ffdf4SAdrien Descamps 	__le16 frmlen;
825a18ffdf4SAdrien Descamps 	__le16 offset;
826a18ffdf4SAdrien Descamps 	__le16 page;
827aaad4303SSolomon Peachy 	u8 pad[56];
82894ec5464SSergio Paracuellos } __packed;
82900b3ed16SGreg Kroah-Hartman 
83000b3ed16SGreg Kroah-Hartman /*------------------------------------*/
83100b3ed16SGreg Kroah-Hartman /* Response (bulk IN) packet contents */
83200b3ed16SGreg Kroah-Hartman 
833684b2e08SSergio Paracuellos struct hfa384x_usb_rxfrm {
83470adf509SSergio Paracuellos 	struct hfa384x_rx_frame desc;
835aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
836684b2e08SSergio Paracuellos } __packed;
83700b3ed16SGreg Kroah-Hartman 
838e20a7ca1SSergio Paracuellos struct hfa384x_usb_infofrm {
839aaad4303SSolomon Peachy 	u16 type;
84060f5f3fbSJuliana Rodrigues 	struct hfa384x_inf_frame info;
841e20a7ca1SSergio Paracuellos } __packed;
84200b3ed16SGreg Kroah-Hartman 
843385a79dfSSergio Paracuellos struct hfa384x_usb_statusresp {
844aaad4303SSolomon Peachy 	u16 type;
845a18ffdf4SAdrien Descamps 	__le16 status;
846a18ffdf4SAdrien Descamps 	__le16 resp0;
847a18ffdf4SAdrien Descamps 	__le16 resp1;
848a18ffdf4SAdrien Descamps 	__le16 resp2;
849385a79dfSSergio Paracuellos } __packed;
85000b3ed16SGreg Kroah-Hartman 
851a988c9f3SSergio Paracuellos struct hfa384x_usb_rridresp {
852aaad4303SSolomon Peachy 	u16 type;
853a18ffdf4SAdrien Descamps 	__le16 frmlen;
854a18ffdf4SAdrien Descamps 	__le16 rid;
855aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
856a988c9f3SSergio Paracuellos } __packed;
85700b3ed16SGreg Kroah-Hartman 
8581ed54806SSergio Paracuellos struct hfa384x_usb_rmemresp {
859aaad4303SSolomon Peachy 	u16 type;
860aaad4303SSolomon Peachy 	u16 frmlen;
861aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
8621ed54806SSergio Paracuellos } __packed;
86300b3ed16SGreg Kroah-Hartman 
864c4d8a0a8SSergio Paracuellos struct hfa384x_usb_bufavail {
865aaad4303SSolomon Peachy 	u16 type;
866aaad4303SSolomon Peachy 	u16 frmlen;
867c4d8a0a8SSergio Paracuellos } __packed;
86800b3ed16SGreg Kroah-Hartman 
869d4734c30SSergio Paracuellos struct hfa384x_usb_error {
870aaad4303SSolomon Peachy 	u16 type;
871aaad4303SSolomon Peachy 	u16 errortype;
872d4734c30SSergio Paracuellos } __packed;
87300b3ed16SGreg Kroah-Hartman 
87400b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------*/
87500b3ed16SGreg Kroah-Hartman /* Unions for packaging all the known packet types together */
87600b3ed16SGreg Kroah-Hartman 
8774012684aSSergio Paracuellos union hfa384x_usbout {
878a78d1312SAsaf Vertz 	__le16 type;
8792f1014f7SSergio Paracuellos 	struct hfa384x_usb_txfrm txfrm;
880a6dcbdfeSSergio Paracuellos 	struct hfa384x_usb_cmdreq cmdreq;
8813bc070f6SSergio Paracuellos 	struct hfa384x_usb_wridreq wridreq;
8825b9f240eSSergio Paracuellos 	struct hfa384x_usb_rridreq rridreq;
883f0e15d40SSergio Paracuellos 	struct hfa384x_usb_wmemreq wmemreq;
88494ec5464SSergio Paracuellos 	struct hfa384x_usb_rmemreq rmemreq;
8854012684aSSergio Paracuellos } __packed;
88600b3ed16SGreg Kroah-Hartman 
8873e4180c3SSergio Paracuellos union hfa384x_usbin {
888a78d1312SAsaf Vertz 	__le16 type;
889684b2e08SSergio Paracuellos 	struct hfa384x_usb_rxfrm rxfrm;
8902f1014f7SSergio Paracuellos 	struct hfa384x_usb_txfrm txfrm;
891e20a7ca1SSergio Paracuellos 	struct hfa384x_usb_infofrm infofrm;
892385a79dfSSergio Paracuellos 	struct hfa384x_usb_statusresp cmdresp;
8932c8079deSSergio Paracuellos 	struct hfa384x_usb_statusresp wridresp;
894a988c9f3SSergio Paracuellos 	struct hfa384x_usb_rridresp rridresp;
895499c1cc9SSergio Paracuellos 	struct hfa384x_usb_statusresp wmemresp;
8961ed54806SSergio Paracuellos 	struct hfa384x_usb_rmemresp rmemresp;
897c4d8a0a8SSergio Paracuellos 	struct hfa384x_usb_bufavail bufavail;
898d4734c30SSergio Paracuellos 	struct hfa384x_usb_error usberror;
899aaad4303SSolomon Peachy 	u8 boguspad[3000];
9003e4180c3SSergio Paracuellos } __packed;
90100b3ed16SGreg Kroah-Hartman 
90276e3e7c4SKarl Relton /*--------------------------------------------------------------------
9033e27dfa2SSergio Paracuellos  * PD record structures.
9043e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
9053e27dfa2SSergio Paracuellos  */
90676e3e7c4SKarl Relton 
907e0696aa8SSergio Paracuellos struct hfa384x_pdr_pcb_partnum {
90876e3e7c4SKarl Relton 	u8 num[8];
909e0696aa8SSergio Paracuellos } __packed;
91076e3e7c4SKarl Relton 
911caeabb80SSergio Paracuellos struct hfa384x_pdr_pcb_tracenum {
91276e3e7c4SKarl Relton 	u8 num[8];
913caeabb80SSergio Paracuellos } __packed;
91476e3e7c4SKarl Relton 
91566e7bdb6SSergio Paracuellos struct hfa384x_pdr_nic_serial {
91676e3e7c4SKarl Relton 	u8 num[12];
91766e7bdb6SSergio Paracuellos } __packed;
91876e3e7c4SKarl Relton 
919ee9f7626SSergio Paracuellos struct hfa384x_pdr_mkk_measurements {
92076e3e7c4SKarl Relton 	double carrier_freq;
92176e3e7c4SKarl Relton 	double occupied_band;
92276e3e7c4SKarl Relton 	double power_density;
92376e3e7c4SKarl Relton 	double tx_spur_f1;
92476e3e7c4SKarl Relton 	double tx_spur_f2;
92576e3e7c4SKarl Relton 	double tx_spur_f3;
92676e3e7c4SKarl Relton 	double tx_spur_f4;
92776e3e7c4SKarl Relton 	double tx_spur_l1;
92876e3e7c4SKarl Relton 	double tx_spur_l2;
92976e3e7c4SKarl Relton 	double tx_spur_l3;
93076e3e7c4SKarl Relton 	double tx_spur_l4;
93176e3e7c4SKarl Relton 	double rx_spur_f1;
93276e3e7c4SKarl Relton 	double rx_spur_f2;
93376e3e7c4SKarl Relton 	double rx_spur_l1;
93476e3e7c4SKarl Relton 	double rx_spur_l2;
935ee9f7626SSergio Paracuellos } __packed;
93676e3e7c4SKarl Relton 
93702eebae4SSergio Paracuellos struct hfa384x_pdr_nic_ramsize {
93876e3e7c4SKarl Relton 	u8 size[12];		/* units of KB */
93902eebae4SSergio Paracuellos } __packed;
94076e3e7c4SKarl Relton 
9419127692fSSergio Paracuellos struct hfa384x_pdr_mfisuprange {
94276e3e7c4SKarl Relton 	u16 id;
94376e3e7c4SKarl Relton 	u16 variant;
94476e3e7c4SKarl Relton 	u16 bottom;
94576e3e7c4SKarl Relton 	u16 top;
9469127692fSSergio Paracuellos } __packed;
94776e3e7c4SKarl Relton 
9484ae2996fSSergio Paracuellos struct hfa384x_pdr_cfisuprange {
94976e3e7c4SKarl Relton 	u16 id;
95076e3e7c4SKarl Relton 	u16 variant;
95176e3e7c4SKarl Relton 	u16 bottom;
95276e3e7c4SKarl Relton 	u16 top;
9534ae2996fSSergio Paracuellos } __packed;
95476e3e7c4SKarl Relton 
955e9ee92c7SSergio Paracuellos struct hfa384x_pdr_nicid {
95676e3e7c4SKarl Relton 	u16 id;
95776e3e7c4SKarl Relton 	u16 variant;
95876e3e7c4SKarl Relton 	u16 major;
95976e3e7c4SKarl Relton 	u16 minor;
960e9ee92c7SSergio Paracuellos } __packed;
96176e3e7c4SKarl Relton 
9621c0c8ebaSSergio Paracuellos struct hfa384x_pdr_refdac_measurements {
96376e3e7c4SKarl Relton 	u16 value[0];
9641c0c8ebaSSergio Paracuellos } __packed;
96576e3e7c4SKarl Relton 
966de95929cSSergio Paracuellos struct hfa384x_pdr_vgdac_measurements {
96776e3e7c4SKarl Relton 	u16 value[0];
968de95929cSSergio Paracuellos } __packed;
96976e3e7c4SKarl Relton 
970dac1445dSSergio Paracuellos struct hfa384x_pdr_level_comp_measurements {
97176e3e7c4SKarl Relton 	u16 value[0];
972dac1445dSSergio Paracuellos } __packed;
97376e3e7c4SKarl Relton 
97429f1e44eSSergio Paracuellos struct hfa384x_pdr_mac_address {
97576e3e7c4SKarl Relton 	u8 addr[6];
97629f1e44eSSergio Paracuellos } __packed;
97776e3e7c4SKarl Relton 
978f9699553SSergio Paracuellos struct hfa384x_pdr_mkk_callname {
97976e3e7c4SKarl Relton 	u8 callname[8];
980f9699553SSergio Paracuellos } __packed;
98176e3e7c4SKarl Relton 
9820970a33dSSergio Paracuellos struct hfa384x_pdr_regdomain {
98376e3e7c4SKarl Relton 	u16 numdomains;
98476e3e7c4SKarl Relton 	u16 domain[5];
9850970a33dSSergio Paracuellos } __packed;
98676e3e7c4SKarl Relton 
987e0322d1bSSergio Paracuellos struct hfa384x_pdr_allowed_channel {
98876e3e7c4SKarl Relton 	u16 ch_bitmap;
989e0322d1bSSergio Paracuellos } __packed;
99076e3e7c4SKarl Relton 
991892b51ecSSergio Paracuellos struct hfa384x_pdr_default_channel {
99276e3e7c4SKarl Relton 	u16 channel;
993892b51ecSSergio Paracuellos } __packed;
99476e3e7c4SKarl Relton 
9952c1759beSSergio Paracuellos struct hfa384x_pdr_privacy_option {
99676e3e7c4SKarl Relton 	u16 available;
9972c1759beSSergio Paracuellos } __packed;
99876e3e7c4SKarl Relton 
9990c350461SSergio Paracuellos struct hfa384x_pdr_temptype {
100076e3e7c4SKarl Relton 	u16 type;
10010c350461SSergio Paracuellos } __packed;
100276e3e7c4SKarl Relton 
10033c92d65dSSergio Paracuellos struct hfa384x_pdr_refdac_setup {
100476e3e7c4SKarl Relton 	u16 ch_value[14];
10053c92d65dSSergio Paracuellos } __packed;
100676e3e7c4SKarl Relton 
1007dce6c283SSergio Paracuellos struct hfa384x_pdr_vgdac_setup {
100876e3e7c4SKarl Relton 	u16 ch_value[14];
1009dce6c283SSergio Paracuellos } __packed;
101076e3e7c4SKarl Relton 
101129aef6bbSSergio Paracuellos struct hfa384x_pdr_level_comp_setup {
101276e3e7c4SKarl Relton 	u16 ch_value[14];
101329aef6bbSSergio Paracuellos } __packed;
101476e3e7c4SKarl Relton 
1015a98f8609SSergio Paracuellos struct hfa384x_pdr_trimdac_setup {
101676e3e7c4SKarl Relton 	u16 trimidac;
101776e3e7c4SKarl Relton 	u16 trimqdac;
1018a98f8609SSergio Paracuellos } __packed;
101976e3e7c4SKarl Relton 
10203d235885SSergio Paracuellos struct hfa384x_pdr_ifr_setting {
102176e3e7c4SKarl Relton 	u16 value[3];
10223d235885SSergio Paracuellos } __packed;
102376e3e7c4SKarl Relton 
1024da79fe4aSSergio Paracuellos struct hfa384x_pdr_rfr_setting {
102576e3e7c4SKarl Relton 	u16 value[3];
1026da79fe4aSSergio Paracuellos } __packed;
102776e3e7c4SKarl Relton 
1028b4547dc5SSergio Paracuellos struct hfa384x_pdr_hfa3861_baseline {
102976e3e7c4SKarl Relton 	u16 value[50];
1030b4547dc5SSergio Paracuellos } __packed;
103176e3e7c4SKarl Relton 
10320dbc2e46SSergio Paracuellos struct hfa384x_pdr_hfa3861_shadow {
103376e3e7c4SKarl Relton 	u32 value[32];
10340dbc2e46SSergio Paracuellos } __packed;
103576e3e7c4SKarl Relton 
10361755c01bSSergio Paracuellos struct hfa384x_pdr_hfa3861_ifrf {
103776e3e7c4SKarl Relton 	u32 value[20];
10381755c01bSSergio Paracuellos } __packed;
103976e3e7c4SKarl Relton 
1040788c9732SSergio Paracuellos struct hfa384x_pdr_hfa3861_chcalsp {
104176e3e7c4SKarl Relton 	u16 value[14];
1042788c9732SSergio Paracuellos } __packed;
104376e3e7c4SKarl Relton 
1044b94425ffSSergio Paracuellos struct hfa384x_pdr_hfa3861_chcali {
104576e3e7c4SKarl Relton 	u16 value[17];
1046b94425ffSSergio Paracuellos } __packed;
104776e3e7c4SKarl Relton 
1048bd84b588SSergio Paracuellos struct hfa384x_pdr_hfa3861_nic_config {
104976e3e7c4SKarl Relton 	u16 config_bitmap;
1050bd84b588SSergio Paracuellos } __packed;
105176e3e7c4SKarl Relton 
10529408a44cSSergio Paracuellos struct hfa384x_pdr_hfo_delay {
105376e3e7c4SKarl Relton 	u8 hfo_delay;
10549408a44cSSergio Paracuellos } __packed;
105576e3e7c4SKarl Relton 
10560960d2e1SSergio Paracuellos struct hfa384x_pdr_hfa3861_manf_testsp {
105776e3e7c4SKarl Relton 	u16 value[30];
10580960d2e1SSergio Paracuellos } __packed;
105976e3e7c4SKarl Relton 
10605a4a5823SSergio Paracuellos struct hfa384x_pdr_hfa3861_manf_testi {
106176e3e7c4SKarl Relton 	u16 value[30];
10625a4a5823SSergio Paracuellos } __packed;
106376e3e7c4SKarl Relton 
1064b26ce5f6SSergio Paracuellos struct hfa384x_pdr_end_of_pda {
106576e3e7c4SKarl Relton 	u16 crc;
1066b26ce5f6SSergio Paracuellos } __packed;
106776e3e7c4SKarl Relton 
10684f026e89SSergio Paracuellos struct hfa384x_pdrec {
106976b4580bSMaciek Borzecki 	__le16 len;		/* in words */
107076b4580bSMaciek Borzecki 	__le16 code;
107176e3e7c4SKarl Relton 	union pdr {
1072e0696aa8SSergio Paracuellos 		struct hfa384x_pdr_pcb_partnum pcb_partnum;
1073caeabb80SSergio Paracuellos 		struct hfa384x_pdr_pcb_tracenum pcb_tracenum;
107466e7bdb6SSergio Paracuellos 		struct hfa384x_pdr_nic_serial nic_serial;
1075ee9f7626SSergio Paracuellos 		struct hfa384x_pdr_mkk_measurements mkk_measurements;
107602eebae4SSergio Paracuellos 		struct hfa384x_pdr_nic_ramsize nic_ramsize;
10779127692fSSergio Paracuellos 		struct hfa384x_pdr_mfisuprange mfisuprange;
10784ae2996fSSergio Paracuellos 		struct hfa384x_pdr_cfisuprange cfisuprange;
1079e9ee92c7SSergio Paracuellos 		struct hfa384x_pdr_nicid nicid;
10801c0c8ebaSSergio Paracuellos 		struct hfa384x_pdr_refdac_measurements refdac_measurements;
1081de95929cSSergio Paracuellos 		struct hfa384x_pdr_vgdac_measurements vgdac_measurements;
1082dac1445dSSergio Paracuellos 		struct hfa384x_pdr_level_comp_measurements level_compc_measurements;
108329f1e44eSSergio Paracuellos 		struct hfa384x_pdr_mac_address mac_address;
1084f9699553SSergio Paracuellos 		struct hfa384x_pdr_mkk_callname mkk_callname;
10850970a33dSSergio Paracuellos 		struct hfa384x_pdr_regdomain regdomain;
1086e0322d1bSSergio Paracuellos 		struct hfa384x_pdr_allowed_channel allowed_channel;
1087892b51ecSSergio Paracuellos 		struct hfa384x_pdr_default_channel default_channel;
10882c1759beSSergio Paracuellos 		struct hfa384x_pdr_privacy_option privacy_option;
10890c350461SSergio Paracuellos 		struct hfa384x_pdr_temptype temptype;
10903c92d65dSSergio Paracuellos 		struct hfa384x_pdr_refdac_setup refdac_setup;
1091dce6c283SSergio Paracuellos 		struct hfa384x_pdr_vgdac_setup vgdac_setup;
109229aef6bbSSergio Paracuellos 		struct hfa384x_pdr_level_comp_setup level_comp_setup;
1093a98f8609SSergio Paracuellos 		struct hfa384x_pdr_trimdac_setup trimdac_setup;
10943d235885SSergio Paracuellos 		struct hfa384x_pdr_ifr_setting ifr_setting;
1095da79fe4aSSergio Paracuellos 		struct hfa384x_pdr_rfr_setting rfr_setting;
1096b4547dc5SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_baseline hfa3861_baseline;
10970dbc2e46SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_shadow hfa3861_shadow;
10981755c01bSSergio Paracuellos 		struct hfa384x_pdr_hfa3861_ifrf hfa3861_ifrf;
1099788c9732SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_chcalsp hfa3861_chcalsp;
1100b94425ffSSergio Paracuellos 		struct hfa384x_pdr_hfa3861_chcali hfa3861_chcali;
1101bd84b588SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_nic_config nic_config;
11029408a44cSSergio Paracuellos 		struct hfa384x_pdr_hfo_delay hfo_delay;
11030960d2e1SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_manf_testsp hfa3861_manf_testsp;
11045a4a5823SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_manf_testi hfa3861_manf_testi;
1105b26ce5f6SSergio Paracuellos 		struct hfa384x_pdr_end_of_pda end_of_pda;
110676e3e7c4SKarl Relton 
110776e3e7c4SKarl Relton 	} data;
11084f026e89SSergio Paracuellos } __packed;
110976e3e7c4SKarl Relton 
111000b3ed16SGreg Kroah-Hartman #ifdef __KERNEL__
111100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
11123e27dfa2SSergio Paracuellos  * ---  MAC state structure, argument to all functions --
11133e27dfa2SSergio Paracuellos  * ---  Also, a collection of support types --
11143e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
11153e27dfa2SSergio Paracuellos  */
1116501f5f96SSergio Paracuellos struct hfa384x_cmdresult {
1117aaad4303SSolomon Peachy 	u16 status;
1118aaad4303SSolomon Peachy 	u16 resp0;
1119aaad4303SSolomon Peachy 	u16 resp1;
1120aaad4303SSolomon Peachy 	u16 resp2;
1121501f5f96SSergio Paracuellos };
112200b3ed16SGreg Kroah-Hartman 
112300b3ed16SGreg Kroah-Hartman /* USB Control Exchange (CTLX):
112400b3ed16SGreg Kroah-Hartman  *  A queue of the structure below is maintained for all of the
112500b3ed16SGreg Kroah-Hartman  *  Request/Response type USB packets supported by Prism2.
112600b3ed16SGreg Kroah-Hartman  */
112700b3ed16SGreg Kroah-Hartman /* The following hfa384x_* structures are arguments to
112800b3ed16SGreg Kroah-Hartman  * the usercb() for the different CTLX types.
112900b3ed16SGreg Kroah-Hartman  */
1130b3fd890eSSergio Paracuellos struct hfa384x_rridresult {
1131aaad4303SSolomon Peachy 	u16 rid;
113200b3ed16SGreg Kroah-Hartman 	const void *riddata;
1133aaad4303SSolomon Peachy 	unsigned int riddata_len;
1134b3fd890eSSergio Paracuellos };
113500b3ed16SGreg Kroah-Hartman 
113600b3ed16SGreg Kroah-Hartman enum ctlx_state {
113700b3ed16SGreg Kroah-Hartman 	CTLX_START = 0,		/* Start state, not queued */
113800b3ed16SGreg Kroah-Hartman 
113900b3ed16SGreg Kroah-Hartman 	CTLX_COMPLETE,		/* CTLX successfully completed */
114000b3ed16SGreg Kroah-Hartman 	CTLX_REQ_FAILED,	/* OUT URB completed w/ error */
114100b3ed16SGreg Kroah-Hartman 
114200b3ed16SGreg Kroah-Hartman 	CTLX_PENDING,		/* Queued, data valid */
114300b3ed16SGreg Kroah-Hartman 	CTLX_REQ_SUBMITTED,	/* OUT URB submitted */
114400b3ed16SGreg Kroah-Hartman 	CTLX_REQ_COMPLETE,	/* OUT URB complete */
114500b3ed16SGreg Kroah-Hartman 	CTLX_RESP_COMPLETE	/* IN URB received */
114600b3ed16SGreg Kroah-Hartman };
114700b3ed16SGreg Kroah-Hartman 
114800b3ed16SGreg Kroah-Hartman struct hfa384x_usbctlx;
114900b3ed16SGreg Kroah-Hartman struct hfa384x;
115000b3ed16SGreg Kroah-Hartman 
115100b3ed16SGreg Kroah-Hartman typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);
115200b3ed16SGreg Kroah-Hartman 
1153e573aaa4SMoritz Muehlenhoff typedef void (*ctlx_usercb_t) (struct hfa384x *hw,
1154e573aaa4SMoritz Muehlenhoff 			       void *ctlxresult, void *usercb_data);
115500b3ed16SGreg Kroah-Hartman 
1156a10d36b0SSergio Paracuellos struct hfa384x_usbctlx {
115700b3ed16SGreg Kroah-Hartman 	struct list_head list;
115800b3ed16SGreg Kroah-Hartman 
115900b3ed16SGreg Kroah-Hartman 	size_t outbufsize;
11604012684aSSergio Paracuellos 	union hfa384x_usbout outbuf;	/* pkt buf for OUT */
11613e4180c3SSergio Paracuellos 	union hfa384x_usbin inbuf;	/* pkt buf for IN(a copy) */
116200b3ed16SGreg Kroah-Hartman 
1163173bf7e3SSergio Paracuellos 	enum ctlx_state state;	/* Tracks running state */
116400b3ed16SGreg Kroah-Hartman 
116500b3ed16SGreg Kroah-Hartman 	struct completion done;
1166318c66d4STim Collier 	int reapable;		/* Food for the reaper task */
116700b3ed16SGreg Kroah-Hartman 
116800b3ed16SGreg Kroah-Hartman 	ctlx_cmdcb_t cmdcb;	/* Async command callback */
116900b3ed16SGreg Kroah-Hartman 	ctlx_usercb_t usercb;	/* Async user callback, */
117000b3ed16SGreg Kroah-Hartman 	void *usercb_data;	/*  at CTLX completion  */
1171a10d36b0SSergio Paracuellos };
117200b3ed16SGreg Kroah-Hartman 
11733df38936SSergio Paracuellos struct hfa384x_usbctlxq {
117400b3ed16SGreg Kroah-Hartman 	spinlock_t lock;
117500b3ed16SGreg Kroah-Hartman 	struct list_head pending;
117600b3ed16SGreg Kroah-Hartman 	struct list_head active;
117700b3ed16SGreg Kroah-Hartman 	struct list_head completing;
117800b3ed16SGreg Kroah-Hartman 	struct list_head reapable;
11793df38936SSergio Paracuellos };
118000b3ed16SGreg Kroah-Hartman 
1181e2f503c4SSergio Paracuellos struct hfa384x_metacmd {
1182aaad4303SSolomon Peachy 	u16 cmd;
118300b3ed16SGreg Kroah-Hartman 
1184aaad4303SSolomon Peachy 	u16 parm0;
1185aaad4303SSolomon Peachy 	u16 parm1;
1186aaad4303SSolomon Peachy 	u16 parm2;
118700b3ed16SGreg Kroah-Hartman 
1188501f5f96SSergio Paracuellos 	struct hfa384x_cmdresult result;
1189e2f503c4SSergio Paracuellos };
119000b3ed16SGreg Kroah-Hartman 
119100b3ed16SGreg Kroah-Hartman #define	MAX_GRP_ADDR		32
119200b3ed16SGreg Kroah-Hartman #define WLAN_COMMENT_MAX	80  /* Max. length of user comment string. */
119300b3ed16SGreg Kroah-Hartman 
119400b3ed16SGreg Kroah-Hartman #define WLAN_AUTH_MAX           60  /* Max. # of authenticated stations. */
119500b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_MAX		60  /* Max. # of stations in an access list. */
119600b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_NONE	0   /* No stations may be authenticated. */
119700b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALL		1   /* All stations may be authenticated. */
119800b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALLOW	2   /* Authenticate only "allowed" stations. */
119900b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_DENY	3   /* Do not authenticate "denied" stations. */
120000b3ed16SGreg Kroah-Hartman 
120100b3ed16SGreg Kroah-Hartman /* XXX These are going away ASAP */
1202c84b528cSVatika Harlalka struct prism2sta_authlist {
1203aaad4303SSolomon Peachy 	unsigned int cnt;
120428b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_AUTH_MAX][ETH_ALEN];
1205aaad4303SSolomon Peachy 	u8 assoc[WLAN_AUTH_MAX];
1206c84b528cSVatika Harlalka };
120700b3ed16SGreg Kroah-Hartman 
12084d10ece3SVatika Harlalka struct prism2sta_accesslist {
1209aaad4303SSolomon Peachy 	unsigned int modify;
1210aaad4303SSolomon Peachy 	unsigned int cnt;
121128b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_ACCESS_MAX][ETH_ALEN];
1212aaad4303SSolomon Peachy 	unsigned int cnt1;
121328b17a4bSMoritz Muehlenhoff 	u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN];
12144d10ece3SVatika Harlalka };
121500b3ed16SGreg Kroah-Hartman 
12165a2214e2SSergio Paracuellos struct hfa384x {
121700b3ed16SGreg Kroah-Hartman 	/* USB support data */
121800b3ed16SGreg Kroah-Hartman 	struct usb_device *usb;
121900b3ed16SGreg Kroah-Hartman 	struct urb rx_urb;
122000b3ed16SGreg Kroah-Hartman 	struct sk_buff *rx_urb_skb;
122100b3ed16SGreg Kroah-Hartman 	struct urb tx_urb;
122200b3ed16SGreg Kroah-Hartman 	struct urb ctlx_urb;
12234012684aSSergio Paracuellos 	union hfa384x_usbout txbuff;
12243df38936SSergio Paracuellos 	struct hfa384x_usbctlxq ctlxq;
122500b3ed16SGreg Kroah-Hartman 	struct timer_list reqtimer;
122600b3ed16SGreg Kroah-Hartman 	struct timer_list resptimer;
122700b3ed16SGreg Kroah-Hartman 
122800b3ed16SGreg Kroah-Hartman 	struct timer_list throttle;
122900b3ed16SGreg Kroah-Hartman 
1230*cbe0f674SDavidlohr Bueso 	struct work_struct reaper_bh;
123100b3ed16SGreg Kroah-Hartman 	struct tasklet_struct completion_bh;
123200b3ed16SGreg Kroah-Hartman 
123300b3ed16SGreg Kroah-Hartman 	struct work_struct usb_work;
123400b3ed16SGreg Kroah-Hartman 
123500b3ed16SGreg Kroah-Hartman 	unsigned long usb_flags;
123600b3ed16SGreg Kroah-Hartman #define THROTTLE_RX	0
123700b3ed16SGreg Kroah-Hartman #define THROTTLE_TX	1
123800b3ed16SGreg Kroah-Hartman #define WORK_RX_HALT	2
123900b3ed16SGreg Kroah-Hartman #define WORK_TX_HALT	3
124000b3ed16SGreg Kroah-Hartman #define WORK_RX_RESUME	4
124100b3ed16SGreg Kroah-Hartman #define WORK_TX_RESUME	5
124200b3ed16SGreg Kroah-Hartman 
124300b3ed16SGreg Kroah-Hartman 	unsigned short req_timer_done:1;
124400b3ed16SGreg Kroah-Hartman 	unsigned short resp_timer_done:1;
124500b3ed16SGreg Kroah-Hartman 
124600b3ed16SGreg Kroah-Hartman 	int endp_in;
124700b3ed16SGreg Kroah-Hartman 	int endp_out;
124800b3ed16SGreg Kroah-Hartman 
124900b3ed16SGreg Kroah-Hartman 	int sniff_fcs;
125000b3ed16SGreg Kroah-Hartman 	int sniff_channel;
125100b3ed16SGreg Kroah-Hartman 	int sniff_truncate;
125200b3ed16SGreg Kroah-Hartman 	int sniffhdr;
125300b3ed16SGreg Kroah-Hartman 
125400b3ed16SGreg Kroah-Hartman 	wait_queue_head_t cmdq;	/* wait queue itself */
125500b3ed16SGreg Kroah-Hartman 
125600b3ed16SGreg Kroah-Hartman 	/* Controller state */
1257aaad4303SSolomon Peachy 	u32 state;
1258aaad4303SSolomon Peachy 	u32 isap;
1259aaad4303SSolomon Peachy 	u8 port_enabled[HFA384x_NUMPORTS_MAX];
126000b3ed16SGreg Kroah-Hartman 
126100b3ed16SGreg Kroah-Hartman 	/* Download support */
1262aaad4303SSolomon Peachy 	unsigned int dlstate;
1263b71db740SSergio Paracuellos 	struct hfa384x_downloadbuffer bufinfo;
1264aaad4303SSolomon Peachy 	u16 dltimeout;
126500b3ed16SGreg Kroah-Hartman 
12661a6dfce7SMasanari Iida 	int scanflag;		/* to signal scan complete */
126700b3ed16SGreg Kroah-Hartman 	int join_ap;		/* are we joined to a specific ap */
126800b3ed16SGreg Kroah-Hartman 	int join_retries;	/* number of join retries till we fail */
1269de3dc47cSJuliana Rodrigues 	struct hfa384x_join_request_data joinreq;/* join request saved data */
127000b3ed16SGreg Kroah-Hartman 
1271c9573a8dSsayli karnik 	struct wlandevice *wlandev;
127200b3ed16SGreg Kroah-Hartman 	/* Timer to allow for the deferred processing of linkstatus messages */
127300b3ed16SGreg Kroah-Hartman 	struct work_struct link_bh;
127400b3ed16SGreg Kroah-Hartman 
127500b3ed16SGreg Kroah-Hartman 	struct work_struct commsqual_bh;
1276a1e95045SSergio Paracuellos 	struct hfa384x_commsquality qual;
127700b3ed16SGreg Kroah-Hartman 	struct timer_list commsqual_timer;
127800b3ed16SGreg Kroah-Hartman 
1279aaad4303SSolomon Peachy 	u16 link_status;
1280aaad4303SSolomon Peachy 	u16 link_status_new;
128100b3ed16SGreg Kroah-Hartman 	struct sk_buff_head authq;
128200b3ed16SGreg Kroah-Hartman 
1283cb3126e6SKarl Relton 	u32 txrate;
1284cb3126e6SKarl Relton 
128500b3ed16SGreg Kroah-Hartman 	/* And here we have stuff that used to be in priv */
128600b3ed16SGreg Kroah-Hartman 
128700b3ed16SGreg Kroah-Hartman 	/* State variables */
1288aaad4303SSolomon Peachy 	unsigned int presniff_port_type;
1289aaad4303SSolomon Peachy 	u16 presniff_wepflags;
1290aaad4303SSolomon Peachy 	u32 dot11_desired_bss_type;
129100b3ed16SGreg Kroah-Hartman 
129200b3ed16SGreg Kroah-Hartman 	int dbmadjust;
129300b3ed16SGreg Kroah-Hartman 
129400b3ed16SGreg Kroah-Hartman 	/* Group Addresses - right now, there are up to a total
12955f0730fdSJuliana Rodrigues 	 * of MAX_GRP_ADDR group addresses
12965f0730fdSJuliana Rodrigues 	 */
129728b17a4bSMoritz Muehlenhoff 	u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN];
1298aaad4303SSolomon Peachy 	unsigned int dot11_grpcnt;
129900b3ed16SGreg Kroah-Hartman 
130000b3ed16SGreg Kroah-Hartman 	/* Component Identities */
13015f046456SSergio Paracuellos 	struct hfa384x_compident ident_nic;
13025f046456SSergio Paracuellos 	struct hfa384x_compident ident_pri_fw;
13035f046456SSergio Paracuellos 	struct hfa384x_compident ident_sta_fw;
13045f046456SSergio Paracuellos 	struct hfa384x_compident ident_ap_fw;
1305aaad4303SSolomon Peachy 	u16 mm_mods;
130600b3ed16SGreg Kroah-Hartman 
130700b3ed16SGreg Kroah-Hartman 	/* Supplier compatibility ranges */
130865f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_mfi;
130965f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_cfi;
131065f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_pri;
131165f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_sta;
131265f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_ap;
131300b3ed16SGreg Kroah-Hartman 
131400b3ed16SGreg Kroah-Hartman 	/* Actor compatibility ranges */
131565f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_pri_cfi; /*
131671508ee4SAlessandro Ghedini 						  * pri f/w to controller
131771508ee4SAlessandro Ghedini 						  * interface
131871508ee4SAlessandro Ghedini 						  */
131971508ee4SAlessandro Ghedini 
132065f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_sta_cfi; /*
132171508ee4SAlessandro Ghedini 						  * sta f/w to controller
132271508ee4SAlessandro Ghedini 						  * interface
132371508ee4SAlessandro Ghedini 						  */
132471508ee4SAlessandro Ghedini 
13257003e01aSTim Collier 	struct hfa384x_caplevel cap_act_sta_mfi; /*
13267003e01aSTim Collier 						  * sta f/w to modem interface
13277003e01aSTim Collier 						  */
132871508ee4SAlessandro Ghedini 
132965f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_ap_cfi;	/*
133071508ee4SAlessandro Ghedini 						 * ap f/w to controller
133171508ee4SAlessandro Ghedini 						 * interface
133271508ee4SAlessandro Ghedini 						 */
133371508ee4SAlessandro Ghedini 
133465f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_ap_mfi;	/* ap f/w to modem interface */
133500b3ed16SGreg Kroah-Hartman 
1336aaad4303SSolomon Peachy 	u32 psusercount;	/* Power save user count. */
1337b244edc6SJuliana Rodrigues 	struct hfa384x_comm_tallies_32 tallies;	/* Communication tallies. */
1338aaad4303SSolomon Peachy 	u8 comment[WLAN_COMMENT_MAX + 1];	/* User comment */
133900b3ed16SGreg Kroah-Hartman 
134000b3ed16SGreg Kroah-Hartman 	/* Channel Info request results (AP only) */
134100b3ed16SGreg Kroah-Hartman 	struct {
134200b3ed16SGreg Kroah-Hartman 		atomic_t done;
1343aaad4303SSolomon Peachy 		u8 count;
1344c447358aSSergio Paracuellos 		struct hfa384x_ch_info_result results;
134500b3ed16SGreg Kroah-Hartman 	} channel_info;
134600b3ed16SGreg Kroah-Hartman 
134760f5f3fbSJuliana Rodrigues 	struct hfa384x_inf_frame *scanresults;
134800b3ed16SGreg Kroah-Hartman 
13497003e01aSTim Collier 	struct prism2sta_authlist authlist;	/*
13507003e01aSTim Collier 						 * Authenticated station list.
13517003e01aSTim Collier 						 */
1352aaad4303SSolomon Peachy 	unsigned int accessmode;		/* Access mode. */
13534d10ece3SVatika Harlalka 	struct prism2sta_accesslist allow;	/* Allowed station list. */
13544d10ece3SVatika Harlalka 	struct prism2sta_accesslist deny;	/* Denied station list. */
135500b3ed16SGreg Kroah-Hartman 
13565a2214e2SSergio Paracuellos };
135700b3ed16SGreg Kroah-Hartman 
13585a2214e2SSergio Paracuellos void hfa384x_create(struct hfa384x *hw, struct usb_device *usb);
13595a2214e2SSergio Paracuellos void hfa384x_destroy(struct hfa384x *hw);
136000b3ed16SGreg Kroah-Hartman 
1361ffe5a0a1SBranden Bonaby int hfa384x_corereset(struct hfa384x *hw, int holdtime, int settletime,
1362ffe5a0a1SBranden Bonaby 		      int genesis);
13635a2214e2SSergio Paracuellos int hfa384x_drvr_disable(struct hfa384x *hw, u16 macport);
13645a2214e2SSergio Paracuellos int hfa384x_drvr_enable(struct hfa384x *hw, u16 macport);
13655a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_enable(struct hfa384x *hw);
13665a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_disable(struct hfa384x *hw);
13677003e01aSTim Collier int hfa384x_drvr_flashdl_write(struct hfa384x *hw, u32 daddr, void *buf,
13687003e01aSTim Collier 			       u32 len);
13695a2214e2SSergio Paracuellos int hfa384x_drvr_getconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
13705a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_enable(struct hfa384x *hw, u32 exeaddr);
13715a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_disable(struct hfa384x *hw);
13725a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
13735a2214e2SSergio Paracuellos int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len);
13745a2214e2SSergio Paracuellos int hfa384x_drvr_setconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
137500b3ed16SGreg Kroah-Hartman 
13767003e01aSTim Collier static inline int
13777003e01aSTim Collier hfa384x_drvr_getconfig16(struct hfa384x *hw, u16 rid, void *val)
137800b3ed16SGreg Kroah-Hartman {
137900b3ed16SGreg Kroah-Hartman 	int result = 0;
13807489df36SVeronika Kabatova 
1381aaad4303SSolomon Peachy 	result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
1382e573aaa4SMoritz Muehlenhoff 	if (result == 0)
1383e996024fSEric Salem 		le16_to_cpus(val);
138400b3ed16SGreg Kroah-Hartman 	return result;
138500b3ed16SGreg Kroah-Hartman }
138600b3ed16SGreg Kroah-Hartman 
13875a2214e2SSergio Paracuellos static inline int hfa384x_drvr_setconfig16(struct hfa384x *hw, u16 rid, u16 val)
138800b3ed16SGreg Kroah-Hartman {
1389e996024fSEric Salem 	__le16 value = cpu_to_le16(val);
13907489df36SVeronika Kabatova 
139100b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
139200b3ed16SGreg Kroah-Hartman }
139300b3ed16SGreg Kroah-Hartman 
139400b3ed16SGreg Kroah-Hartman int
13955a2214e2SSergio Paracuellos hfa384x_drvr_setconfig_async(struct hfa384x *hw,
1396aaad4303SSolomon Peachy 			     u16 rid,
139700b3ed16SGreg Kroah-Hartman 			     void *buf,
1398e573aaa4SMoritz Muehlenhoff 			     u16 len, ctlx_usercb_t usercb, void *usercb_data);
139900b3ed16SGreg Kroah-Hartman 
140000b3ed16SGreg Kroah-Hartman static inline int
14015a2214e2SSergio Paracuellos hfa384x_drvr_setconfig16_async(struct hfa384x *hw, u16 rid, u16 val)
140200b3ed16SGreg Kroah-Hartman {
1403a18ffdf4SAdrien Descamps 	__le16 value = cpu_to_le16(val);
14047489df36SVeronika Kabatova 
140500b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
140600b3ed16SGreg Kroah-Hartman 					    NULL, NULL);
140700b3ed16SGreg Kroah-Hartman }
140800b3ed16SGreg Kroah-Hartman 
14095a2214e2SSergio Paracuellos int hfa384x_drvr_start(struct hfa384x *hw);
14105a2214e2SSergio Paracuellos int hfa384x_drvr_stop(struct hfa384x *hw);
141100b3ed16SGreg Kroah-Hartman int
14125a2214e2SSergio Paracuellos hfa384x_drvr_txframe(struct hfa384x *hw, struct sk_buff *skb,
14136277fbfdSKees Cook 		     struct p80211_hdr *p80211_hdr,
1414f6b43c2eSSven Dziadek 		     struct p80211_metawep *p80211_wep);
1415c9573a8dSsayli karnik void hfa384x_tx_timeout(struct wlandevice *wlandev);
141600b3ed16SGreg Kroah-Hartman 
14175a2214e2SSergio Paracuellos int hfa384x_cmd_initialize(struct hfa384x *hw);
14185a2214e2SSergio Paracuellos int hfa384x_cmd_enable(struct hfa384x *hw, u16 macport);
14195a2214e2SSergio Paracuellos int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport);
14205a2214e2SSergio Paracuellos int hfa384x_cmd_allocate(struct hfa384x *hw, u16 len);
14215a2214e2SSergio Paracuellos int hfa384x_cmd_monitor(struct hfa384x *hw, u16 enable);
142200b3ed16SGreg Kroah-Hartman int
14235a2214e2SSergio Paracuellos hfa384x_cmd_download(struct hfa384x *hw,
1424e573aaa4SMoritz Muehlenhoff 		     u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
142500b3ed16SGreg Kroah-Hartman 
142600b3ed16SGreg Kroah-Hartman #endif /*__KERNEL__ */
142700b3ed16SGreg Kroah-Hartman 
142800b3ed16SGreg Kroah-Hartman #endif /*_HFA384x_H */
1429