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