100b3ed16SGreg Kroah-Hartman /* hfa384x.h
200b3ed16SGreg Kroah-Hartman  *
300b3ed16SGreg Kroah-Hartman  * Defines the constants and data structures for the hfa384x
400b3ed16SGreg Kroah-Hartman  *
500b3ed16SGreg Kroah-Hartman  * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
600b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
700b3ed16SGreg Kroah-Hartman  *
800b3ed16SGreg Kroah-Hartman  * linux-wlan
900b3ed16SGreg Kroah-Hartman  *
1000b3ed16SGreg Kroah-Hartman  *   The contents of this file are subject to the Mozilla Public
1100b3ed16SGreg Kroah-Hartman  *   License Version 1.1 (the "License"); you may not use this file
1200b3ed16SGreg Kroah-Hartman  *   except in compliance with the License. You may obtain a copy of
1300b3ed16SGreg Kroah-Hartman  *   the License at http://www.mozilla.org/MPL/
1400b3ed16SGreg Kroah-Hartman  *
1500b3ed16SGreg Kroah-Hartman  *   Software distributed under the License is distributed on an "AS
1600b3ed16SGreg Kroah-Hartman  *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
1700b3ed16SGreg Kroah-Hartman  *    implied. See the License for the specific language governing
1800b3ed16SGreg Kroah-Hartman  *   rights and limitations under the License.
1900b3ed16SGreg Kroah-Hartman  *
2000b3ed16SGreg Kroah-Hartman  *   Alternatively, the contents of this file may be used under the
2100b3ed16SGreg Kroah-Hartman  *   terms of the GNU Public License version 2 (the "GPL"), in which
2200b3ed16SGreg Kroah-Hartman  *   case the provisions of the GPL are applicable instead of the
2300b3ed16SGreg Kroah-Hartman  *   above.  If you wish to allow the use of your version of this file
2400b3ed16SGreg Kroah-Hartman  *   only under the terms of the GPL and not to allow others to use
2500b3ed16SGreg Kroah-Hartman  *   your version of this file under the MPL, indicate your decision
2600b3ed16SGreg Kroah-Hartman  *   by deleting the provisions above and replace them with the notice
2700b3ed16SGreg Kroah-Hartman  *   and other provisions required by the GPL.  If you do not delete
2800b3ed16SGreg Kroah-Hartman  *   the provisions above, a recipient may use your version of this
2900b3ed16SGreg Kroah-Hartman  *   file under either the MPL or the GPL.
3000b3ed16SGreg Kroah-Hartman  *
3100b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
3200b3ed16SGreg Kroah-Hartman  *
3300b3ed16SGreg Kroah-Hartman  * Inquiries regarding the linux-wlan Open Source project can be
3400b3ed16SGreg Kroah-Hartman  * made directly to:
3500b3ed16SGreg Kroah-Hartman  *
3600b3ed16SGreg Kroah-Hartman  * AbsoluteValue Systems Inc.
3700b3ed16SGreg Kroah-Hartman  * info@linux-wlan.com
3800b3ed16SGreg Kroah-Hartman  * http://www.linux-wlan.com
3900b3ed16SGreg Kroah-Hartman  *
4000b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
4100b3ed16SGreg Kroah-Hartman  *
4200b3ed16SGreg Kroah-Hartman  * Portions of the development of this software were funded by
4300b3ed16SGreg Kroah-Hartman  * Intersil Corporation as part of PRISM(R) chipset product development.
4400b3ed16SGreg Kroah-Hartman  *
4500b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
4600b3ed16SGreg Kroah-Hartman  *
4700b3ed16SGreg Kroah-Hartman  *   [Implementation and usage notes]
4800b3ed16SGreg Kroah-Hartman  *
4900b3ed16SGreg Kroah-Hartman  *   [References]
5000b3ed16SGreg Kroah-Hartman  *	CW10 Programmer's Manual v1.5
5100b3ed16SGreg Kroah-Hartman  *	IEEE 802.11 D10.0
5200b3ed16SGreg Kroah-Hartman  *
5300b3ed16SGreg Kroah-Hartman  * --------------------------------------------------------------------
5400b3ed16SGreg Kroah-Hartman  */
5500b3ed16SGreg Kroah-Hartman 
5600b3ed16SGreg Kroah-Hartman #ifndef _HFA384x_H
5700b3ed16SGreg Kroah-Hartman #define _HFA384x_H
5800b3ed16SGreg Kroah-Hartman 
5900b3ed16SGreg Kroah-Hartman #define HFA384x_FIRMWARE_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
6000b3ed16SGreg Kroah-Hartman 
6128b17a4bSMoritz Muehlenhoff #include <linux/if_ether.h>
622e380275SKumar Amit Mehta #include <linux/usb.h>
6328b17a4bSMoritz Muehlenhoff 
6400b3ed16SGreg Kroah-Hartman /*--- Mins & Maxs -----------------------------------*/
65aaad4303SSolomon Peachy #define	HFA384x_PORTID_MAX		((u16)7)
66aaad4303SSolomon Peachy #define	HFA384x_NUMPORTS_MAX		((u16)(HFA384x_PORTID_MAX + 1))
67aaad4303SSolomon Peachy #define	HFA384x_PDR_LEN_MAX		((u16)512) /* in bytes, from EK */
6876e3e7c4SKarl Relton #define	HFA384x_PDA_RECS_MAX		((u16)200) /* a guess */
69aaad4303SSolomon Peachy #define	HFA384x_PDA_LEN_MAX		((u16)1024) /* in bytes, from EK*/
70aaad4303SSolomon Peachy #define	HFA384x_SCANRESULT_MAX		((u16)31)
71aaad4303SSolomon Peachy #define	HFA384x_HSCANRESULT_MAX		((u16)31)
72aaad4303SSolomon Peachy #define	HFA384x_CHINFORESULT_MAX	((u16)16)
7300b3ed16SGreg Kroah-Hartman #define	HFA384x_RID_GUESSING_MAXLEN	2048	/* I'm not really sure */
7400b3ed16SGreg Kroah-Hartman #define	HFA384x_RIDDATA_MAXLEN		HFA384x_RID_GUESSING_MAXLEN
7500b3ed16SGreg Kroah-Hartman #define	HFA384x_USB_RWMEM_MAXLEN	2048
7600b3ed16SGreg Kroah-Hartman 
7700b3ed16SGreg Kroah-Hartman /*--- Support Constants -----------------------------*/
78aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_IBSS			((u16)0)
79aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_BSS			((u16)1)
80aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_PSUEDOIBSS		((u16)3)
817f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_PRIVINVOKED		((u16)BIT(0))
827f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_EXCLUDE		((u16)BIT(1))
837f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_DISABLE_TXCRYPT	((u16)BIT(4))
847f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_DISABLE_RXCRYPT	((u16)BIT(7))
85aaad4303SSolomon Peachy #define		HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM	((u16)3)
86aaad4303SSolomon Peachy #define		HFA384x_PORTSTATUS_DISABLED		((u16)1)
87aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_1			((u16)1)
88aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_2			((u16)2)
89aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_5dot5			((u16)4)
90aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_11			((u16)8)
9100b3ed16SGreg Kroah-Hartman 
9200b3ed16SGreg Kroah-Hartman /*--- MAC Internal memory constants and macros ------*/
9300b3ed16SGreg Kroah-Hartman /* masks and macros used to manipulate MAC internal memory addresses. */
9400b3ed16SGreg Kroah-Hartman /* MAC internal memory addresses are 23 bit quantities.  The MAC uses
9500b3ed16SGreg Kroah-Hartman  * a paged address space where the upper 16 bits are the page number
9600b3ed16SGreg Kroah-Hartman  * and the lower 7 bits are the offset.  There are various Host API
9700b3ed16SGreg Kroah-Hartman  * elements that require two 16-bit quantities to specify a MAC
9800b3ed16SGreg Kroah-Hartman  * internal memory address.  Unfortunately, some of the API's use a
9900b3ed16SGreg Kroah-Hartman  * page/offset format where the offset value is JUST the lower seven
10000b3ed16SGreg Kroah-Hartman  * bits and the page is  the remaining 16 bits.  Some of the API's
10100b3ed16SGreg Kroah-Hartman  * assume that the 23 bit address has been split at the 16th bit.  We
10200b3ed16SGreg Kroah-Hartman  * refer to these two formats as AUX format and CMD format.  The
10300b3ed16SGreg Kroah-Hartman  * macros below help handle some of this.
10400b3ed16SGreg Kroah-Hartman  */
10500b3ed16SGreg Kroah-Hartman 
10600b3ed16SGreg Kroah-Hartman /* Mask bits for discarding unwanted pieces in a flat address */
10700b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_AUX_PAGE_MASK	(0x007fff80)
10800b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_AUX_OFF_MASK	(0x0000007f)
10900b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_CMD_PAGE_MASK	(0xffff0000)
11000b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_CMD_OFF_MASK	(0x0000ffff)
11100b3ed16SGreg Kroah-Hartman 
112e573aaa4SMoritz Muehlenhoff /* Mask bits for discarding unwanted pieces in AUX format
11395842bc9SJuliana Rodrigues  * 16-bit address parts
11495842bc9SJuliana Rodrigues  */
11500b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_PAGE_MASK	(0xffff)
11600b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_OFF_MASK	(0x007f)
11700b3ed16SGreg Kroah-Hartman 
11800b3ed16SGreg Kroah-Hartman /* Make a 32-bit flat address from AUX format 16-bit page and offset */
11900b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_MKFLAT(p, o)	\
1205dd8acc8SSvenne Krap 		((((u32)(((u16)(p)) & HFA384x_ADDR_AUX_PAGE_MASK)) << 7) | \
1215dd8acc8SSvenne Krap 		((u32)(((u16)(o)) & HFA384x_ADDR_AUX_OFF_MASK)))
12200b3ed16SGreg Kroah-Hartman 
12300b3ed16SGreg Kroah-Hartman /* Make CMD format offset and page from a 32-bit flat address */
12400b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_CMD_MKPAGE(f) \
125aaad4303SSolomon Peachy 		((u16)((((u32)(f)) & HFA384x_ADDR_FLAT_CMD_PAGE_MASK) >> 16))
12600b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_CMD_MKOFF(f) \
127aaad4303SSolomon Peachy 		((u16)(((u32)(f)) & HFA384x_ADDR_FLAT_CMD_OFF_MASK))
12800b3ed16SGreg Kroah-Hartman 
12900b3ed16SGreg Kroah-Hartman /*--- Controller Memory addresses -------------------*/
13000b3ed16SGreg Kroah-Hartman #define		HFA3842_PDA_BASE	(0x007f0000UL)
13100b3ed16SGreg Kroah-Hartman #define		HFA3841_PDA_BASE	(0x003f0000UL)
13200b3ed16SGreg Kroah-Hartman #define		HFA3841_PDA_BOGUS_BASE	(0x00390000UL)
13300b3ed16SGreg Kroah-Hartman 
13400b3ed16SGreg Kroah-Hartman /*--- Driver Download states  -----------------------*/
13500b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_DISABLED		0
13600b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_RAMENABLED		1
13700b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_FLASHENABLED		2
13800b3ed16SGreg Kroah-Hartman 
13900b3ed16SGreg Kroah-Hartman /*--- Register Field Masks --------------------------*/
14071508ee4SAlessandro Ghedini #define		HFA384x_CMD_AINFO		((u16)(BIT(14) | BIT(13) \
14171508ee4SAlessandro Ghedini 							| BIT(12) | BIT(11) \
14271508ee4SAlessandro Ghedini 							| BIT(10) | BIT(9) \
14371508ee4SAlessandro Ghedini 							| BIT(8)))
14471508ee4SAlessandro Ghedini #define		HFA384x_CMD_MACPORT		((u16)(BIT(10) | BIT(9) | \
14571508ee4SAlessandro Ghedini 							BIT(8)))
1467f6e0e44SMoritz Muehlenhoff #define		HFA384x_CMD_PROGMODE		((u16)(BIT(9) | BIT(8)))
14771508ee4SAlessandro Ghedini #define		HFA384x_CMD_CMDCODE		((u16)(BIT(5) | BIT(4) | \
14871508ee4SAlessandro Ghedini 							BIT(3) | BIT(2) | \
14971508ee4SAlessandro Ghedini 							BIT(1) | BIT(0)))
15000b3ed16SGreg Kroah-Hartman 
15171508ee4SAlessandro Ghedini #define		HFA384x_STATUS_RESULT		((u16)(BIT(14) | BIT(13) \
15271508ee4SAlessandro Ghedini 							| BIT(12) | BIT(11) \
15371508ee4SAlessandro Ghedini 							| BIT(10) | BIT(9) \
15471508ee4SAlessandro Ghedini 							| BIT(8)))
15500b3ed16SGreg Kroah-Hartman 
15600b3ed16SGreg Kroah-Hartman /*--- Command Code Constants --------------------------*/
15700b3ed16SGreg Kroah-Hartman /*--- Controller Commands --------------------------*/
158aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INIT		((u16)0x00)
159aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_ENABLE		((u16)0x01)
160aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DISABLE		((u16)0x02)
16100b3ed16SGreg Kroah-Hartman 
16200b3ed16SGreg Kroah-Hartman /*--- Regulate Commands --------------------------*/
163aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INQ		((u16)0x11)
16400b3ed16SGreg Kroah-Hartman 
16500b3ed16SGreg Kroah-Hartman /*--- Configure Commands --------------------------*/
166aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DOWNLD		((u16)0x22)
16700b3ed16SGreg Kroah-Hartman 
16800b3ed16SGreg Kroah-Hartman /*--- Debugging Commands -----------------------------*/
169aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_MONITOR		((u16)(0x38))
170aaad4303SSolomon Peachy #define		HFA384x_MONITOR_ENABLE		((u16)(0x0b))
171aaad4303SSolomon Peachy #define		HFA384x_MONITOR_DISABLE		((u16)(0x0f))
17200b3ed16SGreg Kroah-Hartman 
17300b3ed16SGreg Kroah-Hartman /*--- Result Codes --------------------------*/
174aaad4303SSolomon Peachy #define		HFA384x_CMD_ERR			((u16)(0x7F))
17500b3ed16SGreg Kroah-Hartman 
17600b3ed16SGreg Kroah-Hartman /*--- Programming Modes --------------------------
1773e27dfa2SSergio Paracuellos  *	MODE 0: Disable programming
1783e27dfa2SSergio Paracuellos  *	MODE 1: Enable volatile memory programming
1793e27dfa2SSergio Paracuellos  *	MODE 2: Enable non-volatile memory programming
1803e27dfa2SSergio Paracuellos  *	MODE 3: Program non-volatile memory section
1813e27dfa2SSergio Paracuellos  *-------------------------------------------------
1823e27dfa2SSergio Paracuellos  */
183aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_DISABLE	((u16)0x00)
184aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_RAM		((u16)0x01)
185aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NV		((u16)0x02)
186aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NVWRITE	((u16)0x03)
18700b3ed16SGreg Kroah-Hartman 
18800b3ed16SGreg Kroah-Hartman /*--- Record ID Constants --------------------------*/
18900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
1903e27dfa2SSergio Paracuellos  * Configuration RIDs: Network Parameters, Static Configuration Entities
1913e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
1923e27dfa2SSergio Paracuellos  */
193aaad4303SSolomon Peachy #define		HFA384x_RID_CNFPORTTYPE		((u16)0xFC00)
194aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR	((u16)0xFC01)
195aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID	((u16)0xFC02)
196aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNCHANNEL	((u16)0xFC03)
197aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID		((u16)0xFC04)
198aaad4303SSolomon Peachy #define		HFA384x_RID_CNFMAXDATALEN	((u16)0xFC07)
19900b3ed16SGreg Kroah-Hartman 
20000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2013e27dfa2SSergio Paracuellos  * Configuration RID lengths: Network Params, Static Config Entities
2023e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
2033e27dfa2SSergio Paracuellos  * include the len or code fields)
2043e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2053e27dfa2SSergio Paracuellos  */
206aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR_LEN	((u16)6)
207aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID_LEN	((u16)34)
208aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID_LEN	((u16)34)
20900b3ed16SGreg Kroah-Hartman 
21000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2113e27dfa2SSergio Paracuellos  * Configuration RIDs: Network Parameters, Dynamic Configuration Entities
2123e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2133e27dfa2SSergio Paracuellos  */
214aaad4303SSolomon Peachy #define		HFA384x_RID_CREATEIBSS		((u16)0xFC81)
215aaad4303SSolomon Peachy #define		HFA384x_RID_FRAGTHRESH		((u16)0xFC82)
216aaad4303SSolomon Peachy #define		HFA384x_RID_RTSTHRESH		((u16)0xFC83)
217aaad4303SSolomon Peachy #define		HFA384x_RID_TXRATECNTL		((u16)0xFC84)
218aaad4303SSolomon Peachy #define		HFA384x_RID_PROMISCMODE		((u16)0xFC85)
21900b3ed16SGreg Kroah-Hartman 
22000b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
2213e27dfa2SSergio Paracuellos  * Information RIDs: NIC Information
2223e27dfa2SSergio Paracuellos  *----------------------------------------------------------------------
2233e27dfa2SSergio Paracuellos  */
224aaad4303SSolomon Peachy #define		HFA384x_RID_MAXLOADTIME		((u16)0xFD00)
225aaad4303SSolomon Peachy #define		HFA384x_RID_DOWNLOADBUFFER	((u16)0xFD01)
226aaad4303SSolomon Peachy #define		HFA384x_RID_PRIIDENTITY		((u16)0xFD02)
227aaad4303SSolomon Peachy #define		HFA384x_RID_PRISUPRANGE		((u16)0xFD03)
228aaad4303SSolomon Peachy #define		HFA384x_RID_PRI_CFIACTRANGES	((u16)0xFD04)
229aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER	((u16)0xFD0A)
230aaad4303SSolomon Peachy #define		HFA384x_RID_NICIDENTITY		((u16)0xFD0B)
231aaad4303SSolomon Peachy #define		HFA384x_RID_MFISUPRANGE		((u16)0xFD0C)
232aaad4303SSolomon Peachy #define		HFA384x_RID_CFISUPRANGE		((u16)0xFD0D)
233aaad4303SSolomon Peachy #define		HFA384x_RID_STAIDENTITY		((u16)0xFD20)
234aaad4303SSolomon Peachy #define		HFA384x_RID_STASUPRANGE		((u16)0xFD21)
235aaad4303SSolomon Peachy #define		HFA384x_RID_STA_MFIACTRANGES	((u16)0xFD22)
236aaad4303SSolomon Peachy #define		HFA384x_RID_STA_CFIACTRANGES	((u16)0xFD23)
23700b3ed16SGreg Kroah-Hartman 
23800b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
2393e27dfa2SSergio Paracuellos  * Information RID Lengths: NIC Information
2403e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
2413e27dfa2SSergio Paracuellos  * include the len or code fields)
2423e27dfa2SSergio Paracuellos  *---------------------------------------------------------------------
2433e27dfa2SSergio Paracuellos  */
244aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER_LEN		((u16)12)
24500b3ed16SGreg Kroah-Hartman 
24600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2473e27dfa2SSergio Paracuellos  * Information RIDs:  MAC Information
2483e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2493e27dfa2SSergio Paracuellos  */
250aaad4303SSolomon Peachy #define		HFA384x_RID_PORTSTATUS		((u16)0xFD40)
251aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTSSID		((u16)0xFD41)
252aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTBSSID	((u16)0xFD42)
253aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTTXRATE	((u16)0xFD44)
254aaad4303SSolomon Peachy #define		HFA384x_RID_SHORTRETRYLIMIT	((u16)0xFD48)
255aaad4303SSolomon Peachy #define		HFA384x_RID_LONGRETRYLIMIT	((u16)0xFD49)
256aaad4303SSolomon Peachy #define		HFA384x_RID_MAXTXLIFETIME	((u16)0xFD4A)
257aaad4303SSolomon Peachy #define		HFA384x_RID_PRIVACYOPTIMP	((u16)0xFD4F)
258aaad4303SSolomon Peachy #define		HFA384x_RID_DBMCOMMSQUALITY	((u16)0xFD51)
25900b3ed16SGreg Kroah-Hartman 
26000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2613e27dfa2SSergio Paracuellos  * Information RID Lengths:  MAC Information
2623e27dfa2SSergio Paracuellos  * This is the length of JUST the DATA part of the RID (does not
2633e27dfa2SSergio Paracuellos  * include the len or code fields)
2643e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2653e27dfa2SSergio Paracuellos  */
26671508ee4SAlessandro Ghedini #define		HFA384x_RID_DBMCOMMSQUALITY_LEN	 \
26762e493c4SSergio Paracuellos 	((u16)sizeof(struct hfa384x_dbmcommsquality))
26871508ee4SAlessandro Ghedini #define		HFA384x_RID_JOINREQUEST_LEN \
269de3dc47cSJuliana Rodrigues 	((u16)sizeof(struct hfa384x_join_request_data))
27040a67411SMoritz Muehlenhoff 
27100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2723e27dfa2SSergio Paracuellos  * Information RIDs:  Modem Information
2733e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2743e27dfa2SSergio Paracuellos  */
275aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTCHANNEL	((u16)0xFDC1)
27600b3ed16SGreg Kroah-Hartman 
27700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
2783e27dfa2SSergio Paracuellos  * API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
2793e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
2803e27dfa2SSergio Paracuellos  */
281aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEYID	((u16)0xFC23)
282aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY0	((u16)0xFC24)
283aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY1	((u16)0xFC25)
284aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY2	((u16)0xFC26)
285aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY3	((u16)0xFC27)
286aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPFLAGS		((u16)0xFC28)
287aaad4303SSolomon Peachy #define		HFA384x_RID_CNFAUTHENTICATION	((u16)0xFC2A)
288aaad4303SSolomon Peachy #define		HFA384x_RID_CNFROAMINGMODE	((u16)0xFC2D)
289b937612fSSergio Paracuellos #define		HFA384x_RID_CNFAPBCNINT		((u16)0xFC33)
290e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFDBMADJUST	((u16)0xFC46)
291e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFWPADATA		((u16)0xFC48)
292aaad4303SSolomon Peachy #define		HFA384x_RID_CNFBASICRATES	((u16)0xFCB3)
293aaad4303SSolomon Peachy #define		HFA384x_RID_CNFSUPPRATES	((u16)0xFCB4)
294e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_CNFPASSIVESCANCTRL	((u16)0xFCBA)
295e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_TXPOWERMAX		((u16)0xFCBE)
296aaad4303SSolomon Peachy #define		HFA384x_RID_JOINREQUEST		((u16)0xFCE2)
297aaad4303SSolomon Peachy #define		HFA384x_RID_AUTHENTICATESTA	((u16)0xFCE3)
298e573aaa4SMoritz Muehlenhoff #define		HFA384x_RID_HOSTSCAN		((u16)0xFCE5)
29900b3ed16SGreg Kroah-Hartman 
300aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY_LEN	((u16)6)
301aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEP128DEFAULTKEY_LEN	((u16)14)
30240a67411SMoritz Muehlenhoff 
30300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
3043e27dfa2SSergio Paracuellos  * PD Record codes
3053e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
3063e27dfa2SSergio Paracuellos  */
307aaad4303SSolomon Peachy #define HFA384x_PDR_PCB_PARTNUM		((u16)0x0001)
308aaad4303SSolomon Peachy #define HFA384x_PDR_PDAVER		((u16)0x0002)
309aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_SERIAL		((u16)0x0003)
310aaad4303SSolomon Peachy #define HFA384x_PDR_MKK_MEASUREMENTS	((u16)0x0004)
311aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_RAMSIZE		((u16)0x0005)
312aaad4303SSolomon Peachy #define HFA384x_PDR_MFISUPRANGE		((u16)0x0006)
313aaad4303SSolomon Peachy #define HFA384x_PDR_CFISUPRANGE		((u16)0x0007)
314aaad4303SSolomon Peachy #define HFA384x_PDR_NICID		((u16)0x0008)
315aaad4303SSolomon Peachy #define HFA384x_PDR_MAC_ADDRESS		((u16)0x0101)
316aaad4303SSolomon Peachy #define HFA384x_PDR_REGDOMAIN		((u16)0x0103)
317aaad4303SSolomon Peachy #define HFA384x_PDR_ALLOWED_CHANNEL	((u16)0x0104)
318aaad4303SSolomon Peachy #define HFA384x_PDR_DEFAULT_CHANNEL	((u16)0x0105)
319aaad4303SSolomon Peachy #define HFA384x_PDR_TEMPTYPE		((u16)0x0107)
320aaad4303SSolomon Peachy #define HFA384x_PDR_IFR_SETTING		((u16)0x0200)
321aaad4303SSolomon Peachy #define HFA384x_PDR_RFR_SETTING		((u16)0x0201)
322aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_BASELINE	((u16)0x0202)
323aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_SHADOW	((u16)0x0203)
324aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_IFRF	((u16)0x0204)
325aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALSP	((u16)0x0300)
326aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALI	((u16)0x0301)
327aaad4303SSolomon Peachy #define HFA384x_PDR_MAX_TX_POWER	((u16)0x0302)
328aaad4303SSolomon Peachy #define HFA384x_PDR_MASTER_CHAN_LIST	((u16)0x0303)
329aaad4303SSolomon Peachy #define HFA384x_PDR_3842_NIC_CONFIG	((u16)0x0400)
330aaad4303SSolomon Peachy #define HFA384x_PDR_USB_ID		((u16)0x0401)
331aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_ID		((u16)0x0402)
332aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_IFCONF		((u16)0x0403)
333aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_PMCONF		((u16)0x0404)
334aaad4303SSolomon Peachy #define HFA384x_PDR_RFENRGY		((u16)0x0406)
335aaad4303SSolomon Peachy #define HFA384x_PDR_USB_POWER_TYPE      ((u16)0x0407)
336aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MAX_POWER	((u16)0x0409)
337aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MANUFACTURER	((u16)0x0410)
338aaad4303SSolomon Peachy #define HFA384x_PDR_USB_PRODUCT		((u16)0x0411)
339aaad4303SSolomon Peachy #define HFA384x_PDR_ANT_DIVERSITY	((u16)0x0412)
340aaad4303SSolomon Peachy #define HFA384x_PDR_HFO_DELAY		((u16)0x0413)
341aaad4303SSolomon Peachy #define HFA384x_PDR_SCALE_THRESH	((u16)0x0414)
34200b3ed16SGreg Kroah-Hartman 
343aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTSP	((u16)0x0900)
344aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTI	((u16)0x0901)
345aaad4303SSolomon Peachy #define HFA384x_PDR_END_OF_PDA		((u16)0x0000)
34600b3ed16SGreg Kroah-Hartman 
34700b3ed16SGreg Kroah-Hartman /*--- Register Test/Get/Set Field macros ------------------------*/
34800b3ed16SGreg Kroah-Hartman 
349aaad4303SSolomon Peachy #define		HFA384x_CMD_AINFO_SET(value)	((u16)((u16)(value) << 8))
35071508ee4SAlessandro Ghedini #define		HFA384x_CMD_MACPORT_SET(value)	\
35171508ee4SAlessandro Ghedini 			((u16)HFA384x_CMD_AINFO_SET(value))
35271508ee4SAlessandro Ghedini #define		HFA384x_CMD_PROGMODE_SET(value)	\
35371508ee4SAlessandro Ghedini 			((u16)HFA384x_CMD_AINFO_SET((u16)value))
354aaad4303SSolomon Peachy #define		HFA384x_CMD_CMDCODE_SET(value)		((u16)(value))
35500b3ed16SGreg Kroah-Hartman 
356aaad4303SSolomon Peachy #define		HFA384x_STATUS_RESULT_SET(value)	(((u16)(value)) << 8)
35700b3ed16SGreg Kroah-Hartman 
35800b3ed16SGreg Kroah-Hartman /* Host Maintained State Info */
35900b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_PREINIT	0
36000b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_INIT	1
36100b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_RUNNING	2
36200b3ed16SGreg Kroah-Hartman 
36300b3ed16SGreg Kroah-Hartman /*-------------------------------------------------------------*/
36400b3ed16SGreg Kroah-Hartman /* Commonly used basic types */
365b2119911SHimangi Saraogi struct hfa384x_bytestr {
366aaad4303SSolomon Peachy 	u16 len;
367aaad4303SSolomon Peachy 	u8 data[0];
368b2119911SHimangi Saraogi } __packed;
36900b3ed16SGreg Kroah-Hartman 
37003c2975bSSergio Paracuellos struct hfa384x_bytestr32 {
371aaad4303SSolomon Peachy 	u16 len;
372aaad4303SSolomon Peachy 	u8 data[32];
37303c2975bSSergio Paracuellos } __packed;
37400b3ed16SGreg Kroah-Hartman 
37500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
3763e27dfa2SSergio Paracuellos  * Configuration Record Structures:
3773e27dfa2SSergio Paracuellos  *	Network Parameters, Static Configuration Entities
3783e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
3793e27dfa2SSergio Paracuellos  */
38000b3ed16SGreg Kroah-Hartman 
38100b3ed16SGreg Kroah-Hartman /*-- Hardware/Firmware Component Information ----------*/
3825f046456SSergio Paracuellos struct hfa384x_compident {
383aaad4303SSolomon Peachy 	u16 id;
384aaad4303SSolomon Peachy 	u16 variant;
385aaad4303SSolomon Peachy 	u16 major;
386aaad4303SSolomon Peachy 	u16 minor;
3875f046456SSergio Paracuellos } __packed;
38800b3ed16SGreg Kroah-Hartman 
38965f170c6SSergio Paracuellos struct hfa384x_caplevel {
390aaad4303SSolomon Peachy 	u16 role;
391aaad4303SSolomon Peachy 	u16 id;
392aaad4303SSolomon Peachy 	u16 variant;
393aaad4303SSolomon Peachy 	u16 bottom;
394aaad4303SSolomon Peachy 	u16 top;
39565f170c6SSergio Paracuellos } __packed;
39600b3ed16SGreg Kroah-Hartman 
39700b3ed16SGreg Kroah-Hartman /*-- Configuration Record: cnfAuthentication --*/
39800b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM	0x0001
39900b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_SHAREDKEY	0x0002
40000b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_LEAP		0x0004
40100b3ed16SGreg Kroah-Hartman 
40200b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4033e27dfa2SSergio Paracuellos  * Configuration Record Structures:
4043e27dfa2SSergio Paracuellos  *	Network Parameters, Dynamic Configuration Entities
4053e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4063e27dfa2SSergio Paracuellos  */
40700b3ed16SGreg Kroah-Hartman 
40800b3ed16SGreg Kroah-Hartman #define HFA384x_CREATEIBSS_JOINCREATEIBSS          0
40900b3ed16SGreg Kroah-Hartman 
41000b3ed16SGreg Kroah-Hartman /*-- Configuration Record: HostScanRequest (data portion only) --*/
411e474b4d4SSergio Paracuellos struct hfa384x_host_scan_request_data {
412e474b4d4SSergio Paracuellos 	u16 channel_list;
413e474b4d4SSergio Paracuellos 	u16 tx_rate;
41403c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
415935cbfb2SSergio Paracuellos } __packed;
41600b3ed16SGreg Kroah-Hartman 
41700b3ed16SGreg Kroah-Hartman /*-- Configuration Record: JoinRequest (data portion only) --*/
418de3dc47cSJuliana Rodrigues struct hfa384x_join_request_data {
419aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
420aaad4303SSolomon Peachy 	u16 channel;
421f0ffa0e2SSergio Paracuellos } __packed;
42200b3ed16SGreg Kroah-Hartman 
42300b3ed16SGreg Kroah-Hartman /*-- Configuration Record: authenticateStation (data portion only) --*/
4244c976b16SJuliana Rodrigues struct hfa384x_authenticate_station_data {
42528b17a4bSMoritz Muehlenhoff 	u8 address[ETH_ALEN];
426aaad4303SSolomon Peachy 	u16 status;
427aaad4303SSolomon Peachy 	u16 algorithm;
42817fb19f0SSergio Paracuellos } __packed;
42900b3ed16SGreg Kroah-Hartman 
43000b3ed16SGreg Kroah-Hartman /*-- Configuration Record: WPAData       (data portion only) --*/
431162da263SSergio Paracuellos struct hfa384x_wpa_data {
432aaad4303SSolomon Peachy 	u16 datalen;
4335dd8acc8SSvenne Krap 	u8 data[0];		/* max 80 */
434a2a44803SSergio Paracuellos } __packed;
43500b3ed16SGreg Kroah-Hartman 
43600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4373e27dfa2SSergio Paracuellos  * Information Record Structures: NIC Information
4383e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4393e27dfa2SSergio Paracuellos  */
44000b3ed16SGreg Kroah-Hartman 
44100b3ed16SGreg Kroah-Hartman /*-- Information Record: DownLoadBuffer --*/
44200b3ed16SGreg Kroah-Hartman /* NOTE: The page and offset are in AUX format */
443b71db740SSergio Paracuellos struct hfa384x_downloadbuffer {
444aaad4303SSolomon Peachy 	u16 page;
445aaad4303SSolomon Peachy 	u16 offset;
446aaad4303SSolomon Peachy 	u16 len;
447b71db740SSergio Paracuellos } __packed;
44800b3ed16SGreg Kroah-Hartman 
44900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4503e27dfa2SSergio Paracuellos  * Information Record Structures: NIC Information
4513e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4523e27dfa2SSergio Paracuellos  */
45300b3ed16SGreg Kroah-Hartman 
454aaad4303SSolomon Peachy #define HFA384x_PSTATUS_CONN_IBSS	((u16)3)
45500b3ed16SGreg Kroah-Hartman 
45600b3ed16SGreg Kroah-Hartman /*-- Information Record: commsquality --*/
457a1e95045SSergio Paracuellos struct hfa384x_commsquality {
4581680202cSJuliana Rodrigues 	u16 cq_curr_bss;
4590e771659SJuliana Rodrigues 	u16 asl_curr_bss;
4606b6f9491SJuliana Rodrigues 	u16 anl_curr_fc;
461a1e95045SSergio Paracuellos } __packed;
46200b3ed16SGreg Kroah-Hartman 
46300b3ed16SGreg Kroah-Hartman /*-- Information Record: dmbcommsquality --*/
46462e493c4SSergio Paracuellos struct hfa384x_dbmcommsquality {
465c08510e1SSergio Paracuellos 	u16 cq_dbm_curr_bss;
466c08510e1SSergio Paracuellos 	u16 asl_dbm_curr_bss;
467c08510e1SSergio Paracuellos 	u16 anl_dbm_curr_fc;
46862e493c4SSergio Paracuellos } __packed;
46900b3ed16SGreg Kroah-Hartman 
47000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
4713e27dfa2SSergio Paracuellos  * FRAME STRUCTURES: Communication Frames
4723e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4733e27dfa2SSergio Paracuellos  * Communication Frames: Transmit Frames
4743e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
4753e27dfa2SSergio Paracuellos  */
47600b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Transmit Frame Structure --*/
477eb76afc9SSergio Paracuellos struct hfa384x_tx_frame {
478aaad4303SSolomon Peachy 	u16 status;
479aaad4303SSolomon Peachy 	u16 reserved1;
480aaad4303SSolomon Peachy 	u16 reserved2;
481aaad4303SSolomon Peachy 	u32 sw_support;
482aaad4303SSolomon Peachy 	u8 tx_retrycount;
483aaad4303SSolomon Peachy 	u8 tx_rate;
484aaad4303SSolomon Peachy 	u16 tx_control;
48500b3ed16SGreg Kroah-Hartman 
48600b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information --*/
48700b3ed16SGreg Kroah-Hartman 
488aaad4303SSolomon Peachy 	u16 frame_control;
489aaad4303SSolomon Peachy 	u16 duration_id;
490aaad4303SSolomon Peachy 	u8 address1[6];
491aaad4303SSolomon Peachy 	u8 address2[6];
492aaad4303SSolomon Peachy 	u8 address3[6];
493aaad4303SSolomon Peachy 	u16 sequence_control;
494aaad4303SSolomon Peachy 	u8 address4[6];
495aaad4303SSolomon Peachy 	u16 data_len;		/* little endian format */
49600b3ed16SGreg Kroah-Hartman 
49700b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
49800b3ed16SGreg Kroah-Hartman 
499aaad4303SSolomon Peachy 	u8 dest_addr[6];
500aaad4303SSolomon Peachy 	u8 src_addr[6];
501aaad4303SSolomon Peachy 	u16 data_length;	/* big endian format */
502eb76afc9SSergio Paracuellos } __packed;
50300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5043e27dfa2SSergio Paracuellos  * Communication Frames: Field Masks for Transmit Frames
5053e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5063e27dfa2SSergio Paracuellos  */
50700b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
5087f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_ACKERR			((u16)BIT(5))
5097f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_FORMERR		((u16)BIT(3))
5107f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_DISCON			((u16)BIT(2))
5117f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_AGEDERR		((u16)BIT(1))
5127f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_RETRYERR		((u16)BIT(0))
51300b3ed16SGreg Kroah-Hartman /*-- Transmit Control Field --*/
51471508ee4SAlessandro Ghedini #define		HFA384x_TX_MACPORT			((u16)(BIT(10) | \
51571508ee4SAlessandro Ghedini 							  BIT(9) | BIT(8)))
5167f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_STRUCTYPE			((u16)(BIT(4) | BIT(3)))
5177f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXEX				((u16)BIT(2))
5187f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXOK				((u16)BIT(1))
51900b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5203e27dfa2SSergio Paracuellos  * Communication Frames: Test/Get/Set Field Values for Transmit Frames
5213e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5223e27dfa2SSergio Paracuellos  */
52300b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
52400b3ed16SGreg Kroah-Hartman #define HFA384x_TXSTATUS_ISERROR(v)	\
525aaad4303SSolomon Peachy 	(((u16)(v)) & \
52600b3ed16SGreg Kroah-Hartman 	(HFA384x_TXSTATUS_ACKERR | HFA384x_TXSTATUS_FORMERR | \
52700b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_DISCON | HFA384x_TXSTATUS_AGEDERR | \
52800b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_RETRYERR))
52900b3ed16SGreg Kroah-Hartman 
530aaad4303SSolomon Peachy #define	HFA384x_TX_SET(v, m, s)		((((u16)(v)) << ((u16)(s))) & ((u16)(m)))
53100b3ed16SGreg Kroah-Hartman 
53200b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_MACPORT_SET(v)	HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
53371508ee4SAlessandro Ghedini #define	HFA384x_TX_STRUCTYPE_SET(v)	HFA384x_TX_SET(v, \
53471508ee4SAlessandro Ghedini 						HFA384x_TX_STRUCTYPE, 3)
53500b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXEX_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
53600b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXOK_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
53700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5383e27dfa2SSergio Paracuellos  * Communication Frames: Receive Frames
5393e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5403e27dfa2SSergio Paracuellos  */
54100b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Receive Frame Structure --*/
54270adf509SSergio Paracuellos struct hfa384x_rx_frame {
54300b3ed16SGreg Kroah-Hartman 	/*-- MAC rx descriptor (hfa384x byte order) --*/
544aaad4303SSolomon Peachy 	u16 status;
545aaad4303SSolomon Peachy 	u32 time;
546aaad4303SSolomon Peachy 	u8 silence;
547aaad4303SSolomon Peachy 	u8 signal;
548aaad4303SSolomon Peachy 	u8 rate;
549aaad4303SSolomon Peachy 	u8 rx_flow;
550aaad4303SSolomon Peachy 	u16 reserved1;
551aaad4303SSolomon Peachy 	u16 reserved2;
55200b3ed16SGreg Kroah-Hartman 
55300b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information (802.11 byte order) --*/
5548cbe56e0SHimangi Saraogi 	__le16 frame_control;
555aaad4303SSolomon Peachy 	u16 duration_id;
556aaad4303SSolomon Peachy 	u8 address1[6];
557aaad4303SSolomon Peachy 	u8 address2[6];
558aaad4303SSolomon Peachy 	u8 address3[6];
559aaad4303SSolomon Peachy 	u16 sequence_control;
560aaad4303SSolomon Peachy 	u8 address4[6];
5618cbe56e0SHimangi Saraogi 	__le16 data_len;		/* hfa384x (little endian) format */
56200b3ed16SGreg Kroah-Hartman 
56300b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
564aaad4303SSolomon Peachy 	u8 dest_addr[6];
565aaad4303SSolomon Peachy 	u8 src_addr[6];
566aaad4303SSolomon Peachy 	u16 data_length;	/* IEEE? (big endian) format */
56770adf509SSergio Paracuellos } __packed;
56800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5693e27dfa2SSergio Paracuellos  * Communication Frames: Field Masks for Receive Frames
5703e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5713e27dfa2SSergio Paracuellos  */
57200b3ed16SGreg Kroah-Hartman 
57300b3ed16SGreg Kroah-Hartman /*-- Status Fields --*/
57471508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_MACPORT		((u16)(BIT(10) | \
57571508ee4SAlessandro Ghedini 								BIT(9) | \
57671508ee4SAlessandro Ghedini 								BIT(8)))
5777f6e0e44SMoritz Muehlenhoff #define		HFA384x_RXSTATUS_FCSERR			((u16)BIT(0))
57800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5793e27dfa2SSergio Paracuellos  * Communication Frames: Test/Get/Set Field Values for Receive Frames
5803e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5813e27dfa2SSergio Paracuellos  */
58271508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_MACPORT_GET(value)	((u16)((((u16)(value)) \
58371508ee4SAlessandro Ghedini 					    & HFA384x_RXSTATUS_MACPORT) >> 8))
58471508ee4SAlessandro Ghedini #define		HFA384x_RXSTATUS_ISFCSERR(value)	((u16)(((u16)(value)) \
58571508ee4SAlessandro Ghedini 						  & HFA384x_RXSTATUS_FCSERR))
58600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
5873e27dfa2SSergio Paracuellos  * FRAME STRUCTURES: Information Types and Information Frame Structures
5883e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5893e27dfa2SSergio Paracuellos  * Information Types
5903e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
5913e27dfa2SSergio Paracuellos  */
592aaad4303SSolomon Peachy #define		HFA384x_IT_HANDOVERADDR			((u16)0xF000UL)
593aaad4303SSolomon Peachy #define		HFA384x_IT_COMMTALLIES			((u16)0xF100UL)
594aaad4303SSolomon Peachy #define		HFA384x_IT_SCANRESULTS			((u16)0xF101UL)
595aaad4303SSolomon Peachy #define		HFA384x_IT_CHINFORESULTS		((u16)0xF102UL)
596aaad4303SSolomon Peachy #define		HFA384x_IT_HOSTSCANRESULTS		((u16)0xF103UL)
597aaad4303SSolomon Peachy #define		HFA384x_IT_LINKSTATUS			((u16)0xF200UL)
598aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCSTATUS			((u16)0xF201UL)
599aaad4303SSolomon Peachy #define		HFA384x_IT_AUTHREQ			((u16)0xF202UL)
600aaad4303SSolomon Peachy #define		HFA384x_IT_PSUSERCNT			((u16)0xF203UL)
601aaad4303SSolomon Peachy #define		HFA384x_IT_KEYIDCHANGED			((u16)0xF204UL)
602aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCREQ			((u16)0xF205UL)
603aaad4303SSolomon Peachy #define		HFA384x_IT_MICFAILURE			((u16)0xF206UL)
60400b3ed16SGreg Kroah-Hartman 
60500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
6063e27dfa2SSergio Paracuellos  * Information Frames Structures
6073e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
6083e27dfa2SSergio Paracuellos  * Information Frames: Notification Frame Structures
6093e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
6103e27dfa2SSergio Paracuellos  */
61100b3ed16SGreg Kroah-Hartman 
61200b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Communication Tallies --*/
6134cc454f2SSergio Paracuellos struct hfa384x_comm_tallies_16 {
614aaad4303SSolomon Peachy 	u16 txunicastframes;
615aaad4303SSolomon Peachy 	u16 txmulticastframes;
616aaad4303SSolomon Peachy 	u16 txfragments;
617aaad4303SSolomon Peachy 	u16 txunicastoctets;
618aaad4303SSolomon Peachy 	u16 txmulticastoctets;
619aaad4303SSolomon Peachy 	u16 txdeferredtrans;
620aaad4303SSolomon Peachy 	u16 txsingleretryframes;
621aaad4303SSolomon Peachy 	u16 txmultipleretryframes;
622aaad4303SSolomon Peachy 	u16 txretrylimitexceeded;
623aaad4303SSolomon Peachy 	u16 txdiscards;
624aaad4303SSolomon Peachy 	u16 rxunicastframes;
625aaad4303SSolomon Peachy 	u16 rxmulticastframes;
626aaad4303SSolomon Peachy 	u16 rxfragments;
627aaad4303SSolomon Peachy 	u16 rxunicastoctets;
628aaad4303SSolomon Peachy 	u16 rxmulticastoctets;
629aaad4303SSolomon Peachy 	u16 rxfcserrors;
630aaad4303SSolomon Peachy 	u16 rxdiscardsnobuffer;
631aaad4303SSolomon Peachy 	u16 txdiscardswrongsa;
632aaad4303SSolomon Peachy 	u16 rxdiscardswepundecr;
633aaad4303SSolomon Peachy 	u16 rxmsginmsgfrag;
634aaad4303SSolomon Peachy 	u16 rxmsginbadmsgfrag;
63507e23b67SSergio Paracuellos } __packed;
63600b3ed16SGreg Kroah-Hartman 
637b244edc6SJuliana Rodrigues struct hfa384x_comm_tallies_32 {
638aaad4303SSolomon Peachy 	u32 txunicastframes;
639aaad4303SSolomon Peachy 	u32 txmulticastframes;
640aaad4303SSolomon Peachy 	u32 txfragments;
641aaad4303SSolomon Peachy 	u32 txunicastoctets;
642aaad4303SSolomon Peachy 	u32 txmulticastoctets;
643aaad4303SSolomon Peachy 	u32 txdeferredtrans;
644aaad4303SSolomon Peachy 	u32 txsingleretryframes;
645aaad4303SSolomon Peachy 	u32 txmultipleretryframes;
646aaad4303SSolomon Peachy 	u32 txretrylimitexceeded;
647aaad4303SSolomon Peachy 	u32 txdiscards;
648aaad4303SSolomon Peachy 	u32 rxunicastframes;
649aaad4303SSolomon Peachy 	u32 rxmulticastframes;
650aaad4303SSolomon Peachy 	u32 rxfragments;
651aaad4303SSolomon Peachy 	u32 rxunicastoctets;
652aaad4303SSolomon Peachy 	u32 rxmulticastoctets;
653aaad4303SSolomon Peachy 	u32 rxfcserrors;
654aaad4303SSolomon Peachy 	u32 rxdiscardsnobuffer;
655aaad4303SSolomon Peachy 	u32 txdiscardswrongsa;
656aaad4303SSolomon Peachy 	u32 rxdiscardswepundecr;
657aaad4303SSolomon Peachy 	u32 rxmsginmsgfrag;
658aaad4303SSolomon Peachy 	u32 rxmsginbadmsgfrag;
659cfc6cb1fSSergio Paracuellos } __packed;
66000b3ed16SGreg Kroah-Hartman 
66100b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Scan Results & Subfields--*/
662b263dd5eSJuliana Rodrigues struct hfa384x_scan_result_sub {
663aaad4303SSolomon Peachy 	u16 chid;
664aaad4303SSolomon Peachy 	u16 anl;
665aaad4303SSolomon Peachy 	u16 sl;
666aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
667aaad4303SSolomon Peachy 	u16 bcnint;
668aaad4303SSolomon Peachy 	u16 capinfo;
66903c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
670aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
671aaad4303SSolomon Peachy 	u16 proberesp_rate;
6724400334bSSergio Paracuellos } __packed;
67300b3ed16SGreg Kroah-Hartman 
674040a7bd4SJuliana Rodrigues struct hfa384x_scan_result {
675aaad4303SSolomon Peachy 	u16 rsvd;
676aaad4303SSolomon Peachy 	u16 scanreason;
677b263dd5eSJuliana Rodrigues 	struct hfa384x_scan_result_sub result[HFA384x_SCANRESULT_MAX];
678dc0bb002SSergio Paracuellos } __packed;
67900b3ed16SGreg Kroah-Hartman 
68000b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
681e35baeb0SJuliana Rodrigues struct hfa384x_ch_info_result_sub {
682aaad4303SSolomon Peachy 	u16 chid;
683aaad4303SSolomon Peachy 	u16 anl;
684aaad4303SSolomon Peachy 	u16 pnl;
685aaad4303SSolomon Peachy 	u16 active;
6861bc4292aSSergio Paracuellos } __packed;
68700b3ed16SGreg Kroah-Hartman 
6887f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_BSSACTIVE	BIT(0)
6897f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_PCFACTIVE	BIT(1)
69000b3ed16SGreg Kroah-Hartman 
691c447358aSSergio Paracuellos struct hfa384x_ch_info_result {
692aaad4303SSolomon Peachy 	u16 scanchannels;
693e35baeb0SJuliana Rodrigues 	struct hfa384x_ch_info_result_sub result[HFA384x_CHINFORESULT_MAX];
6940fddae8eSSergio Paracuellos } __packed;
69500b3ed16SGreg Kroah-Hartman 
69600b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
6978f8149deSSergio Paracuellos struct hfa384x_hscan_result_sub {
698aaad4303SSolomon Peachy 	u16 chid;
699aaad4303SSolomon Peachy 	u16 anl;
700aaad4303SSolomon Peachy 	u16 sl;
701aaad4303SSolomon Peachy 	u8 bssid[WLAN_BSSID_LEN];
702aaad4303SSolomon Peachy 	u16 bcnint;
703aaad4303SSolomon Peachy 	u16 capinfo;
70403c2975bSSergio Paracuellos 	struct hfa384x_bytestr32 ssid;
705aaad4303SSolomon Peachy 	u8 supprates[10];	/* 802.11 info element */
706aaad4303SSolomon Peachy 	u16 proberesp_rate;
707aaad4303SSolomon Peachy 	u16 atim;
708b353d11aSSergio Paracuellos } __packed;
70900b3ed16SGreg Kroah-Hartman 
7100e2ce9adSSergio Paracuellos struct hfa384x_hscan_result {
711aaad4303SSolomon Peachy 	u16 nresult;
712aaad4303SSolomon Peachy 	u16 rsvd;
7138f8149deSSergio Paracuellos 	struct hfa384x_hscan_result_sub result[HFA384x_HSCANRESULT_MAX];
714f8f2821eSSergio Paracuellos } __packed;
71500b3ed16SGreg Kroah-Hartman 
71600b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: LinkStatus --*/
71700b3ed16SGreg Kroah-Hartman 
718aaad4303SSolomon Peachy #define HFA384x_LINK_NOTCONNECTED	((u16)0)
719aaad4303SSolomon Peachy #define HFA384x_LINK_CONNECTED		((u16)1)
720aaad4303SSolomon Peachy #define HFA384x_LINK_DISCONNECTED	((u16)2)
721aaad4303SSolomon Peachy #define HFA384x_LINK_AP_CHANGE		((u16)3)
722aaad4303SSolomon Peachy #define HFA384x_LINK_AP_OUTOFRANGE	((u16)4)
723aaad4303SSolomon Peachy #define HFA384x_LINK_AP_INRANGE		((u16)5)
724aaad4303SSolomon Peachy #define HFA384x_LINK_ASSOCFAIL		((u16)6)
72500b3ed16SGreg Kroah-Hartman 
7267190f3f1SSergio Paracuellos struct hfa384x_link_status {
727aaad4303SSolomon Peachy 	u16 linkstatus;
728a8eb5139SSergio Paracuellos } __packed;
72900b3ed16SGreg Kroah-Hartman 
73000b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
73100b3ed16SGreg Kroah-Hartman 
732aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_STAASSOC	((u16)1)
733aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_REASSOC	((u16)2)
734aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_AUTHFAIL	((u16)5)
73500b3ed16SGreg Kroah-Hartman 
7361889b0dbSJuliana Rodrigues struct hfa384x_assoc_status {
737aaad4303SSolomon Peachy 	u16 assocstatus;
73828b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
73900b3ed16SGreg Kroah-Hartman 	/* old_ap_addr is only valid if assocstatus == 2 */
74028b17a4bSMoritz Muehlenhoff 	u8 old_ap_addr[ETH_ALEN];
741aaad4303SSolomon Peachy 	u16 reason;
742aaad4303SSolomon Peachy 	u16 reserved;
7435383f13eSSergio Paracuellos } __packed;
74400b3ed16SGreg Kroah-Hartman 
74500b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
74600b3ed16SGreg Kroah-Hartman 
747b8f55192SSergio Paracuellos struct hfa384x_auth_request {
74828b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
749aaad4303SSolomon Peachy 	u16 algorithm;
750b9820e0cSSergio Paracuellos } __packed;
75100b3ed16SGreg Kroah-Hartman 
75200b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
75300b3ed16SGreg Kroah-Hartman 
7540c3b2bd7SSergio Paracuellos struct hfa384x_ps_user_count {
755aaad4303SSolomon Peachy 	u16 usercnt;
756013e69ebSSergio Paracuellos } __packed;
75700b3ed16SGreg Kroah-Hartman 
758ab42187aSSergio Paracuellos struct hfa384x_key_id_changed {
75928b17a4bSMoritz Muehlenhoff 	u8 sta_addr[ETH_ALEN];
760aaad4303SSolomon Peachy 	u16 keyid;
76144049d81SSergio Paracuellos } __packed;
76200b3ed16SGreg Kroah-Hartman 
76300b3ed16SGreg Kroah-Hartman /*--  Collection of all Inf frames ---------------*/
764f745ea61SSergio Paracuellos union hfa384x_infodata {
7654cc454f2SSergio Paracuellos 	struct hfa384x_comm_tallies_16 commtallies16;
766b244edc6SJuliana Rodrigues 	struct hfa384x_comm_tallies_32 commtallies32;
767040a7bd4SJuliana Rodrigues 	struct hfa384x_scan_result scanresult;
768c447358aSSergio Paracuellos 	struct hfa384x_ch_info_result chinforesult;
7690e2ce9adSSergio Paracuellos 	struct hfa384x_hscan_result hscanresult;
7707190f3f1SSergio Paracuellos 	struct hfa384x_link_status linkstatus;
7711889b0dbSJuliana Rodrigues 	struct hfa384x_assoc_status assocstatus;
772b8f55192SSergio Paracuellos 	struct hfa384x_auth_request authreq;
7730c3b2bd7SSergio Paracuellos 	struct hfa384x_ps_user_count psusercnt;
774ab42187aSSergio Paracuellos 	struct hfa384x_key_id_changed keyidchanged;
775f745ea61SSergio Paracuellos } __packed;
77600b3ed16SGreg Kroah-Hartman 
77760f5f3fbSJuliana Rodrigues struct hfa384x_inf_frame {
778aaad4303SSolomon Peachy 	u16 framelen;
779aaad4303SSolomon Peachy 	u16 infotype;
780f745ea61SSergio Paracuellos 	union hfa384x_infodata info;
781f69de9e3SSergio Paracuellos } __packed;
78200b3ed16SGreg Kroah-Hartman 
78300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
7843e27dfa2SSergio Paracuellos  * USB Packet structures and constants.
7853e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
7863e27dfa2SSergio Paracuellos  */
78700b3ed16SGreg Kroah-Hartman 
78800b3ed16SGreg Kroah-Hartman /* Should be sent to the bulkout endpoint */
78900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_TXFRM	0
79000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDREQ	1
79100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDREQ	2
79200b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDREQ	3
79300b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMREQ	4
79400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMREQ	5
79500b3ed16SGreg Kroah-Hartman 
79600b3ed16SGreg Kroah-Hartman /* Received from the bulkin endpoint */
79700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISTXFRM(a)	(((a) & 0x9000) == 0x1000)
79800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISRXFRM(a)	(!((a) & 0x9000))
79900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_INFOFRM	0x8000
80000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDRESP	0x8001
80100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDRESP	0x8002
80200b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDRESP	0x8003
80300b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMRESP	0x8004
80400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMRESP	0x8005
80500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_BUFAVAIL	0x8006
80600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ERROR	0x8007
80700b3ed16SGreg Kroah-Hartman 
80800b3ed16SGreg Kroah-Hartman /*------------------------------------*/
80900b3ed16SGreg Kroah-Hartman /* Request (bulk OUT) packet contents */
81000b3ed16SGreg Kroah-Hartman 
8112f1014f7SSergio Paracuellos struct hfa384x_usb_txfrm {
812eb76afc9SSergio Paracuellos 	struct hfa384x_tx_frame desc;
813aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
8142f1014f7SSergio Paracuellos } __packed;
81500b3ed16SGreg Kroah-Hartman 
816a6dcbdfeSSergio Paracuellos struct hfa384x_usb_cmdreq {
817aaad4303SSolomon Peachy 	u16 type;
818aaad4303SSolomon Peachy 	u16 cmd;
819aaad4303SSolomon Peachy 	u16 parm0;
820aaad4303SSolomon Peachy 	u16 parm1;
821aaad4303SSolomon Peachy 	u16 parm2;
822aaad4303SSolomon Peachy 	u8 pad[54];
823a6dcbdfeSSergio Paracuellos } __packed;
82400b3ed16SGreg Kroah-Hartman 
8253bc070f6SSergio Paracuellos struct hfa384x_usb_wridreq {
826aaad4303SSolomon Peachy 	u16 type;
827aaad4303SSolomon Peachy 	u16 frmlen;
828aaad4303SSolomon Peachy 	u16 rid;
829aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
8303bc070f6SSergio Paracuellos } __packed;
83100b3ed16SGreg Kroah-Hartman 
8325b9f240eSSergio Paracuellos struct hfa384x_usb_rridreq {
833aaad4303SSolomon Peachy 	u16 type;
834aaad4303SSolomon Peachy 	u16 frmlen;
835aaad4303SSolomon Peachy 	u16 rid;
836aaad4303SSolomon Peachy 	u8 pad[58];
8375b9f240eSSergio Paracuellos } __packed;
83800b3ed16SGreg Kroah-Hartman 
839f0e15d40SSergio Paracuellos struct hfa384x_usb_wmemreq {
840aaad4303SSolomon Peachy 	u16 type;
841aaad4303SSolomon Peachy 	u16 frmlen;
842aaad4303SSolomon Peachy 	u16 offset;
843aaad4303SSolomon Peachy 	u16 page;
844aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
845f0e15d40SSergio Paracuellos } __packed;
84600b3ed16SGreg Kroah-Hartman 
84794ec5464SSergio Paracuellos struct hfa384x_usb_rmemreq {
848aaad4303SSolomon Peachy 	u16 type;
849aaad4303SSolomon Peachy 	u16 frmlen;
850aaad4303SSolomon Peachy 	u16 offset;
851aaad4303SSolomon Peachy 	u16 page;
852aaad4303SSolomon Peachy 	u8 pad[56];
85394ec5464SSergio Paracuellos } __packed;
85400b3ed16SGreg Kroah-Hartman 
85500b3ed16SGreg Kroah-Hartman /*------------------------------------*/
85600b3ed16SGreg Kroah-Hartman /* Response (bulk IN) packet contents */
85700b3ed16SGreg Kroah-Hartman 
858684b2e08SSergio Paracuellos struct hfa384x_usb_rxfrm {
85970adf509SSergio Paracuellos 	struct hfa384x_rx_frame desc;
860aaad4303SSolomon Peachy 	u8 data[WLAN_DATA_MAXLEN];
861684b2e08SSergio Paracuellos } __packed;
86200b3ed16SGreg Kroah-Hartman 
863e20a7ca1SSergio Paracuellos struct hfa384x_usb_infofrm {
864aaad4303SSolomon Peachy 	u16 type;
86560f5f3fbSJuliana Rodrigues 	struct hfa384x_inf_frame info;
866e20a7ca1SSergio Paracuellos } __packed;
86700b3ed16SGreg Kroah-Hartman 
868385a79dfSSergio Paracuellos struct hfa384x_usb_statusresp {
869aaad4303SSolomon Peachy 	u16 type;
870aaad4303SSolomon Peachy 	u16 status;
871aaad4303SSolomon Peachy 	u16 resp0;
872aaad4303SSolomon Peachy 	u16 resp1;
873aaad4303SSolomon Peachy 	u16 resp2;
874385a79dfSSergio Paracuellos } __packed;
87500b3ed16SGreg Kroah-Hartman 
876a988c9f3SSergio Paracuellos struct hfa384x_usb_rridresp {
877aaad4303SSolomon Peachy 	u16 type;
878aaad4303SSolomon Peachy 	u16 frmlen;
879aaad4303SSolomon Peachy 	u16 rid;
880aaad4303SSolomon Peachy 	u8 data[HFA384x_RIDDATA_MAXLEN];
881a988c9f3SSergio Paracuellos } __packed;
88200b3ed16SGreg Kroah-Hartman 
8831ed54806SSergio Paracuellos struct hfa384x_usb_rmemresp {
884aaad4303SSolomon Peachy 	u16 type;
885aaad4303SSolomon Peachy 	u16 frmlen;
886aaad4303SSolomon Peachy 	u8 data[HFA384x_USB_RWMEM_MAXLEN];
8871ed54806SSergio Paracuellos } __packed;
88800b3ed16SGreg Kroah-Hartman 
889c4d8a0a8SSergio Paracuellos struct hfa384x_usb_bufavail {
890aaad4303SSolomon Peachy 	u16 type;
891aaad4303SSolomon Peachy 	u16 frmlen;
892c4d8a0a8SSergio Paracuellos } __packed;
89300b3ed16SGreg Kroah-Hartman 
894d4734c30SSergio Paracuellos struct hfa384x_usb_error {
895aaad4303SSolomon Peachy 	u16 type;
896aaad4303SSolomon Peachy 	u16 errortype;
897d4734c30SSergio Paracuellos } __packed;
89800b3ed16SGreg Kroah-Hartman 
89900b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------*/
90000b3ed16SGreg Kroah-Hartman /* Unions for packaging all the known packet types together */
90100b3ed16SGreg Kroah-Hartman 
9024012684aSSergio Paracuellos union hfa384x_usbout {
903a78d1312SAsaf Vertz 	__le16 type;
9042f1014f7SSergio Paracuellos 	struct hfa384x_usb_txfrm txfrm;
905a6dcbdfeSSergio Paracuellos 	struct hfa384x_usb_cmdreq cmdreq;
9063bc070f6SSergio Paracuellos 	struct hfa384x_usb_wridreq wridreq;
9075b9f240eSSergio Paracuellos 	struct hfa384x_usb_rridreq rridreq;
908f0e15d40SSergio Paracuellos 	struct hfa384x_usb_wmemreq wmemreq;
90994ec5464SSergio Paracuellos 	struct hfa384x_usb_rmemreq rmemreq;
9104012684aSSergio Paracuellos } __packed;
91100b3ed16SGreg Kroah-Hartman 
9123e4180c3SSergio Paracuellos union hfa384x_usbin {
913a78d1312SAsaf Vertz 	__le16 type;
914684b2e08SSergio Paracuellos 	struct hfa384x_usb_rxfrm rxfrm;
9152f1014f7SSergio Paracuellos 	struct hfa384x_usb_txfrm txfrm;
916e20a7ca1SSergio Paracuellos 	struct hfa384x_usb_infofrm infofrm;
917385a79dfSSergio Paracuellos 	struct hfa384x_usb_statusresp cmdresp;
9182c8079deSSergio Paracuellos 	struct hfa384x_usb_statusresp wridresp;
919a988c9f3SSergio Paracuellos 	struct hfa384x_usb_rridresp rridresp;
920499c1cc9SSergio Paracuellos 	struct hfa384x_usb_statusresp wmemresp;
9211ed54806SSergio Paracuellos 	struct hfa384x_usb_rmemresp rmemresp;
922c4d8a0a8SSergio Paracuellos 	struct hfa384x_usb_bufavail bufavail;
923d4734c30SSergio Paracuellos 	struct hfa384x_usb_error usberror;
924aaad4303SSolomon Peachy 	u8 boguspad[3000];
9253e4180c3SSergio Paracuellos } __packed;
92600b3ed16SGreg Kroah-Hartman 
92776e3e7c4SKarl Relton /*--------------------------------------------------------------------
9283e27dfa2SSergio Paracuellos  * PD record structures.
9293e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
9303e27dfa2SSergio Paracuellos  */
93176e3e7c4SKarl Relton 
932e0696aa8SSergio Paracuellos struct hfa384x_pdr_pcb_partnum {
93376e3e7c4SKarl Relton 	u8 num[8];
934e0696aa8SSergio Paracuellos } __packed;
93576e3e7c4SKarl Relton 
936caeabb80SSergio Paracuellos struct hfa384x_pdr_pcb_tracenum {
93776e3e7c4SKarl Relton 	u8 num[8];
938caeabb80SSergio Paracuellos } __packed;
93976e3e7c4SKarl Relton 
94066e7bdb6SSergio Paracuellos struct hfa384x_pdr_nic_serial {
94176e3e7c4SKarl Relton 	u8 num[12];
94266e7bdb6SSergio Paracuellos } __packed;
94376e3e7c4SKarl Relton 
944ee9f7626SSergio Paracuellos struct hfa384x_pdr_mkk_measurements {
94576e3e7c4SKarl Relton 	double carrier_freq;
94676e3e7c4SKarl Relton 	double occupied_band;
94776e3e7c4SKarl Relton 	double power_density;
94876e3e7c4SKarl Relton 	double tx_spur_f1;
94976e3e7c4SKarl Relton 	double tx_spur_f2;
95076e3e7c4SKarl Relton 	double tx_spur_f3;
95176e3e7c4SKarl Relton 	double tx_spur_f4;
95276e3e7c4SKarl Relton 	double tx_spur_l1;
95376e3e7c4SKarl Relton 	double tx_spur_l2;
95476e3e7c4SKarl Relton 	double tx_spur_l3;
95576e3e7c4SKarl Relton 	double tx_spur_l4;
95676e3e7c4SKarl Relton 	double rx_spur_f1;
95776e3e7c4SKarl Relton 	double rx_spur_f2;
95876e3e7c4SKarl Relton 	double rx_spur_l1;
95976e3e7c4SKarl Relton 	double rx_spur_l2;
960ee9f7626SSergio Paracuellos } __packed;
96176e3e7c4SKarl Relton 
96202eebae4SSergio Paracuellos struct hfa384x_pdr_nic_ramsize {
96376e3e7c4SKarl Relton 	u8 size[12];		/* units of KB */
96402eebae4SSergio Paracuellos } __packed;
96576e3e7c4SKarl Relton 
9669127692fSSergio Paracuellos struct hfa384x_pdr_mfisuprange {
96776e3e7c4SKarl Relton 	u16 id;
96876e3e7c4SKarl Relton 	u16 variant;
96976e3e7c4SKarl Relton 	u16 bottom;
97076e3e7c4SKarl Relton 	u16 top;
9719127692fSSergio Paracuellos } __packed;
97276e3e7c4SKarl Relton 
9734ae2996fSSergio Paracuellos struct hfa384x_pdr_cfisuprange {
97476e3e7c4SKarl Relton 	u16 id;
97576e3e7c4SKarl Relton 	u16 variant;
97676e3e7c4SKarl Relton 	u16 bottom;
97776e3e7c4SKarl Relton 	u16 top;
9784ae2996fSSergio Paracuellos } __packed;
97976e3e7c4SKarl Relton 
980e9ee92c7SSergio Paracuellos struct hfa384x_pdr_nicid {
98176e3e7c4SKarl Relton 	u16 id;
98276e3e7c4SKarl Relton 	u16 variant;
98376e3e7c4SKarl Relton 	u16 major;
98476e3e7c4SKarl Relton 	u16 minor;
985e9ee92c7SSergio Paracuellos } __packed;
98676e3e7c4SKarl Relton 
9871c0c8ebaSSergio Paracuellos struct hfa384x_pdr_refdac_measurements {
98876e3e7c4SKarl Relton 	u16 value[0];
9891c0c8ebaSSergio Paracuellos } __packed;
99076e3e7c4SKarl Relton 
991de95929cSSergio Paracuellos struct hfa384x_pdr_vgdac_measurements {
99276e3e7c4SKarl Relton 	u16 value[0];
993de95929cSSergio Paracuellos } __packed;
99476e3e7c4SKarl Relton 
995dac1445dSSergio Paracuellos struct hfa384x_pdr_level_comp_measurements {
99676e3e7c4SKarl Relton 	u16 value[0];
997dac1445dSSergio Paracuellos } __packed;
99876e3e7c4SKarl Relton 
99929f1e44eSSergio Paracuellos struct hfa384x_pdr_mac_address {
100076e3e7c4SKarl Relton 	u8 addr[6];
100129f1e44eSSergio Paracuellos } __packed;
100276e3e7c4SKarl Relton 
1003f9699553SSergio Paracuellos struct hfa384x_pdr_mkk_callname {
100476e3e7c4SKarl Relton 	u8 callname[8];
1005f9699553SSergio Paracuellos } __packed;
100676e3e7c4SKarl Relton 
10070970a33dSSergio Paracuellos struct hfa384x_pdr_regdomain {
100876e3e7c4SKarl Relton 	u16 numdomains;
100976e3e7c4SKarl Relton 	u16 domain[5];
10100970a33dSSergio Paracuellos } __packed;
101176e3e7c4SKarl Relton 
1012e0322d1bSSergio Paracuellos struct hfa384x_pdr_allowed_channel {
101376e3e7c4SKarl Relton 	u16 ch_bitmap;
1014e0322d1bSSergio Paracuellos } __packed;
101576e3e7c4SKarl Relton 
1016892b51ecSSergio Paracuellos struct hfa384x_pdr_default_channel {
101776e3e7c4SKarl Relton 	u16 channel;
1018892b51ecSSergio Paracuellos } __packed;
101976e3e7c4SKarl Relton 
10202c1759beSSergio Paracuellos struct hfa384x_pdr_privacy_option {
102176e3e7c4SKarl Relton 	u16 available;
10222c1759beSSergio Paracuellos } __packed;
102376e3e7c4SKarl Relton 
10240c350461SSergio Paracuellos struct hfa384x_pdr_temptype {
102576e3e7c4SKarl Relton 	u16 type;
10260c350461SSergio Paracuellos } __packed;
102776e3e7c4SKarl Relton 
10283c92d65dSSergio Paracuellos struct hfa384x_pdr_refdac_setup {
102976e3e7c4SKarl Relton 	u16 ch_value[14];
10303c92d65dSSergio Paracuellos } __packed;
103176e3e7c4SKarl Relton 
1032dce6c283SSergio Paracuellos struct hfa384x_pdr_vgdac_setup {
103376e3e7c4SKarl Relton 	u16 ch_value[14];
1034dce6c283SSergio Paracuellos } __packed;
103576e3e7c4SKarl Relton 
103629aef6bbSSergio Paracuellos struct hfa384x_pdr_level_comp_setup {
103776e3e7c4SKarl Relton 	u16 ch_value[14];
103829aef6bbSSergio Paracuellos } __packed;
103976e3e7c4SKarl Relton 
1040a98f8609SSergio Paracuellos struct hfa384x_pdr_trimdac_setup {
104176e3e7c4SKarl Relton 	u16 trimidac;
104276e3e7c4SKarl Relton 	u16 trimqdac;
1043a98f8609SSergio Paracuellos } __packed;
104476e3e7c4SKarl Relton 
10453d235885SSergio Paracuellos struct hfa384x_pdr_ifr_setting {
104676e3e7c4SKarl Relton 	u16 value[3];
10473d235885SSergio Paracuellos } __packed;
104876e3e7c4SKarl Relton 
1049da79fe4aSSergio Paracuellos struct hfa384x_pdr_rfr_setting {
105076e3e7c4SKarl Relton 	u16 value[3];
1051da79fe4aSSergio Paracuellos } __packed;
105276e3e7c4SKarl Relton 
1053b4547dc5SSergio Paracuellos struct hfa384x_pdr_hfa3861_baseline {
105476e3e7c4SKarl Relton 	u16 value[50];
1055b4547dc5SSergio Paracuellos } __packed;
105676e3e7c4SKarl Relton 
10570dbc2e46SSergio Paracuellos struct hfa384x_pdr_hfa3861_shadow {
105876e3e7c4SKarl Relton 	u32 value[32];
10590dbc2e46SSergio Paracuellos } __packed;
106076e3e7c4SKarl Relton 
10611755c01bSSergio Paracuellos struct hfa384x_pdr_hfa3861_ifrf {
106276e3e7c4SKarl Relton 	u32 value[20];
10631755c01bSSergio Paracuellos } __packed;
106476e3e7c4SKarl Relton 
1065788c9732SSergio Paracuellos struct hfa384x_pdr_hfa3861_chcalsp {
106676e3e7c4SKarl Relton 	u16 value[14];
1067788c9732SSergio Paracuellos } __packed;
106876e3e7c4SKarl Relton 
1069b94425ffSSergio Paracuellos struct hfa384x_pdr_hfa3861_chcali {
107076e3e7c4SKarl Relton 	u16 value[17];
1071b94425ffSSergio Paracuellos } __packed;
107276e3e7c4SKarl Relton 
1073bd84b588SSergio Paracuellos struct hfa384x_pdr_hfa3861_nic_config {
107476e3e7c4SKarl Relton 	u16 config_bitmap;
1075bd84b588SSergio Paracuellos } __packed;
107676e3e7c4SKarl Relton 
10779408a44cSSergio Paracuellos struct hfa384x_pdr_hfo_delay {
107876e3e7c4SKarl Relton 	u8 hfo_delay;
10799408a44cSSergio Paracuellos } __packed;
108076e3e7c4SKarl Relton 
10810960d2e1SSergio Paracuellos struct hfa384x_pdr_hfa3861_manf_testsp {
108276e3e7c4SKarl Relton 	u16 value[30];
10830960d2e1SSergio Paracuellos } __packed;
108476e3e7c4SKarl Relton 
10855a4a5823SSergio Paracuellos struct hfa384x_pdr_hfa3861_manf_testi {
108676e3e7c4SKarl Relton 	u16 value[30];
10875a4a5823SSergio Paracuellos } __packed;
108876e3e7c4SKarl Relton 
1089b26ce5f6SSergio Paracuellos struct hfa384x_pdr_end_of_pda {
109076e3e7c4SKarl Relton 	u16 crc;
1091b26ce5f6SSergio Paracuellos } __packed;
109276e3e7c4SKarl Relton 
10934f026e89SSergio Paracuellos struct hfa384x_pdrec {
109476e3e7c4SKarl Relton 	u16 len;		/* in words */
109576e3e7c4SKarl Relton 	u16 code;
109676e3e7c4SKarl Relton 	union pdr {
1097e0696aa8SSergio Paracuellos 		struct hfa384x_pdr_pcb_partnum pcb_partnum;
1098caeabb80SSergio Paracuellos 		struct hfa384x_pdr_pcb_tracenum pcb_tracenum;
109966e7bdb6SSergio Paracuellos 		struct hfa384x_pdr_nic_serial nic_serial;
1100ee9f7626SSergio Paracuellos 		struct hfa384x_pdr_mkk_measurements mkk_measurements;
110102eebae4SSergio Paracuellos 		struct hfa384x_pdr_nic_ramsize nic_ramsize;
11029127692fSSergio Paracuellos 		struct hfa384x_pdr_mfisuprange mfisuprange;
11034ae2996fSSergio Paracuellos 		struct hfa384x_pdr_cfisuprange cfisuprange;
1104e9ee92c7SSergio Paracuellos 		struct hfa384x_pdr_nicid nicid;
11051c0c8ebaSSergio Paracuellos 		struct hfa384x_pdr_refdac_measurements refdac_measurements;
1106de95929cSSergio Paracuellos 		struct hfa384x_pdr_vgdac_measurements vgdac_measurements;
1107dac1445dSSergio Paracuellos 		struct hfa384x_pdr_level_comp_measurements level_compc_measurements;
110829f1e44eSSergio Paracuellos 		struct hfa384x_pdr_mac_address mac_address;
1109f9699553SSergio Paracuellos 		struct hfa384x_pdr_mkk_callname mkk_callname;
11100970a33dSSergio Paracuellos 		struct hfa384x_pdr_regdomain regdomain;
1111e0322d1bSSergio Paracuellos 		struct hfa384x_pdr_allowed_channel allowed_channel;
1112892b51ecSSergio Paracuellos 		struct hfa384x_pdr_default_channel default_channel;
11132c1759beSSergio Paracuellos 		struct hfa384x_pdr_privacy_option privacy_option;
11140c350461SSergio Paracuellos 		struct hfa384x_pdr_temptype temptype;
11153c92d65dSSergio Paracuellos 		struct hfa384x_pdr_refdac_setup refdac_setup;
1116dce6c283SSergio Paracuellos 		struct hfa384x_pdr_vgdac_setup vgdac_setup;
111729aef6bbSSergio Paracuellos 		struct hfa384x_pdr_level_comp_setup level_comp_setup;
1118a98f8609SSergio Paracuellos 		struct hfa384x_pdr_trimdac_setup trimdac_setup;
11193d235885SSergio Paracuellos 		struct hfa384x_pdr_ifr_setting ifr_setting;
1120da79fe4aSSergio Paracuellos 		struct hfa384x_pdr_rfr_setting rfr_setting;
1121b4547dc5SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_baseline hfa3861_baseline;
11220dbc2e46SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_shadow hfa3861_shadow;
11231755c01bSSergio Paracuellos 		struct hfa384x_pdr_hfa3861_ifrf hfa3861_ifrf;
1124788c9732SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_chcalsp hfa3861_chcalsp;
1125b94425ffSSergio Paracuellos 		struct hfa384x_pdr_hfa3861_chcali hfa3861_chcali;
1126bd84b588SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_nic_config nic_config;
11279408a44cSSergio Paracuellos 		struct hfa384x_pdr_hfo_delay hfo_delay;
11280960d2e1SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_manf_testsp hfa3861_manf_testsp;
11295a4a5823SSergio Paracuellos 		struct hfa384x_pdr_hfa3861_manf_testi hfa3861_manf_testi;
1130b26ce5f6SSergio Paracuellos 		struct hfa384x_pdr_end_of_pda end_of_pda;
113176e3e7c4SKarl Relton 
113276e3e7c4SKarl Relton 	} data;
11334f026e89SSergio Paracuellos } __packed;
113476e3e7c4SKarl Relton 
113500b3ed16SGreg Kroah-Hartman #ifdef __KERNEL__
113600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
11373e27dfa2SSergio Paracuellos  * ---  MAC state structure, argument to all functions --
11383e27dfa2SSergio Paracuellos  * ---  Also, a collection of support types --
11393e27dfa2SSergio Paracuellos  *--------------------------------------------------------------------
11403e27dfa2SSergio Paracuellos  */
1141501f5f96SSergio Paracuellos struct hfa384x_cmdresult {
1142aaad4303SSolomon Peachy 	u16 status;
1143aaad4303SSolomon Peachy 	u16 resp0;
1144aaad4303SSolomon Peachy 	u16 resp1;
1145aaad4303SSolomon Peachy 	u16 resp2;
1146501f5f96SSergio Paracuellos };
114700b3ed16SGreg Kroah-Hartman 
114800b3ed16SGreg Kroah-Hartman /* USB Control Exchange (CTLX):
114900b3ed16SGreg Kroah-Hartman  *  A queue of the structure below is maintained for all of the
115000b3ed16SGreg Kroah-Hartman  *  Request/Response type USB packets supported by Prism2.
115100b3ed16SGreg Kroah-Hartman  */
115200b3ed16SGreg Kroah-Hartman /* The following hfa384x_* structures are arguments to
115300b3ed16SGreg Kroah-Hartman  * the usercb() for the different CTLX types.
115400b3ed16SGreg Kroah-Hartman  */
1155b3fd890eSSergio Paracuellos struct hfa384x_rridresult {
1156aaad4303SSolomon Peachy 	u16 rid;
115700b3ed16SGreg Kroah-Hartman 	const void *riddata;
1158aaad4303SSolomon Peachy 	unsigned int riddata_len;
1159b3fd890eSSergio Paracuellos };
116000b3ed16SGreg Kroah-Hartman 
116100b3ed16SGreg Kroah-Hartman enum ctlx_state {
116200b3ed16SGreg Kroah-Hartman 	CTLX_START = 0,		/* Start state, not queued */
116300b3ed16SGreg Kroah-Hartman 
116400b3ed16SGreg Kroah-Hartman 	CTLX_COMPLETE,		/* CTLX successfully completed */
116500b3ed16SGreg Kroah-Hartman 	CTLX_REQ_FAILED,	/* OUT URB completed w/ error */
116600b3ed16SGreg Kroah-Hartman 
116700b3ed16SGreg Kroah-Hartman 	CTLX_PENDING,		/* Queued, data valid */
116800b3ed16SGreg Kroah-Hartman 	CTLX_REQ_SUBMITTED,	/* OUT URB submitted */
116900b3ed16SGreg Kroah-Hartman 	CTLX_REQ_COMPLETE,	/* OUT URB complete */
117000b3ed16SGreg Kroah-Hartman 	CTLX_RESP_COMPLETE	/* IN URB received */
117100b3ed16SGreg Kroah-Hartman };
117200b3ed16SGreg Kroah-Hartman 
117300b3ed16SGreg Kroah-Hartman struct hfa384x_usbctlx;
117400b3ed16SGreg Kroah-Hartman struct hfa384x;
117500b3ed16SGreg Kroah-Hartman 
117600b3ed16SGreg Kroah-Hartman typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);
117700b3ed16SGreg Kroah-Hartman 
1178e573aaa4SMoritz Muehlenhoff typedef void (*ctlx_usercb_t) (struct hfa384x *hw,
1179e573aaa4SMoritz Muehlenhoff 			       void *ctlxresult, void *usercb_data);
118000b3ed16SGreg Kroah-Hartman 
1181a10d36b0SSergio Paracuellos struct hfa384x_usbctlx {
118200b3ed16SGreg Kroah-Hartman 	struct list_head list;
118300b3ed16SGreg Kroah-Hartman 
118400b3ed16SGreg Kroah-Hartman 	size_t outbufsize;
11854012684aSSergio Paracuellos 	union hfa384x_usbout outbuf;	/* pkt buf for OUT */
11863e4180c3SSergio Paracuellos 	union hfa384x_usbin inbuf;	/* pkt buf for IN(a copy) */
118700b3ed16SGreg Kroah-Hartman 
1188173bf7e3SSergio Paracuellos 	enum ctlx_state state;	/* Tracks running state */
118900b3ed16SGreg Kroah-Hartman 
119000b3ed16SGreg Kroah-Hartman 	struct completion done;
119100b3ed16SGreg Kroah-Hartman 	volatile int reapable;	/* Food for the reaper task */
119200b3ed16SGreg Kroah-Hartman 
119300b3ed16SGreg Kroah-Hartman 	ctlx_cmdcb_t cmdcb;	/* Async command callback */
119400b3ed16SGreg Kroah-Hartman 	ctlx_usercb_t usercb;	/* Async user callback, */
119500b3ed16SGreg Kroah-Hartman 	void *usercb_data;	/*  at CTLX completion  */
119600b3ed16SGreg Kroah-Hartman 
119700b3ed16SGreg Kroah-Hartman 	int variant;		/* Identifies cmd variant */
1198a10d36b0SSergio Paracuellos };
119900b3ed16SGreg Kroah-Hartman 
12003df38936SSergio Paracuellos struct hfa384x_usbctlxq {
120100b3ed16SGreg Kroah-Hartman 	spinlock_t lock;
120200b3ed16SGreg Kroah-Hartman 	struct list_head pending;
120300b3ed16SGreg Kroah-Hartman 	struct list_head active;
120400b3ed16SGreg Kroah-Hartman 	struct list_head completing;
120500b3ed16SGreg Kroah-Hartman 	struct list_head reapable;
12063df38936SSergio Paracuellos };
120700b3ed16SGreg Kroah-Hartman 
1208e2f503c4SSergio Paracuellos struct hfa384x_metacmd {
1209aaad4303SSolomon Peachy 	u16 cmd;
121000b3ed16SGreg Kroah-Hartman 
1211aaad4303SSolomon Peachy 	u16 parm0;
1212aaad4303SSolomon Peachy 	u16 parm1;
1213aaad4303SSolomon Peachy 	u16 parm2;
121400b3ed16SGreg Kroah-Hartman 
1215501f5f96SSergio Paracuellos 	struct hfa384x_cmdresult result;
1216e2f503c4SSergio Paracuellos };
121700b3ed16SGreg Kroah-Hartman 
121800b3ed16SGreg Kroah-Hartman #define	MAX_GRP_ADDR		32
121900b3ed16SGreg Kroah-Hartman #define WLAN_COMMENT_MAX	80  /* Max. length of user comment string. */
122000b3ed16SGreg Kroah-Hartman 
122100b3ed16SGreg Kroah-Hartman #define WLAN_AUTH_MAX           60  /* Max. # of authenticated stations. */
122200b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_MAX		60  /* Max. # of stations in an access list. */
122300b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_NONE	0   /* No stations may be authenticated. */
122400b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALL		1   /* All stations may be authenticated. */
122500b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALLOW	2   /* Authenticate only "allowed" stations. */
122600b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_DENY	3   /* Do not authenticate "denied" stations. */
122700b3ed16SGreg Kroah-Hartman 
122800b3ed16SGreg Kroah-Hartman /* XXX These are going away ASAP */
1229c84b528cSVatika Harlalka struct prism2sta_authlist {
1230aaad4303SSolomon Peachy 	unsigned int cnt;
123128b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_AUTH_MAX][ETH_ALEN];
1232aaad4303SSolomon Peachy 	u8 assoc[WLAN_AUTH_MAX];
1233c84b528cSVatika Harlalka };
123400b3ed16SGreg Kroah-Hartman 
12354d10ece3SVatika Harlalka struct prism2sta_accesslist {
1236aaad4303SSolomon Peachy 	unsigned int modify;
1237aaad4303SSolomon Peachy 	unsigned int cnt;
123828b17a4bSMoritz Muehlenhoff 	u8 addr[WLAN_ACCESS_MAX][ETH_ALEN];
1239aaad4303SSolomon Peachy 	unsigned int cnt1;
124028b17a4bSMoritz Muehlenhoff 	u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN];
12414d10ece3SVatika Harlalka };
124200b3ed16SGreg Kroah-Hartman 
12435a2214e2SSergio Paracuellos struct hfa384x {
124400b3ed16SGreg Kroah-Hartman 	/* USB support data */
124500b3ed16SGreg Kroah-Hartman 	struct usb_device *usb;
124600b3ed16SGreg Kroah-Hartman 	struct urb rx_urb;
124700b3ed16SGreg Kroah-Hartman 	struct sk_buff *rx_urb_skb;
124800b3ed16SGreg Kroah-Hartman 	struct urb tx_urb;
124900b3ed16SGreg Kroah-Hartman 	struct urb ctlx_urb;
12504012684aSSergio Paracuellos 	union hfa384x_usbout txbuff;
12513df38936SSergio Paracuellos 	struct hfa384x_usbctlxq ctlxq;
125200b3ed16SGreg Kroah-Hartman 	struct timer_list reqtimer;
125300b3ed16SGreg Kroah-Hartman 	struct timer_list resptimer;
125400b3ed16SGreg Kroah-Hartman 
125500b3ed16SGreg Kroah-Hartman 	struct timer_list throttle;
125600b3ed16SGreg Kroah-Hartman 
125700b3ed16SGreg Kroah-Hartman 	struct tasklet_struct reaper_bh;
125800b3ed16SGreg Kroah-Hartman 	struct tasklet_struct completion_bh;
125900b3ed16SGreg Kroah-Hartman 
126000b3ed16SGreg Kroah-Hartman 	struct work_struct usb_work;
126100b3ed16SGreg Kroah-Hartman 
126200b3ed16SGreg Kroah-Hartman 	unsigned long usb_flags;
126300b3ed16SGreg Kroah-Hartman #define THROTTLE_RX	0
126400b3ed16SGreg Kroah-Hartman #define THROTTLE_TX	1
126500b3ed16SGreg Kroah-Hartman #define WORK_RX_HALT	2
126600b3ed16SGreg Kroah-Hartman #define WORK_TX_HALT	3
126700b3ed16SGreg Kroah-Hartman #define WORK_RX_RESUME	4
126800b3ed16SGreg Kroah-Hartman #define WORK_TX_RESUME	5
126900b3ed16SGreg Kroah-Hartman 
127000b3ed16SGreg Kroah-Hartman 	unsigned short req_timer_done:1;
127100b3ed16SGreg Kroah-Hartman 	unsigned short resp_timer_done:1;
127200b3ed16SGreg Kroah-Hartman 
127300b3ed16SGreg Kroah-Hartman 	int endp_in;
127400b3ed16SGreg Kroah-Hartman 	int endp_out;
127500b3ed16SGreg Kroah-Hartman 
127600b3ed16SGreg Kroah-Hartman 	int sniff_fcs;
127700b3ed16SGreg Kroah-Hartman 	int sniff_channel;
127800b3ed16SGreg Kroah-Hartman 	int sniff_truncate;
127900b3ed16SGreg Kroah-Hartman 	int sniffhdr;
128000b3ed16SGreg Kroah-Hartman 
128100b3ed16SGreg Kroah-Hartman 	wait_queue_head_t cmdq;	/* wait queue itself */
128200b3ed16SGreg Kroah-Hartman 
128300b3ed16SGreg Kroah-Hartman 	/* Controller state */
1284aaad4303SSolomon Peachy 	u32 state;
1285aaad4303SSolomon Peachy 	u32 isap;
1286aaad4303SSolomon Peachy 	u8 port_enabled[HFA384x_NUMPORTS_MAX];
128700b3ed16SGreg Kroah-Hartman 
128800b3ed16SGreg Kroah-Hartman 	/* Download support */
1289aaad4303SSolomon Peachy 	unsigned int dlstate;
1290b71db740SSergio Paracuellos 	struct hfa384x_downloadbuffer bufinfo;
1291aaad4303SSolomon Peachy 	u16 dltimeout;
129200b3ed16SGreg Kroah-Hartman 
12931a6dfce7SMasanari Iida 	int scanflag;		/* to signal scan complete */
129400b3ed16SGreg Kroah-Hartman 	int join_ap;		/* are we joined to a specific ap */
129500b3ed16SGreg Kroah-Hartman 	int join_retries;	/* number of join retries till we fail */
1296de3dc47cSJuliana Rodrigues 	struct hfa384x_join_request_data joinreq;/* join request saved data */
129700b3ed16SGreg Kroah-Hartman 
1298c9573a8dSsayli karnik 	struct wlandevice *wlandev;
129900b3ed16SGreg Kroah-Hartman 	/* Timer to allow for the deferred processing of linkstatus messages */
130000b3ed16SGreg Kroah-Hartman 	struct work_struct link_bh;
130100b3ed16SGreg Kroah-Hartman 
130200b3ed16SGreg Kroah-Hartman 	struct work_struct commsqual_bh;
1303a1e95045SSergio Paracuellos 	struct hfa384x_commsquality qual;
130400b3ed16SGreg Kroah-Hartman 	struct timer_list commsqual_timer;
130500b3ed16SGreg Kroah-Hartman 
1306aaad4303SSolomon Peachy 	u16 link_status;
1307aaad4303SSolomon Peachy 	u16 link_status_new;
130800b3ed16SGreg Kroah-Hartman 	struct sk_buff_head authq;
130900b3ed16SGreg Kroah-Hartman 
1310cb3126e6SKarl Relton 	u32 txrate;
1311cb3126e6SKarl Relton 
131200b3ed16SGreg Kroah-Hartman 	/* And here we have stuff that used to be in priv */
131300b3ed16SGreg Kroah-Hartman 
131400b3ed16SGreg Kroah-Hartman 	/* State variables */
1315aaad4303SSolomon Peachy 	unsigned int presniff_port_type;
1316aaad4303SSolomon Peachy 	u16 presniff_wepflags;
1317aaad4303SSolomon Peachy 	u32 dot11_desired_bss_type;
131800b3ed16SGreg Kroah-Hartman 
131900b3ed16SGreg Kroah-Hartman 	int dbmadjust;
132000b3ed16SGreg Kroah-Hartman 
132100b3ed16SGreg Kroah-Hartman 	/* Group Addresses - right now, there are up to a total
13225f0730fdSJuliana Rodrigues 	 * of MAX_GRP_ADDR group addresses
13235f0730fdSJuliana Rodrigues 	 */
132428b17a4bSMoritz Muehlenhoff 	u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN];
1325aaad4303SSolomon Peachy 	unsigned int dot11_grpcnt;
132600b3ed16SGreg Kroah-Hartman 
132700b3ed16SGreg Kroah-Hartman 	/* Component Identities */
13285f046456SSergio Paracuellos 	struct hfa384x_compident ident_nic;
13295f046456SSergio Paracuellos 	struct hfa384x_compident ident_pri_fw;
13305f046456SSergio Paracuellos 	struct hfa384x_compident ident_sta_fw;
13315f046456SSergio Paracuellos 	struct hfa384x_compident ident_ap_fw;
1332aaad4303SSolomon Peachy 	u16 mm_mods;
133300b3ed16SGreg Kroah-Hartman 
133400b3ed16SGreg Kroah-Hartman 	/* Supplier compatibility ranges */
133565f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_mfi;
133665f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_cfi;
133765f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_pri;
133865f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_sta;
133965f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_sup_ap;
134000b3ed16SGreg Kroah-Hartman 
134100b3ed16SGreg Kroah-Hartman 	/* Actor compatibility ranges */
134265f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_pri_cfi; /*
134371508ee4SAlessandro Ghedini 						  * pri f/w to controller
134471508ee4SAlessandro Ghedini 						  * interface
134571508ee4SAlessandro Ghedini 						  */
134671508ee4SAlessandro Ghedini 
134765f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_sta_cfi; /*
134871508ee4SAlessandro Ghedini 						  * sta f/w to controller
134971508ee4SAlessandro Ghedini 						  * interface
135071508ee4SAlessandro Ghedini 						  */
135171508ee4SAlessandro Ghedini 
135265f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_sta_mfi; /* sta f/w to modem interface */
135371508ee4SAlessandro Ghedini 
135465f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_ap_cfi;	/*
135571508ee4SAlessandro Ghedini 						 * ap f/w to controller
135671508ee4SAlessandro Ghedini 						 * interface
135771508ee4SAlessandro Ghedini 						 */
135871508ee4SAlessandro Ghedini 
135965f170c6SSergio Paracuellos 	struct hfa384x_caplevel cap_act_ap_mfi;	/* ap f/w to modem interface */
136000b3ed16SGreg Kroah-Hartman 
1361aaad4303SSolomon Peachy 	u32 psusercount;	/* Power save user count. */
1362b244edc6SJuliana Rodrigues 	struct hfa384x_comm_tallies_32 tallies;	/* Communication tallies. */
1363aaad4303SSolomon Peachy 	u8 comment[WLAN_COMMENT_MAX + 1];	/* User comment */
136400b3ed16SGreg Kroah-Hartman 
136500b3ed16SGreg Kroah-Hartman 	/* Channel Info request results (AP only) */
136600b3ed16SGreg Kroah-Hartman 	struct {
136700b3ed16SGreg Kroah-Hartman 		atomic_t done;
1368aaad4303SSolomon Peachy 		u8 count;
1369c447358aSSergio Paracuellos 		struct hfa384x_ch_info_result results;
137000b3ed16SGreg Kroah-Hartman 	} channel_info;
137100b3ed16SGreg Kroah-Hartman 
137260f5f3fbSJuliana Rodrigues 	struct hfa384x_inf_frame *scanresults;
137300b3ed16SGreg Kroah-Hartman 
1374c84b528cSVatika Harlalka 	struct prism2sta_authlist authlist;	/* Authenticated station list. */
1375aaad4303SSolomon Peachy 	unsigned int accessmode;		/* Access mode. */
13764d10ece3SVatika Harlalka 	struct prism2sta_accesslist allow;	/* Allowed station list. */
13774d10ece3SVatika Harlalka 	struct prism2sta_accesslist deny;	/* Denied station list. */
137800b3ed16SGreg Kroah-Hartman 
13795a2214e2SSergio Paracuellos };
138000b3ed16SGreg Kroah-Hartman 
13815a2214e2SSergio Paracuellos void hfa384x_create(struct hfa384x *hw, struct usb_device *usb);
13825a2214e2SSergio Paracuellos void hfa384x_destroy(struct hfa384x *hw);
138300b3ed16SGreg Kroah-Hartman 
138400b3ed16SGreg Kroah-Hartman int
13855a2214e2SSergio Paracuellos hfa384x_corereset(struct hfa384x *hw, int holdtime, int settletime, int genesis);
13865a2214e2SSergio Paracuellos int hfa384x_drvr_disable(struct hfa384x *hw, u16 macport);
13875a2214e2SSergio Paracuellos int hfa384x_drvr_enable(struct hfa384x *hw, u16 macport);
13885a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_enable(struct hfa384x *hw);
13895a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_disable(struct hfa384x *hw);
13905a2214e2SSergio Paracuellos int hfa384x_drvr_flashdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
13915a2214e2SSergio Paracuellos int hfa384x_drvr_getconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
13925a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_enable(struct hfa384x *hw, u32 exeaddr);
13935a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_disable(struct hfa384x *hw);
13945a2214e2SSergio Paracuellos int hfa384x_drvr_ramdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
13955a2214e2SSergio Paracuellos int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len);
13965a2214e2SSergio Paracuellos int hfa384x_drvr_setconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
139700b3ed16SGreg Kroah-Hartman 
13985a2214e2SSergio Paracuellos static inline int hfa384x_drvr_getconfig16(struct hfa384x *hw, u16 rid, void *val)
139900b3ed16SGreg Kroah-Hartman {
140000b3ed16SGreg Kroah-Hartman 	int result = 0;
14017489df36SVeronika Kabatova 
1402aaad4303SSolomon Peachy 	result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
1403e573aaa4SMoritz Muehlenhoff 	if (result == 0)
140418c7f792SMoritz Muehlenhoff 		*((u16 *)val) = le16_to_cpu(*((u16 *)val));
140500b3ed16SGreg Kroah-Hartman 	return result;
140600b3ed16SGreg Kroah-Hartman }
140700b3ed16SGreg Kroah-Hartman 
14085a2214e2SSergio Paracuellos static inline int hfa384x_drvr_setconfig16(struct hfa384x *hw, u16 rid, u16 val)
140900b3ed16SGreg Kroah-Hartman {
141018c7f792SMoritz Muehlenhoff 	u16 value = cpu_to_le16(val);
14117489df36SVeronika Kabatova 
141200b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
141300b3ed16SGreg Kroah-Hartman }
141400b3ed16SGreg Kroah-Hartman 
141500b3ed16SGreg Kroah-Hartman int
14165a2214e2SSergio Paracuellos hfa384x_drvr_setconfig_async(struct hfa384x *hw,
1417aaad4303SSolomon Peachy 			     u16 rid,
141800b3ed16SGreg Kroah-Hartman 			     void *buf,
1419e573aaa4SMoritz Muehlenhoff 			     u16 len, ctlx_usercb_t usercb, void *usercb_data);
142000b3ed16SGreg Kroah-Hartman 
142100b3ed16SGreg Kroah-Hartman static inline int
14225a2214e2SSergio Paracuellos hfa384x_drvr_setconfig16_async(struct hfa384x *hw, u16 rid, u16 val)
142300b3ed16SGreg Kroah-Hartman {
142418c7f792SMoritz Muehlenhoff 	u16 value = cpu_to_le16(val);
14257489df36SVeronika Kabatova 
142600b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
142700b3ed16SGreg Kroah-Hartman 					    NULL, NULL);
142800b3ed16SGreg Kroah-Hartman }
142900b3ed16SGreg Kroah-Hartman 
14305a2214e2SSergio Paracuellos int hfa384x_drvr_start(struct hfa384x *hw);
14315a2214e2SSergio Paracuellos int hfa384x_drvr_stop(struct hfa384x *hw);
143200b3ed16SGreg Kroah-Hartman int
14335a2214e2SSergio Paracuellos hfa384x_drvr_txframe(struct hfa384x *hw, struct sk_buff *skb,
1434f6b43c2eSSven Dziadek 		     union p80211_hdr *p80211_hdr,
1435f6b43c2eSSven Dziadek 		     struct p80211_metawep *p80211_wep);
1436c9573a8dSsayli karnik void hfa384x_tx_timeout(struct wlandevice *wlandev);
143700b3ed16SGreg Kroah-Hartman 
14385a2214e2SSergio Paracuellos int hfa384x_cmd_initialize(struct hfa384x *hw);
14395a2214e2SSergio Paracuellos int hfa384x_cmd_enable(struct hfa384x *hw, u16 macport);
14405a2214e2SSergio Paracuellos int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport);
14415a2214e2SSergio Paracuellos int hfa384x_cmd_allocate(struct hfa384x *hw, u16 len);
14425a2214e2SSergio Paracuellos int hfa384x_cmd_monitor(struct hfa384x *hw, u16 enable);
144300b3ed16SGreg Kroah-Hartman int
14445a2214e2SSergio Paracuellos hfa384x_cmd_download(struct hfa384x *hw,
1445e573aaa4SMoritz Muehlenhoff 		     u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
144600b3ed16SGreg Kroah-Hartman 
144700b3ed16SGreg Kroah-Hartman #endif /*__KERNEL__ */
144800b3ed16SGreg Kroah-Hartman 
144900b3ed16SGreg Kroah-Hartman #endif /*_HFA384x_H */
1450