Merge drm/drm-next into drm-intel-next
[linux-block.git] / drivers / staging / wlan-ng / hfa384x.h
CommitLineData
3fb28ae7 1/* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */
8ffd91d9 2/*
5f7688dd
SP
3 *
4 * Defines the constants and data structures for the hfa384x
5 *
6 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
7 * --------------------------------------------------------------------
8 *
9 * linux-wlan
10 *
5f7688dd
SP
11 * --------------------------------------------------------------------
12 *
13 * Inquiries regarding the linux-wlan Open Source project can be
14 * made directly to:
15 *
16 * AbsoluteValue Systems Inc.
17 * info@linux-wlan.com
18 * http://www.linux-wlan.com
19 *
20 * --------------------------------------------------------------------
21 *
22 * Portions of the development of this software were funded by
23 * Intersil Corporation as part of PRISM(R) chipset product development.
24 *
25 * --------------------------------------------------------------------
26 *
27 * [Implementation and usage notes]
28 *
29 * [References]
30 * CW10 Programmer's Manual v1.5
31 * IEEE 802.11 D10.0
32 *
33 * --------------------------------------------------------------------
34 */
00b3ed16
GKH
35
36#ifndef _HFA384x_H
37#define _HFA384x_H
38
e573aaa4 39#define HFA384x_FIRMWARE_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
00b3ed16 40
28b17a4b 41#include <linux/if_ether.h>
2e380275 42#include <linux/usb.h>
28b17a4b 43
00b3ed16 44/*--- Mins & Maxs -----------------------------------*/
71508ee4 45#define HFA384x_PORTID_MAX ((u16)7)
0548cad1 46#define HFA384x_NUMPORTS_MAX ((u16)(HFA384x_PORTID_MAX + 1))
71508ee4
AG
47#define HFA384x_PDR_LEN_MAX ((u16)512) /* in bytes, from EK */
48#define HFA384x_PDA_RECS_MAX ((u16)200) /* a guess */
49#define HFA384x_PDA_LEN_MAX ((u16)1024) /* in bytes, from EK*/
50#define HFA384x_SCANRESULT_MAX ((u16)31)
51#define HFA384x_HSCANRESULT_MAX ((u16)31)
52#define HFA384x_CHINFORESULT_MAX ((u16)16)
53#define HFA384x_RID_GUESSING_MAXLEN 2048 /* I'm not really sure */
54#define HFA384x_RIDDATA_MAXLEN HFA384x_RID_GUESSING_MAXLEN
55#define HFA384x_USB_RWMEM_MAXLEN 2048
00b3ed16
GKH
56
57/*--- Support Constants -----------------------------*/
aaad4303
SP
58#define HFA384x_PORTTYPE_IBSS ((u16)0)
59#define HFA384x_PORTTYPE_BSS ((u16)1)
aaad4303 60#define HFA384x_PORTTYPE_PSUEDOIBSS ((u16)3)
7f6e0e44
MM
61#define HFA384x_WEPFLAGS_PRIVINVOKED ((u16)BIT(0))
62#define HFA384x_WEPFLAGS_EXCLUDE ((u16)BIT(1))
63#define HFA384x_WEPFLAGS_DISABLE_TXCRYPT ((u16)BIT(4))
64#define HFA384x_WEPFLAGS_DISABLE_RXCRYPT ((u16)BIT(7))
eec0d0dc
GH
65#define HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM ((u16)3)
66#define HFA384x_PORTSTATUS_DISABLED ((u16)1)
aaad4303
SP
67#define HFA384x_RATEBIT_1 ((u16)1)
68#define HFA384x_RATEBIT_2 ((u16)2)
69#define HFA384x_RATEBIT_5dot5 ((u16)4)
70#define HFA384x_RATEBIT_11 ((u16)8)
00b3ed16 71
00b3ed16
GKH
72/*--- MAC Internal memory constants and macros ------*/
73/* masks and macros used to manipulate MAC internal memory addresses. */
74/* MAC internal memory addresses are 23 bit quantities. The MAC uses
75 * a paged address space where the upper 16 bits are the page number
76 * and the lower 7 bits are the offset. There are various Host API
77 * elements that require two 16-bit quantities to specify a MAC
78 * internal memory address. Unfortunately, some of the API's use a
79 * page/offset format where the offset value is JUST the lower seven
80 * bits and the page is the remaining 16 bits. Some of the API's
81 * assume that the 23 bit address has been split at the 16th bit. We
82 * refer to these two formats as AUX format and CMD format. The
83 * macros below help handle some of this.
84 */
85
00b3ed16
GKH
86/* Mask bits for discarding unwanted pieces in a flat address */
87#define HFA384x_ADDR_FLAT_AUX_PAGE_MASK (0x007fff80)
88#define HFA384x_ADDR_FLAT_AUX_OFF_MASK (0x0000007f)
89#define HFA384x_ADDR_FLAT_CMD_PAGE_MASK (0xffff0000)
90#define HFA384x_ADDR_FLAT_CMD_OFF_MASK (0x0000ffff)
91
e573aaa4 92/* Mask bits for discarding unwanted pieces in AUX format
95842bc9
JR
93 * 16-bit address parts
94 */
00b3ed16
GKH
95#define HFA384x_ADDR_AUX_PAGE_MASK (0xffff)
96#define HFA384x_ADDR_AUX_OFF_MASK (0x007f)
97
00b3ed16 98/* Make a 32-bit flat address from AUX format 16-bit page and offset */
e573aaa4 99#define HFA384x_ADDR_AUX_MKFLAT(p, o) \
65dbeefd
GS
100 ((((u32)(((u16)(p)) & HFA384x_ADDR_AUX_PAGE_MASK)) << 7) | \
101 ((u32)(((u16)(o)) & HFA384x_ADDR_AUX_OFF_MASK)))
00b3ed16 102
00b3ed16
GKH
103/* Make CMD format offset and page from a 32-bit flat address */
104#define HFA384x_ADDR_CMD_MKPAGE(f) \
061eab5c 105 ((u16)((((u32)(f)) & HFA384x_ADDR_FLAT_CMD_PAGE_MASK) >> 16))
00b3ed16 106#define HFA384x_ADDR_CMD_MKOFF(f) \
65dbeefd 107 ((u16)(((u32)(f)) & HFA384x_ADDR_FLAT_CMD_OFF_MASK))
00b3ed16 108
00b3ed16
GKH
109/*--- Controller Memory addresses -------------------*/
110#define HFA3842_PDA_BASE (0x007f0000UL)
111#define HFA3841_PDA_BASE (0x003f0000UL)
112#define HFA3841_PDA_BOGUS_BASE (0x00390000UL)
113
114/*--- Driver Download states -----------------------*/
115#define HFA384x_DLSTATE_DISABLED 0
116#define HFA384x_DLSTATE_RAMENABLED 1
117#define HFA384x_DLSTATE_FLASHENABLED 2
00b3ed16 118
00b3ed16 119/*--- Register Field Masks --------------------------*/
d349883f
SP
120#define HFA384x_CMD_AINFO ((u16)GENMASK(14, 8))
121#define HFA384x_CMD_MACPORT ((u16)GENMASK(10, 8))
122#define HFA384x_CMD_PROGMODE ((u16)GENMASK(9, 8))
123#define HFA384x_CMD_CMDCODE ((u16)GENMASK(5, 0))
124#define HFA384x_STATUS_RESULT ((u16)GENMASK(14, 8))
7f6e0e44 125
00b3ed16
GKH
126/*--- Command Code Constants --------------------------*/
127/*--- Controller Commands --------------------------*/
aaad4303
SP
128#define HFA384x_CMDCODE_INIT ((u16)0x00)
129#define HFA384x_CMDCODE_ENABLE ((u16)0x01)
130#define HFA384x_CMDCODE_DISABLE ((u16)0x02)
00b3ed16
GKH
131
132/*--- Regulate Commands --------------------------*/
aaad4303 133#define HFA384x_CMDCODE_INQ ((u16)0x11)
00b3ed16
GKH
134
135/*--- Configure Commands --------------------------*/
aaad4303 136#define HFA384x_CMDCODE_DOWNLD ((u16)0x22)
00b3ed16
GKH
137
138/*--- Debugging Commands -----------------------------*/
eec0d0dc 139#define HFA384x_CMDCODE_MONITOR ((u16)(0x38))
aaad4303
SP
140#define HFA384x_MONITOR_ENABLE ((u16)(0x0b))
141#define HFA384x_MONITOR_DISABLE ((u16)(0x0f))
00b3ed16
GKH
142
143/*--- Result Codes --------------------------*/
aaad4303 144#define HFA384x_CMD_ERR ((u16)(0x7F))
00b3ed16
GKH
145
146/*--- Programming Modes --------------------------
3e27dfa2
SP
147 * MODE 0: Disable programming
148 * MODE 1: Enable volatile memory programming
149 * MODE 2: Enable non-volatile memory programming
150 * MODE 3: Program non-volatile memory section
151 *-------------------------------------------------
152 */
aaad4303
SP
153#define HFA384x_PROGMODE_DISABLE ((u16)0x00)
154#define HFA384x_PROGMODE_RAM ((u16)0x01)
155#define HFA384x_PROGMODE_NV ((u16)0x02)
156#define HFA384x_PROGMODE_NVWRITE ((u16)0x03)
00b3ed16 157
00b3ed16
GKH
158/*--- Record ID Constants --------------------------*/
159/*--------------------------------------------------------------------
3e27dfa2
SP
160 * Configuration RIDs: Network Parameters, Static Configuration Entities
161 *--------------------------------------------------------------------
162 */
aaad4303
SP
163#define HFA384x_RID_CNFPORTTYPE ((u16)0xFC00)
164#define HFA384x_RID_CNFOWNMACADDR ((u16)0xFC01)
165#define HFA384x_RID_CNFDESIREDSSID ((u16)0xFC02)
166#define HFA384x_RID_CNFOWNCHANNEL ((u16)0xFC03)
167#define HFA384x_RID_CNFOWNSSID ((u16)0xFC04)
aaad4303 168#define HFA384x_RID_CNFMAXDATALEN ((u16)0xFC07)
00b3ed16
GKH
169
170/*--------------------------------------------------------------------
3e27dfa2
SP
171 * Configuration RID lengths: Network Params, Static Config Entities
172 * This is the length of JUST the DATA part of the RID (does not
173 * include the len or code fields)
174 *--------------------------------------------------------------------
175 */
aaad4303
SP
176#define HFA384x_RID_CNFOWNMACADDR_LEN ((u16)6)
177#define HFA384x_RID_CNFDESIREDSSID_LEN ((u16)34)
aaad4303 178#define HFA384x_RID_CNFOWNSSID_LEN ((u16)34)
00b3ed16
GKH
179
180/*--------------------------------------------------------------------
3e27dfa2
SP
181 * Configuration RIDs: Network Parameters, Dynamic Configuration Entities
182 *--------------------------------------------------------------------
183 */
aaad4303
SP
184#define HFA384x_RID_CREATEIBSS ((u16)0xFC81)
185#define HFA384x_RID_FRAGTHRESH ((u16)0xFC82)
186#define HFA384x_RID_RTSTHRESH ((u16)0xFC83)
187#define HFA384x_RID_TXRATECNTL ((u16)0xFC84)
188#define HFA384x_RID_PROMISCMODE ((u16)0xFC85)
00b3ed16
GKH
189
190/*----------------------------------------------------------------------
3e27dfa2
SP
191 * Information RIDs: NIC Information
192 *----------------------------------------------------------------------
193 */
aaad4303
SP
194#define HFA384x_RID_MAXLOADTIME ((u16)0xFD00)
195#define HFA384x_RID_DOWNLOADBUFFER ((u16)0xFD01)
196#define HFA384x_RID_PRIIDENTITY ((u16)0xFD02)
197#define HFA384x_RID_PRISUPRANGE ((u16)0xFD03)
198#define HFA384x_RID_PRI_CFIACTRANGES ((u16)0xFD04)
199#define HFA384x_RID_NICSERIALNUMBER ((u16)0xFD0A)
200#define HFA384x_RID_NICIDENTITY ((u16)0xFD0B)
201#define HFA384x_RID_MFISUPRANGE ((u16)0xFD0C)
202#define HFA384x_RID_CFISUPRANGE ((u16)0xFD0D)
aaad4303
SP
203#define HFA384x_RID_STAIDENTITY ((u16)0xFD20)
204#define HFA384x_RID_STASUPRANGE ((u16)0xFD21)
205#define HFA384x_RID_STA_MFIACTRANGES ((u16)0xFD22)
206#define HFA384x_RID_STA_CFIACTRANGES ((u16)0xFD23)
00b3ed16
GKH
207
208/*----------------------------------------------------------------------
3e27dfa2
SP
209 * Information RID Lengths: NIC Information
210 * This is the length of JUST the DATA part of the RID (does not
211 * include the len or code fields)
212 *---------------------------------------------------------------------
213 */
aaad4303 214#define HFA384x_RID_NICSERIALNUMBER_LEN ((u16)12)
00b3ed16
GKH
215
216/*--------------------------------------------------------------------
3e27dfa2
SP
217 * Information RIDs: MAC Information
218 *--------------------------------------------------------------------
219 */
aaad4303
SP
220#define HFA384x_RID_PORTSTATUS ((u16)0xFD40)
221#define HFA384x_RID_CURRENTSSID ((u16)0xFD41)
222#define HFA384x_RID_CURRENTBSSID ((u16)0xFD42)
aaad4303 223#define HFA384x_RID_CURRENTTXRATE ((u16)0xFD44)
aaad4303
SP
224#define HFA384x_RID_SHORTRETRYLIMIT ((u16)0xFD48)
225#define HFA384x_RID_LONGRETRYLIMIT ((u16)0xFD49)
226#define HFA384x_RID_MAXTXLIFETIME ((u16)0xFD4A)
aaad4303
SP
227#define HFA384x_RID_PRIVACYOPTIMP ((u16)0xFD4F)
228#define HFA384x_RID_DBMCOMMSQUALITY ((u16)0xFD51)
00b3ed16
GKH
229
230/*--------------------------------------------------------------------
3e27dfa2
SP
231 * Information RID Lengths: MAC Information
232 * This is the length of JUST the DATA part of the RID (does not
233 * include the len or code fields)
234 *--------------------------------------------------------------------
235 */
71508ee4 236#define HFA384x_RID_DBMCOMMSQUALITY_LEN \
62e493c4 237 ((u16)sizeof(struct hfa384x_dbmcommsquality))
71508ee4 238#define HFA384x_RID_JOINREQUEST_LEN \
de3dc47c 239 ((u16)sizeof(struct hfa384x_join_request_data))
40a67411 240
00b3ed16 241/*--------------------------------------------------------------------
3e27dfa2
SP
242 * Information RIDs: Modem Information
243 *--------------------------------------------------------------------
244 */
aaad4303 245#define HFA384x_RID_CURRENTCHANNEL ((u16)0xFDC1)
00b3ed16
GKH
246
247/*--------------------------------------------------------------------
3e27dfa2
SP
248 * API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
249 *--------------------------------------------------------------------
250 */
aaad4303
SP
251#define HFA384x_RID_CNFWEPDEFAULTKEYID ((u16)0xFC23)
252#define HFA384x_RID_CNFWEPDEFAULTKEY0 ((u16)0xFC24)
253#define HFA384x_RID_CNFWEPDEFAULTKEY1 ((u16)0xFC25)
254#define HFA384x_RID_CNFWEPDEFAULTKEY2 ((u16)0xFC26)
255#define HFA384x_RID_CNFWEPDEFAULTKEY3 ((u16)0xFC27)
256#define HFA384x_RID_CNFWEPFLAGS ((u16)0xFC28)
aaad4303 257#define HFA384x_RID_CNFAUTHENTICATION ((u16)0xFC2A)
aaad4303 258#define HFA384x_RID_CNFROAMINGMODE ((u16)0xFC2D)
b937612f 259#define HFA384x_RID_CNFAPBCNINT ((u16)0xFC33)
eec0d0dc
GH
260#define HFA384x_RID_CNFDBMADJUST ((u16)0xFC46)
261#define HFA384x_RID_CNFWPADATA ((u16)0xFC48)
aaad4303
SP
262#define HFA384x_RID_CNFBASICRATES ((u16)0xFCB3)
263#define HFA384x_RID_CNFSUPPRATES ((u16)0xFCB4)
e573aaa4 264#define HFA384x_RID_CNFPASSIVESCANCTRL ((u16)0xFCBA)
eec0d0dc 265#define HFA384x_RID_TXPOWERMAX ((u16)0xFCBE)
aaad4303
SP
266#define HFA384x_RID_JOINREQUEST ((u16)0xFCE2)
267#define HFA384x_RID_AUTHENTICATESTA ((u16)0xFCE3)
eec0d0dc 268#define HFA384x_RID_HOSTSCAN ((u16)0xFCE5)
aaad4303
SP
269
270#define HFA384x_RID_CNFWEPDEFAULTKEY_LEN ((u16)6)
271#define HFA384x_RID_CNFWEP128DEFAULTKEY_LEN ((u16)14)
40a67411 272
00b3ed16 273/*--------------------------------------------------------------------
3e27dfa2
SP
274 * PD Record codes
275 *--------------------------------------------------------------------
276 */
aaad4303
SP
277#define HFA384x_PDR_PCB_PARTNUM ((u16)0x0001)
278#define HFA384x_PDR_PDAVER ((u16)0x0002)
279#define HFA384x_PDR_NIC_SERIAL ((u16)0x0003)
280#define HFA384x_PDR_MKK_MEASUREMENTS ((u16)0x0004)
281#define HFA384x_PDR_NIC_RAMSIZE ((u16)0x0005)
282#define HFA384x_PDR_MFISUPRANGE ((u16)0x0006)
283#define HFA384x_PDR_CFISUPRANGE ((u16)0x0007)
284#define HFA384x_PDR_NICID ((u16)0x0008)
aaad4303 285#define HFA384x_PDR_MAC_ADDRESS ((u16)0x0101)
aaad4303
SP
286#define HFA384x_PDR_REGDOMAIN ((u16)0x0103)
287#define HFA384x_PDR_ALLOWED_CHANNEL ((u16)0x0104)
288#define HFA384x_PDR_DEFAULT_CHANNEL ((u16)0x0105)
aaad4303 289#define HFA384x_PDR_TEMPTYPE ((u16)0x0107)
aaad4303
SP
290#define HFA384x_PDR_IFR_SETTING ((u16)0x0200)
291#define HFA384x_PDR_RFR_SETTING ((u16)0x0201)
292#define HFA384x_PDR_HFA3861_BASELINE ((u16)0x0202)
293#define HFA384x_PDR_HFA3861_SHADOW ((u16)0x0203)
294#define HFA384x_PDR_HFA3861_IFRF ((u16)0x0204)
295#define HFA384x_PDR_HFA3861_CHCALSP ((u16)0x0300)
296#define HFA384x_PDR_HFA3861_CHCALI ((u16)0x0301)
eec0d0dc 297#define HFA384x_PDR_MAX_TX_POWER ((u16)0x0302)
aaad4303
SP
298#define HFA384x_PDR_MASTER_CHAN_LIST ((u16)0x0303)
299#define HFA384x_PDR_3842_NIC_CONFIG ((u16)0x0400)
300#define HFA384x_PDR_USB_ID ((u16)0x0401)
301#define HFA384x_PDR_PCI_ID ((u16)0x0402)
302#define HFA384x_PDR_PCI_IFCONF ((u16)0x0403)
303#define HFA384x_PDR_PCI_PMCONF ((u16)0x0404)
304#define HFA384x_PDR_RFENRGY ((u16)0x0406)
305#define HFA384x_PDR_USB_POWER_TYPE ((u16)0x0407)
aaad4303
SP
306#define HFA384x_PDR_USB_MAX_POWER ((u16)0x0409)
307#define HFA384x_PDR_USB_MANUFACTURER ((u16)0x0410)
eec0d0dc
GH
308#define HFA384x_PDR_USB_PRODUCT ((u16)0x0411)
309#define HFA384x_PDR_ANT_DIVERSITY ((u16)0x0412)
310#define HFA384x_PDR_HFO_DELAY ((u16)0x0413)
311#define HFA384x_PDR_SCALE_THRESH ((u16)0x0414)
aaad4303
SP
312
313#define HFA384x_PDR_HFA3861_MANF_TESTSP ((u16)0x0900)
314#define HFA384x_PDR_HFA3861_MANF_TESTI ((u16)0x0901)
315#define HFA384x_PDR_END_OF_PDA ((u16)0x0000)
00b3ed16 316
00b3ed16
GKH
317/*--- Register Test/Get/Set Field macros ------------------------*/
318
71508ee4
AG
319#define HFA384x_CMD_AINFO_SET(value) ((u16)((u16)(value) << 8))
320#define HFA384x_CMD_MACPORT_SET(value) \
321 ((u16)HFA384x_CMD_AINFO_SET(value))
322#define HFA384x_CMD_PROGMODE_SET(value) \
323 ((u16)HFA384x_CMD_AINFO_SET((u16)value))
aaad4303
SP
324#define HFA384x_CMD_CMDCODE_SET(value) ((u16)(value))
325
aaad4303 326#define HFA384x_STATUS_RESULT_SET(value) (((u16)(value)) << 8)
acb7e242 327
00b3ed16
GKH
328/* Host Maintained State Info */
329#define HFA384x_STATE_PREINIT 0
330#define HFA384x_STATE_INIT 1
331#define HFA384x_STATE_RUNNING 2
332
00b3ed16
GKH
333/*-------------------------------------------------------------*/
334/* Commonly used basic types */
b2119911 335struct hfa384x_bytestr {
0a3bbcbd 336 __le16 len;
5979afa2 337 u8 data[];
b2119911 338} __packed;
00b3ed16 339
03c2975b 340struct hfa384x_bytestr32 {
18cd9021 341 __le16 len;
e573aaa4 342 u8 data[32];
03c2975b 343} __packed;
00b3ed16
GKH
344
345/*--------------------------------------------------------------------
3e27dfa2
SP
346 * Configuration Record Structures:
347 * Network Parameters, Static Configuration Entities
348 *--------------------------------------------------------------------
349 */
00b3ed16
GKH
350
351/*-- Hardware/Firmware Component Information ----------*/
5f046456 352struct hfa384x_compident {
e573aaa4
MM
353 u16 id;
354 u16 variant;
355 u16 major;
356 u16 minor;
5f046456 357} __packed;
e573aaa4 358
65f170c6 359struct hfa384x_caplevel {
e573aaa4
MM
360 u16 role;
361 u16 id;
362 u16 variant;
363 u16 bottom;
364 u16 top;
65f170c6 365} __packed;
00b3ed16 366
00b3ed16
GKH
367/*-- Configuration Record: cnfAuthentication --*/
368#define HFA384x_CNFAUTHENTICATION_OPENSYSTEM 0x0001
369#define HFA384x_CNFAUTHENTICATION_SHAREDKEY 0x0002
eec0d0dc 370#define HFA384x_CNFAUTHENTICATION_LEAP 0x0004
00b3ed16 371
00b3ed16 372/*--------------------------------------------------------------------
3e27dfa2
SP
373 * Configuration Record Structures:
374 * Network Parameters, Dynamic Configuration Entities
375 *--------------------------------------------------------------------
376 */
00b3ed16 377
00b3ed16 378#define HFA384x_CREATEIBSS_JOINCREATEIBSS 0
00b3ed16
GKH
379
380/*-- Configuration Record: HostScanRequest (data portion only) --*/
e474b4d4 381struct hfa384x_host_scan_request_data {
18cd9021
SM
382 __le16 channel_list;
383 __le16 tx_rate;
03c2975b 384 struct hfa384x_bytestr32 ssid;
935cbfb2 385} __packed;
00b3ed16
GKH
386
387/*-- Configuration Record: JoinRequest (data portion only) --*/
de3dc47c 388struct hfa384x_join_request_data {
e573aaa4
MM
389 u8 bssid[WLAN_BSSID_LEN];
390 u16 channel;
f0ffa0e2 391} __packed;
00b3ed16
GKH
392
393/*-- Configuration Record: authenticateStation (data portion only) --*/
4c976b16 394struct hfa384x_authenticate_station_data {
e573aaa4 395 u8 address[ETH_ALEN];
e708d2c7
AP
396 __le16 status;
397 __le16 algorithm;
17fb19f0 398} __packed;
00b3ed16 399
00b3ed16 400/*-- Configuration Record: WPAData (data portion only) --*/
162da263 401struct hfa384x_wpa_data {
0a3bbcbd 402 __le16 datalen;
5979afa2 403 u8 data[]; /* max 80 */
a2a44803 404} __packed;
00b3ed16 405
00b3ed16 406/*--------------------------------------------------------------------
3e27dfa2
SP
407 * Information Record Structures: NIC Information
408 *--------------------------------------------------------------------
409 */
00b3ed16 410
00b3ed16
GKH
411/*-- Information Record: DownLoadBuffer --*/
412/* NOTE: The page and offset are in AUX format */
b71db740 413struct hfa384x_downloadbuffer {
e573aaa4
MM
414 u16 page;
415 u16 offset;
416 u16 len;
b71db740 417} __packed;
00b3ed16 418
00b3ed16 419/*--------------------------------------------------------------------
3e27dfa2
SP
420 * Information Record Structures: NIC Information
421 *--------------------------------------------------------------------
422 */
00b3ed16 423
aaad4303 424#define HFA384x_PSTATUS_CONN_IBSS ((u16)3)
00b3ed16
GKH
425
426/*-- Information Record: commsquality --*/
a1e95045 427struct hfa384x_commsquality {
7d647bcf
VL
428 __le16 cq_curr_bss;
429 __le16 asl_curr_bss;
430 __le16 anl_curr_fc;
a1e95045 431} __packed;
00b3ed16
GKH
432
433/*-- Information Record: dmbcommsquality --*/
62e493c4 434struct hfa384x_dbmcommsquality {
c08510e1
SP
435 u16 cq_dbm_curr_bss;
436 u16 asl_dbm_curr_bss;
437 u16 anl_dbm_curr_fc;
62e493c4 438} __packed;
00b3ed16 439
00b3ed16 440/*--------------------------------------------------------------------
3e27dfa2
SP
441 * FRAME STRUCTURES: Communication Frames
442 *--------------------------------------------------------------------
443 * Communication Frames: Transmit Frames
444 *--------------------------------------------------------------------
445 */
00b3ed16 446/*-- Communication Frame: Transmit Frame Structure --*/
eb76afc9 447struct hfa384x_tx_frame {
e573aaa4
MM
448 u16 status;
449 u16 reserved1;
450 u16 reserved2;
451 u32 sw_support;
452 u8 tx_retrycount;
453 u8 tx_rate;
454 u16 tx_control;
00b3ed16
GKH
455
456 /*-- 802.11 Header Information --*/
86a0727b 457 struct p80211_hdr hdr;
a18ffdf4 458 __le16 data_len; /* little endian format */
00b3ed16
GKH
459
460 /*-- 802.3 Header Information --*/
461
e573aaa4
MM
462 u8 dest_addr[6];
463 u8 src_addr[6];
464 u16 data_length; /* big endian format */
eb76afc9 465} __packed;
00b3ed16 466/*--------------------------------------------------------------------
3e27dfa2
SP
467 * Communication Frames: Field Masks for Transmit Frames
468 *--------------------------------------------------------------------
469 */
00b3ed16 470/*-- Status Field --*/
7f6e0e44
MM
471#define HFA384x_TXSTATUS_ACKERR ((u16)BIT(5))
472#define HFA384x_TXSTATUS_FORMERR ((u16)BIT(3))
473#define HFA384x_TXSTATUS_DISCON ((u16)BIT(2))
474#define HFA384x_TXSTATUS_AGEDERR ((u16)BIT(1))
475#define HFA384x_TXSTATUS_RETRYERR ((u16)BIT(0))
00b3ed16 476/*-- Transmit Control Field --*/
d349883f
SP
477#define HFA384x_TX_MACPORT ((u16)GENMASK(10, 8))
478#define HFA384x_TX_STRUCTYPE ((u16)GENMASK(4, 3))
7f6e0e44
MM
479#define HFA384x_TX_TXEX ((u16)BIT(2))
480#define HFA384x_TX_TXOK ((u16)BIT(1))
00b3ed16 481/*--------------------------------------------------------------------
3e27dfa2
SP
482 * Communication Frames: Test/Get/Set Field Values for Transmit Frames
483 *--------------------------------------------------------------------
484 */
00b3ed16
GKH
485/*-- Status Field --*/
486#define HFA384x_TXSTATUS_ISERROR(v) \
65dbeefd 487 (((u16)(v)) & \
05235ce2
GS
488 (HFA384x_TXSTATUS_ACKERR | HFA384x_TXSTATUS_FORMERR | \
489 HFA384x_TXSTATUS_DISCON | HFA384x_TXSTATUS_AGEDERR | \
00b3ed16
GKH
490 HFA384x_TXSTATUS_RETRYERR))
491
6e81f6f1 492#define HFA384x_TX_SET(v, m, s) ((((u16)(v)) << ((u16)(s))) & ((u16)(m)))
00b3ed16 493
00b3ed16 494#define HFA384x_TX_MACPORT_SET(v) HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
71508ee4
AG
495#define HFA384x_TX_STRUCTYPE_SET(v) HFA384x_TX_SET(v, \
496 HFA384x_TX_STRUCTYPE, 3)
00b3ed16 497#define HFA384x_TX_TXEX_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
00b3ed16
GKH
498#define HFA384x_TX_TXOK_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
499/*--------------------------------------------------------------------
3e27dfa2
SP
500 * Communication Frames: Receive Frames
501 *--------------------------------------------------------------------
502 */
00b3ed16 503/*-- Communication Frame: Receive Frame Structure --*/
70adf509 504struct hfa384x_rx_frame {
00b3ed16 505 /*-- MAC rx descriptor (hfa384x byte order) --*/
e573aaa4
MM
506 u16 status;
507 u32 time;
508 u8 silence;
509 u8 signal;
510 u8 rate;
511 u8 rx_flow;
512 u16 reserved1;
513 u16 reserved2;
00b3ed16
GKH
514
515 /*-- 802.11 Header Information (802.11 byte order) --*/
86a0727b 516 struct p80211_hdr hdr;
8cbe56e0 517 __le16 data_len; /* hfa384x (little endian) format */
00b3ed16
GKH
518
519 /*-- 802.3 Header Information --*/
e573aaa4
MM
520 u8 dest_addr[6];
521 u8 src_addr[6];
522 u16 data_length; /* IEEE? (big endian) format */
70adf509 523} __packed;
00b3ed16 524/*--------------------------------------------------------------------
3e27dfa2
SP
525 * Communication Frames: Field Masks for Receive Frames
526 *--------------------------------------------------------------------
527 */
00b3ed16
GKH
528
529/*-- Status Fields --*/
d349883f 530#define HFA384x_RXSTATUS_MACPORT ((u16)GENMASK(10, 8))
7f6e0e44 531#define HFA384x_RXSTATUS_FCSERR ((u16)BIT(0))
00b3ed16 532/*--------------------------------------------------------------------
3e27dfa2
SP
533 * Communication Frames: Test/Get/Set Field Values for Receive Frames
534 *--------------------------------------------------------------------
535 */
71508ee4
AG
536#define HFA384x_RXSTATUS_MACPORT_GET(value) ((u16)((((u16)(value)) \
537 & HFA384x_RXSTATUS_MACPORT) >> 8))
538#define HFA384x_RXSTATUS_ISFCSERR(value) ((u16)(((u16)(value)) \
539 & HFA384x_RXSTATUS_FCSERR))
00b3ed16 540/*--------------------------------------------------------------------
3e27dfa2
SP
541 * FRAME STRUCTURES: Information Types and Information Frame Structures
542 *--------------------------------------------------------------------
543 * Information Types
544 *--------------------------------------------------------------------
545 */
aaad4303 546#define HFA384x_IT_HANDOVERADDR ((u16)0xF000UL)
aaad4303
SP
547#define HFA384x_IT_COMMTALLIES ((u16)0xF100UL)
548#define HFA384x_IT_SCANRESULTS ((u16)0xF101UL)
549#define HFA384x_IT_CHINFORESULTS ((u16)0xF102UL)
550#define HFA384x_IT_HOSTSCANRESULTS ((u16)0xF103UL)
551#define HFA384x_IT_LINKSTATUS ((u16)0xF200UL)
552#define HFA384x_IT_ASSOCSTATUS ((u16)0xF201UL)
553#define HFA384x_IT_AUTHREQ ((u16)0xF202UL)
554#define HFA384x_IT_PSUSERCNT ((u16)0xF203UL)
555#define HFA384x_IT_KEYIDCHANGED ((u16)0xF204UL)
eec0d0dc
GH
556#define HFA384x_IT_ASSOCREQ ((u16)0xF205UL)
557#define HFA384x_IT_MICFAILURE ((u16)0xF206UL)
00b3ed16
GKH
558
559/*--------------------------------------------------------------------
3e27dfa2
SP
560 * Information Frames Structures
561 *--------------------------------------------------------------------
562 * Information Frames: Notification Frame Structures
563 *--------------------------------------------------------------------
564 */
00b3ed16
GKH
565
566/*-- Inquiry Frame, Diagnose: Communication Tallies --*/
4cc454f2 567struct hfa384x_comm_tallies_16 {
5551ad1e
CP
568 __le16 txunicastframes;
569 __le16 txmulticastframes;
570 __le16 txfragments;
571 __le16 txunicastoctets;
572 __le16 txmulticastoctets;
573 __le16 txdeferredtrans;
574 __le16 txsingleretryframes;
575 __le16 txmultipleretryframes;
576 __le16 txretrylimitexceeded;
577 __le16 txdiscards;
578 __le16 rxunicastframes;
579 __le16 rxmulticastframes;
580 __le16 rxfragments;
581 __le16 rxunicastoctets;
582 __le16 rxmulticastoctets;
583 __le16 rxfcserrors;
584 __le16 rxdiscardsnobuffer;
585 __le16 txdiscardswrongsa;
586 __le16 rxdiscardswepundecr;
587 __le16 rxmsginmsgfrag;
588 __le16 rxmsginbadmsgfrag;
07e23b67 589} __packed;
e573aaa4 590
b244edc6 591struct hfa384x_comm_tallies_32 {
5551ad1e
CP
592 __le32 txunicastframes;
593 __le32 txmulticastframes;
594 __le32 txfragments;
595 __le32 txunicastoctets;
596 __le32 txmulticastoctets;
597 __le32 txdeferredtrans;
598 __le32 txsingleretryframes;
599 __le32 txmultipleretryframes;
600 __le32 txretrylimitexceeded;
601 __le32 txdiscards;
602 __le32 rxunicastframes;
603 __le32 rxmulticastframes;
604 __le32 rxfragments;
605 __le32 rxunicastoctets;
606 __le32 rxmulticastoctets;
607 __le32 rxfcserrors;
608 __le32 rxdiscardsnobuffer;
609 __le32 txdiscardswrongsa;
610 __le32 rxdiscardswepundecr;
611 __le32 rxmsginmsgfrag;
612 __le32 rxmsginbadmsgfrag;
cfc6cb1f 613} __packed;
00b3ed16
GKH
614
615/*-- Inquiry Frame, Diagnose: Scan Results & Subfields--*/
b263dd5e 616struct hfa384x_scan_result_sub {
e573aaa4
MM
617 u16 chid;
618 u16 anl;
619 u16 sl;
620 u8 bssid[WLAN_BSSID_LEN];
621 u16 bcnint;
622 u16 capinfo;
03c2975b 623 struct hfa384x_bytestr32 ssid;
e573aaa4
MM
624 u8 supprates[10]; /* 802.11 info element */
625 u16 proberesp_rate;
4400334b 626} __packed;
e573aaa4 627
040a7bd4 628struct hfa384x_scan_result {
e573aaa4
MM
629 u16 rsvd;
630 u16 scanreason;
b263dd5e 631 struct hfa384x_scan_result_sub result[HFA384x_SCANRESULT_MAX];
dc0bb002 632} __packed;
00b3ed16
GKH
633
634/*-- Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
e35baeb0 635struct hfa384x_ch_info_result_sub {
e573aaa4
MM
636 u16 chid;
637 u16 anl;
638 u16 pnl;
639 u16 active;
1bc4292a 640} __packed;
00b3ed16 641
7f6e0e44
MM
642#define HFA384x_CHINFORESULT_BSSACTIVE BIT(0)
643#define HFA384x_CHINFORESULT_PCFACTIVE BIT(1)
00b3ed16 644
c447358a 645struct hfa384x_ch_info_result {
e573aaa4 646 u16 scanchannels;
e35baeb0 647 struct hfa384x_ch_info_result_sub result[HFA384x_CHINFORESULT_MAX];
0fddae8e 648} __packed;
00b3ed16
GKH
649
650/*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
8f8149de 651struct hfa384x_hscan_result_sub {
18cd9021
SM
652 __le16 chid;
653 __le16 anl;
654 __le16 sl;
e573aaa4 655 u8 bssid[WLAN_BSSID_LEN];
18cd9021
SM
656 __le16 bcnint;
657 __le16 capinfo;
03c2975b 658 struct hfa384x_bytestr32 ssid;
e573aaa4
MM
659 u8 supprates[10]; /* 802.11 info element */
660 u16 proberesp_rate;
18cd9021 661 __le16 atim;
b353d11a 662} __packed;
e573aaa4 663
0e2ce9ad 664struct hfa384x_hscan_result {
e573aaa4
MM
665 u16 nresult;
666 u16 rsvd;
8f8149de 667 struct hfa384x_hscan_result_sub result[HFA384x_HSCANRESULT_MAX];
f8f2821e 668} __packed;
00b3ed16
GKH
669
670/*-- Unsolicited Frame, MAC Mgmt: LinkStatus --*/
671
aaad4303
SP
672#define HFA384x_LINK_NOTCONNECTED ((u16)0)
673#define HFA384x_LINK_CONNECTED ((u16)1)
674#define HFA384x_LINK_DISCONNECTED ((u16)2)
675#define HFA384x_LINK_AP_CHANGE ((u16)3)
676#define HFA384x_LINK_AP_OUTOFRANGE ((u16)4)
677#define HFA384x_LINK_AP_INRANGE ((u16)5)
678#define HFA384x_LINK_ASSOCFAIL ((u16)6)
00b3ed16 679
7190f3f1 680struct hfa384x_link_status {
e0384407 681 __le16 linkstatus;
a8eb5139 682} __packed;
00b3ed16
GKH
683
684/*-- Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
685
aaad4303
SP
686#define HFA384x_ASSOCSTATUS_STAASSOC ((u16)1)
687#define HFA384x_ASSOCSTATUS_REASSOC ((u16)2)
aaad4303 688#define HFA384x_ASSOCSTATUS_AUTHFAIL ((u16)5)
00b3ed16 689
1889b0db 690struct hfa384x_assoc_status {
e573aaa4
MM
691 u16 assocstatus;
692 u8 sta_addr[ETH_ALEN];
00b3ed16 693 /* old_ap_addr is only valid if assocstatus == 2 */
e573aaa4
MM
694 u8 old_ap_addr[ETH_ALEN];
695 u16 reason;
696 u16 reserved;
5383f13e 697} __packed;
00b3ed16
GKH
698
699/*-- Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
700
b8f55192 701struct hfa384x_auth_request {
e573aaa4 702 u8 sta_addr[ETH_ALEN];
e708d2c7 703 __le16 algorithm;
b9820e0c 704} __packed;
00b3ed16 705
00b3ed16
GKH
706/*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
707
0c3b2bd7 708struct hfa384x_ps_user_count {
8cd924a2 709 __le16 usercnt;
013e69eb 710} __packed;
00b3ed16 711
ab42187a 712struct hfa384x_key_id_changed {
e573aaa4
MM
713 u8 sta_addr[ETH_ALEN];
714 u16 keyid;
44049d81 715} __packed;
00b3ed16
GKH
716
717/*-- Collection of all Inf frames ---------------*/
f745ea61 718union hfa384x_infodata {
4cc454f2 719 struct hfa384x_comm_tallies_16 commtallies16;
b244edc6 720 struct hfa384x_comm_tallies_32 commtallies32;
040a7bd4 721 struct hfa384x_scan_result scanresult;
c447358a 722 struct hfa384x_ch_info_result chinforesult;
0e2ce9ad 723 struct hfa384x_hscan_result hscanresult;
7190f3f1 724 struct hfa384x_link_status linkstatus;
1889b0db 725 struct hfa384x_assoc_status assocstatus;
b8f55192 726 struct hfa384x_auth_request authreq;
0c3b2bd7 727 struct hfa384x_ps_user_count psusercnt;
ab42187a 728 struct hfa384x_key_id_changed keyidchanged;
f745ea61 729} __packed;
e573aaa4 730
60f5f3fb 731struct hfa384x_inf_frame {
e573aaa4
MM
732 u16 framelen;
733 u16 infotype;
f745ea61 734 union hfa384x_infodata info;
f69de9e3 735} __packed;
00b3ed16 736
00b3ed16 737/*--------------------------------------------------------------------
3e27dfa2
SP
738 * USB Packet structures and constants.
739 *--------------------------------------------------------------------
740 */
00b3ed16 741
00b3ed16
GKH
742/* Should be sent to the bulkout endpoint */
743#define HFA384x_USB_TXFRM 0
744#define HFA384x_USB_CMDREQ 1
745#define HFA384x_USB_WRIDREQ 2
746#define HFA384x_USB_RRIDREQ 3
747#define HFA384x_USB_WMEMREQ 4
748#define HFA384x_USB_RMEMREQ 5
749
750/* Received from the bulkin endpoint */
00b3ed16
GKH
751#define HFA384x_USB_ISTXFRM(a) (((a) & 0x9000) == 0x1000)
752#define HFA384x_USB_ISRXFRM(a) (!((a) & 0x9000))
753#define HFA384x_USB_INFOFRM 0x8000
754#define HFA384x_USB_CMDRESP 0x8001
755#define HFA384x_USB_WRIDRESP 0x8002
756#define HFA384x_USB_RRIDRESP 0x8003
757#define HFA384x_USB_WMEMRESP 0x8004
758#define HFA384x_USB_RMEMRESP 0x8005
759#define HFA384x_USB_BUFAVAIL 0x8006
760#define HFA384x_USB_ERROR 0x8007
761
762/*------------------------------------*/
763/* Request (bulk OUT) packet contents */
764
2f1014f7 765struct hfa384x_usb_txfrm {
eb76afc9 766 struct hfa384x_tx_frame desc;
e573aaa4 767 u8 data[WLAN_DATA_MAXLEN];
2f1014f7 768} __packed;
00b3ed16 769
a6dcbdfe 770struct hfa384x_usb_cmdreq {
a18ffdf4
AD
771 __le16 type;
772 __le16 cmd;
773 __le16 parm0;
774 __le16 parm1;
775 __le16 parm2;
e573aaa4 776 u8 pad[54];
a6dcbdfe 777} __packed;
00b3ed16 778
3bc070f6 779struct hfa384x_usb_wridreq {
a18ffdf4
AD
780 __le16 type;
781 __le16 frmlen;
782 __le16 rid;
e573aaa4 783 u8 data[HFA384x_RIDDATA_MAXLEN];
3bc070f6 784} __packed;
00b3ed16 785
5b9f240e 786struct hfa384x_usb_rridreq {
a18ffdf4
AD
787 __le16 type;
788 __le16 frmlen;
789 __le16 rid;
e573aaa4 790 u8 pad[58];
5b9f240e 791} __packed;
00b3ed16 792
f0e15d40 793struct hfa384x_usb_wmemreq {
a18ffdf4
AD
794 __le16 type;
795 __le16 frmlen;
796 __le16 offset;
797 __le16 page;
e573aaa4 798 u8 data[HFA384x_USB_RWMEM_MAXLEN];
f0e15d40 799} __packed;
00b3ed16 800
94ec5464 801struct hfa384x_usb_rmemreq {
a18ffdf4
AD
802 __le16 type;
803 __le16 frmlen;
804 __le16 offset;
805 __le16 page;
e573aaa4 806 u8 pad[56];
94ec5464 807} __packed;
00b3ed16
GKH
808
809/*------------------------------------*/
810/* Response (bulk IN) packet contents */
811
684b2e08 812struct hfa384x_usb_rxfrm {
70adf509 813 struct hfa384x_rx_frame desc;
e573aaa4 814 u8 data[WLAN_DATA_MAXLEN];
684b2e08 815} __packed;
00b3ed16 816
e20a7ca1 817struct hfa384x_usb_infofrm {
e573aaa4 818 u16 type;
60f5f3fb 819 struct hfa384x_inf_frame info;
e20a7ca1 820} __packed;
00b3ed16 821
385a79df 822struct hfa384x_usb_statusresp {
e573aaa4 823 u16 type;
a18ffdf4
AD
824 __le16 status;
825 __le16 resp0;
826 __le16 resp1;
827 __le16 resp2;
385a79df 828} __packed;
00b3ed16 829
a988c9f3 830struct hfa384x_usb_rridresp {
e573aaa4 831 u16 type;
a18ffdf4
AD
832 __le16 frmlen;
833 __le16 rid;
e573aaa4 834 u8 data[HFA384x_RIDDATA_MAXLEN];
a988c9f3 835} __packed;
00b3ed16 836
1ed54806 837struct hfa384x_usb_rmemresp {
e573aaa4
MM
838 u16 type;
839 u16 frmlen;
840 u8 data[HFA384x_USB_RWMEM_MAXLEN];
1ed54806 841} __packed;
00b3ed16 842
c4d8a0a8 843struct hfa384x_usb_bufavail {
e573aaa4
MM
844 u16 type;
845 u16 frmlen;
c4d8a0a8 846} __packed;
00b3ed16 847
d4734c30 848struct hfa384x_usb_error {
e573aaa4
MM
849 u16 type;
850 u16 errortype;
d4734c30 851} __packed;
00b3ed16
GKH
852
853/*----------------------------------------------------------*/
854/* Unions for packaging all the known packet types together */
855
4012684a 856union hfa384x_usbout {
a78d1312 857 __le16 type;
2f1014f7 858 struct hfa384x_usb_txfrm txfrm;
a6dcbdfe 859 struct hfa384x_usb_cmdreq cmdreq;
3bc070f6 860 struct hfa384x_usb_wridreq wridreq;
5b9f240e 861 struct hfa384x_usb_rridreq rridreq;
f0e15d40 862 struct hfa384x_usb_wmemreq wmemreq;
94ec5464 863 struct hfa384x_usb_rmemreq rmemreq;
4012684a 864} __packed;
00b3ed16 865
3e4180c3 866union hfa384x_usbin {
a78d1312 867 __le16 type;
684b2e08 868 struct hfa384x_usb_rxfrm rxfrm;
2f1014f7 869 struct hfa384x_usb_txfrm txfrm;
e20a7ca1 870 struct hfa384x_usb_infofrm infofrm;
385a79df 871 struct hfa384x_usb_statusresp cmdresp;
2c8079de 872 struct hfa384x_usb_statusresp wridresp;
a988c9f3 873 struct hfa384x_usb_rridresp rridresp;
499c1cc9 874 struct hfa384x_usb_statusresp wmemresp;
1ed54806 875 struct hfa384x_usb_rmemresp rmemresp;
c4d8a0a8 876 struct hfa384x_usb_bufavail bufavail;
d4734c30 877 struct hfa384x_usb_error usberror;
e573aaa4 878 u8 boguspad[3000];
3e4180c3 879} __packed;
00b3ed16 880
76e3e7c4 881/*--------------------------------------------------------------------
3e27dfa2
SP
882 * PD record structures.
883 *--------------------------------------------------------------------
884 */
76e3e7c4 885
9127692f 886struct hfa384x_pdr_mfisuprange {
75f49e07
MT
887 u16 id;
888 u16 variant;
889 u16 bottom;
890 u16 top;
9127692f 891} __packed;
76e3e7c4 892
4ae2996f 893struct hfa384x_pdr_cfisuprange {
75f49e07
MT
894 u16 id;
895 u16 variant;
896 u16 bottom;
897 u16 top;
4ae2996f 898} __packed;
76e3e7c4 899
e9ee92c7 900struct hfa384x_pdr_nicid {
75f49e07
MT
901 u16 id;
902 u16 variant;
903 u16 major;
904 u16 minor;
e9ee92c7 905} __packed;
76e3e7c4 906
4f026e89 907struct hfa384x_pdrec {
76b4580b
MB
908 __le16 len; /* in words */
909 __le16 code;
76e3e7c4 910 union pdr {
9127692f 911 struct hfa384x_pdr_mfisuprange mfisuprange;
4ae2996f 912 struct hfa384x_pdr_cfisuprange cfisuprange;
e9ee92c7 913 struct hfa384x_pdr_nicid nicid;
76e3e7c4
KR
914
915 } data;
4f026e89 916} __packed;
76e3e7c4 917
00b3ed16
GKH
918#ifdef __KERNEL__
919/*--------------------------------------------------------------------
3e27dfa2
SP
920 * --- MAC state structure, argument to all functions --
921 * --- Also, a collection of support types --
922 *--------------------------------------------------------------------
923 */
501f5f96 924struct hfa384x_cmdresult {
e573aaa4
MM
925 u16 status;
926 u16 resp0;
927 u16 resp1;
928 u16 resp2;
501f5f96 929};
00b3ed16 930
00b3ed16
GKH
931/* USB Control Exchange (CTLX):
932 * A queue of the structure below is maintained for all of the
933 * Request/Response type USB packets supported by Prism2.
934 */
935/* The following hfa384x_* structures are arguments to
936 * the usercb() for the different CTLX types.
937 */
b3fd890e 938struct hfa384x_rridresult {
e573aaa4
MM
939 u16 rid;
940 const void *riddata;
941 unsigned int riddata_len;
b3fd890e 942};
00b3ed16
GKH
943
944enum ctlx_state {
e573aaa4 945 CTLX_START = 0, /* Start state, not queued */
00b3ed16 946
e573aaa4 947 CTLX_COMPLETE, /* CTLX successfully completed */
00b3ed16
GKH
948 CTLX_REQ_FAILED, /* OUT URB completed w/ error */
949
950 CTLX_PENDING, /* Queued, data valid */
951 CTLX_REQ_SUBMITTED, /* OUT URB submitted */
952 CTLX_REQ_COMPLETE, /* OUT URB complete */
953 CTLX_RESP_COMPLETE /* IN URB received */
954};
00b3ed16
GKH
955
956struct hfa384x_usbctlx;
957struct hfa384x;
958
e573aaa4 959typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);
00b3ed16 960
5dd8acc8 961typedef void (*ctlx_usercb_t) (struct hfa384x *hw,
e573aaa4 962 void *ctlxresult, void *usercb_data);
00b3ed16 963
a10d36b0 964struct hfa384x_usbctlx {
e573aaa4 965 struct list_head list;
00b3ed16 966
e573aaa4 967 size_t outbufsize;
4012684a 968 union hfa384x_usbout outbuf; /* pkt buf for OUT */
3e4180c3 969 union hfa384x_usbin inbuf; /* pkt buf for IN(a copy) */
00b3ed16 970
173bf7e3 971 enum ctlx_state state; /* Tracks running state */
00b3ed16 972
e573aaa4 973 struct completion done;
318c66d4 974 int reapable; /* Food for the reaper task */
00b3ed16 975
e573aaa4
MM
976 ctlx_cmdcb_t cmdcb; /* Async command callback */
977 ctlx_usercb_t usercb; /* Async user callback, */
978 void *usercb_data; /* at CTLX completion */
a10d36b0 979};
00b3ed16 980
3df38936 981struct hfa384x_usbctlxq {
e573aaa4
MM
982 spinlock_t lock;
983 struct list_head pending;
984 struct list_head active;
985 struct list_head completing;
986 struct list_head reapable;
3df38936 987};
00b3ed16 988
e2f503c4 989struct hfa384x_metacmd {
e573aaa4 990 u16 cmd;
00b3ed16 991
e573aaa4
MM
992 u16 parm0;
993 u16 parm1;
994 u16 parm2;
00b3ed16 995
501f5f96 996 struct hfa384x_cmdresult result;
e2f503c4 997};
00b3ed16 998
00b3ed16 999#define MAX_GRP_ADDR 32
71508ee4 1000#define WLAN_COMMENT_MAX 80 /* Max. length of user comment string. */
00b3ed16 1001
71508ee4
AG
1002#define WLAN_AUTH_MAX 60 /* Max. # of authenticated stations. */
1003#define WLAN_ACCESS_MAX 60 /* Max. # of stations in an access list. */
1004#define WLAN_ACCESS_NONE 0 /* No stations may be authenticated. */
1005#define WLAN_ACCESS_ALL 1 /* All stations may be authenticated. */
1006#define WLAN_ACCESS_ALLOW 2 /* Authenticate only "allowed" stations. */
1007#define WLAN_ACCESS_DENY 3 /* Do not authenticate "denied" stations. */
00b3ed16
GKH
1008
1009/* XXX These are going away ASAP */
c84b528c 1010struct prism2sta_authlist {
e573aaa4
MM
1011 unsigned int cnt;
1012 u8 addr[WLAN_AUTH_MAX][ETH_ALEN];
1013 u8 assoc[WLAN_AUTH_MAX];
c84b528c 1014};
00b3ed16 1015
4d10ece3 1016struct prism2sta_accesslist {
e573aaa4
MM
1017 unsigned int modify;
1018 unsigned int cnt;
1019 u8 addr[WLAN_ACCESS_MAX][ETH_ALEN];
1020 unsigned int cnt1;
1021 u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN];
4d10ece3 1022};
00b3ed16 1023
5a2214e2 1024struct hfa384x {
00b3ed16 1025 /* USB support data */
e573aaa4
MM
1026 struct usb_device *usb;
1027 struct urb rx_urb;
1028 struct sk_buff *rx_urb_skb;
1029 struct urb tx_urb;
1030 struct urb ctlx_urb;
4012684a 1031 union hfa384x_usbout txbuff;
3df38936 1032 struct hfa384x_usbctlxq ctlxq;
e573aaa4
MM
1033 struct timer_list reqtimer;
1034 struct timer_list resptimer;
00b3ed16 1035
e573aaa4 1036 struct timer_list throttle;
00b3ed16 1037
cbe0f674 1038 struct work_struct reaper_bh;
9442e81d 1039 struct work_struct completion_bh;
00b3ed16 1040
e573aaa4 1041 struct work_struct usb_work;
00b3ed16 1042
e573aaa4 1043 unsigned long usb_flags;
00b3ed16
GKH
1044#define THROTTLE_RX 0
1045#define THROTTLE_TX 1
1046#define WORK_RX_HALT 2
1047#define WORK_TX_HALT 3
1048#define WORK_RX_RESUME 4
1049#define WORK_TX_RESUME 5
1050
e573aaa4
MM
1051 unsigned short req_timer_done:1;
1052 unsigned short resp_timer_done:1;
00b3ed16 1053
e573aaa4
MM
1054 int endp_in;
1055 int endp_out;
00b3ed16 1056
e573aaa4
MM
1057 int sniff_fcs;
1058 int sniff_channel;
1059 int sniff_truncate;
1060 int sniffhdr;
00b3ed16 1061
e573aaa4 1062 wait_queue_head_t cmdq; /* wait queue itself */
00b3ed16
GKH
1063
1064 /* Controller state */
e573aaa4
MM
1065 u32 state;
1066 u32 isap;
1067 u8 port_enabled[HFA384x_NUMPORTS_MAX];
00b3ed16
GKH
1068
1069 /* Download support */
e573aaa4 1070 unsigned int dlstate;
b71db740 1071 struct hfa384x_downloadbuffer bufinfo;
e573aaa4 1072 u16 dltimeout;
00b3ed16 1073
1a6dfce7 1074 int scanflag; /* to signal scan complete */
e573aaa4
MM
1075 int join_ap; /* are we joined to a specific ap */
1076 int join_retries; /* number of join retries till we fail */
de3dc47c 1077 struct hfa384x_join_request_data joinreq;/* join request saved data */
00b3ed16 1078
c9573a8d 1079 struct wlandevice *wlandev;
00b3ed16 1080 /* Timer to allow for the deferred processing of linkstatus messages */
e573aaa4 1081 struct work_struct link_bh;
00b3ed16 1082
e573aaa4 1083 struct work_struct commsqual_bh;
a1e95045 1084 struct hfa384x_commsquality qual;
e573aaa4 1085 struct timer_list commsqual_timer;
00b3ed16 1086
aaad4303
SP
1087 u16 link_status;
1088 u16 link_status_new;
e573aaa4 1089 struct sk_buff_head authq;
00b3ed16 1090
cb3126e6
KR
1091 u32 txrate;
1092
00b3ed16
GKH
1093 /* And here we have stuff that used to be in priv */
1094
1095 /* State variables */
e573aaa4
MM
1096 unsigned int presniff_port_type;
1097 u16 presniff_wepflags;
1098 u32 dot11_desired_bss_type;
00b3ed16 1099
e573aaa4 1100 int dbmadjust;
00b3ed16
GKH
1101
1102 /* Group Addresses - right now, there are up to a total
5f0730fd
JR
1103 * of MAX_GRP_ADDR group addresses
1104 */
e573aaa4
MM
1105 u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN];
1106 unsigned int dot11_grpcnt;
00b3ed16
GKH
1107
1108 /* Component Identities */
5f046456
SP
1109 struct hfa384x_compident ident_nic;
1110 struct hfa384x_compident ident_pri_fw;
1111 struct hfa384x_compident ident_sta_fw;
1112 struct hfa384x_compident ident_ap_fw;
e573aaa4 1113 u16 mm_mods;
00b3ed16
GKH
1114
1115 /* Supplier compatibility ranges */
65f170c6
SP
1116 struct hfa384x_caplevel cap_sup_mfi;
1117 struct hfa384x_caplevel cap_sup_cfi;
1118 struct hfa384x_caplevel cap_sup_pri;
1119 struct hfa384x_caplevel cap_sup_sta;
1120 struct hfa384x_caplevel cap_sup_ap;
00b3ed16
GKH
1121
1122 /* Actor compatibility ranges */
5f7688dd
SP
1123 struct hfa384x_caplevel cap_act_pri_cfi; /*
1124 * pri f/w to controller
1125 * interface
1126 */
71508ee4 1127
5f7688dd
SP
1128 struct hfa384x_caplevel cap_act_sta_cfi; /*
1129 * sta f/w to controller
1130 * interface
1131 */
71508ee4 1132
7003e01a
TC
1133 struct hfa384x_caplevel cap_act_sta_mfi; /*
1134 * sta f/w to modem interface
1135 */
71508ee4 1136
65f170c6 1137 struct hfa384x_caplevel cap_act_ap_cfi; /*
71508ee4
AG
1138 * ap f/w to controller
1139 * interface
1140 */
1141
65f170c6 1142 struct hfa384x_caplevel cap_act_ap_mfi; /* ap f/w to modem interface */
00b3ed16 1143
e573aaa4 1144 u32 psusercount; /* Power save user count. */
b244edc6 1145 struct hfa384x_comm_tallies_32 tallies; /* Communication tallies. */
e573aaa4 1146 u8 comment[WLAN_COMMENT_MAX + 1]; /* User comment */
00b3ed16
GKH
1147
1148 /* Channel Info request results (AP only) */
1149 struct {
e573aaa4
MM
1150 atomic_t done;
1151 u8 count;
c447358a 1152 struct hfa384x_ch_info_result results;
00b3ed16
GKH
1153 } channel_info;
1154
60f5f3fb 1155 struct hfa384x_inf_frame *scanresults;
00b3ed16 1156
7003e01a
TC
1157 struct prism2sta_authlist authlist; /*
1158 * Authenticated station list.
1159 */
4d10ece3
VH
1160 unsigned int accessmode; /* Access mode. */
1161 struct prism2sta_accesslist allow; /* Allowed station list. */
1162 struct prism2sta_accesslist deny; /* Denied station list. */
00b3ed16 1163
5a2214e2 1164};
00b3ed16 1165
5a2214e2
SP
1166void hfa384x_create(struct hfa384x *hw, struct usb_device *usb);
1167void hfa384x_destroy(struct hfa384x *hw);
00b3ed16 1168
ffe5a0a1 1169int hfa384x_corereset(struct hfa384x *hw, int holdtime, int settletime,
95d8aa5c 1170 int genesis);
5a2214e2
SP
1171int hfa384x_drvr_disable(struct hfa384x *hw, u16 macport);
1172int hfa384x_drvr_enable(struct hfa384x *hw, u16 macport);
1173int hfa384x_drvr_flashdl_enable(struct hfa384x *hw);
1174int hfa384x_drvr_flashdl_disable(struct hfa384x *hw);
7003e01a
TC
1175int hfa384x_drvr_flashdl_write(struct hfa384x *hw, u32 daddr, void *buf,
1176 u32 len);
5a2214e2
SP
1177int hfa384x_drvr_getconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
1178int hfa384x_drvr_ramdl_enable(struct hfa384x *hw, u32 exeaddr);
1179int hfa384x_drvr_ramdl_disable(struct hfa384x *hw);
1180int hfa384x_drvr_ramdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
1181int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len);
1182int hfa384x_drvr_setconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
1183
7003e01a
TC
1184static inline int
1185hfa384x_drvr_getconfig16(struct hfa384x *hw, u16 rid, void *val)
00b3ed16 1186{
e573aaa4 1187 int result = 0;
7489df36 1188
aaad4303 1189 result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
e573aaa4 1190 if (result == 0)
e996024f 1191 le16_to_cpus(val);
00b3ed16
GKH
1192 return result;
1193}
1194
5a2214e2 1195static inline int hfa384x_drvr_setconfig16(struct hfa384x *hw, u16 rid, u16 val)
00b3ed16 1196{
e996024f 1197 __le16 value = cpu_to_le16(val);
7489df36 1198
00b3ed16
GKH
1199 return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
1200}
1201
00b3ed16 1202int
5a2214e2 1203hfa384x_drvr_setconfig_async(struct hfa384x *hw,
e573aaa4
MM
1204 u16 rid,
1205 void *buf,
1206 u16 len, ctlx_usercb_t usercb, void *usercb_data);
00b3ed16
GKH
1207
1208static inline int
5a2214e2 1209hfa384x_drvr_setconfig16_async(struct hfa384x *hw, u16 rid, u16 val)
00b3ed16 1210{
a18ffdf4 1211 __le16 value = cpu_to_le16(val);
7489df36 1212
00b3ed16 1213 return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
e573aaa4 1214 NULL, NULL);
00b3ed16
GKH
1215}
1216
5a2214e2
SP
1217int hfa384x_drvr_start(struct hfa384x *hw);
1218int hfa384x_drvr_stop(struct hfa384x *hw);
00b3ed16 1219int
5a2214e2 1220hfa384x_drvr_txframe(struct hfa384x *hw, struct sk_buff *skb,
6277fbfd 1221 struct p80211_hdr *p80211_hdr,
f6b43c2e 1222 struct p80211_metawep *p80211_wep);
c9573a8d 1223void hfa384x_tx_timeout(struct wlandevice *wlandev);
5dd8acc8 1224
5a2214e2
SP
1225int hfa384x_cmd_initialize(struct hfa384x *hw);
1226int hfa384x_cmd_enable(struct hfa384x *hw, u16 macport);
1227int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport);
1228int hfa384x_cmd_allocate(struct hfa384x *hw, u16 len);
1229int hfa384x_cmd_monitor(struct hfa384x *hw, u16 enable);
00b3ed16 1230int
5a2214e2 1231hfa384x_cmd_download(struct hfa384x *hw,
e573aaa4 1232 u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
00b3ed16 1233
71508ee4 1234#endif /*__KERNEL__ */
00b3ed16 1235
71508ee4 1236#endif /*_HFA384x_H */