Linux Audio

Check our new training course

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