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