blob: 43c299c3b631ef7810b37e4c5465201e4ec69584 [file] [log] [blame]
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001/* hfa384x.h
Sergio Paracuellos5f7688d2016-09-28 20:20:20 +02002 *
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 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070055
56#ifndef _HFA384x_H
57#define _HFA384x_H
58
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +010059#define HFA384x_FIRMWARE_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070060
Moritz Muehlenhoff28b17a42009-01-21 22:00:41 +010061#include <linux/if_ether.h>
Kumar Amit Mehta2e380272013-02-16 05:01:22 -080062#include <linux/usb.h>
Moritz Muehlenhoff28b17a42009-01-21 22:00:41 +010063
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070064/*--- Mins & Maxs -----------------------------------*/
Alessandro Ghedini71508ee2010-02-15 12:25:22 +010065#define HFA384x_PORTID_MAX ((u16)7)
Gargi Sharma0548cad2016-09-16 08:16:03 +053066#define HFA384x_NUMPORTS_MAX ((u16)(HFA384x_PORTID_MAX + 1))
Alessandro Ghedini71508ee2010-02-15 12:25:22 +010067#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
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070076
77/*--- Support Constants -----------------------------*/
Solomon Peachyaaad4302008-10-29 10:42:53 -040078#define HFA384x_PORTTYPE_IBSS ((u16)0)
79#define HFA384x_PORTTYPE_BSS ((u16)1)
Solomon Peachyaaad4302008-10-29 10:42:53 -040080#define HFA384x_PORTTYPE_PSUEDOIBSS ((u16)3)
Moritz Muehlenhoff7f6e0e42009-01-25 21:54:55 +010081#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))
Garrick Heeec0d0d2013-02-01 01:45:16 -080085#define HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM ((u16)3)
86#define HFA384x_PORTSTATUS_DISABLED ((u16)1)
Solomon Peachyaaad4302008-10-29 10:42:53 -040087#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)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070091
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070092/*--- 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
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700106/* 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
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100112/* Mask bits for discarding unwanted pieces in AUX format
Juliana Rodrigues95842bc2016-09-22 00:24:40 -0300113 * 16-bit address parts
114 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700115#define HFA384x_ADDR_AUX_PAGE_MASK (0xffff)
116#define HFA384x_ADDR_AUX_OFF_MASK (0x007f)
117
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700118/* Make a 32-bit flat address from AUX format 16-bit page and offset */
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100119#define HFA384x_ADDR_AUX_MKFLAT(p, o) \
Gargi Sharma65dbeef2016-09-16 08:16:04 +0530120 ((((u32)(((u16)(p)) & HFA384x_ADDR_AUX_PAGE_MASK)) << 7) | \
121 ((u32)(((u16)(o)) & HFA384x_ADDR_AUX_OFF_MASK)))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700122
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700123/* Make CMD format offset and page from a 32-bit flat address */
124#define HFA384x_ADDR_CMD_MKPAGE(f) \
Gargi Sharma061eab52016-09-16 08:16:05 +0530125 ((u16)((((u32)(f)) & HFA384x_ADDR_FLAT_CMD_PAGE_MASK) >> 16))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700126#define HFA384x_ADDR_CMD_MKOFF(f) \
Gargi Sharma65dbeef2016-09-16 08:16:04 +0530127 ((u16)(((u32)(f)) & HFA384x_ADDR_FLAT_CMD_OFF_MASK))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700128
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700129/*--- 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
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700138
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700139/*--- Register Field Masks --------------------------*/
Alessandro Ghedini71508ee2010-02-15 12:25:22 +0100140#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)))
Moritz Muehlenhoff7f6e0e42009-01-25 21:54:55 +0100146#define HFA384x_CMD_PROGMODE ((u16)(BIT(9) | BIT(8)))
Alessandro Ghedini71508ee2010-02-15 12:25:22 +0100147#define HFA384x_CMD_CMDCODE ((u16)(BIT(5) | BIT(4) | \
148 BIT(3) | BIT(2) | \
149 BIT(1) | BIT(0)))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700150
Alessandro Ghedini71508ee2010-02-15 12:25:22 +0100151#define HFA384x_STATUS_RESULT ((u16)(BIT(14) | BIT(13) \
152 | BIT(12) | BIT(11) \
153 | BIT(10) | BIT(9) \
154 | BIT(8)))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700155
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700156/*--- Command Code Constants --------------------------*/
157/*--- Controller Commands --------------------------*/
Solomon Peachyaaad4302008-10-29 10:42:53 -0400158#define HFA384x_CMDCODE_INIT ((u16)0x00)
159#define HFA384x_CMDCODE_ENABLE ((u16)0x01)
160#define HFA384x_CMDCODE_DISABLE ((u16)0x02)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700161
162/*--- Regulate Commands --------------------------*/
Solomon Peachyaaad4302008-10-29 10:42:53 -0400163#define HFA384x_CMDCODE_INQ ((u16)0x11)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700164
165/*--- Configure Commands --------------------------*/
Solomon Peachyaaad4302008-10-29 10:42:53 -0400166#define HFA384x_CMDCODE_DOWNLD ((u16)0x22)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700167
168/*--- Debugging Commands -----------------------------*/
Garrick Heeec0d0d2013-02-01 01:45:16 -0800169#define HFA384x_CMDCODE_MONITOR ((u16)(0x38))
Solomon Peachyaaad4302008-10-29 10:42:53 -0400170#define HFA384x_MONITOR_ENABLE ((u16)(0x0b))
171#define HFA384x_MONITOR_DISABLE ((u16)(0x0f))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700172
173/*--- Result Codes --------------------------*/
Solomon Peachyaaad4302008-10-29 10:42:53 -0400174#define HFA384x_CMD_ERR ((u16)(0x7F))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700175
176/*--- Programming Modes --------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200177 * 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 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400183#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)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700187
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700188/*--- Record ID Constants --------------------------*/
189/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200190 * Configuration RIDs: Network Parameters, Static Configuration Entities
191 *--------------------------------------------------------------------
192 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400193#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)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400198#define HFA384x_RID_CNFMAXDATALEN ((u16)0xFC07)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700199
200/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200201 * 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 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400206#define HFA384x_RID_CNFOWNMACADDR_LEN ((u16)6)
207#define HFA384x_RID_CNFDESIREDSSID_LEN ((u16)34)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400208#define HFA384x_RID_CNFOWNSSID_LEN ((u16)34)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700209
210/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200211 * Configuration RIDs: Network Parameters, Dynamic Configuration Entities
212 *--------------------------------------------------------------------
213 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400214#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)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700219
220/*----------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200221 * Information RIDs: NIC Information
222 *----------------------------------------------------------------------
223 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400224#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)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400233#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)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700237
238/*----------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200239 * 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 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400244#define HFA384x_RID_NICSERIALNUMBER_LEN ((u16)12)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700245
246/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200247 * Information RIDs: MAC Information
248 *--------------------------------------------------------------------
249 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400250#define HFA384x_RID_PORTSTATUS ((u16)0xFD40)
251#define HFA384x_RID_CURRENTSSID ((u16)0xFD41)
252#define HFA384x_RID_CURRENTBSSID ((u16)0xFD42)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400253#define HFA384x_RID_CURRENTTXRATE ((u16)0xFD44)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400254#define HFA384x_RID_SHORTRETRYLIMIT ((u16)0xFD48)
255#define HFA384x_RID_LONGRETRYLIMIT ((u16)0xFD49)
256#define HFA384x_RID_MAXTXLIFETIME ((u16)0xFD4A)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400257#define HFA384x_RID_PRIVACYOPTIMP ((u16)0xFD4F)
258#define HFA384x_RID_DBMCOMMSQUALITY ((u16)0xFD51)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700259
260/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200261 * 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 */
Alessandro Ghedini71508ee2010-02-15 12:25:22 +0100266#define HFA384x_RID_DBMCOMMSQUALITY_LEN \
Sergio Paracuellos62e493c2016-09-28 20:19:04 +0200267 ((u16)sizeof(struct hfa384x_dbmcommsquality))
Alessandro Ghedini71508ee2010-02-15 12:25:22 +0100268#define HFA384x_RID_JOINREQUEST_LEN \
Sergio Paracuellosf0ffa0e2016-09-28 20:18:59 +0200269 ((u16)sizeof(struct hfa384x_JoinRequest_data))
Moritz Muehlenhoff40a67412009-02-01 13:29:08 +0100270
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700271/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200272 * Information RIDs: Modem Information
273 *--------------------------------------------------------------------
274 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400275#define HFA384x_RID_CURRENTCHANNEL ((u16)0xFDC1)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700276
277/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200278 * API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
279 *--------------------------------------------------------------------
280 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400281#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)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400287#define HFA384x_RID_CNFAUTHENTICATION ((u16)0xFC2A)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400288#define HFA384x_RID_CNFROAMINGMODE ((u16)0xFC2D)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400289#define HFA384x_RID_CNFAPBCNint ((u16)0xFC33)
Garrick Heeec0d0d2013-02-01 01:45:16 -0800290#define HFA384x_RID_CNFDBMADJUST ((u16)0xFC46)
291#define HFA384x_RID_CNFWPADATA ((u16)0xFC48)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400292#define HFA384x_RID_CNFBASICRATES ((u16)0xFCB3)
293#define HFA384x_RID_CNFSUPPRATES ((u16)0xFCB4)
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100294#define HFA384x_RID_CNFPASSIVESCANCTRL ((u16)0xFCBA)
Garrick Heeec0d0d2013-02-01 01:45:16 -0800295#define HFA384x_RID_TXPOWERMAX ((u16)0xFCBE)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400296#define HFA384x_RID_JOINREQUEST ((u16)0xFCE2)
297#define HFA384x_RID_AUTHENTICATESTA ((u16)0xFCE3)
Garrick Heeec0d0d2013-02-01 01:45:16 -0800298#define HFA384x_RID_HOSTSCAN ((u16)0xFCE5)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700299
Solomon Peachyaaad4302008-10-29 10:42:53 -0400300#define HFA384x_RID_CNFWEPDEFAULTKEY_LEN ((u16)6)
301#define HFA384x_RID_CNFWEP128DEFAULTKEY_LEN ((u16)14)
Moritz Muehlenhoff40a67412009-02-01 13:29:08 +0100302
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700303/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200304 * PD Record codes
305 *--------------------------------------------------------------------
306 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400307#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)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400315#define HFA384x_PDR_MAC_ADDRESS ((u16)0x0101)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400316#define HFA384x_PDR_REGDOMAIN ((u16)0x0103)
317#define HFA384x_PDR_ALLOWED_CHANNEL ((u16)0x0104)
318#define HFA384x_PDR_DEFAULT_CHANNEL ((u16)0x0105)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400319#define HFA384x_PDR_TEMPTYPE ((u16)0x0107)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400320#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)
Garrick Heeec0d0d2013-02-01 01:45:16 -0800327#define HFA384x_PDR_MAX_TX_POWER ((u16)0x0302)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400328#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)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400336#define HFA384x_PDR_USB_MAX_POWER ((u16)0x0409)
337#define HFA384x_PDR_USB_MANUFACTURER ((u16)0x0410)
Garrick Heeec0d0d2013-02-01 01:45:16 -0800338#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)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700342
Solomon Peachyaaad4302008-10-29 10:42:53 -0400343#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)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700346
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700347/*--- Register Test/Get/Set Field macros ------------------------*/
348
Alessandro Ghedini71508ee2010-02-15 12:25:22 +0100349#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))
Solomon Peachyaaad4302008-10-29 10:42:53 -0400354#define HFA384x_CMD_CMDCODE_SET(value) ((u16)(value))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700355
Solomon Peachyaaad4302008-10-29 10:42:53 -0400356#define HFA384x_STATUS_RESULT_SET(value) (((u16)(value)) << 8)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700357
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700358/* Host Maintained State Info */
359#define HFA384x_STATE_PREINIT 0
360#define HFA384x_STATE_INIT 1
361#define HFA384x_STATE_RUNNING 2
362
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700363/*-------------------------------------------------------------*/
364/* Commonly used basic types */
Himangi Saraogib2119912013-11-02 18:11:44 +0530365struct hfa384x_bytestr {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100366 u16 len;
367 u8 data[0];
Himangi Saraogib2119912013-11-02 18:11:44 +0530368} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700369
Sergio Paracuellos03c29752016-09-28 20:18:54 +0200370struct hfa384x_bytestr32 {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100371 u16 len;
372 u8 data[32];
Sergio Paracuellos03c29752016-09-28 20:18:54 +0200373} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700374
375/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200376 * Configuration Record Structures:
377 * Network Parameters, Static Configuration Entities
378 *--------------------------------------------------------------------
379 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700380
381/*-- Hardware/Firmware Component Information ----------*/
Sergio Paracuellos5f046452016-09-28 20:18:55 +0200382struct hfa384x_compident {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100383 u16 id;
384 u16 variant;
385 u16 major;
386 u16 minor;
Sergio Paracuellos5f046452016-09-28 20:18:55 +0200387} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700388
Sergio Paracuellos65f170c2016-09-28 20:18:57 +0200389struct hfa384x_caplevel {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100390 u16 role;
391 u16 id;
392 u16 variant;
393 u16 bottom;
394 u16 top;
Sergio Paracuellos65f170c2016-09-28 20:18:57 +0200395} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700396
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700397/*-- Configuration Record: cnfAuthentication --*/
398#define HFA384x_CNFAUTHENTICATION_OPENSYSTEM 0x0001
399#define HFA384x_CNFAUTHENTICATION_SHAREDKEY 0x0002
Garrick Heeec0d0d2013-02-01 01:45:16 -0800400#define HFA384x_CNFAUTHENTICATION_LEAP 0x0004
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700401
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700402/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200403 * Configuration Record Structures:
404 * Network Parameters, Dynamic Configuration Entities
405 *--------------------------------------------------------------------
406 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700407
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700408#define HFA384x_CREATEIBSS_JOINCREATEIBSS 0
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700409
410/*-- Configuration Record: HostScanRequest (data portion only) --*/
Sergio Paracuellos935cbfb2016-09-28 20:18:58 +0200411struct hfa384x_HostScanRequest_data {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100412 u16 channelList;
413 u16 txRate;
Sergio Paracuellos03c29752016-09-28 20:18:54 +0200414 struct hfa384x_bytestr32 ssid;
Sergio Paracuellos935cbfb2016-09-28 20:18:58 +0200415} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700416
417/*-- Configuration Record: JoinRequest (data portion only) --*/
Sergio Paracuellosf0ffa0e2016-09-28 20:18:59 +0200418struct hfa384x_JoinRequest_data {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100419 u8 bssid[WLAN_BSSID_LEN];
420 u16 channel;
Sergio Paracuellosf0ffa0e2016-09-28 20:18:59 +0200421} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700422
423/*-- Configuration Record: authenticateStation (data portion only) --*/
Sergio Paracuellos17fb19f2016-09-28 20:19:00 +0200424struct hfa384x_authenticateStation_data {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100425 u8 address[ETH_ALEN];
426 u16 status;
427 u16 algorithm;
Sergio Paracuellos17fb19f2016-09-28 20:19:00 +0200428} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700429
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700430/*-- Configuration Record: WPAData (data portion only) --*/
Sergio Paracuellosa2a44802016-09-28 20:19:01 +0200431struct hfa384x_WPAData {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100432 u16 datalen;
Svenne Krap5dd8acc2010-02-14 18:59:00 +0100433 u8 data[0]; /* max 80 */
Sergio Paracuellosa2a44802016-09-28 20:19:01 +0200434} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700435
436/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200437 * Information Record Structures: NIC Information
438 *--------------------------------------------------------------------
439 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700440
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700441/*-- Information Record: DownLoadBuffer --*/
442/* NOTE: The page and offset are in AUX format */
Sergio Paracuellosb71db742016-09-28 20:19:02 +0200443struct hfa384x_downloadbuffer {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100444 u16 page;
445 u16 offset;
446 u16 len;
Sergio Paracuellosb71db742016-09-28 20:19:02 +0200447} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700448
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700449/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200450 * Information Record Structures: NIC Information
451 *--------------------------------------------------------------------
452 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700453
Solomon Peachyaaad4302008-10-29 10:42:53 -0400454#define HFA384x_PSTATUS_CONN_IBSS ((u16)3)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700455
456/*-- Information Record: commsquality --*/
Sergio Paracuellosa1e95042016-09-28 20:19:03 +0200457struct hfa384x_commsquality {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100458 u16 CQ_currBSS;
459 u16 ASL_currBSS;
460 u16 ANL_currFC;
Sergio Paracuellosa1e95042016-09-28 20:19:03 +0200461} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700462
463/*-- Information Record: dmbcommsquality --*/
Sergio Paracuellos62e493c2016-09-28 20:19:04 +0200464struct hfa384x_dbmcommsquality {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100465 u16 CQdbm_currBSS;
466 u16 ASLdbm_currBSS;
467 u16 ANLdbm_currFC;
Sergio Paracuellos62e493c2016-09-28 20:19:04 +0200468} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700469
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700470/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200471 * FRAME STRUCTURES: Communication Frames
472 *--------------------------------------------------------------------
473 * Communication Frames: Transmit Frames
474 *--------------------------------------------------------------------
475 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700476/*-- Communication Frame: Transmit Frame Structure --*/
Sergio Paracuelloseb76afc2016-09-28 20:19:05 +0200477struct hfa384x_tx_frame {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100478 u16 status;
479 u16 reserved1;
480 u16 reserved2;
481 u32 sw_support;
482 u8 tx_retrycount;
483 u8 tx_rate;
484 u16 tx_control;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700485
486 /*-- 802.11 Header Information --*/
487
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100488 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 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700496
497 /*-- 802.3 Header Information --*/
498
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100499 u8 dest_addr[6];
500 u8 src_addr[6];
501 u16 data_length; /* big endian format */
Sergio Paracuelloseb76afc2016-09-28 20:19:05 +0200502} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700503/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200504 * Communication Frames: Field Masks for Transmit Frames
505 *--------------------------------------------------------------------
506 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700507/*-- Status Field --*/
Moritz Muehlenhoff7f6e0e42009-01-25 21:54:55 +0100508#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))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700513/*-- Transmit Control Field --*/
Alessandro Ghedini71508ee2010-02-15 12:25:22 +0100514#define HFA384x_TX_MACPORT ((u16)(BIT(10) | \
515 BIT(9) | BIT(8)))
Moritz Muehlenhoff7f6e0e42009-01-25 21:54:55 +0100516#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))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700519/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200520 * Communication Frames: Test/Get/Set Field Values for Transmit Frames
521 *--------------------------------------------------------------------
522 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700523/*-- Status Field --*/
524#define HFA384x_TXSTATUS_ISERROR(v) \
Gargi Sharma65dbeef2016-09-16 08:16:04 +0530525 (((u16)(v)) & \
Gargi Sharma05235ce2016-09-16 08:16:06 +0530526 (HFA384x_TXSTATUS_ACKERR | HFA384x_TXSTATUS_FORMERR | \
527 HFA384x_TXSTATUS_DISCON | HFA384x_TXSTATUS_AGEDERR | \
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700528 HFA384x_TXSTATUS_RETRYERR))
529
Gargi Sharma6e81f6f2016-09-16 08:16:07 +0530530#define HFA384x_TX_SET(v, m, s) ((((u16)(v)) << ((u16)(s))) & ((u16)(m)))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700531
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700532#define HFA384x_TX_MACPORT_SET(v) HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
Alessandro Ghedini71508ee2010-02-15 12:25:22 +0100533#define HFA384x_TX_STRUCTYPE_SET(v) HFA384x_TX_SET(v, \
534 HFA384x_TX_STRUCTYPE, 3)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700535#define HFA384x_TX_TXEX_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700536#define HFA384x_TX_TXOK_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
537/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200538 * Communication Frames: Receive Frames
539 *--------------------------------------------------------------------
540 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700541/*-- Communication Frame: Receive Frame Structure --*/
Sergio Paracuellos70adf502016-09-28 20:19:06 +0200542struct hfa384x_rx_frame {
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700543 /*-- MAC rx descriptor (hfa384x byte order) --*/
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100544 u16 status;
545 u32 time;
546 u8 silence;
547 u8 signal;
548 u8 rate;
549 u8 rx_flow;
550 u16 reserved1;
551 u16 reserved2;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700552
553 /*-- 802.11 Header Information (802.11 byte order) --*/
Himangi Saraogi8cbe56e2014-03-05 21:10:52 +0530554 __le16 frame_control;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100555 u16 duration_id;
556 u8 address1[6];
557 u8 address2[6];
558 u8 address3[6];
559 u16 sequence_control;
560 u8 address4[6];
Himangi Saraogi8cbe56e2014-03-05 21:10:52 +0530561 __le16 data_len; /* hfa384x (little endian) format */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700562
563 /*-- 802.3 Header Information --*/
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100564 u8 dest_addr[6];
565 u8 src_addr[6];
566 u16 data_length; /* IEEE? (big endian) format */
Sergio Paracuellos70adf502016-09-28 20:19:06 +0200567} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700568/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200569 * Communication Frames: Field Masks for Receive Frames
570 *--------------------------------------------------------------------
571 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700572
573/*-- Status Fields --*/
Alessandro Ghedini71508ee2010-02-15 12:25:22 +0100574#define HFA384x_RXSTATUS_MACPORT ((u16)(BIT(10) | \
575 BIT(9) | \
576 BIT(8)))
Moritz Muehlenhoff7f6e0e42009-01-25 21:54:55 +0100577#define HFA384x_RXSTATUS_FCSERR ((u16)BIT(0))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700578/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200579 * Communication Frames: Test/Get/Set Field Values for Receive Frames
580 *--------------------------------------------------------------------
581 */
Alessandro Ghedini71508ee2010-02-15 12:25:22 +0100582#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))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700586/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200587 * FRAME STRUCTURES: Information Types and Information Frame Structures
588 *--------------------------------------------------------------------
589 * Information Types
590 *--------------------------------------------------------------------
591 */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400592#define HFA384x_IT_HANDOVERADDR ((u16)0xF000UL)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400593#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)
Garrick Heeec0d0d2013-02-01 01:45:16 -0800602#define HFA384x_IT_ASSOCREQ ((u16)0xF205UL)
603#define HFA384x_IT_MICFAILURE ((u16)0xF206UL)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700604
605/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200606 * Information Frames Structures
607 *--------------------------------------------------------------------
608 * Information Frames: Notification Frame Structures
609 *--------------------------------------------------------------------
610 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700611
612/*-- Inquiry Frame, Diagnose: Communication Tallies --*/
Sergio Paracuellos07e23b62016-09-28 20:19:07 +0200613struct hfa384x_CommTallies16 {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100614 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;
Sergio Paracuellos07e23b62016-09-28 20:19:07 +0200635} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700636
Sergio Paracuelloscfc6cb12016-09-28 20:19:08 +0200637struct hfa384x_CommTallies32 {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100638 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;
Sergio Paracuelloscfc6cb12016-09-28 20:19:08 +0200659} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700660
661/*-- Inquiry Frame, Diagnose: Scan Results & Subfields--*/
Sergio Paracuellos44003342016-09-28 20:19:09 +0200662struct hfa384x_ScanResultSub {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100663 u16 chid;
664 u16 anl;
665 u16 sl;
666 u8 bssid[WLAN_BSSID_LEN];
667 u16 bcnint;
668 u16 capinfo;
Sergio Paracuellos03c29752016-09-28 20:18:54 +0200669 struct hfa384x_bytestr32 ssid;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100670 u8 supprates[10]; /* 802.11 info element */
671 u16 proberesp_rate;
Sergio Paracuellos44003342016-09-28 20:19:09 +0200672} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700673
Sergio Paracuellosdc0bb002016-09-28 20:19:10 +0200674struct hfa384x_ScanResult {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100675 u16 rsvd;
676 u16 scanreason;
Sergio Paracuellos44003342016-09-28 20:19:09 +0200677 struct hfa384x_ScanResultSub result[HFA384x_SCANRESULT_MAX];
Sergio Paracuellosdc0bb002016-09-28 20:19:10 +0200678} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700679
680/*-- Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
Sergio Paracuellos1bc4292a2016-09-28 20:19:11 +0200681struct hfa384x_ChInfoResultSub {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100682 u16 chid;
683 u16 anl;
684 u16 pnl;
685 u16 active;
Sergio Paracuellos1bc4292a2016-09-28 20:19:11 +0200686} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700687
Moritz Muehlenhoff7f6e0e42009-01-25 21:54:55 +0100688#define HFA384x_CHINFORESULT_BSSACTIVE BIT(0)
689#define HFA384x_CHINFORESULT_PCFACTIVE BIT(1)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700690
Sergio Paracuellos0fddae82016-09-28 20:19:12 +0200691struct hfa384x_ChInfoResult {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100692 u16 scanchannels;
Sergio Paracuellos1bc4292a2016-09-28 20:19:11 +0200693 struct hfa384x_ChInfoResultSub result[HFA384x_CHINFORESULT_MAX];
Sergio Paracuellos0fddae82016-09-28 20:19:12 +0200694} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700695
696/*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
Sergio Paracuellosb353d112016-09-28 20:19:13 +0200697struct hfa384x_HScanResultSub {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100698 u16 chid;
699 u16 anl;
700 u16 sl;
701 u8 bssid[WLAN_BSSID_LEN];
702 u16 bcnint;
703 u16 capinfo;
Sergio Paracuellos03c29752016-09-28 20:18:54 +0200704 struct hfa384x_bytestr32 ssid;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100705 u8 supprates[10]; /* 802.11 info element */
706 u16 proberesp_rate;
707 u16 atim;
Sergio Paracuellosb353d112016-09-28 20:19:13 +0200708} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700709
Sergio Paracuellosf8f28212016-09-28 20:19:14 +0200710struct hfa384x_HScanResult {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100711 u16 nresult;
712 u16 rsvd;
Sergio Paracuellosb353d112016-09-28 20:19:13 +0200713 struct hfa384x_HScanResultSub result[HFA384x_HSCANRESULT_MAX];
Sergio Paracuellosf8f28212016-09-28 20:19:14 +0200714} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700715
716/*-- Unsolicited Frame, MAC Mgmt: LinkStatus --*/
717
Solomon Peachyaaad4302008-10-29 10:42:53 -0400718#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)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700725
Sergio Paracuellosa8eb5132016-09-28 20:19:15 +0200726struct hfa384x_LinkStatus {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100727 u16 linkstatus;
Sergio Paracuellosa8eb5132016-09-28 20:19:15 +0200728} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700729
730/*-- Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
731
Solomon Peachyaaad4302008-10-29 10:42:53 -0400732#define HFA384x_ASSOCSTATUS_STAASSOC ((u16)1)
733#define HFA384x_ASSOCSTATUS_REASSOC ((u16)2)
Solomon Peachyaaad4302008-10-29 10:42:53 -0400734#define HFA384x_ASSOCSTATUS_AUTHFAIL ((u16)5)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700735
Sergio Paracuellos5383f132016-09-28 20:19:16 +0200736struct hfa384x_AssocStatus {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100737 u16 assocstatus;
738 u8 sta_addr[ETH_ALEN];
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700739 /* old_ap_addr is only valid if assocstatus == 2 */
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100740 u8 old_ap_addr[ETH_ALEN];
741 u16 reason;
742 u16 reserved;
Sergio Paracuellos5383f132016-09-28 20:19:16 +0200743} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700744
745/*-- Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
746
Sergio Paracuellosb9820e02016-09-28 20:19:17 +0200747struct hfa384x_AuthRequest {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100748 u8 sta_addr[ETH_ALEN];
749 u16 algorithm;
Sergio Paracuellosb9820e02016-09-28 20:19:17 +0200750} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700751
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700752/*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
753
Sergio Paracuellos013e69e2016-09-28 20:19:18 +0200754struct hfa384x_PSUserCount {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100755 u16 usercnt;
Sergio Paracuellos013e69e2016-09-28 20:19:18 +0200756} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700757
Sergio Paracuellos44049d82016-09-28 20:19:19 +0200758struct hfa384x_KeyIDChanged {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100759 u8 sta_addr[ETH_ALEN];
760 u16 keyid;
Sergio Paracuellos44049d82016-09-28 20:19:19 +0200761} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700762
763/*-- Collection of all Inf frames ---------------*/
Sergio Paracuellosf745ea62016-09-28 20:19:20 +0200764union hfa384x_infodata {
Sergio Paracuellos07e23b62016-09-28 20:19:07 +0200765 struct hfa384x_CommTallies16 commtallies16;
Sergio Paracuelloscfc6cb12016-09-28 20:19:08 +0200766 struct hfa384x_CommTallies32 commtallies32;
Sergio Paracuellosdc0bb002016-09-28 20:19:10 +0200767 struct hfa384x_ScanResult scanresult;
Sergio Paracuellos0fddae82016-09-28 20:19:12 +0200768 struct hfa384x_ChInfoResult chinforesult;
Sergio Paracuellosf8f28212016-09-28 20:19:14 +0200769 struct hfa384x_HScanResult hscanresult;
Sergio Paracuellosa8eb5132016-09-28 20:19:15 +0200770 struct hfa384x_LinkStatus linkstatus;
Sergio Paracuellos5383f132016-09-28 20:19:16 +0200771 struct hfa384x_AssocStatus assocstatus;
Sergio Paracuellosb9820e02016-09-28 20:19:17 +0200772 struct hfa384x_AuthRequest authreq;
Sergio Paracuellos013e69e2016-09-28 20:19:18 +0200773 struct hfa384x_PSUserCount psusercnt;
Sergio Paracuellos44049d82016-09-28 20:19:19 +0200774 struct hfa384x_KeyIDChanged keyidchanged;
Sergio Paracuellosf745ea62016-09-28 20:19:20 +0200775} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700776
Sergio Paracuellosf69de9e2016-09-28 20:19:21 +0200777struct hfa384x_InfFrame {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100778 u16 framelen;
779 u16 infotype;
Sergio Paracuellosf745ea62016-09-28 20:19:20 +0200780 union hfa384x_infodata info;
Sergio Paracuellosf69de9e2016-09-28 20:19:21 +0200781} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700782
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700783/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200784 * USB Packet structures and constants.
785 *--------------------------------------------------------------------
786 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700787
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700788/* 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 */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700797#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
Sergio Paracuellos2f1014f2016-09-28 20:19:22 +0200811struct hfa384x_usb_txfrm {
Sergio Paracuelloseb76afc2016-09-28 20:19:05 +0200812 struct hfa384x_tx_frame desc;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100813 u8 data[WLAN_DATA_MAXLEN];
Sergio Paracuellos2f1014f2016-09-28 20:19:22 +0200814} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700815
Sergio Paracuellosa6dcbdf2016-09-28 20:19:23 +0200816struct hfa384x_usb_cmdreq {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100817 u16 type;
818 u16 cmd;
819 u16 parm0;
820 u16 parm1;
821 u16 parm2;
822 u8 pad[54];
Sergio Paracuellosa6dcbdf2016-09-28 20:19:23 +0200823} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700824
Sergio Paracuellos3bc070f2016-09-28 20:19:24 +0200825struct hfa384x_usb_wridreq {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100826 u16 type;
827 u16 frmlen;
828 u16 rid;
829 u8 data[HFA384x_RIDDATA_MAXLEN];
Sergio Paracuellos3bc070f2016-09-28 20:19:24 +0200830} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700831
Sergio Paracuellos5b9f2402016-09-28 20:19:25 +0200832struct hfa384x_usb_rridreq {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100833 u16 type;
834 u16 frmlen;
835 u16 rid;
836 u8 pad[58];
Sergio Paracuellos5b9f2402016-09-28 20:19:25 +0200837} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700838
Sergio Paracuellosf0e15d42016-09-28 20:19:26 +0200839struct hfa384x_usb_wmemreq {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100840 u16 type;
841 u16 frmlen;
842 u16 offset;
843 u16 page;
844 u8 data[HFA384x_USB_RWMEM_MAXLEN];
Sergio Paracuellosf0e15d42016-09-28 20:19:26 +0200845} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700846
Sergio Paracuellos94ec5462016-09-28 20:19:27 +0200847struct hfa384x_usb_rmemreq {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100848 u16 type;
849 u16 frmlen;
850 u16 offset;
851 u16 page;
852 u8 pad[56];
Sergio Paracuellos94ec5462016-09-28 20:19:27 +0200853} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700854
855/*------------------------------------*/
856/* Response (bulk IN) packet contents */
857
Sergio Paracuellos684b2e02016-09-28 20:19:28 +0200858struct hfa384x_usb_rxfrm {
Sergio Paracuellos70adf502016-09-28 20:19:06 +0200859 struct hfa384x_rx_frame desc;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100860 u8 data[WLAN_DATA_MAXLEN];
Sergio Paracuellos684b2e02016-09-28 20:19:28 +0200861} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700862
Sergio Paracuellose20a7ca2016-09-28 20:19:29 +0200863struct hfa384x_usb_infofrm {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100864 u16 type;
Sergio Paracuellosf69de9e2016-09-28 20:19:21 +0200865 struct hfa384x_InfFrame info;
Sergio Paracuellose20a7ca2016-09-28 20:19:29 +0200866} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700867
Sergio Paracuellos385a79d2016-09-28 20:19:30 +0200868struct hfa384x_usb_statusresp {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100869 u16 type;
870 u16 status;
871 u16 resp0;
872 u16 resp1;
873 u16 resp2;
Sergio Paracuellos385a79d2016-09-28 20:19:30 +0200874} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700875
Sergio Paracuellosa988c9f2016-09-28 20:19:32 +0200876struct hfa384x_usb_rridresp {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100877 u16 type;
878 u16 frmlen;
879 u16 rid;
880 u8 data[HFA384x_RIDDATA_MAXLEN];
Sergio Paracuellosa988c9f2016-09-28 20:19:32 +0200881} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700882
Sergio Paracuellos1ed54802016-09-28 20:19:34 +0200883struct hfa384x_usb_rmemresp {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100884 u16 type;
885 u16 frmlen;
886 u8 data[HFA384x_USB_RWMEM_MAXLEN];
Sergio Paracuellos1ed54802016-09-28 20:19:34 +0200887} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700888
Sergio Paracuellosc4d8a0a2016-09-28 20:19:35 +0200889struct hfa384x_usb_bufavail {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100890 u16 type;
891 u16 frmlen;
Sergio Paracuellosc4d8a0a2016-09-28 20:19:35 +0200892} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700893
Sergio Paracuellosd4734c32016-09-28 20:19:36 +0200894struct hfa384x_usb_error {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100895 u16 type;
896 u16 errortype;
Sergio Paracuellosd4734c32016-09-28 20:19:36 +0200897} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700898
899/*----------------------------------------------------------*/
900/* Unions for packaging all the known packet types together */
901
Sergio Paracuellos40126842016-09-28 20:19:37 +0200902union hfa384x_usbout {
Asaf Vertza78d1312015-01-18 09:11:39 +0200903 __le16 type;
Sergio Paracuellos2f1014f2016-09-28 20:19:22 +0200904 struct hfa384x_usb_txfrm txfrm;
Sergio Paracuellosa6dcbdf2016-09-28 20:19:23 +0200905 struct hfa384x_usb_cmdreq cmdreq;
Sergio Paracuellos3bc070f2016-09-28 20:19:24 +0200906 struct hfa384x_usb_wridreq wridreq;
Sergio Paracuellos5b9f2402016-09-28 20:19:25 +0200907 struct hfa384x_usb_rridreq rridreq;
Sergio Paracuellosf0e15d42016-09-28 20:19:26 +0200908 struct hfa384x_usb_wmemreq wmemreq;
Sergio Paracuellos94ec5462016-09-28 20:19:27 +0200909 struct hfa384x_usb_rmemreq rmemreq;
Sergio Paracuellos40126842016-09-28 20:19:37 +0200910} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700911
Sergio Paracuellos3e4180c2016-09-28 20:19:38 +0200912union hfa384x_usbin {
Asaf Vertza78d1312015-01-18 09:11:39 +0200913 __le16 type;
Sergio Paracuellos684b2e02016-09-28 20:19:28 +0200914 struct hfa384x_usb_rxfrm rxfrm;
Sergio Paracuellos2f1014f2016-09-28 20:19:22 +0200915 struct hfa384x_usb_txfrm txfrm;
Sergio Paracuellose20a7ca2016-09-28 20:19:29 +0200916 struct hfa384x_usb_infofrm infofrm;
Sergio Paracuellos385a79d2016-09-28 20:19:30 +0200917 struct hfa384x_usb_statusresp cmdresp;
Sergio Paracuellos2c8079d2016-09-28 20:19:31 +0200918 struct hfa384x_usb_statusresp wridresp;
Sergio Paracuellosa988c9f2016-09-28 20:19:32 +0200919 struct hfa384x_usb_rridresp rridresp;
Sergio Paracuellos499c1cc2016-09-28 20:19:33 +0200920 struct hfa384x_usb_statusresp wmemresp;
Sergio Paracuellos1ed54802016-09-28 20:19:34 +0200921 struct hfa384x_usb_rmemresp rmemresp;
Sergio Paracuellosc4d8a0a2016-09-28 20:19:35 +0200922 struct hfa384x_usb_bufavail bufavail;
Sergio Paracuellosd4734c32016-09-28 20:19:36 +0200923 struct hfa384x_usb_error usberror;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +0100924 u8 boguspad[3000];
Sergio Paracuellos3e4180c2016-09-28 20:19:38 +0200925} __packed;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700926
Karl Relton76e3e7c2009-04-17 10:15:34 +0100927/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +0200928 * PD record structures.
929 *--------------------------------------------------------------------
930 */
Karl Relton76e3e7c2009-04-17 10:15:34 +0100931
Sergio Paracuellose0696aa2016-09-28 20:19:39 +0200932struct hfa384x_pdr_pcb_partnum {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530933 u8 num[8];
Sergio Paracuellose0696aa2016-09-28 20:19:39 +0200934} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100935
Sergio Paracuelloscaeabb82016-09-28 20:19:40 +0200936struct hfa384x_pdr_pcb_tracenum {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530937 u8 num[8];
Sergio Paracuelloscaeabb82016-09-28 20:19:40 +0200938} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100939
Sergio Paracuellos66e7bdb2016-09-28 20:19:41 +0200940struct hfa384x_pdr_nic_serial {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530941 u8 num[12];
Sergio Paracuellos66e7bdb2016-09-28 20:19:41 +0200942} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100943
Sergio Paracuellosee9f7622016-09-28 20:19:42 +0200944struct hfa384x_pdr_mkk_measurements {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530945 double carrier_freq;
946 double occupied_band;
947 double power_density;
948 double tx_spur_f1;
949 double tx_spur_f2;
950 double tx_spur_f3;
951 double tx_spur_f4;
952 double tx_spur_l1;
953 double tx_spur_l2;
954 double tx_spur_l3;
955 double tx_spur_l4;
956 double rx_spur_f1;
957 double rx_spur_f2;
958 double rx_spur_l1;
959 double rx_spur_l2;
Sergio Paracuellosee9f7622016-09-28 20:19:42 +0200960} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100961
Sergio Paracuellos02eebae2016-09-28 20:19:43 +0200962struct hfa384x_pdr_nic_ramsize {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530963 u8 size[12]; /* units of KB */
Sergio Paracuellos02eebae2016-09-28 20:19:43 +0200964} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100965
Sergio Paracuellos91276922016-09-28 20:19:44 +0200966struct hfa384x_pdr_mfisuprange {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530967 u16 id;
968 u16 variant;
969 u16 bottom;
970 u16 top;
Sergio Paracuellos91276922016-09-28 20:19:44 +0200971} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100972
Sergio Paracuellos4ae29962016-09-28 20:19:45 +0200973struct hfa384x_pdr_cfisuprange {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530974 u16 id;
975 u16 variant;
976 u16 bottom;
977 u16 top;
Sergio Paracuellos4ae29962016-09-28 20:19:45 +0200978} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100979
Sergio Paracuellose9ee92c2016-09-28 20:19:46 +0200980struct hfa384x_pdr_nicid {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530981 u16 id;
982 u16 variant;
983 u16 major;
984 u16 minor;
Sergio Paracuellose9ee92c2016-09-28 20:19:46 +0200985} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100986
Sergio Paracuellos1c0c8eb2016-09-28 20:19:47 +0200987struct hfa384x_pdr_refdac_measurements {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530988 u16 value[0];
Sergio Paracuellos1c0c8eb2016-09-28 20:19:47 +0200989} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100990
Sergio Paracuellosde959292016-09-28 20:19:48 +0200991struct hfa384x_pdr_vgdac_measurements {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530992 u16 value[0];
Sergio Paracuellosde959292016-09-28 20:19:48 +0200993} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100994
Sergio Paracuellosdac14452016-09-28 20:19:49 +0200995struct hfa384x_pdr_level_comp_measurements {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +0530996 u16 value[0];
Sergio Paracuellosdac14452016-09-28 20:19:49 +0200997} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +0100998
Sergio Paracuellos29f1e442016-09-28 20:19:50 +0200999struct hfa384x_pdr_mac_address {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301000 u8 addr[6];
Sergio Paracuellos29f1e442016-09-28 20:19:50 +02001001} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001002
Sergio Paracuellosf9699552016-09-28 20:19:51 +02001003struct hfa384x_pdr_mkk_callname {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301004 u8 callname[8];
Sergio Paracuellosf9699552016-09-28 20:19:51 +02001005} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001006
Sergio Paracuellos0970a332016-09-28 20:19:52 +02001007struct hfa384x_pdr_regdomain {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301008 u16 numdomains;
1009 u16 domain[5];
Sergio Paracuellos0970a332016-09-28 20:19:52 +02001010} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001011
Sergio Paracuellose0322d12016-09-28 20:19:53 +02001012struct hfa384x_pdr_allowed_channel {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301013 u16 ch_bitmap;
Sergio Paracuellose0322d12016-09-28 20:19:53 +02001014} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001015
Sergio Paracuellos892b51e2016-09-28 20:19:54 +02001016struct hfa384x_pdr_default_channel {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301017 u16 channel;
Sergio Paracuellos892b51e2016-09-28 20:19:54 +02001018} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001019
Sergio Paracuellos2c1759b2016-09-28 20:19:55 +02001020struct hfa384x_pdr_privacy_option {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301021 u16 available;
Sergio Paracuellos2c1759b2016-09-28 20:19:55 +02001022} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001023
Sergio Paracuellos0c350462016-09-28 20:19:56 +02001024struct hfa384x_pdr_temptype {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301025 u16 type;
Sergio Paracuellos0c350462016-09-28 20:19:56 +02001026} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001027
Sergio Paracuellos3c92d652016-09-28 20:19:57 +02001028struct hfa384x_pdr_refdac_setup {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301029 u16 ch_value[14];
Sergio Paracuellos3c92d652016-09-28 20:19:57 +02001030} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001031
Sergio Paracuellosdce6c2832016-09-28 20:19:58 +02001032struct hfa384x_pdr_vgdac_setup {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301033 u16 ch_value[14];
Sergio Paracuellosdce6c2832016-09-28 20:19:58 +02001034} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001035
Sergio Paracuellos29aef6b2016-09-28 20:19:59 +02001036struct hfa384x_pdr_level_comp_setup {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301037 u16 ch_value[14];
Sergio Paracuellos29aef6b2016-09-28 20:19:59 +02001038} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001039
Sergio Paracuellosa98f8602016-09-28 20:20:00 +02001040struct hfa384x_pdr_trimdac_setup {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301041 u16 trimidac;
1042 u16 trimqdac;
Sergio Paracuellosa98f8602016-09-28 20:20:00 +02001043} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001044
Sergio Paracuellos3d235882016-09-28 20:20:01 +02001045struct hfa384x_pdr_ifr_setting {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301046 u16 value[3];
Sergio Paracuellos3d235882016-09-28 20:20:01 +02001047} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001048
Sergio Paracuellosda79fe42016-09-28 20:20:02 +02001049struct hfa384x_pdr_rfr_setting {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301050 u16 value[3];
Sergio Paracuellosda79fe42016-09-28 20:20:02 +02001051} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001052
Sergio Paracuellosb4547dc2016-09-28 20:20:03 +02001053struct hfa384x_pdr_hfa3861_baseline {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301054 u16 value[50];
Sergio Paracuellosb4547dc2016-09-28 20:20:03 +02001055} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001056
Sergio Paracuellos0dbc2e42016-09-28 20:20:04 +02001057struct hfa384x_pdr_hfa3861_shadow {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301058 u32 value[32];
Sergio Paracuellos0dbc2e42016-09-28 20:20:04 +02001059} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001060
Sergio Paracuellos1755c012016-09-28 20:20:05 +02001061struct hfa384x_pdr_hfa3861_ifrf {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301062 u32 value[20];
Sergio Paracuellos1755c012016-09-28 20:20:05 +02001063} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001064
Sergio Paracuellos788c9732016-09-28 20:20:06 +02001065struct hfa384x_pdr_hfa3861_chcalsp {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301066 u16 value[14];
Sergio Paracuellos788c9732016-09-28 20:20:06 +02001067} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001068
Sergio Paracuellosb94425f2016-09-28 20:20:07 +02001069struct hfa384x_pdr_hfa3861_chcali {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301070 u16 value[17];
Sergio Paracuellosb94425f2016-09-28 20:20:07 +02001071} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001072
Sergio Paracuellosbd84b582016-09-28 20:20:08 +02001073struct hfa384x_pdr_hfa3861_nic_config {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301074 u16 config_bitmap;
Sergio Paracuellosbd84b582016-09-28 20:20:08 +02001075} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001076
Sergio Paracuellos9408a442016-09-28 20:20:09 +02001077struct hfa384x_pdr_hfo_delay {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301078 u8 hfo_delay;
Sergio Paracuellos9408a442016-09-28 20:20:09 +02001079} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001080
Sergio Paracuellos0960d2e12016-09-28 20:20:10 +02001081struct hfa384x_pdr_hfa3861_manf_testsp {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301082 u16 value[30];
Sergio Paracuellos0960d2e12016-09-28 20:20:10 +02001083} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001084
Sergio Paracuellos5a4a5822016-09-28 20:20:11 +02001085struct hfa384x_pdr_hfa3861_manf_testi {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301086 u16 value[30];
Sergio Paracuellos5a4a5822016-09-28 20:20:11 +02001087} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001088
Sergio Paracuellosb26ce5f2016-09-28 20:20:12 +02001089struct hfa384x_pdr_end_of_pda {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301090 u16 crc;
Sergio Paracuellosb26ce5f2016-09-28 20:20:12 +02001091} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001092
Sergio Paracuellos4f026e82016-09-28 20:20:13 +02001093struct hfa384x_pdrec {
Mithlesh Thukral75f49e02009-05-25 19:06:16 +05301094 u16 len; /* in words */
1095 u16 code;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001096 union pdr {
Sergio Paracuellose0696aa2016-09-28 20:19:39 +02001097 struct hfa384x_pdr_pcb_partnum pcb_partnum;
Sergio Paracuelloscaeabb82016-09-28 20:19:40 +02001098 struct hfa384x_pdr_pcb_tracenum pcb_tracenum;
Sergio Paracuellos66e7bdb2016-09-28 20:19:41 +02001099 struct hfa384x_pdr_nic_serial nic_serial;
Sergio Paracuellosee9f7622016-09-28 20:19:42 +02001100 struct hfa384x_pdr_mkk_measurements mkk_measurements;
Sergio Paracuellos02eebae2016-09-28 20:19:43 +02001101 struct hfa384x_pdr_nic_ramsize nic_ramsize;
Sergio Paracuellos91276922016-09-28 20:19:44 +02001102 struct hfa384x_pdr_mfisuprange mfisuprange;
Sergio Paracuellos4ae29962016-09-28 20:19:45 +02001103 struct hfa384x_pdr_cfisuprange cfisuprange;
Sergio Paracuellose9ee92c2016-09-28 20:19:46 +02001104 struct hfa384x_pdr_nicid nicid;
Sergio Paracuellos1c0c8eb2016-09-28 20:19:47 +02001105 struct hfa384x_pdr_refdac_measurements refdac_measurements;
Sergio Paracuellosde959292016-09-28 20:19:48 +02001106 struct hfa384x_pdr_vgdac_measurements vgdac_measurements;
Sergio Paracuellosdac14452016-09-28 20:19:49 +02001107 struct hfa384x_pdr_level_comp_measurements level_compc_measurements;
Sergio Paracuellos29f1e442016-09-28 20:19:50 +02001108 struct hfa384x_pdr_mac_address mac_address;
Sergio Paracuellosf9699552016-09-28 20:19:51 +02001109 struct hfa384x_pdr_mkk_callname mkk_callname;
Sergio Paracuellos0970a332016-09-28 20:19:52 +02001110 struct hfa384x_pdr_regdomain regdomain;
Sergio Paracuellose0322d12016-09-28 20:19:53 +02001111 struct hfa384x_pdr_allowed_channel allowed_channel;
Sergio Paracuellos892b51e2016-09-28 20:19:54 +02001112 struct hfa384x_pdr_default_channel default_channel;
Sergio Paracuellos2c1759b2016-09-28 20:19:55 +02001113 struct hfa384x_pdr_privacy_option privacy_option;
Sergio Paracuellos0c350462016-09-28 20:19:56 +02001114 struct hfa384x_pdr_temptype temptype;
Sergio Paracuellos3c92d652016-09-28 20:19:57 +02001115 struct hfa384x_pdr_refdac_setup refdac_setup;
Sergio Paracuellosdce6c2832016-09-28 20:19:58 +02001116 struct hfa384x_pdr_vgdac_setup vgdac_setup;
Sergio Paracuellos29aef6b2016-09-28 20:19:59 +02001117 struct hfa384x_pdr_level_comp_setup level_comp_setup;
Sergio Paracuellosa98f8602016-09-28 20:20:00 +02001118 struct hfa384x_pdr_trimdac_setup trimdac_setup;
Sergio Paracuellos3d235882016-09-28 20:20:01 +02001119 struct hfa384x_pdr_ifr_setting ifr_setting;
Sergio Paracuellosda79fe42016-09-28 20:20:02 +02001120 struct hfa384x_pdr_rfr_setting rfr_setting;
Sergio Paracuellosb4547dc2016-09-28 20:20:03 +02001121 struct hfa384x_pdr_hfa3861_baseline hfa3861_baseline;
Sergio Paracuellos0dbc2e42016-09-28 20:20:04 +02001122 struct hfa384x_pdr_hfa3861_shadow hfa3861_shadow;
Sergio Paracuellos1755c012016-09-28 20:20:05 +02001123 struct hfa384x_pdr_hfa3861_ifrf hfa3861_ifrf;
Sergio Paracuellos788c9732016-09-28 20:20:06 +02001124 struct hfa384x_pdr_hfa3861_chcalsp hfa3861_chcalsp;
Sergio Paracuellosb94425f2016-09-28 20:20:07 +02001125 struct hfa384x_pdr_hfa3861_chcali hfa3861_chcali;
Sergio Paracuellosbd84b582016-09-28 20:20:08 +02001126 struct hfa384x_pdr_hfa3861_nic_config nic_config;
Sergio Paracuellos9408a442016-09-28 20:20:09 +02001127 struct hfa384x_pdr_hfo_delay hfo_delay;
Sergio Paracuellos0960d2e12016-09-28 20:20:10 +02001128 struct hfa384x_pdr_hfa3861_manf_testsp hfa3861_manf_testsp;
Sergio Paracuellos5a4a5822016-09-28 20:20:11 +02001129 struct hfa384x_pdr_hfa3861_manf_testi hfa3861_manf_testi;
Sergio Paracuellosb26ce5f2016-09-28 20:20:12 +02001130 struct hfa384x_pdr_end_of_pda end_of_pda;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001131
1132 } data;
Sergio Paracuellos4f026e82016-09-28 20:20:13 +02001133} __packed;
Karl Relton76e3e7c2009-04-17 10:15:34 +01001134
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001135#ifdef __KERNEL__
1136/*--------------------------------------------------------------------
Sergio Paracuellos3e27dfa2016-09-28 20:18:56 +02001137 * --- MAC state structure, argument to all functions --
1138 * --- Also, a collection of support types --
1139 *--------------------------------------------------------------------
1140 */
Sergio Paracuellos501f5f92016-09-28 20:20:14 +02001141struct hfa384x_cmdresult {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001142 u16 status;
1143 u16 resp0;
1144 u16 resp1;
1145 u16 resp2;
Sergio Paracuellos501f5f92016-09-28 20:20:14 +02001146};
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001147
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001148/* USB Control Exchange (CTLX):
1149 * A queue of the structure below is maintained for all of the
1150 * Request/Response type USB packets supported by Prism2.
1151 */
1152/* The following hfa384x_* structures are arguments to
1153 * the usercb() for the different CTLX types.
1154 */
Sergio Paracuellosb3fd8902016-09-28 20:20:15 +02001155struct hfa384x_rridresult {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001156 u16 rid;
1157 const void *riddata;
1158 unsigned int riddata_len;
Sergio Paracuellosb3fd8902016-09-28 20:20:15 +02001159};
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001160
1161enum ctlx_state {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001162 CTLX_START = 0, /* Start state, not queued */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001163
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001164 CTLX_COMPLETE, /* CTLX successfully completed */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001165 CTLX_REQ_FAILED, /* OUT URB completed w/ error */
1166
1167 CTLX_PENDING, /* Queued, data valid */
1168 CTLX_REQ_SUBMITTED, /* OUT URB submitted */
1169 CTLX_REQ_COMPLETE, /* OUT URB complete */
1170 CTLX_RESP_COMPLETE /* IN URB received */
1171};
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001172typedef enum ctlx_state CTLX_STATE;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001173
1174struct hfa384x_usbctlx;
1175struct hfa384x;
1176
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001177typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001178
Svenne Krap5dd8acc2010-02-14 18:59:00 +01001179typedef void (*ctlx_usercb_t) (struct hfa384x *hw,
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001180 void *ctlxresult, void *usercb_data);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001181
Sergio Paracuellosa10d36b2016-09-28 20:20:16 +02001182struct hfa384x_usbctlx {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001183 struct list_head list;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001184
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001185 size_t outbufsize;
Sergio Paracuellos40126842016-09-28 20:19:37 +02001186 union hfa384x_usbout outbuf; /* pkt buf for OUT */
Sergio Paracuellos3e4180c2016-09-28 20:19:38 +02001187 union hfa384x_usbin inbuf; /* pkt buf for IN(a copy) */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001188
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001189 CTLX_STATE state; /* Tracks running state */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001190
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001191 struct completion done;
1192 volatile int reapable; /* Food for the reaper task */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001193
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001194 ctlx_cmdcb_t cmdcb; /* Async command callback */
1195 ctlx_usercb_t usercb; /* Async user callback, */
1196 void *usercb_data; /* at CTLX completion */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001197
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001198 int variant; /* Identifies cmd variant */
Sergio Paracuellosa10d36b2016-09-28 20:20:16 +02001199};
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001200
Sergio Paracuellos3df38932016-09-28 20:20:17 +02001201struct hfa384x_usbctlxq {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001202 spinlock_t lock;
1203 struct list_head pending;
1204 struct list_head active;
1205 struct list_head completing;
1206 struct list_head reapable;
Sergio Paracuellos3df38932016-09-28 20:20:17 +02001207};
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001208
Sergio Paracuellose2f503c2016-09-28 20:20:18 +02001209struct hfa384x_metacmd {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001210 u16 cmd;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001211
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001212 u16 parm0;
1213 u16 parm1;
1214 u16 parm2;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001215
Sergio Paracuellos501f5f92016-09-28 20:20:14 +02001216 struct hfa384x_cmdresult result;
Sergio Paracuellose2f503c2016-09-28 20:20:18 +02001217};
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001218
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001219#define MAX_GRP_ADDR 32
Alessandro Ghedini71508ee2010-02-15 12:25:22 +01001220#define WLAN_COMMENT_MAX 80 /* Max. length of user comment string. */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001221
Alessandro Ghedini71508ee2010-02-15 12:25:22 +01001222#define WLAN_AUTH_MAX 60 /* Max. # of authenticated stations. */
1223#define WLAN_ACCESS_MAX 60 /* Max. # of stations in an access list. */
1224#define WLAN_ACCESS_NONE 0 /* No stations may be authenticated. */
1225#define WLAN_ACCESS_ALL 1 /* All stations may be authenticated. */
1226#define WLAN_ACCESS_ALLOW 2 /* Authenticate only "allowed" stations. */
1227#define WLAN_ACCESS_DENY 3 /* Do not authenticate "denied" stations. */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001228
1229/* XXX These are going away ASAP */
Vatika Harlalkac84b5282015-03-21 12:27:24 +05301230struct prism2sta_authlist {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001231 unsigned int cnt;
1232 u8 addr[WLAN_AUTH_MAX][ETH_ALEN];
1233 u8 assoc[WLAN_AUTH_MAX];
Vatika Harlalkac84b5282015-03-21 12:27:24 +05301234};
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001235
Vatika Harlalka4d10ece2015-03-21 12:27:34 +05301236struct prism2sta_accesslist {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001237 unsigned int modify;
1238 unsigned int cnt;
1239 u8 addr[WLAN_ACCESS_MAX][ETH_ALEN];
1240 unsigned int cnt1;
1241 u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN];
Vatika Harlalka4d10ece2015-03-21 12:27:34 +05301242};
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001243
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001244struct hfa384x {
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001245 /* USB support data */
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001246 struct usb_device *usb;
1247 struct urb rx_urb;
1248 struct sk_buff *rx_urb_skb;
1249 struct urb tx_urb;
1250 struct urb ctlx_urb;
Sergio Paracuellos40126842016-09-28 20:19:37 +02001251 union hfa384x_usbout txbuff;
Sergio Paracuellos3df38932016-09-28 20:20:17 +02001252 struct hfa384x_usbctlxq ctlxq;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001253 struct timer_list reqtimer;
1254 struct timer_list resptimer;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001255
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001256 struct timer_list throttle;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001257
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001258 struct tasklet_struct reaper_bh;
1259 struct tasklet_struct completion_bh;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001260
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001261 struct work_struct usb_work;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001262
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001263 unsigned long usb_flags;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001264#define THROTTLE_RX 0
1265#define THROTTLE_TX 1
1266#define WORK_RX_HALT 2
1267#define WORK_TX_HALT 3
1268#define WORK_RX_RESUME 4
1269#define WORK_TX_RESUME 5
1270
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001271 unsigned short req_timer_done:1;
1272 unsigned short resp_timer_done:1;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001273
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001274 int endp_in;
1275 int endp_out;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001276
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001277 int sniff_fcs;
1278 int sniff_channel;
1279 int sniff_truncate;
1280 int sniffhdr;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001281
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001282 wait_queue_head_t cmdq; /* wait queue itself */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001283
1284 /* Controller state */
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001285 u32 state;
1286 u32 isap;
1287 u8 port_enabled[HFA384x_NUMPORTS_MAX];
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001288
1289 /* Download support */
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001290 unsigned int dlstate;
Sergio Paracuellosb71db742016-09-28 20:19:02 +02001291 struct hfa384x_downloadbuffer bufinfo;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001292 u16 dltimeout;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001293
Masanari Iida1a6dfce2014-12-01 00:29:00 +09001294 int scanflag; /* to signal scan complete */
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001295 int join_ap; /* are we joined to a specific ap */
1296 int join_retries; /* number of join retries till we fail */
Sergio Paracuellosf0ffa0e2016-09-28 20:18:59 +02001297 struct hfa384x_JoinRequest_data joinreq; /* join request saved data */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001298
sayli karnikc9573a82016-09-18 15:11:14 +05301299 struct wlandevice *wlandev;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001300 /* Timer to allow for the deferred processing of linkstatus messages */
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001301 struct work_struct link_bh;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001302
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001303 struct work_struct commsqual_bh;
Sergio Paracuellosa1e95042016-09-28 20:19:03 +02001304 struct hfa384x_commsquality qual;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001305 struct timer_list commsqual_timer;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001306
Solomon Peachyaaad4302008-10-29 10:42:53 -04001307 u16 link_status;
1308 u16 link_status_new;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001309 struct sk_buff_head authq;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001310
Karl Reltoncb3126e2010-06-03 23:04:06 +01001311 u32 txrate;
1312
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001313 /* And here we have stuff that used to be in priv */
1314
1315 /* State variables */
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001316 unsigned int presniff_port_type;
1317 u16 presniff_wepflags;
1318 u32 dot11_desired_bss_type;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001319
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001320 int dbmadjust;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001321
1322 /* Group Addresses - right now, there are up to a total
Juliana Rodrigues5f0730f2016-09-22 03:01:28 -03001323 * of MAX_GRP_ADDR group addresses
1324 */
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001325 u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN];
1326 unsigned int dot11_grpcnt;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001327
1328 /* Component Identities */
Sergio Paracuellos5f046452016-09-28 20:18:55 +02001329 struct hfa384x_compident ident_nic;
1330 struct hfa384x_compident ident_pri_fw;
1331 struct hfa384x_compident ident_sta_fw;
1332 struct hfa384x_compident ident_ap_fw;
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001333 u16 mm_mods;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001334
1335 /* Supplier compatibility ranges */
Sergio Paracuellos65f170c2016-09-28 20:18:57 +02001336 struct hfa384x_caplevel cap_sup_mfi;
1337 struct hfa384x_caplevel cap_sup_cfi;
1338 struct hfa384x_caplevel cap_sup_pri;
1339 struct hfa384x_caplevel cap_sup_sta;
1340 struct hfa384x_caplevel cap_sup_ap;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001341
1342 /* Actor compatibility ranges */
Sergio Paracuellos5f7688d2016-09-28 20:20:20 +02001343 struct hfa384x_caplevel cap_act_pri_cfi; /*
1344 * pri f/w to controller
1345 * interface
1346 */
Alessandro Ghedini71508ee2010-02-15 12:25:22 +01001347
Sergio Paracuellos5f7688d2016-09-28 20:20:20 +02001348 struct hfa384x_caplevel cap_act_sta_cfi; /*
1349 * sta f/w to controller
1350 * interface
1351 */
Alessandro Ghedini71508ee2010-02-15 12:25:22 +01001352
Sergio Paracuellos5f7688d2016-09-28 20:20:20 +02001353 struct hfa384x_caplevel cap_act_sta_mfi; /* sta f/w to modem interface */
Alessandro Ghedini71508ee2010-02-15 12:25:22 +01001354
Sergio Paracuellos65f170c2016-09-28 20:18:57 +02001355 struct hfa384x_caplevel cap_act_ap_cfi; /*
Alessandro Ghedini71508ee2010-02-15 12:25:22 +01001356 * ap f/w to controller
1357 * interface
1358 */
1359
Sergio Paracuellos65f170c2016-09-28 20:18:57 +02001360 struct hfa384x_caplevel cap_act_ap_mfi; /* ap f/w to modem interface */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001361
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001362 u32 psusercount; /* Power save user count. */
Sergio Paracuelloscfc6cb12016-09-28 20:19:08 +02001363 struct hfa384x_CommTallies32 tallies; /* Communication tallies. */
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001364 u8 comment[WLAN_COMMENT_MAX + 1]; /* User comment */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001365
1366 /* Channel Info request results (AP only) */
1367 struct {
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001368 atomic_t done;
1369 u8 count;
Sergio Paracuellos0fddae82016-09-28 20:19:12 +02001370 struct hfa384x_ChInfoResult results;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001371 } channel_info;
1372
Sergio Paracuellosf69de9e2016-09-28 20:19:21 +02001373 struct hfa384x_InfFrame *scanresults;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001374
Vatika Harlalkac84b5282015-03-21 12:27:24 +05301375 struct prism2sta_authlist authlist; /* Authenticated station list. */
Vatika Harlalka4d10ece2015-03-21 12:27:34 +05301376 unsigned int accessmode; /* Access mode. */
1377 struct prism2sta_accesslist allow; /* Allowed station list. */
1378 struct prism2sta_accesslist deny; /* Denied station list. */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001379
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001380};
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001381
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001382void hfa384x_create(struct hfa384x *hw, struct usb_device *usb);
1383void hfa384x_destroy(struct hfa384x *hw);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001384
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001385int
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001386hfa384x_corereset(struct hfa384x *hw, int holdtime, int settletime, int genesis);
1387int hfa384x_drvr_disable(struct hfa384x *hw, u16 macport);
1388int hfa384x_drvr_enable(struct hfa384x *hw, u16 macport);
1389int hfa384x_drvr_flashdl_enable(struct hfa384x *hw);
1390int hfa384x_drvr_flashdl_disable(struct hfa384x *hw);
1391int hfa384x_drvr_flashdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
1392int hfa384x_drvr_getconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
1393int hfa384x_drvr_ramdl_enable(struct hfa384x *hw, u32 exeaddr);
1394int hfa384x_drvr_ramdl_disable(struct hfa384x *hw);
1395int hfa384x_drvr_ramdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len);
1396int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len);
1397int hfa384x_drvr_setconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001398
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001399static inline int hfa384x_drvr_getconfig16(struct hfa384x *hw, u16 rid, void *val)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001400{
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001401 int result = 0;
Veronika Kabatova7489df32014-10-05 10:33:56 +02001402
Solomon Peachyaaad4302008-10-29 10:42:53 -04001403 result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001404 if (result == 0)
Jannik Becher0e21fa42016-09-23 01:02:10 +02001405 *((u16 *)val) = le16_to_cpu(*((u16 *)val));
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001406 return result;
1407}
1408
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001409static inline int hfa384x_drvr_setconfig16(struct hfa384x *hw, u16 rid, u16 val)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001410{
Moritz Muehlenhoff18c7f792009-02-18 19:50:07 +01001411 u16 value = cpu_to_le16(val);
Veronika Kabatova7489df32014-10-05 10:33:56 +02001412
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001413 return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
1414}
1415
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001416int
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001417hfa384x_drvr_setconfig_async(struct hfa384x *hw,
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001418 u16 rid,
1419 void *buf,
1420 u16 len, ctlx_usercb_t usercb, void *usercb_data);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001421
1422static inline int
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001423hfa384x_drvr_setconfig16_async(struct hfa384x *hw, u16 rid, u16 val)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001424{
Moritz Muehlenhoff18c7f792009-02-18 19:50:07 +01001425 u16 value = cpu_to_le16(val);
Veronika Kabatova7489df32014-10-05 10:33:56 +02001426
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001427 return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001428 NULL, NULL);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001429}
1430
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001431int hfa384x_drvr_start(struct hfa384x *hw);
1432int hfa384x_drvr_stop(struct hfa384x *hw);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001433int
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001434hfa384x_drvr_txframe(struct hfa384x *hw, struct sk_buff *skb,
Sven Dziadekf6b43c22015-03-19 20:42:48 +01001435 union p80211_hdr *p80211_hdr,
1436 struct p80211_metawep *p80211_wep);
sayli karnikc9573a82016-09-18 15:11:14 +05301437void hfa384x_tx_timeout(struct wlandevice *wlandev);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001438
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001439int hfa384x_cmd_initialize(struct hfa384x *hw);
1440int hfa384x_cmd_enable(struct hfa384x *hw, u16 macport);
1441int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport);
1442int hfa384x_cmd_allocate(struct hfa384x *hw, u16 len);
1443int hfa384x_cmd_monitor(struct hfa384x *hw, u16 enable);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001444int
Sergio Paracuellos5a2214e2016-09-28 20:20:19 +02001445hfa384x_cmd_download(struct hfa384x *hw,
Moritz Muehlenhoffe573aaa2009-02-08 02:20:49 +01001446 u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001447
Alessandro Ghedini71508ee2010-02-15 12:25:22 +01001448#endif /*__KERNEL__ */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001449
Alessandro Ghedini71508ee2010-02-15 12:25:22 +01001450#endif /*_HFA384x_H */