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