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