hfa384x.h 43 KB

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