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 /* Byte Order */ 332 #ifdef __KERNEL__ 333 #define hfa384x2host_16(n) (__le16_to_cpu((u16)(n))) 334 #define hfa384x2host_32(n) (__le32_to_cpu((u32)(n))) 335 #define host2hfa384x_16(n) (__cpu_to_le16((u16)(n))) 336 #define host2hfa384x_32(n) (__cpu_to_le32((u32)(n))) 337 #endif 338 339 /* Host Maintained State Info */ 340 #define HFA384x_STATE_PREINIT 0 341 #define HFA384x_STATE_INIT 1 342 #define HFA384x_STATE_RUNNING 2 343 344 /*-------------------------------------------------------------*/ 345 /* Commonly used basic types */ 346 typedef struct hfa384x_bytestr { 347 u16 len; 348 u8 data[0]; 349 } __attribute__ ((packed)) hfa384x_bytestr_t; 350 351 typedef struct hfa384x_bytestr32 { 352 u16 len; 353 u8 data[32]; 354 } __attribute__ ((packed)) hfa384x_bytestr32_t; 355 356 /*-------------------------------------------------------------------- 357 Configuration Record Structures: 358 Network Parameters, Static Configuration Entities 359 --------------------------------------------------------------------*/ 360 361 /*-- Hardware/Firmware Component Information ----------*/ 362 typedef struct hfa384x_compident { 363 u16 id; 364 u16 variant; 365 u16 major; 366 u16 minor; 367 } __attribute__ ((packed)) hfa384x_compident_t; 368 369 typedef struct hfa384x_caplevel { 370 u16 role; 371 u16 id; 372 u16 variant; 373 u16 bottom; 374 u16 top; 375 } __attribute__ ((packed)) hfa384x_caplevel_t; 376 377 /*-- Configuration Record: cnfAuthentication --*/ 378 #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM 0x0001 379 #define HFA384x_CNFAUTHENTICATION_SHAREDKEY 0x0002 380 #define HFA384x_CNFAUTHENTICATION_LEAP 0x0004 381 382 /*-------------------------------------------------------------------- 383 Configuration Record Structures: 384 Network Parameters, Dynamic Configuration Entities 385 --------------------------------------------------------------------*/ 386 387 #define HFA384x_CREATEIBSS_JOINCREATEIBSS 0 388 389 /*-- Configuration Record: HostScanRequest (data portion only) --*/ 390 typedef struct hfa384x_HostScanRequest_data { 391 u16 channelList; 392 u16 txRate; 393 hfa384x_bytestr32_t ssid; 394 } __attribute__ ((packed)) hfa384x_HostScanRequest_data_t; 395 396 /*-- Configuration Record: JoinRequest (data portion only) --*/ 397 typedef struct hfa384x_JoinRequest_data { 398 u8 bssid[WLAN_BSSID_LEN]; 399 u16 channel; 400 } __attribute__ ((packed)) hfa384x_JoinRequest_data_t; 401 402 /*-- Configuration Record: authenticateStation (data portion only) --*/ 403 typedef struct hfa384x_authenticateStation_data { 404 u8 address[ETH_ALEN]; 405 u16 status; 406 u16 algorithm; 407 } __attribute__ ((packed)) hfa384x_authenticateStation_data_t; 408 409 /*-- Configuration Record: WPAData (data portion only) --*/ 410 typedef struct hfa384x_WPAData { 411 u16 datalen; 412 u8 data[0]; // max 80 413 } __attribute__ ((packed)) hfa384x_WPAData_t; 414 415 /*-------------------------------------------------------------------- 416 Information Record Structures: NIC Information 417 --------------------------------------------------------------------*/ 418 419 /*-- Information Record: DownLoadBuffer --*/ 420 /* NOTE: The page and offset are in AUX format */ 421 typedef struct hfa384x_downloadbuffer { 422 u16 page; 423 u16 offset; 424 u16 len; 425 } __attribute__ ((packed)) hfa384x_downloadbuffer_t; 426 427 /*-------------------------------------------------------------------- 428 Information Record Structures: NIC Information 429 --------------------------------------------------------------------*/ 430 431 #define HFA384x_PSTATUS_CONN_IBSS ((u16)3) 432 433 /*-- Information Record: commsquality --*/ 434 typedef struct hfa384x_commsquality { 435 u16 CQ_currBSS; 436 u16 ASL_currBSS; 437 u16 ANL_currFC; 438 } __attribute__ ((packed)) hfa384x_commsquality_t; 439 440 /*-- Information Record: dmbcommsquality --*/ 441 typedef struct hfa384x_dbmcommsquality { 442 u16 CQdbm_currBSS; 443 u16 ASLdbm_currBSS; 444 u16 ANLdbm_currFC; 445 } __attribute__ ((packed)) hfa384x_dbmcommsquality_t; 446 447 /*-------------------------------------------------------------------- 448 FRAME STRUCTURES: Communication Frames 449 ---------------------------------------------------------------------- 450 Communication Frames: Transmit Frames 451 --------------------------------------------------------------------*/ 452 /*-- Communication Frame: Transmit Frame Structure --*/ 453 typedef struct hfa384x_tx_frame { 454 u16 status; 455 u16 reserved1; 456 u16 reserved2; 457 u32 sw_support; 458 u8 tx_retrycount; 459 u8 tx_rate; 460 u16 tx_control; 461 462 /*-- 802.11 Header Information --*/ 463 464 u16 frame_control; 465 u16 duration_id; 466 u8 address1[6]; 467 u8 address2[6]; 468 u8 address3[6]; 469 u16 sequence_control; 470 u8 address4[6]; 471 u16 data_len; /* little endian format */ 472 473 /*-- 802.3 Header Information --*/ 474 475 u8 dest_addr[6]; 476 u8 src_addr[6]; 477 u16 data_length; /* big endian format */ 478 } __attribute__ ((packed)) hfa384x_tx_frame_t; 479 /*-------------------------------------------------------------------- 480 Communication Frames: Field Masks for Transmit Frames 481 --------------------------------------------------------------------*/ 482 /*-- Status Field --*/ 483 #define HFA384x_TXSTATUS_ACKERR ((u16)BIT(5)) 484 #define HFA384x_TXSTATUS_FORMERR ((u16)BIT(3)) 485 #define HFA384x_TXSTATUS_DISCON ((u16)BIT(2)) 486 #define HFA384x_TXSTATUS_AGEDERR ((u16)BIT(1)) 487 #define HFA384x_TXSTATUS_RETRYERR ((u16)BIT(0)) 488 /*-- Transmit Control Field --*/ 489 #define HFA384x_TX_MACPORT ((u16)(BIT(10) | BIT(9) | BIT(8))) 490 #define HFA384x_TX_STRUCTYPE ((u16)(BIT(4) | BIT(3))) 491 #define HFA384x_TX_TXEX ((u16)BIT(2)) 492 #define HFA384x_TX_TXOK ((u16)BIT(1)) 493 /*-------------------------------------------------------------------- 494 Communication Frames: Test/Get/Set Field Values for Transmit Frames 495 --------------------------------------------------------------------*/ 496 /*-- Status Field --*/ 497 #define HFA384x_TXSTATUS_ISERROR(v) \ 498 (((u16)(v))&\ 499 (HFA384x_TXSTATUS_ACKERR|HFA384x_TXSTATUS_FORMERR|\ 500 HFA384x_TXSTATUS_DISCON|HFA384x_TXSTATUS_AGEDERR|\ 501 HFA384x_TXSTATUS_RETRYERR)) 502 503 #define HFA384x_TX_SET(v, m, s) ((((u16)(v))<<((u16)(s)))&((u16)(m))) 504 505 #define HFA384x_TX_MACPORT_SET(v) HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8) 506 #define HFA384x_TX_STRUCTYPE_SET(v) HFA384x_TX_SET(v, HFA384x_TX_STRUCTYPE, 3) 507 #define HFA384x_TX_TXEX_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2) 508 #define HFA384x_TX_TXOK_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1) 509 /*-------------------------------------------------------------------- 510 Communication Frames: Receive Frames 511 --------------------------------------------------------------------*/ 512 /*-- Communication Frame: Receive Frame Structure --*/ 513 typedef struct hfa384x_rx_frame { 514 /*-- MAC rx descriptor (hfa384x byte order) --*/ 515 u16 status; 516 u32 time; 517 u8 silence; 518 u8 signal; 519 u8 rate; 520 u8 rx_flow; 521 u16 reserved1; 522 u16 reserved2; 523 524 /*-- 802.11 Header Information (802.11 byte order) --*/ 525 u16 frame_control; 526 u16 duration_id; 527 u8 address1[6]; 528 u8 address2[6]; 529 u8 address3[6]; 530 u16 sequence_control; 531 u8 address4[6]; 532 u16 data_len; /* hfa384x (little endian) format */ 533 534 /*-- 802.3 Header Information --*/ 535 u8 dest_addr[6]; 536 u8 src_addr[6]; 537 u16 data_length; /* IEEE? (big endian) format */ 538 } __attribute__ ((packed)) hfa384x_rx_frame_t; 539 /*-------------------------------------------------------------------- 540 Communication Frames: Field Masks for Receive Frames 541 --------------------------------------------------------------------*/ 542 543 /*-- Status Fields --*/ 544 #define HFA384x_RXSTATUS_MACPORT ((u16)(BIT(10) | BIT(9) | BIT(8))) 545 #define HFA384x_RXSTATUS_FCSERR ((u16)BIT(0)) 546 /*-------------------------------------------------------------------- 547 Communication Frames: Test/Get/Set Field Values for Receive Frames 548 --------------------------------------------------------------------*/ 549 #define HFA384x_RXSTATUS_MACPORT_GET(value) ((u16)((((u16)(value)) & HFA384x_RXSTATUS_MACPORT) >> 8)) 550 #define HFA384x_RXSTATUS_ISFCSERR(value) ((u16)(((u16)(value)) & HFA384x_RXSTATUS_FCSERR)) 551 /*-------------------------------------------------------------------- 552 FRAME STRUCTURES: Information Types and Information Frame Structures 553 ---------------------------------------------------------------------- 554 Information Types 555 --------------------------------------------------------------------*/ 556 #define HFA384x_IT_HANDOVERADDR ((u16)0xF000UL) 557 #define HFA384x_IT_COMMTALLIES ((u16)0xF100UL) 558 #define HFA384x_IT_SCANRESULTS ((u16)0xF101UL) 559 #define HFA384x_IT_CHINFORESULTS ((u16)0xF102UL) 560 #define HFA384x_IT_HOSTSCANRESULTS ((u16)0xF103UL) 561 #define HFA384x_IT_LINKSTATUS ((u16)0xF200UL) 562 #define HFA384x_IT_ASSOCSTATUS ((u16)0xF201UL) 563 #define HFA384x_IT_AUTHREQ ((u16)0xF202UL) 564 #define HFA384x_IT_PSUSERCNT ((u16)0xF203UL) 565 #define HFA384x_IT_KEYIDCHANGED ((u16)0xF204UL) 566 #define HFA384x_IT_ASSOCREQ ((u16)0xF205UL) 567 #define HFA384x_IT_MICFAILURE ((u16)0xF206UL) 568 569 /*-------------------------------------------------------------------- 570 Information Frames Structures 571 ---------------------------------------------------------------------- 572 Information Frames: Notification Frame Structures 573 --------------------------------------------------------------------*/ 574 575 /*-- Inquiry Frame, Diagnose: Communication Tallies --*/ 576 typedef struct hfa384x_CommTallies16 { 577 u16 txunicastframes; 578 u16 txmulticastframes; 579 u16 txfragments; 580 u16 txunicastoctets; 581 u16 txmulticastoctets; 582 u16 txdeferredtrans; 583 u16 txsingleretryframes; 584 u16 txmultipleretryframes; 585 u16 txretrylimitexceeded; 586 u16 txdiscards; 587 u16 rxunicastframes; 588 u16 rxmulticastframes; 589 u16 rxfragments; 590 u16 rxunicastoctets; 591 u16 rxmulticastoctets; 592 u16 rxfcserrors; 593 u16 rxdiscardsnobuffer; 594 u16 txdiscardswrongsa; 595 u16 rxdiscardswepundecr; 596 u16 rxmsginmsgfrag; 597 u16 rxmsginbadmsgfrag; 598 } __attribute__ ((packed)) hfa384x_CommTallies16_t; 599 600 typedef struct hfa384x_CommTallies32 { 601 u32 txunicastframes; 602 u32 txmulticastframes; 603 u32 txfragments; 604 u32 txunicastoctets; 605 u32 txmulticastoctets; 606 u32 txdeferredtrans; 607 u32 txsingleretryframes; 608 u32 txmultipleretryframes; 609 u32 txretrylimitexceeded; 610 u32 txdiscards; 611 u32 rxunicastframes; 612 u32 rxmulticastframes; 613 u32 rxfragments; 614 u32 rxunicastoctets; 615 u32 rxmulticastoctets; 616 u32 rxfcserrors; 617 u32 rxdiscardsnobuffer; 618 u32 txdiscardswrongsa; 619 u32 rxdiscardswepundecr; 620 u32 rxmsginmsgfrag; 621 u32 rxmsginbadmsgfrag; 622 } __attribute__ ((packed)) hfa384x_CommTallies32_t; 623 624 /*-- Inquiry Frame, Diagnose: Scan Results & Subfields--*/ 625 typedef struct hfa384x_ScanResultSub { 626 u16 chid; 627 u16 anl; 628 u16 sl; 629 u8 bssid[WLAN_BSSID_LEN]; 630 u16 bcnint; 631 u16 capinfo; 632 hfa384x_bytestr32_t ssid; 633 u8 supprates[10]; /* 802.11 info element */ 634 u16 proberesp_rate; 635 } __attribute__ ((packed)) hfa384x_ScanResultSub_t; 636 637 typedef struct hfa384x_ScanResult { 638 u16 rsvd; 639 u16 scanreason; 640 hfa384x_ScanResultSub_t result[HFA384x_SCANRESULT_MAX]; 641 } __attribute__ ((packed)) hfa384x_ScanResult_t; 642 643 /*-- Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/ 644 typedef struct hfa384x_ChInfoResultSub { 645 u16 chid; 646 u16 anl; 647 u16 pnl; 648 u16 active; 649 } __attribute__ ((packed)) hfa384x_ChInfoResultSub_t; 650 651 #define HFA384x_CHINFORESULT_BSSACTIVE BIT(0) 652 #define HFA384x_CHINFORESULT_PCFACTIVE BIT(1) 653 654 typedef struct hfa384x_ChInfoResult { 655 u16 scanchannels; 656 hfa384x_ChInfoResultSub_t result[HFA384x_CHINFORESULT_MAX]; 657 } __attribute__ ((packed)) hfa384x_ChInfoResult_t; 658 659 /*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/ 660 typedef struct hfa384x_HScanResultSub { 661 u16 chid; 662 u16 anl; 663 u16 sl; 664 u8 bssid[WLAN_BSSID_LEN]; 665 u16 bcnint; 666 u16 capinfo; 667 hfa384x_bytestr32_t ssid; 668 u8 supprates[10]; /* 802.11 info element */ 669 u16 proberesp_rate; 670 u16 atim; 671 } __attribute__ ((packed)) hfa384x_HScanResultSub_t; 672 673 typedef struct hfa384x_HScanResult { 674 u16 nresult; 675 u16 rsvd; 676 hfa384x_HScanResultSub_t result[HFA384x_HSCANRESULT_MAX]; 677 } __attribute__ ((packed)) hfa384x_HScanResult_t; 678 679 /*-- Unsolicited Frame, MAC Mgmt: LinkStatus --*/ 680 681 #define HFA384x_LINK_NOTCONNECTED ((u16)0) 682 #define HFA384x_LINK_CONNECTED ((u16)1) 683 #define HFA384x_LINK_DISCONNECTED ((u16)2) 684 #define HFA384x_LINK_AP_CHANGE ((u16)3) 685 #define HFA384x_LINK_AP_OUTOFRANGE ((u16)4) 686 #define HFA384x_LINK_AP_INRANGE ((u16)5) 687 #define HFA384x_LINK_ASSOCFAIL ((u16)6) 688 689 typedef struct hfa384x_LinkStatus { 690 u16 linkstatus; 691 } __attribute__ ((packed)) hfa384x_LinkStatus_t; 692 693 /*-- Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/ 694 695 #define HFA384x_ASSOCSTATUS_STAASSOC ((u16)1) 696 #define HFA384x_ASSOCSTATUS_REASSOC ((u16)2) 697 #define HFA384x_ASSOCSTATUS_AUTHFAIL ((u16)5) 698 699 typedef struct hfa384x_AssocStatus { 700 u16 assocstatus; 701 u8 sta_addr[ETH_ALEN]; 702 /* old_ap_addr is only valid if assocstatus == 2 */ 703 u8 old_ap_addr[ETH_ALEN]; 704 u16 reason; 705 u16 reserved; 706 } __attribute__ ((packed)) hfa384x_AssocStatus_t; 707 708 /*-- Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/ 709 710 typedef struct hfa384x_AuthRequest { 711 u8 sta_addr[ETH_ALEN]; 712 u16 algorithm; 713 } __attribute__ ((packed)) hfa384x_AuthReq_t; 714 715 /*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/ 716 717 typedef struct hfa384x_PSUserCount { 718 u16 usercnt; 719 } __attribute__ ((packed)) hfa384x_PSUserCount_t; 720 721 typedef struct hfa384x_KeyIDChanged { 722 u8 sta_addr[ETH_ALEN]; 723 u16 keyid; 724 } __attribute__ ((packed)) hfa384x_KeyIDChanged_t; 725 726 /*-- Collection of all Inf frames ---------------*/ 727 typedef union hfa384x_infodata { 728 hfa384x_CommTallies16_t commtallies16; 729 hfa384x_CommTallies32_t commtallies32; 730 hfa384x_ScanResult_t scanresult; 731 hfa384x_ChInfoResult_t chinforesult; 732 hfa384x_HScanResult_t hscanresult; 733 hfa384x_LinkStatus_t linkstatus; 734 hfa384x_AssocStatus_t assocstatus; 735 hfa384x_AuthReq_t authreq; 736 hfa384x_PSUserCount_t psusercnt; 737 hfa384x_KeyIDChanged_t keyidchanged; 738 } __attribute__ ((packed)) hfa384x_infodata_t; 739 740 typedef struct hfa384x_InfFrame { 741 u16 framelen; 742 u16 infotype; 743 hfa384x_infodata_t info; 744 } __attribute__ ((packed)) hfa384x_InfFrame_t; 745 746 /*-------------------------------------------------------------------- 747 USB Packet structures and constants. 748 --------------------------------------------------------------------*/ 749 750 /* Should be sent to the bulkout endpoint */ 751 #define HFA384x_USB_TXFRM 0 752 #define HFA384x_USB_CMDREQ 1 753 #define HFA384x_USB_WRIDREQ 2 754 #define HFA384x_USB_RRIDREQ 3 755 #define HFA384x_USB_WMEMREQ 4 756 #define HFA384x_USB_RMEMREQ 5 757 758 /* Received from the bulkin endpoint */ 759 #define HFA384x_USB_ISTXFRM(a) (((a) & 0x9000) == 0x1000) 760 #define HFA384x_USB_ISRXFRM(a) (!((a) & 0x9000)) 761 #define HFA384x_USB_INFOFRM 0x8000 762 #define HFA384x_USB_CMDRESP 0x8001 763 #define HFA384x_USB_WRIDRESP 0x8002 764 #define HFA384x_USB_RRIDRESP 0x8003 765 #define HFA384x_USB_WMEMRESP 0x8004 766 #define HFA384x_USB_RMEMRESP 0x8005 767 #define HFA384x_USB_BUFAVAIL 0x8006 768 #define HFA384x_USB_ERROR 0x8007 769 770 /*------------------------------------*/ 771 /* Request (bulk OUT) packet contents */ 772 773 typedef struct hfa384x_usb_txfrm { 774 hfa384x_tx_frame_t desc; 775 u8 data[WLAN_DATA_MAXLEN]; 776 } __attribute__ ((packed)) hfa384x_usb_txfrm_t; 777 778 typedef struct hfa384x_usb_cmdreq { 779 u16 type; 780 u16 cmd; 781 u16 parm0; 782 u16 parm1; 783 u16 parm2; 784 u8 pad[54]; 785 } __attribute__ ((packed)) hfa384x_usb_cmdreq_t; 786 787 typedef struct hfa384x_usb_wridreq { 788 u16 type; 789 u16 frmlen; 790 u16 rid; 791 u8 data[HFA384x_RIDDATA_MAXLEN]; 792 } __attribute__ ((packed)) hfa384x_usb_wridreq_t; 793 794 typedef struct hfa384x_usb_rridreq { 795 u16 type; 796 u16 frmlen; 797 u16 rid; 798 u8 pad[58]; 799 } __attribute__ ((packed)) hfa384x_usb_rridreq_t; 800 801 typedef struct hfa384x_usb_wmemreq { 802 u16 type; 803 u16 frmlen; 804 u16 offset; 805 u16 page; 806 u8 data[HFA384x_USB_RWMEM_MAXLEN]; 807 } __attribute__ ((packed)) hfa384x_usb_wmemreq_t; 808 809 typedef struct hfa384x_usb_rmemreq { 810 u16 type; 811 u16 frmlen; 812 u16 offset; 813 u16 page; 814 u8 pad[56]; 815 } __attribute__ ((packed)) hfa384x_usb_rmemreq_t; 816 817 /*------------------------------------*/ 818 /* Response (bulk IN) packet contents */ 819 820 typedef struct hfa384x_usb_rxfrm { 821 hfa384x_rx_frame_t desc; 822 u8 data[WLAN_DATA_MAXLEN]; 823 } __attribute__ ((packed)) hfa384x_usb_rxfrm_t; 824 825 typedef struct hfa384x_usb_infofrm { 826 u16 type; 827 hfa384x_InfFrame_t info; 828 } __attribute__ ((packed)) hfa384x_usb_infofrm_t; 829 830 typedef struct hfa384x_usb_statusresp { 831 u16 type; 832 u16 status; 833 u16 resp0; 834 u16 resp1; 835 u16 resp2; 836 } __attribute__ ((packed)) hfa384x_usb_cmdresp_t; 837 838 typedef hfa384x_usb_cmdresp_t hfa384x_usb_wridresp_t; 839 840 typedef struct hfa384x_usb_rridresp { 841 u16 type; 842 u16 frmlen; 843 u16 rid; 844 u8 data[HFA384x_RIDDATA_MAXLEN]; 845 } __attribute__ ((packed)) hfa384x_usb_rridresp_t; 846 847 typedef hfa384x_usb_cmdresp_t hfa384x_usb_wmemresp_t; 848 849 typedef struct hfa384x_usb_rmemresp { 850 u16 type; 851 u16 frmlen; 852 u8 data[HFA384x_USB_RWMEM_MAXLEN]; 853 } __attribute__ ((packed)) hfa384x_usb_rmemresp_t; 854 855 typedef struct hfa384x_usb_bufavail { 856 u16 type; 857 u16 frmlen; 858 } __attribute__ ((packed)) hfa384x_usb_bufavail_t; 859 860 typedef struct hfa384x_usb_error { 861 u16 type; 862 u16 errortype; 863 } __attribute__ ((packed)) hfa384x_usb_error_t; 864 865 /*----------------------------------------------------------*/ 866 /* Unions for packaging all the known packet types together */ 867 868 typedef union hfa384x_usbout { 869 u16 type; 870 hfa384x_usb_txfrm_t txfrm; 871 hfa384x_usb_cmdreq_t cmdreq; 872 hfa384x_usb_wridreq_t wridreq; 873 hfa384x_usb_rridreq_t rridreq; 874 hfa384x_usb_wmemreq_t wmemreq; 875 hfa384x_usb_rmemreq_t rmemreq; 876 } __attribute__ ((packed)) hfa384x_usbout_t; 877 878 typedef union hfa384x_usbin { 879 u16 type; 880 hfa384x_usb_rxfrm_t rxfrm; 881 hfa384x_usb_txfrm_t txfrm; 882 hfa384x_usb_infofrm_t infofrm; 883 hfa384x_usb_cmdresp_t cmdresp; 884 hfa384x_usb_wridresp_t wridresp; 885 hfa384x_usb_rridresp_t rridresp; 886 hfa384x_usb_wmemresp_t wmemresp; 887 hfa384x_usb_rmemresp_t rmemresp; 888 hfa384x_usb_bufavail_t bufavail; 889 hfa384x_usb_error_t usberror; 890 u8 boguspad[3000]; 891 } __attribute__ ((packed)) hfa384x_usbin_t; 892 893 #ifdef __KERNEL__ 894 /*-------------------------------------------------------------------- 895 --- MAC state structure, argument to all functions -- 896 --- Also, a collection of support types -- 897 --------------------------------------------------------------------*/ 898 typedef struct hfa384x_statusresult { 899 u16 status; 900 u16 resp0; 901 u16 resp1; 902 u16 resp2; 903 } hfa384x_cmdresult_t; 904 905 /* USB Control Exchange (CTLX): 906 * A queue of the structure below is maintained for all of the 907 * Request/Response type USB packets supported by Prism2. 908 */ 909 /* The following hfa384x_* structures are arguments to 910 * the usercb() for the different CTLX types. 911 */ 912 typedef struct hfa384x_rridresult { 913 u16 rid; 914 const void *riddata; 915 unsigned int riddata_len; 916 } hfa384x_rridresult_t; 917 918 enum ctlx_state { 919 CTLX_START = 0, /* Start state, not queued */ 920 921 CTLX_COMPLETE, /* CTLX successfully completed */ 922 CTLX_REQ_FAILED, /* OUT URB completed w/ error */ 923 924 CTLX_PENDING, /* Queued, data valid */ 925 CTLX_REQ_SUBMITTED, /* OUT URB submitted */ 926 CTLX_REQ_COMPLETE, /* OUT URB complete */ 927 CTLX_RESP_COMPLETE /* IN URB received */ 928 }; 929 typedef enum ctlx_state CTLX_STATE; 930 931 struct hfa384x_usbctlx; 932 struct hfa384x; 933 934 typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *); 935 936 typedef void (*ctlx_usercb_t) (struct hfa384x *hw, 937 void *ctlxresult, void *usercb_data); 938 939 typedef struct hfa384x_usbctlx { 940 struct list_head list; 941 942 size_t outbufsize; 943 hfa384x_usbout_t outbuf; /* pkt buf for OUT */ 944 hfa384x_usbin_t inbuf; /* pkt buf for IN(a copy) */ 945 946 CTLX_STATE state; /* Tracks running state */ 947 948 struct completion done; 949 volatile int reapable; /* Food for the reaper task */ 950 951 ctlx_cmdcb_t cmdcb; /* Async command callback */ 952 ctlx_usercb_t usercb; /* Async user callback, */ 953 void *usercb_data; /* at CTLX completion */ 954 955 int variant; /* Identifies cmd variant */ 956 } hfa384x_usbctlx_t; 957 958 typedef struct hfa384x_usbctlxq { 959 spinlock_t lock; 960 struct list_head pending; 961 struct list_head active; 962 struct list_head completing; 963 struct list_head reapable; 964 } hfa384x_usbctlxq_t; 965 966 typedef struct hfa484x_metacmd { 967 u16 cmd; 968 969 u16 parm0; 970 u16 parm1; 971 u16 parm2; 972 973 hfa384x_cmdresult_t result; 974 } hfa384x_metacmd_t; 975 976 #define MAX_GRP_ADDR 32 977 #define WLAN_COMMENT_MAX 80 /* Max. length of user comment string. */ 978 979 #define WLAN_AUTH_MAX 60 /* Max. # of authenticated stations. */ 980 #define WLAN_ACCESS_MAX 60 /* Max. # of stations in an access list. */ 981 #define WLAN_ACCESS_NONE 0 /* No stations may be authenticated. */ 982 #define WLAN_ACCESS_ALL 1 /* All stations may be authenticated. */ 983 #define WLAN_ACCESS_ALLOW 2 /* Authenticate only "allowed" stations. */ 984 #define WLAN_ACCESS_DENY 3 /* Do not authenticate "denied" stations. */ 985 986 /* XXX These are going away ASAP */ 987 typedef struct prism2sta_authlist { 988 unsigned int cnt; 989 u8 addr[WLAN_AUTH_MAX][ETH_ALEN]; 990 u8 assoc[WLAN_AUTH_MAX]; 991 } prism2sta_authlist_t; 992 993 typedef struct prism2sta_accesslist { 994 unsigned int modify; 995 unsigned int cnt; 996 u8 addr[WLAN_ACCESS_MAX][ETH_ALEN]; 997 unsigned int cnt1; 998 u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN]; 999 } prism2sta_accesslist_t; 1000 1001 typedef struct hfa384x { 1002 /* USB support data */ 1003 struct usb_device *usb; 1004 struct urb rx_urb; 1005 struct sk_buff *rx_urb_skb; 1006 struct urb tx_urb; 1007 struct urb ctlx_urb; 1008 hfa384x_usbout_t txbuff; 1009 hfa384x_usbctlxq_t ctlxq; 1010 struct timer_list reqtimer; 1011 struct timer_list resptimer; 1012 1013 struct timer_list throttle; 1014 1015 struct tasklet_struct reaper_bh; 1016 struct tasklet_struct completion_bh; 1017 1018 struct work_struct usb_work; 1019 1020 unsigned long usb_flags; 1021 #define THROTTLE_RX 0 1022 #define THROTTLE_TX 1 1023 #define WORK_RX_HALT 2 1024 #define WORK_TX_HALT 3 1025 #define WORK_RX_RESUME 4 1026 #define WORK_TX_RESUME 5 1027 1028 unsigned short req_timer_done:1; 1029 unsigned short resp_timer_done:1; 1030 1031 int endp_in; 1032 int endp_out; 1033 1034 int sniff_fcs; 1035 int sniff_channel; 1036 int sniff_truncate; 1037 int sniffhdr; 1038 1039 wait_queue_head_t cmdq; /* wait queue itself */ 1040 1041 /* Controller state */ 1042 u32 state; 1043 u32 isap; 1044 u8 port_enabled[HFA384x_NUMPORTS_MAX]; 1045 1046 /* Download support */ 1047 unsigned int dlstate; 1048 hfa384x_downloadbuffer_t bufinfo; 1049 u16 dltimeout; 1050 1051 int scanflag; /* to signal scan comlete */ 1052 int join_ap; /* are we joined to a specific ap */ 1053 int join_retries; /* number of join retries till we fail */ 1054 hfa384x_JoinRequest_data_t joinreq; /* join request saved data */ 1055 1056 wlandevice_t *wlandev; 1057 /* Timer to allow for the deferred processing of linkstatus messages */ 1058 struct work_struct link_bh; 1059 1060 struct work_struct commsqual_bh; 1061 hfa384x_commsquality_t qual; 1062 struct timer_list commsqual_timer; 1063 1064 u16 link_status; 1065 u16 link_status_new; 1066 struct sk_buff_head authq; 1067 1068 /* And here we have stuff that used to be in priv */ 1069 1070 /* State variables */ 1071 unsigned int presniff_port_type; 1072 u16 presniff_wepflags; 1073 u32 dot11_desired_bss_type; 1074 1075 int dbmadjust; 1076 1077 /* Group Addresses - right now, there are up to a total 1078 of MAX_GRP_ADDR group addresses */ 1079 u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN]; 1080 unsigned int dot11_grpcnt; 1081 1082 /* Component Identities */ 1083 hfa384x_compident_t ident_nic; 1084 hfa384x_compident_t ident_pri_fw; 1085 hfa384x_compident_t ident_sta_fw; 1086 hfa384x_compident_t ident_ap_fw; 1087 u16 mm_mods; 1088 1089 /* Supplier compatibility ranges */ 1090 hfa384x_caplevel_t cap_sup_mfi; 1091 hfa384x_caplevel_t cap_sup_cfi; 1092 hfa384x_caplevel_t cap_sup_pri; 1093 hfa384x_caplevel_t cap_sup_sta; 1094 hfa384x_caplevel_t cap_sup_ap; 1095 1096 /* Actor compatibility ranges */ 1097 hfa384x_caplevel_t cap_act_pri_cfi; /* pri f/w to controller interface */ 1098 hfa384x_caplevel_t cap_act_sta_cfi; /* sta f/w to controller interface */ 1099 hfa384x_caplevel_t cap_act_sta_mfi; /* sta f/w to modem interface */ 1100 hfa384x_caplevel_t cap_act_ap_cfi; /* ap f/w to controller interface */ 1101 hfa384x_caplevel_t cap_act_ap_mfi; /* ap f/w to modem interface */ 1102 1103 u32 psusercount; /* Power save user count. */ 1104 hfa384x_CommTallies32_t tallies; /* Communication tallies. */ 1105 u8 comment[WLAN_COMMENT_MAX + 1]; /* User comment */ 1106 1107 /* Channel Info request results (AP only) */ 1108 struct { 1109 atomic_t done; 1110 u8 count; 1111 hfa384x_ChInfoResult_t results; 1112 } channel_info; 1113 1114 hfa384x_InfFrame_t *scanresults; 1115 1116 prism2sta_authlist_t authlist; /* Authenticated station list. */ 1117 unsigned int accessmode; /* Access mode. */ 1118 prism2sta_accesslist_t allow; /* Allowed station list. */ 1119 prism2sta_accesslist_t deny; /* Denied station list. */ 1120 1121 } hfa384x_t; 1122 1123 void hfa384x_create(hfa384x_t *hw, struct usb_device *usb); 1124 void hfa384x_destroy(hfa384x_t *hw); 1125 1126 int 1127 hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis); 1128 int hfa384x_drvr_commtallies(hfa384x_t *hw); 1129 int hfa384x_drvr_disable(hfa384x_t *hw, u16 macport); 1130 int hfa384x_drvr_enable(hfa384x_t *hw, u16 macport); 1131 int hfa384x_drvr_flashdl_enable(hfa384x_t *hw); 1132 int hfa384x_drvr_flashdl_disable(hfa384x_t *hw); 1133 int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len); 1134 int hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len); 1135 int hfa384x_drvr_handover(hfa384x_t *hw, u8 *addr); 1136 int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr); 1137 int hfa384x_drvr_ramdl_disable(hfa384x_t *hw); 1138 int hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len); 1139 int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len); 1140 int hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len); 1141 1142 static inline int hfa384x_drvr_getconfig16(hfa384x_t *hw, u16 rid, void *val) 1143 { 1144 int result = 0; 1145 result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16)); 1146 if (result == 0) 1147 *((u16 *) val) = hfa384x2host_16(*((u16 *) val)); 1148 return result; 1149 } 1150 1151 static inline int hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val) 1152 { 1153 u16 value = host2hfa384x_16(val); 1154 return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value)); 1155 } 1156 1157 int 1158 hfa384x_drvr_getconfig_async(hfa384x_t *hw, 1159 u16 rid, ctlx_usercb_t usercb, void *usercb_data); 1160 1161 int 1162 hfa384x_drvr_setconfig_async(hfa384x_t *hw, 1163 u16 rid, 1164 void *buf, 1165 u16 len, ctlx_usercb_t usercb, void *usercb_data); 1166 1167 static inline int 1168 hfa384x_drvr_setconfig16_async(hfa384x_t *hw, u16 rid, u16 val) 1169 { 1170 u16 value = host2hfa384x_16(val); 1171 return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value), 1172 NULL, NULL); 1173 } 1174 1175 int hfa384x_drvr_start(hfa384x_t *hw); 1176 int hfa384x_drvr_stop(hfa384x_t *hw); 1177 int 1178 hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, 1179 p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep); 1180 void hfa384x_tx_timeout(wlandevice_t *wlandev); 1181 1182 int hfa384x_cmd_initialize(hfa384x_t *hw); 1183 int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport); 1184 int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport); 1185 int hfa384x_cmd_allocate(hfa384x_t *hw, u16 len); 1186 int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable); 1187 int 1188 hfa384x_cmd_download(hfa384x_t *hw, 1189 u16 mode, u16 lowaddr, u16 highaddr, u16 codelen); 1190 void 1191 hfa384x_copy_from_aux(hfa384x_t *hw, 1192 u32 cardaddr, u32 auxctl, void *buf, unsigned int len); 1193 void 1194 hfa384x_copy_to_aux(hfa384x_t *hw, 1195 u32 cardaddr, u32 auxctl, void *buf, unsigned int len); 1196 1197 #endif /* __KERNEL__ */ 1198 1199 #endif /* _HFA384x_H */ 1200