hfa384x.h 45 KB

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