1 /* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */
4 * Defines the constants and data structures for the hfa384x
6 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
7 * --------------------------------------------------------------------
11 * --------------------------------------------------------------------
13 * Inquiries regarding the linux-wlan Open Source project can be
16 * AbsoluteValue Systems Inc.
18 * http://www.linux-wlan.com
20 * --------------------------------------------------------------------
22 * Portions of the development of this software were funded by
23 * Intersil Corporation as part of PRISM(R) chipset product development.
25 * --------------------------------------------------------------------
27 * [Implementation and usage notes]
30 * CW10 Programmer's Manual v1.5
33 * --------------------------------------------------------------------
39 #define HFA384x_FIRMWARE_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
41 #include <linux/if_ether.h>
42 #include <linux/usb.h>
44 /*--- Mins & Maxs -----------------------------------*/
45 #define HFA384x_PORTID_MAX ((u16)7)
46 #define HFA384x_NUMPORTS_MAX ((u16)(HFA384x_PORTID_MAX + 1))
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
57 /*--- Support Constants -----------------------------*/
58 #define HFA384x_PORTTYPE_IBSS ((u16)0)
59 #define HFA384x_PORTTYPE_BSS ((u16)1)
60 #define HFA384x_PORTTYPE_PSUEDOIBSS ((u16)3)
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))
65 #define HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM ((u16)3)
66 #define HFA384x_PORTSTATUS_DISABLED ((u16)1)
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)
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.
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)
92 /* Mask bits for discarding unwanted pieces in AUX format
93 * 16-bit address parts
95 #define HFA384x_ADDR_AUX_PAGE_MASK (0xffff)
96 #define HFA384x_ADDR_AUX_OFF_MASK (0x007f)
98 /* Make a 32-bit flat address from AUX format 16-bit page and offset */
99 #define HFA384x_ADDR_AUX_MKFLAT(p, o) \
100 ((((u32)(((u16)(p)) & HFA384x_ADDR_AUX_PAGE_MASK)) << 7) | \
101 ((u32)(((u16)(o)) & HFA384x_ADDR_AUX_OFF_MASK)))
103 /* Make CMD format offset and page from a 32-bit flat address */
104 #define HFA384x_ADDR_CMD_MKPAGE(f) \
105 ((u16)((((u32)(f)) & HFA384x_ADDR_FLAT_CMD_PAGE_MASK) >> 16))
106 #define HFA384x_ADDR_CMD_MKOFF(f) \
107 ((u16)(((u32)(f)) & HFA384x_ADDR_FLAT_CMD_OFF_MASK))
109 /*--- Controller Memory addresses -------------------*/
110 #define HFA3842_PDA_BASE (0x007f0000UL)
111 #define HFA3841_PDA_BASE (0x003f0000UL)
112 #define HFA3841_PDA_BOGUS_BASE (0x00390000UL)
114 /*--- Driver Download states -----------------------*/
115 #define HFA384x_DLSTATE_DISABLED 0
116 #define HFA384x_DLSTATE_RAMENABLED 1
117 #define HFA384x_DLSTATE_FLASHENABLED 2
119 /*--- Register Field Masks --------------------------*/
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))
126 /*--- Command Code Constants --------------------------*/
127 /*--- Controller Commands --------------------------*/
128 #define HFA384x_CMDCODE_INIT ((u16)0x00)
129 #define HFA384x_CMDCODE_ENABLE ((u16)0x01)
130 #define HFA384x_CMDCODE_DISABLE ((u16)0x02)
132 /*--- Regulate Commands --------------------------*/
133 #define HFA384x_CMDCODE_INQ ((u16)0x11)
135 /*--- Configure Commands --------------------------*/
136 #define HFA384x_CMDCODE_DOWNLD ((u16)0x22)
138 /*--- Debugging Commands -----------------------------*/
139 #define HFA384x_CMDCODE_MONITOR ((u16)(0x38))
140 #define HFA384x_MONITOR_ENABLE ((u16)(0x0b))
141 #define HFA384x_MONITOR_DISABLE ((u16)(0x0f))
143 /*--- Result Codes --------------------------*/
144 #define HFA384x_CMD_ERR ((u16)(0x7F))
146 /*--- Programming Modes --------------------------
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 *-------------------------------------------------
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)
158 /*--- Record ID Constants --------------------------*/
159 /*--------------------------------------------------------------------
160 * Configuration RIDs: Network Parameters, Static Configuration Entities
161 *--------------------------------------------------------------------
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)
168 #define HFA384x_RID_CNFMAXDATALEN ((u16)0xFC07)
170 /*--------------------------------------------------------------------
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 *--------------------------------------------------------------------
176 #define HFA384x_RID_CNFOWNMACADDR_LEN ((u16)6)
177 #define HFA384x_RID_CNFDESIREDSSID_LEN ((u16)34)
178 #define HFA384x_RID_CNFOWNSSID_LEN ((u16)34)
180 /*--------------------------------------------------------------------
181 * Configuration RIDs: Network Parameters, Dynamic Configuration Entities
182 *--------------------------------------------------------------------
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)
190 /*----------------------------------------------------------------------
191 * Information RIDs: NIC Information
192 *----------------------------------------------------------------------
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)
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)
208 /*----------------------------------------------------------------------
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 *---------------------------------------------------------------------
214 #define HFA384x_RID_NICSERIALNUMBER_LEN ((u16)12)
216 /*--------------------------------------------------------------------
217 * Information RIDs: MAC Information
218 *--------------------------------------------------------------------
220 #define HFA384x_RID_PORTSTATUS ((u16)0xFD40)
221 #define HFA384x_RID_CURRENTSSID ((u16)0xFD41)
222 #define HFA384x_RID_CURRENTBSSID ((u16)0xFD42)
223 #define HFA384x_RID_CURRENTTXRATE ((u16)0xFD44)
224 #define HFA384x_RID_SHORTRETRYLIMIT ((u16)0xFD48)
225 #define HFA384x_RID_LONGRETRYLIMIT ((u16)0xFD49)
226 #define HFA384x_RID_MAXTXLIFETIME ((u16)0xFD4A)
227 #define HFA384x_RID_PRIVACYOPTIMP ((u16)0xFD4F)
228 #define HFA384x_RID_DBMCOMMSQUALITY ((u16)0xFD51)
230 /*--------------------------------------------------------------------
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 *--------------------------------------------------------------------
236 #define HFA384x_RID_DBMCOMMSQUALITY_LEN \
237 ((u16)sizeof(struct hfa384x_dbmcommsquality))
238 #define HFA384x_RID_JOINREQUEST_LEN \
239 ((u16)sizeof(struct hfa384x_join_request_data))
241 /*--------------------------------------------------------------------
242 * Information RIDs: Modem Information
243 *--------------------------------------------------------------------
245 #define HFA384x_RID_CURRENTCHANNEL ((u16)0xFDC1)
247 /*--------------------------------------------------------------------
248 * API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
249 *--------------------------------------------------------------------
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)
257 #define HFA384x_RID_CNFAUTHENTICATION ((u16)0xFC2A)
258 #define HFA384x_RID_CNFROAMINGMODE ((u16)0xFC2D)
259 #define HFA384x_RID_CNFAPBCNINT ((u16)0xFC33)
260 #define HFA384x_RID_CNFDBMADJUST ((u16)0xFC46)
261 #define HFA384x_RID_CNFWPADATA ((u16)0xFC48)
262 #define HFA384x_RID_CNFBASICRATES ((u16)0xFCB3)
263 #define HFA384x_RID_CNFSUPPRATES ((u16)0xFCB4)
264 #define HFA384x_RID_CNFPASSIVESCANCTRL ((u16)0xFCBA)
265 #define HFA384x_RID_TXPOWERMAX ((u16)0xFCBE)
266 #define HFA384x_RID_JOINREQUEST ((u16)0xFCE2)
267 #define HFA384x_RID_AUTHENTICATESTA ((u16)0xFCE3)
268 #define HFA384x_RID_HOSTSCAN ((u16)0xFCE5)
270 #define HFA384x_RID_CNFWEPDEFAULTKEY_LEN ((u16)6)
271 #define HFA384x_RID_CNFWEP128DEFAULTKEY_LEN ((u16)14)
273 /*--------------------------------------------------------------------
275 *--------------------------------------------------------------------
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)
285 #define HFA384x_PDR_MAC_ADDRESS ((u16)0x0101)
286 #define HFA384x_PDR_REGDOMAIN ((u16)0x0103)
287 #define HFA384x_PDR_ALLOWED_CHANNEL ((u16)0x0104)
288 #define HFA384x_PDR_DEFAULT_CHANNEL ((u16)0x0105)
289 #define HFA384x_PDR_TEMPTYPE ((u16)0x0107)
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)
297 #define HFA384x_PDR_MAX_TX_POWER ((u16)0x0302)
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)
306 #define HFA384x_PDR_USB_MAX_POWER ((u16)0x0409)
307 #define HFA384x_PDR_USB_MANUFACTURER ((u16)0x0410)
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)
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)
317 /*--- Register Test/Get/Set Field macros ------------------------*/
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))
324 #define HFA384x_CMD_CMDCODE_SET(value) ((u16)(value))
326 #define HFA384x_STATUS_RESULT_SET(value) (((u16)(value)) << 8)
328 /* Host Maintained State Info */
329 #define HFA384x_STATE_PREINIT 0
330 #define HFA384x_STATE_INIT 1
331 #define HFA384x_STATE_RUNNING 2
333 /*-------------------------------------------------------------*/
334 /* Commonly used basic types */
335 struct hfa384x_bytestr {
340 struct hfa384x_bytestr32 {
345 /*--------------------------------------------------------------------
346 * Configuration Record Structures:
347 * Network Parameters, Static Configuration Entities
348 *--------------------------------------------------------------------
351 /*-- Hardware/Firmware Component Information ----------*/
352 struct hfa384x_compident {
359 struct hfa384x_caplevel {
367 /*-- Configuration Record: cnfAuthentication --*/
368 #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM 0x0001
369 #define HFA384x_CNFAUTHENTICATION_SHAREDKEY 0x0002
370 #define HFA384x_CNFAUTHENTICATION_LEAP 0x0004
372 /*--------------------------------------------------------------------
373 * Configuration Record Structures:
374 * Network Parameters, Dynamic Configuration Entities
375 *--------------------------------------------------------------------
378 #define HFA384x_CREATEIBSS_JOINCREATEIBSS 0
380 /*-- Configuration Record: HostScanRequest (data portion only) --*/
381 struct hfa384x_host_scan_request_data {
384 struct hfa384x_bytestr32 ssid;
387 /*-- Configuration Record: JoinRequest (data portion only) --*/
388 struct hfa384x_join_request_data {
389 u8 bssid[WLAN_BSSID_LEN];
393 /*-- Configuration Record: authenticateStation (data portion only) --*/
394 struct hfa384x_authenticate_station_data {
395 u8 address[ETH_ALEN];
400 /*-- Configuration Record: WPAData (data portion only) --*/
401 struct hfa384x_wpa_data {
403 u8 data[]; /* max 80 */
406 /*--------------------------------------------------------------------
407 * Information Record Structures: NIC Information
408 *--------------------------------------------------------------------
411 /*-- Information Record: DownLoadBuffer --*/
412 /* NOTE: The page and offset are in AUX format */
413 struct hfa384x_downloadbuffer {
419 /*--------------------------------------------------------------------
420 * Information Record Structures: NIC Information
421 *--------------------------------------------------------------------
424 #define HFA384x_PSTATUS_CONN_IBSS ((u16)3)
426 /*-- Information Record: commsquality --*/
427 struct hfa384x_commsquality {
433 /*-- Information Record: dmbcommsquality --*/
434 struct hfa384x_dbmcommsquality {
436 u16 asl_dbm_curr_bss;
440 /*--------------------------------------------------------------------
441 * FRAME STRUCTURES: Communication Frames
442 *--------------------------------------------------------------------
443 * Communication Frames: Transmit Frames
444 *--------------------------------------------------------------------
446 /*-- Communication Frame: Transmit Frame Structure --*/
447 struct hfa384x_tx_frame {
456 /*-- 802.11 Header Information --*/
457 struct p80211_hdr hdr;
458 __le16 data_len; /* little endian format */
460 /*-- 802.3 Header Information --*/
464 u16 data_length; /* big endian format */
466 /*--------------------------------------------------------------------
467 * Communication Frames: Field Masks for Transmit Frames
468 *--------------------------------------------------------------------
470 /*-- Status Field --*/
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))
476 /*-- Transmit Control Field --*/
477 #define HFA384x_TX_MACPORT ((u16)GENMASK(10, 8))
478 #define HFA384x_TX_STRUCTYPE ((u16)GENMASK(4, 3))
479 #define HFA384x_TX_TXEX ((u16)BIT(2))
480 #define HFA384x_TX_TXOK ((u16)BIT(1))
481 /*--------------------------------------------------------------------
482 * Communication Frames: Test/Get/Set Field Values for Transmit Frames
483 *--------------------------------------------------------------------
485 /*-- Status Field --*/
486 #define HFA384x_TXSTATUS_ISERROR(v) \
488 (HFA384x_TXSTATUS_ACKERR | HFA384x_TXSTATUS_FORMERR | \
489 HFA384x_TXSTATUS_DISCON | HFA384x_TXSTATUS_AGEDERR | \
490 HFA384x_TXSTATUS_RETRYERR))
492 #define HFA384x_TX_SET(v, m, s) ((((u16)(v)) << ((u16)(s))) & ((u16)(m)))
494 #define HFA384x_TX_MACPORT_SET(v) HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
495 #define HFA384x_TX_STRUCTYPE_SET(v) HFA384x_TX_SET(v, \
496 HFA384x_TX_STRUCTYPE, 3)
497 #define HFA384x_TX_TXEX_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
498 #define HFA384x_TX_TXOK_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
499 /*--------------------------------------------------------------------
500 * Communication Frames: Receive Frames
501 *--------------------------------------------------------------------
503 /*-- Communication Frame: Receive Frame Structure --*/
504 struct hfa384x_rx_frame {
505 /*-- MAC rx descriptor (hfa384x byte order) --*/
515 /*-- 802.11 Header Information (802.11 byte order) --*/
516 struct p80211_hdr hdr;
517 __le16 data_len; /* hfa384x (little endian) format */
519 /*-- 802.3 Header Information --*/
522 u16 data_length; /* IEEE? (big endian) format */
524 /*--------------------------------------------------------------------
525 * Communication Frames: Field Masks for Receive Frames
526 *--------------------------------------------------------------------
529 /*-- Status Fields --*/
530 #define HFA384x_RXSTATUS_MACPORT ((u16)GENMASK(10, 8))
531 #define HFA384x_RXSTATUS_FCSERR ((u16)BIT(0))
532 /*--------------------------------------------------------------------
533 * Communication Frames: Test/Get/Set Field Values for Receive Frames
534 *--------------------------------------------------------------------
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))
540 /*--------------------------------------------------------------------
541 * FRAME STRUCTURES: Information Types and Information Frame Structures
542 *--------------------------------------------------------------------
544 *--------------------------------------------------------------------
546 #define HFA384x_IT_HANDOVERADDR ((u16)0xF000UL)
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)
556 #define HFA384x_IT_ASSOCREQ ((u16)0xF205UL)
557 #define HFA384x_IT_MICFAILURE ((u16)0xF206UL)
559 /*--------------------------------------------------------------------
560 * Information Frames Structures
561 *--------------------------------------------------------------------
562 * Information Frames: Notification Frame Structures
563 *--------------------------------------------------------------------
566 /*-- Inquiry Frame, Diagnose: Communication Tallies --*/
567 struct hfa384x_comm_tallies_16 {
568 __le16 txunicastframes;
569 __le16 txmulticastframes;
571 __le16 txunicastoctets;
572 __le16 txmulticastoctets;
573 __le16 txdeferredtrans;
574 __le16 txsingleretryframes;
575 __le16 txmultipleretryframes;
576 __le16 txretrylimitexceeded;
578 __le16 rxunicastframes;
579 __le16 rxmulticastframes;
581 __le16 rxunicastoctets;
582 __le16 rxmulticastoctets;
584 __le16 rxdiscardsnobuffer;
585 __le16 txdiscardswrongsa;
586 __le16 rxdiscardswepundecr;
587 __le16 rxmsginmsgfrag;
588 __le16 rxmsginbadmsgfrag;
591 struct hfa384x_comm_tallies_32 {
592 __le32 txunicastframes;
593 __le32 txmulticastframes;
595 __le32 txunicastoctets;
596 __le32 txmulticastoctets;
597 __le32 txdeferredtrans;
598 __le32 txsingleretryframes;
599 __le32 txmultipleretryframes;
600 __le32 txretrylimitexceeded;
602 __le32 rxunicastframes;
603 __le32 rxmulticastframes;
605 __le32 rxunicastoctets;
606 __le32 rxmulticastoctets;
608 __le32 rxdiscardsnobuffer;
609 __le32 txdiscardswrongsa;
610 __le32 rxdiscardswepundecr;
611 __le32 rxmsginmsgfrag;
612 __le32 rxmsginbadmsgfrag;
615 /*-- Inquiry Frame, Diagnose: Scan Results & Subfields--*/
616 struct hfa384x_scan_result_sub {
620 u8 bssid[WLAN_BSSID_LEN];
623 struct hfa384x_bytestr32 ssid;
624 u8 supprates[10]; /* 802.11 info element */
628 struct hfa384x_scan_result {
631 struct hfa384x_scan_result_sub result[HFA384x_SCANRESULT_MAX];
634 /*-- Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
635 struct hfa384x_ch_info_result_sub {
642 #define HFA384x_CHINFORESULT_BSSACTIVE BIT(0)
643 #define HFA384x_CHINFORESULT_PCFACTIVE BIT(1)
645 struct hfa384x_ch_info_result {
647 struct hfa384x_ch_info_result_sub result[HFA384x_CHINFORESULT_MAX];
650 /*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
651 struct hfa384x_hscan_result_sub {
655 u8 bssid[WLAN_BSSID_LEN];
658 struct hfa384x_bytestr32 ssid;
659 u8 supprates[10]; /* 802.11 info element */
664 struct hfa384x_hscan_result {
667 struct hfa384x_hscan_result_sub result[HFA384x_HSCANRESULT_MAX];
670 /*-- Unsolicited Frame, MAC Mgmt: LinkStatus --*/
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)
680 struct hfa384x_link_status {
684 /*-- Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
686 #define HFA384x_ASSOCSTATUS_STAASSOC ((u16)1)
687 #define HFA384x_ASSOCSTATUS_REASSOC ((u16)2)
688 #define HFA384x_ASSOCSTATUS_AUTHFAIL ((u16)5)
690 struct hfa384x_assoc_status {
692 u8 sta_addr[ETH_ALEN];
693 /* old_ap_addr is only valid if assocstatus == 2 */
694 u8 old_ap_addr[ETH_ALEN];
699 /*-- Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
701 struct hfa384x_auth_request {
702 u8 sta_addr[ETH_ALEN];
706 /*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
708 struct hfa384x_ps_user_count {
712 struct hfa384x_key_id_changed {
713 u8 sta_addr[ETH_ALEN];
717 /*-- Collection of all Inf frames ---------------*/
718 union hfa384x_infodata {
719 struct hfa384x_comm_tallies_16 commtallies16;
720 struct hfa384x_comm_tallies_32 commtallies32;
721 struct hfa384x_scan_result scanresult;
722 struct hfa384x_ch_info_result chinforesult;
723 struct hfa384x_hscan_result hscanresult;
724 struct hfa384x_link_status linkstatus;
725 struct hfa384x_assoc_status assocstatus;
726 struct hfa384x_auth_request authreq;
727 struct hfa384x_ps_user_count psusercnt;
728 struct hfa384x_key_id_changed keyidchanged;
731 struct hfa384x_inf_frame {
734 union hfa384x_infodata info;
737 /*--------------------------------------------------------------------
738 * USB Packet structures and constants.
739 *--------------------------------------------------------------------
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
750 /* Received from the bulkin endpoint */
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
762 /*------------------------------------*/
763 /* Request (bulk OUT) packet contents */
765 struct hfa384x_usb_txfrm {
766 struct hfa384x_tx_frame desc;
767 u8 data[WLAN_DATA_MAXLEN];
770 struct hfa384x_usb_cmdreq {
779 struct hfa384x_usb_wridreq {
783 u8 data[HFA384x_RIDDATA_MAXLEN];
786 struct hfa384x_usb_rridreq {
793 struct hfa384x_usb_wmemreq {
798 u8 data[HFA384x_USB_RWMEM_MAXLEN];
801 struct hfa384x_usb_rmemreq {
809 /*------------------------------------*/
810 /* Response (bulk IN) packet contents */
812 struct hfa384x_usb_rxfrm {
813 struct hfa384x_rx_frame desc;
814 u8 data[WLAN_DATA_MAXLEN];
817 struct hfa384x_usb_infofrm {
819 struct hfa384x_inf_frame info;
822 struct hfa384x_usb_statusresp {
830 struct hfa384x_usb_rridresp {
834 u8 data[HFA384x_RIDDATA_MAXLEN];
837 struct hfa384x_usb_rmemresp {
840 u8 data[HFA384x_USB_RWMEM_MAXLEN];
843 struct hfa384x_usb_bufavail {
848 struct hfa384x_usb_error {
853 /*----------------------------------------------------------*/
854 /* Unions for packaging all the known packet types together */
856 union hfa384x_usbout {
858 struct hfa384x_usb_txfrm txfrm;
859 struct hfa384x_usb_cmdreq cmdreq;
860 struct hfa384x_usb_wridreq wridreq;
861 struct hfa384x_usb_rridreq rridreq;
862 struct hfa384x_usb_wmemreq wmemreq;
863 struct hfa384x_usb_rmemreq rmemreq;
866 union hfa384x_usbin {
868 struct hfa384x_usb_rxfrm rxfrm;
869 struct hfa384x_usb_txfrm txfrm;
870 struct hfa384x_usb_infofrm infofrm;
871 struct hfa384x_usb_statusresp cmdresp;
872 struct hfa384x_usb_statusresp wridresp;
873 struct hfa384x_usb_rridresp rridresp;
874 struct hfa384x_usb_statusresp wmemresp;
875 struct hfa384x_usb_rmemresp rmemresp;
876 struct hfa384x_usb_bufavail bufavail;
877 struct hfa384x_usb_error usberror;
881 /*--------------------------------------------------------------------
882 * PD record structures.
883 *--------------------------------------------------------------------
886 struct hfa384x_pdr_mfisuprange {
893 struct hfa384x_pdr_cfisuprange {
900 struct hfa384x_pdr_nicid {
907 struct hfa384x_pdrec {
908 __le16 len; /* in words */
911 struct hfa384x_pdr_mfisuprange mfisuprange;
912 struct hfa384x_pdr_cfisuprange cfisuprange;
913 struct hfa384x_pdr_nicid nicid;
919 /*--------------------------------------------------------------------
920 * --- MAC state structure, argument to all functions --
921 * --- Also, a collection of support types --
922 *--------------------------------------------------------------------
924 struct hfa384x_cmdresult {
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.
935 /* The following hfa384x_* structures are arguments to
936 * the usercb() for the different CTLX types.
938 struct hfa384x_rridresult {
941 unsigned int riddata_len;
945 CTLX_START = 0, /* Start state, not queued */
947 CTLX_COMPLETE, /* CTLX successfully completed */
948 CTLX_REQ_FAILED, /* OUT URB completed w/ error */
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 */
956 struct hfa384x_usbctlx;
959 typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);
961 typedef void (*ctlx_usercb_t) (struct hfa384x *hw,
962 void *ctlxresult, void *usercb_data);
964 struct hfa384x_usbctlx {
965 struct list_head list;
968 union hfa384x_usbout outbuf; /* pkt buf for OUT */
969 union hfa384x_usbin inbuf; /* pkt buf for IN(a copy) */
971 enum ctlx_state state; /* Tracks running state */
973 struct completion done;
974 int reapable; /* Food for the reaper task */
976 ctlx_cmdcb_t cmdcb; /* Async command callback */
977 ctlx_usercb_t usercb; /* Async user callback, */
978 void *usercb_data; /* at CTLX completion */
981 struct hfa384x_usbctlxq {
983 struct list_head pending;
984 struct list_head active;
985 struct list_head completing;
986 struct list_head reapable;
989 struct hfa384x_metacmd {
996 struct hfa384x_cmdresult result;
999 #define MAX_GRP_ADDR 32
1000 #define WLAN_COMMENT_MAX 80 /* Max. length of user comment string. */
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. */
1009 /* XXX These are going away ASAP */
1010 struct prism2sta_authlist {
1012 u8 addr[WLAN_AUTH_MAX][ETH_ALEN];
1013 u8 assoc[WLAN_AUTH_MAX];
1016 struct prism2sta_accesslist {
1017 unsigned int modify;
1019 u8 addr[WLAN_ACCESS_MAX][ETH_ALEN];
1021 u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN];
1025 /* USB support data */
1026 struct usb_device *usb;
1028 struct sk_buff *rx_urb_skb;
1030 struct urb ctlx_urb;
1031 union hfa384x_usbout txbuff;
1032 struct hfa384x_usbctlxq ctlxq;
1033 struct timer_list reqtimer;
1034 struct timer_list resptimer;
1036 struct timer_list throttle;
1038 struct work_struct reaper_bh;
1039 struct work_struct completion_bh;
1041 struct work_struct usb_work;
1043 unsigned long usb_flags;
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
1051 unsigned short req_timer_done:1;
1052 unsigned short resp_timer_done:1;
1062 wait_queue_head_t cmdq; /* wait queue itself */
1064 /* Controller state */
1067 u8 port_enabled[HFA384x_NUMPORTS_MAX];
1069 /* Download support */
1070 unsigned int dlstate;
1071 struct hfa384x_downloadbuffer bufinfo;
1074 int scanflag; /* to signal scan complete */
1075 int join_ap; /* are we joined to a specific ap */
1076 int join_retries; /* number of join retries till we fail */
1077 struct hfa384x_join_request_data joinreq;/* join request saved data */
1079 struct wlandevice *wlandev;
1080 /* Timer to allow for the deferred processing of linkstatus messages */
1081 struct work_struct link_bh;
1083 struct work_struct commsqual_bh;
1084 struct hfa384x_commsquality qual;
1085 struct timer_list commsqual_timer;
1088 u16 link_status_new;
1089 struct sk_buff_head authq;
1093 /* And here we have stuff that used to be in priv */
1095 /* State variables */
1096 unsigned int presniff_port_type;
1097 u16 presniff_wepflags;
1098 u32 dot11_desired_bss_type;
1102 /* Group Addresses - right now, there are up to a total
1103 * of MAX_GRP_ADDR group addresses
1105 u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN];
1106 unsigned int dot11_grpcnt;
1108 /* Component Identities */
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;
1115 /* Supplier compatibility ranges */
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;
1122 /* Actor compatibility ranges */
1123 struct hfa384x_caplevel cap_act_pri_cfi; /*
1124 * pri f/w to controller
1128 struct hfa384x_caplevel cap_act_sta_cfi; /*
1129 * sta f/w to controller
1133 struct hfa384x_caplevel cap_act_sta_mfi; /*
1134 * sta f/w to modem interface
1137 struct hfa384x_caplevel cap_act_ap_cfi; /*
1138 * ap f/w to controller
1142 struct hfa384x_caplevel cap_act_ap_mfi; /* ap f/w to modem interface */
1144 u32 psusercount; /* Power save user count. */
1145 struct hfa384x_comm_tallies_32 tallies; /* Communication tallies. */
1146 u8 comment[WLAN_COMMENT_MAX + 1]; /* User comment */
1148 /* Channel Info request results (AP only) */
1152 struct hfa384x_ch_info_result results;
1155 struct hfa384x_inf_frame *scanresults;
1157 struct prism2sta_authlist authlist; /*
1158 * Authenticated station list.
1160 unsigned int accessmode; /* Access mode. */
1161 struct prism2sta_accesslist allow; /* Allowed station list. */
1162 struct prism2sta_accesslist deny; /* Denied station list. */
1166 void hfa384x_create(struct hfa384x *hw, struct usb_device *usb);
1167 void hfa384x_destroy(struct hfa384x *hw);
1169 int hfa384x_corereset(struct hfa384x *hw, int holdtime, int settletime,
1171 int hfa384x_drvr_disable(struct hfa384x *hw, u16 macport);
1172 int hfa384x_drvr_enable(struct hfa384x *hw, u16 macport);
1173 int hfa384x_drvr_flashdl_enable(struct hfa384x *hw);
1174 int hfa384x_drvr_flashdl_disable(struct hfa384x *hw);
1175 int hfa384x_drvr_flashdl_write(struct hfa384x *hw, u32 daddr, void *buf,
1177 int hfa384x_drvr_getconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
1178 int hfa384x_drvr_ramdl_enable(struct hfa384x *hw, u32 exeaddr);
1179 int hfa384x_drvr_ramdl_disable(struct hfa384x *hw);
1180 int hfa384x_drvr_ramdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
1181 int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len);
1182 int hfa384x_drvr_setconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
1185 hfa384x_drvr_getconfig16(struct hfa384x *hw, u16 rid, void *val)
1189 result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
1195 static inline int hfa384x_drvr_setconfig16(struct hfa384x *hw, u16 rid, u16 val)
1197 __le16 value = cpu_to_le16(val);
1199 return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
1203 hfa384x_drvr_setconfig_async(struct hfa384x *hw,
1206 u16 len, ctlx_usercb_t usercb, void *usercb_data);
1209 hfa384x_drvr_setconfig16_async(struct hfa384x *hw, u16 rid, u16 val)
1211 __le16 value = cpu_to_le16(val);
1213 return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
1217 int hfa384x_drvr_start(struct hfa384x *hw);
1218 int hfa384x_drvr_stop(struct hfa384x *hw);
1220 hfa384x_drvr_txframe(struct hfa384x *hw, struct sk_buff *skb,
1221 struct p80211_hdr *p80211_hdr,
1222 struct p80211_metawep *p80211_wep);
1223 void hfa384x_tx_timeout(struct wlandevice *wlandev);
1225 int hfa384x_cmd_initialize(struct hfa384x *hw);
1226 int hfa384x_cmd_enable(struct hfa384x *hw, u16 macport);
1227 int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport);
1228 int hfa384x_cmd_allocate(struct hfa384x *hw, u16 len);
1229 int hfa384x_cmd_monitor(struct hfa384x *hw, u16 enable);
1231 hfa384x_cmd_download(struct hfa384x *hw,
1232 u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
1234 #endif /*__KERNEL__ */
1236 #endif /*_HFA384x_H */