ipw2200.h 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916
  1. /******************************************************************************
  2. Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved.
  3. This program is free software; you can redistribute it and/or modify it
  4. under the terms of version 2 of the GNU General Public License as
  5. published by the Free Software Foundation.
  6. This program is distributed in the hope that it will be useful, but WITHOUT
  7. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  8. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  9. more details.
  10. You should have received a copy of the GNU General Public License along with
  11. this program; if not, write to the Free Software Foundation, Inc., 59
  12. Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  13. The full GNU General Public License is included in this distribution in the
  14. file called LICENSE.
  15. Contact Information:
  16. James P. Ketrenos <ipw2100-admin@linux.intel.com>
  17. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  18. ******************************************************************************/
  19. #ifndef __ipw2200_h__
  20. #define __ipw2200_h__
  21. #define WEXT_USECHANNELS 1
  22. #include <linux/module.h>
  23. #include <linux/moduleparam.h>
  24. #include <linux/config.h>
  25. #include <linux/init.h>
  26. #include <linux/mutex.h>
  27. #include <linux/pci.h>
  28. #include <linux/netdevice.h>
  29. #include <linux/ethtool.h>
  30. #include <linux/skbuff.h>
  31. #include <linux/etherdevice.h>
  32. #include <linux/delay.h>
  33. #include <linux/random.h>
  34. #include <linux/dma-mapping.h>
  35. #include <linux/firmware.h>
  36. #include <linux/wireless.h>
  37. #include <linux/dma-mapping.h>
  38. #include <linux/jiffies.h>
  39. #include <asm/io.h>
  40. #include <net/ieee80211.h>
  41. #include <net/ieee80211_radiotap.h>
  42. #define DRV_NAME "ipw2200"
  43. #include <linux/workqueue.h>
  44. /* Authentication and Association States */
  45. enum connection_manager_assoc_states {
  46. CMAS_INIT = 0,
  47. CMAS_TX_AUTH_SEQ_1,
  48. CMAS_RX_AUTH_SEQ_2,
  49. CMAS_AUTH_SEQ_1_PASS,
  50. CMAS_AUTH_SEQ_1_FAIL,
  51. CMAS_TX_AUTH_SEQ_3,
  52. CMAS_RX_AUTH_SEQ_4,
  53. CMAS_AUTH_SEQ_2_PASS,
  54. CMAS_AUTH_SEQ_2_FAIL,
  55. CMAS_AUTHENTICATED,
  56. CMAS_TX_ASSOC,
  57. CMAS_RX_ASSOC_RESP,
  58. CMAS_ASSOCIATED,
  59. CMAS_LAST
  60. };
  61. #define IPW_WAIT (1<<0)
  62. #define IPW_QUIET (1<<1)
  63. #define IPW_ROAMING (1<<2)
  64. #define IPW_POWER_MODE_CAM 0x00 //(always on)
  65. #define IPW_POWER_INDEX_1 0x01
  66. #define IPW_POWER_INDEX_2 0x02
  67. #define IPW_POWER_INDEX_3 0x03
  68. #define IPW_POWER_INDEX_4 0x04
  69. #define IPW_POWER_INDEX_5 0x05
  70. #define IPW_POWER_AC 0x06
  71. #define IPW_POWER_BATTERY 0x07
  72. #define IPW_POWER_LIMIT 0x07
  73. #define IPW_POWER_MASK 0x0F
  74. #define IPW_POWER_ENABLED 0x10
  75. #define IPW_POWER_LEVEL(x) ((x) & IPW_POWER_MASK)
  76. #define IPW_CMD_HOST_COMPLETE 2
  77. #define IPW_CMD_POWER_DOWN 4
  78. #define IPW_CMD_SYSTEM_CONFIG 6
  79. #define IPW_CMD_MULTICAST_ADDRESS 7
  80. #define IPW_CMD_SSID 8
  81. #define IPW_CMD_ADAPTER_ADDRESS 11
  82. #define IPW_CMD_PORT_TYPE 12
  83. #define IPW_CMD_RTS_THRESHOLD 15
  84. #define IPW_CMD_FRAG_THRESHOLD 16
  85. #define IPW_CMD_POWER_MODE 17
  86. #define IPW_CMD_WEP_KEY 18
  87. #define IPW_CMD_TGI_TX_KEY 19
  88. #define IPW_CMD_SCAN_REQUEST 20
  89. #define IPW_CMD_ASSOCIATE 21
  90. #define IPW_CMD_SUPPORTED_RATES 22
  91. #define IPW_CMD_SCAN_ABORT 23
  92. #define IPW_CMD_TX_FLUSH 24
  93. #define IPW_CMD_QOS_PARAMETERS 25
  94. #define IPW_CMD_SCAN_REQUEST_EXT 26
  95. #define IPW_CMD_DINO_CONFIG 30
  96. #define IPW_CMD_RSN_CAPABILITIES 31
  97. #define IPW_CMD_RX_KEY 32
  98. #define IPW_CMD_CARD_DISABLE 33
  99. #define IPW_CMD_SEED_NUMBER 34
  100. #define IPW_CMD_TX_POWER 35
  101. #define IPW_CMD_COUNTRY_INFO 36
  102. #define IPW_CMD_AIRONET_INFO 37
  103. #define IPW_CMD_AP_TX_POWER 38
  104. #define IPW_CMD_CCKM_INFO 39
  105. #define IPW_CMD_CCX_VER_INFO 40
  106. #define IPW_CMD_SET_CALIBRATION 41
  107. #define IPW_CMD_SENSITIVITY_CALIB 42
  108. #define IPW_CMD_RETRY_LIMIT 51
  109. #define IPW_CMD_IPW_PRE_POWER_DOWN 58
  110. #define IPW_CMD_VAP_BEACON_TEMPLATE 60
  111. #define IPW_CMD_VAP_DTIM_PERIOD 61
  112. #define IPW_CMD_EXT_SUPPORTED_RATES 62
  113. #define IPW_CMD_VAP_LOCAL_TX_PWR_CONSTRAINT 63
  114. #define IPW_CMD_VAP_QUIET_INTERVALS 64
  115. #define IPW_CMD_VAP_CHANNEL_SWITCH 65
  116. #define IPW_CMD_VAP_MANDATORY_CHANNELS 66
  117. #define IPW_CMD_VAP_CELL_PWR_LIMIT 67
  118. #define IPW_CMD_VAP_CF_PARAM_SET 68
  119. #define IPW_CMD_VAP_SET_BEACONING_STATE 69
  120. #define IPW_CMD_MEASUREMENT 80
  121. #define IPW_CMD_POWER_CAPABILITY 81
  122. #define IPW_CMD_SUPPORTED_CHANNELS 82
  123. #define IPW_CMD_TPC_REPORT 83
  124. #define IPW_CMD_WME_INFO 84
  125. #define IPW_CMD_PRODUCTION_COMMAND 85
  126. #define IPW_CMD_LINKSYS_EOU_INFO 90
  127. #define RFD_SIZE 4
  128. #define NUM_TFD_CHUNKS 6
  129. #define TX_QUEUE_SIZE 32
  130. #define RX_QUEUE_SIZE 32
  131. #define DINO_CMD_WEP_KEY 0x08
  132. #define DINO_CMD_TX 0x0B
  133. #define DCT_ANTENNA_A 0x01
  134. #define DCT_ANTENNA_B 0x02
  135. #define IPW_A_MODE 0
  136. #define IPW_B_MODE 1
  137. #define IPW_G_MODE 2
  138. /*
  139. * TX Queue Flag Definitions
  140. */
  141. /* tx wep key definition */
  142. #define DCT_WEP_KEY_NOT_IMMIDIATE 0x00
  143. #define DCT_WEP_KEY_64Bit 0x40
  144. #define DCT_WEP_KEY_128Bit 0x80
  145. #define DCT_WEP_KEY_128bitIV 0xC0
  146. #define DCT_WEP_KEY_SIZE_MASK 0xC0
  147. #define DCT_WEP_KEY_INDEX_MASK 0x0F
  148. #define DCT_WEP_INDEX_USE_IMMEDIATE 0x20
  149. /* abort attempt if mgmt frame is rx'd */
  150. #define DCT_FLAG_ABORT_MGMT 0x01
  151. /* require CTS */
  152. #define DCT_FLAG_CTS_REQUIRED 0x02
  153. /* use short preamble */
  154. #define DCT_FLAG_LONG_PREAMBLE 0x00
  155. #define DCT_FLAG_SHORT_PREAMBLE 0x04
  156. /* RTS/CTS first */
  157. #define DCT_FLAG_RTS_REQD 0x08
  158. /* dont calculate duration field */
  159. #define DCT_FLAG_DUR_SET 0x10
  160. /* even if MAC WEP set (allows pre-encrypt) */
  161. #define DCT_FLAG_NO_WEP 0x20
  162. /* overwrite TSF field */
  163. #define DCT_FLAG_TSF_REQD 0x40
  164. /* ACK rx is expected to follow */
  165. #define DCT_FLAG_ACK_REQD 0x80
  166. /* TX flags extension */
  167. #define DCT_FLAG_EXT_MODE_CCK 0x01
  168. #define DCT_FLAG_EXT_MODE_OFDM 0x00
  169. #define DCT_FLAG_EXT_SECURITY_WEP 0x00
  170. #define DCT_FLAG_EXT_SECURITY_NO DCT_FLAG_EXT_SECURITY_WEP
  171. #define DCT_FLAG_EXT_SECURITY_CKIP 0x04
  172. #define DCT_FLAG_EXT_SECURITY_CCM 0x08
  173. #define DCT_FLAG_EXT_SECURITY_TKIP 0x0C
  174. #define DCT_FLAG_EXT_SECURITY_MASK 0x0C
  175. #define DCT_FLAG_EXT_QOS_ENABLED 0x10
  176. #define DCT_FLAG_EXT_HC_NO_SIFS_PIFS 0x00
  177. #define DCT_FLAG_EXT_HC_SIFS 0x20
  178. #define DCT_FLAG_EXT_HC_PIFS 0x40
  179. #define TX_RX_TYPE_MASK 0xFF
  180. #define TX_FRAME_TYPE 0x00
  181. #define TX_HOST_COMMAND_TYPE 0x01
  182. #define RX_FRAME_TYPE 0x09
  183. #define RX_HOST_NOTIFICATION_TYPE 0x03
  184. #define RX_HOST_CMD_RESPONSE_TYPE 0x04
  185. #define RX_TX_FRAME_RESPONSE_TYPE 0x05
  186. #define TFD_NEED_IRQ_MASK 0x04
  187. #define HOST_CMD_DINO_CONFIG 30
  188. #define HOST_NOTIFICATION_STATUS_ASSOCIATED 10
  189. #define HOST_NOTIFICATION_STATUS_AUTHENTICATE 11
  190. #define HOST_NOTIFICATION_STATUS_SCAN_CHANNEL_RESULT 12
  191. #define HOST_NOTIFICATION_STATUS_SCAN_COMPLETED 13
  192. #define HOST_NOTIFICATION_STATUS_FRAG_LENGTH 14
  193. #define HOST_NOTIFICATION_STATUS_LINK_DETERIORATION 15
  194. #define HOST_NOTIFICATION_DINO_CONFIG_RESPONSE 16
  195. #define HOST_NOTIFICATION_STATUS_BEACON_STATE 17
  196. #define HOST_NOTIFICATION_STATUS_TGI_TX_KEY 18
  197. #define HOST_NOTIFICATION_TX_STATUS 19
  198. #define HOST_NOTIFICATION_CALIB_KEEP_RESULTS 20
  199. #define HOST_NOTIFICATION_MEASUREMENT_STARTED 21
  200. #define HOST_NOTIFICATION_MEASUREMENT_ENDED 22
  201. #define HOST_NOTIFICATION_CHANNEL_SWITCHED 23
  202. #define HOST_NOTIFICATION_RX_DURING_QUIET_PERIOD 24
  203. #define HOST_NOTIFICATION_NOISE_STATS 25
  204. #define HOST_NOTIFICATION_S36_MEASUREMENT_ACCEPTED 30
  205. #define HOST_NOTIFICATION_S36_MEASUREMENT_REFUSED 31
  206. #define HOST_NOTIFICATION_STATUS_BEACON_MISSING 1
  207. #define IPW_MB_ROAMING_THRESHOLD_MIN 1
  208. #define IPW_MB_ROAMING_THRESHOLD_DEFAULT 8
  209. #define IPW_MB_ROAMING_THRESHOLD_MAX 30
  210. #define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT 3*IPW_MB_ROAMING_THRESHOLD_DEFAULT
  211. #define IPW_REAL_RATE_RX_PACKET_THRESHOLD 300
  212. #define MACADRR_BYTE_LEN 6
  213. #define DCR_TYPE_AP 0x01
  214. #define DCR_TYPE_WLAP 0x02
  215. #define DCR_TYPE_MU_ESS 0x03
  216. #define DCR_TYPE_MU_IBSS 0x04
  217. #define DCR_TYPE_MU_PIBSS 0x05
  218. #define DCR_TYPE_SNIFFER 0x06
  219. #define DCR_TYPE_MU_BSS DCR_TYPE_MU_ESS
  220. /* QoS definitions */
  221. #define CW_MIN_OFDM 15
  222. #define CW_MAX_OFDM 1023
  223. #define CW_MIN_CCK 31
  224. #define CW_MAX_CCK 1023
  225. #define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM
  226. #define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM
  227. #define QOS_TX2_CW_MIN_OFDM ( (CW_MIN_OFDM + 1) / 2 - 1 )
  228. #define QOS_TX3_CW_MIN_OFDM ( (CW_MIN_OFDM + 1) / 4 - 1 )
  229. #define QOS_TX0_CW_MIN_CCK CW_MIN_CCK
  230. #define QOS_TX1_CW_MIN_CCK CW_MIN_CCK
  231. #define QOS_TX2_CW_MIN_CCK ( (CW_MIN_CCK + 1) / 2 - 1 )
  232. #define QOS_TX3_CW_MIN_CCK ( (CW_MIN_CCK + 1) / 4 - 1 )
  233. #define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM
  234. #define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM
  235. #define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM
  236. #define QOS_TX3_CW_MAX_OFDM ( (CW_MIN_OFDM + 1) / 2 - 1 )
  237. #define QOS_TX0_CW_MAX_CCK CW_MAX_CCK
  238. #define QOS_TX1_CW_MAX_CCK CW_MAX_CCK
  239. #define QOS_TX2_CW_MAX_CCK CW_MIN_CCK
  240. #define QOS_TX3_CW_MAX_CCK ( (CW_MIN_CCK + 1) / 2 - 1 )
  241. #define QOS_TX0_AIFS (3 - QOS_AIFSN_MIN_VALUE)
  242. #define QOS_TX1_AIFS (7 - QOS_AIFSN_MIN_VALUE)
  243. #define QOS_TX2_AIFS (2 - QOS_AIFSN_MIN_VALUE)
  244. #define QOS_TX3_AIFS (2 - QOS_AIFSN_MIN_VALUE)
  245. #define QOS_TX0_ACM 0
  246. #define QOS_TX1_ACM 0
  247. #define QOS_TX2_ACM 0
  248. #define QOS_TX3_ACM 0
  249. #define QOS_TX0_TXOP_LIMIT_CCK 0
  250. #define QOS_TX1_TXOP_LIMIT_CCK 0
  251. #define QOS_TX2_TXOP_LIMIT_CCK 6016
  252. #define QOS_TX3_TXOP_LIMIT_CCK 3264
  253. #define QOS_TX0_TXOP_LIMIT_OFDM 0
  254. #define QOS_TX1_TXOP_LIMIT_OFDM 0
  255. #define QOS_TX2_TXOP_LIMIT_OFDM 3008
  256. #define QOS_TX3_TXOP_LIMIT_OFDM 1504
  257. #define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM
  258. #define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM
  259. #define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM
  260. #define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM
  261. #define DEF_TX0_CW_MIN_CCK CW_MIN_CCK
  262. #define DEF_TX1_CW_MIN_CCK CW_MIN_CCK
  263. #define DEF_TX2_CW_MIN_CCK CW_MIN_CCK
  264. #define DEF_TX3_CW_MIN_CCK CW_MIN_CCK
  265. #define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM
  266. #define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM
  267. #define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM
  268. #define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM
  269. #define DEF_TX0_CW_MAX_CCK CW_MAX_CCK
  270. #define DEF_TX1_CW_MAX_CCK CW_MAX_CCK
  271. #define DEF_TX2_CW_MAX_CCK CW_MAX_CCK
  272. #define DEF_TX3_CW_MAX_CCK CW_MAX_CCK
  273. #define DEF_TX0_AIFS 0
  274. #define DEF_TX1_AIFS 0
  275. #define DEF_TX2_AIFS 0
  276. #define DEF_TX3_AIFS 0
  277. #define DEF_TX0_ACM 0
  278. #define DEF_TX1_ACM 0
  279. #define DEF_TX2_ACM 0
  280. #define DEF_TX3_ACM 0
  281. #define DEF_TX0_TXOP_LIMIT_CCK 0
  282. #define DEF_TX1_TXOP_LIMIT_CCK 0
  283. #define DEF_TX2_TXOP_LIMIT_CCK 0
  284. #define DEF_TX3_TXOP_LIMIT_CCK 0
  285. #define DEF_TX0_TXOP_LIMIT_OFDM 0
  286. #define DEF_TX1_TXOP_LIMIT_OFDM 0
  287. #define DEF_TX2_TXOP_LIMIT_OFDM 0
  288. #define DEF_TX3_TXOP_LIMIT_OFDM 0
  289. #define QOS_QOS_SETS 3
  290. #define QOS_PARAM_SET_ACTIVE 0
  291. #define QOS_PARAM_SET_DEF_CCK 1
  292. #define QOS_PARAM_SET_DEF_OFDM 2
  293. #define CTRL_QOS_NO_ACK (0x0020)
  294. #define IPW_TX_QUEUE_1 1
  295. #define IPW_TX_QUEUE_2 2
  296. #define IPW_TX_QUEUE_3 3
  297. #define IPW_TX_QUEUE_4 4
  298. /* QoS sturctures */
  299. struct ipw_qos_info {
  300. int qos_enable;
  301. struct ieee80211_qos_parameters *def_qos_parm_OFDM;
  302. struct ieee80211_qos_parameters *def_qos_parm_CCK;
  303. u32 burst_duration_CCK;
  304. u32 burst_duration_OFDM;
  305. u16 qos_no_ack_mask;
  306. int burst_enable;
  307. };
  308. /**************************************************************/
  309. /**
  310. * Generic queue structure
  311. *
  312. * Contains common data for Rx and Tx queues
  313. */
  314. struct clx2_queue {
  315. int n_bd; /**< number of BDs in this queue */
  316. int first_empty; /**< 1-st empty entry (index) */
  317. int last_used; /**< last used entry (index) */
  318. u32 reg_w; /**< 'write' reg (queue head), addr in domain 1 */
  319. u32 reg_r; /**< 'read' reg (queue tail), addr in domain 1 */
  320. dma_addr_t dma_addr; /**< physical addr for BD's */
  321. int low_mark; /**< low watermark, resume queue if free space more than this */
  322. int high_mark; /**< high watermark, stop queue if free space less than this */
  323. } __attribute__ ((packed));
  324. struct machdr32 {
  325. u16 frame_ctl;
  326. u16 duration; // watch out for endians!
  327. u8 addr1[MACADRR_BYTE_LEN];
  328. u8 addr2[MACADRR_BYTE_LEN];
  329. u8 addr3[MACADRR_BYTE_LEN];
  330. u16 seq_ctrl; // more endians!
  331. u8 addr4[MACADRR_BYTE_LEN];
  332. u16 qos_ctrl;
  333. } __attribute__ ((packed));
  334. struct machdr30 {
  335. u16 frame_ctl;
  336. u16 duration; // watch out for endians!
  337. u8 addr1[MACADRR_BYTE_LEN];
  338. u8 addr2[MACADRR_BYTE_LEN];
  339. u8 addr3[MACADRR_BYTE_LEN];
  340. u16 seq_ctrl; // more endians!
  341. u8 addr4[MACADRR_BYTE_LEN];
  342. } __attribute__ ((packed));
  343. struct machdr26 {
  344. u16 frame_ctl;
  345. u16 duration; // watch out for endians!
  346. u8 addr1[MACADRR_BYTE_LEN];
  347. u8 addr2[MACADRR_BYTE_LEN];
  348. u8 addr3[MACADRR_BYTE_LEN];
  349. u16 seq_ctrl; // more endians!
  350. u16 qos_ctrl;
  351. } __attribute__ ((packed));
  352. struct machdr24 {
  353. u16 frame_ctl;
  354. u16 duration; // watch out for endians!
  355. u8 addr1[MACADRR_BYTE_LEN];
  356. u8 addr2[MACADRR_BYTE_LEN];
  357. u8 addr3[MACADRR_BYTE_LEN];
  358. u16 seq_ctrl; // more endians!
  359. } __attribute__ ((packed));
  360. // TX TFD with 32 byte MAC Header
  361. struct tx_tfd_32 {
  362. struct machdr32 mchdr; // 32
  363. u32 uivplaceholder[2]; // 8
  364. } __attribute__ ((packed));
  365. // TX TFD with 30 byte MAC Header
  366. struct tx_tfd_30 {
  367. struct machdr30 mchdr; // 30
  368. u8 reserved[2]; // 2
  369. u32 uivplaceholder[2]; // 8
  370. } __attribute__ ((packed));
  371. // tx tfd with 26 byte mac header
  372. struct tx_tfd_26 {
  373. struct machdr26 mchdr; // 26
  374. u8 reserved1[2]; // 2
  375. u32 uivplaceholder[2]; // 8
  376. u8 reserved2[4]; // 4
  377. } __attribute__ ((packed));
  378. // tx tfd with 24 byte mac header
  379. struct tx_tfd_24 {
  380. struct machdr24 mchdr; // 24
  381. u32 uivplaceholder[2]; // 8
  382. u8 reserved[8]; // 8
  383. } __attribute__ ((packed));
  384. #define DCT_WEP_KEY_FIELD_LENGTH 16
  385. struct tfd_command {
  386. u8 index;
  387. u8 length;
  388. u16 reserved;
  389. u8 payload[0];
  390. } __attribute__ ((packed));
  391. struct tfd_data {
  392. /* Header */
  393. u32 work_area_ptr;
  394. u8 station_number; /* 0 for BSS */
  395. u8 reserved1;
  396. u16 reserved2;
  397. /* Tx Parameters */
  398. u8 cmd_id;
  399. u8 seq_num;
  400. u16 len;
  401. u8 priority;
  402. u8 tx_flags;
  403. u8 tx_flags_ext;
  404. u8 key_index;
  405. u8 wepkey[DCT_WEP_KEY_FIELD_LENGTH];
  406. u8 rate;
  407. u8 antenna;
  408. u16 next_packet_duration;
  409. u16 next_frag_len;
  410. u16 back_off_counter; //////txop;
  411. u8 retrylimit;
  412. u16 cwcurrent;
  413. u8 reserved3;
  414. /* 802.11 MAC Header */
  415. union {
  416. struct tx_tfd_24 tfd_24;
  417. struct tx_tfd_26 tfd_26;
  418. struct tx_tfd_30 tfd_30;
  419. struct tx_tfd_32 tfd_32;
  420. } tfd;
  421. /* Payload DMA info */
  422. u32 num_chunks;
  423. u32 chunk_ptr[NUM_TFD_CHUNKS];
  424. u16 chunk_len[NUM_TFD_CHUNKS];
  425. } __attribute__ ((packed));
  426. struct txrx_control_flags {
  427. u8 message_type;
  428. u8 rx_seq_num;
  429. u8 control_bits;
  430. u8 reserved;
  431. } __attribute__ ((packed));
  432. #define TFD_SIZE 128
  433. #define TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH (TFD_SIZE - sizeof(struct txrx_control_flags))
  434. struct tfd_frame {
  435. struct txrx_control_flags control_flags;
  436. union {
  437. struct tfd_data data;
  438. struct tfd_command cmd;
  439. u8 raw[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH];
  440. } u;
  441. } __attribute__ ((packed));
  442. typedef void destructor_func(const void *);
  443. /**
  444. * Tx Queue for DMA. Queue consists of circular buffer of
  445. * BD's and required locking structures.
  446. */
  447. struct clx2_tx_queue {
  448. struct clx2_queue q;
  449. struct tfd_frame *bd;
  450. struct ieee80211_txb **txb;
  451. };
  452. /*
  453. * RX related structures and functions
  454. */
  455. #define RX_FREE_BUFFERS 32
  456. #define RX_LOW_WATERMARK 8
  457. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  458. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  459. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  460. // Used for passing to driver number of successes and failures per rate
  461. struct rate_histogram {
  462. union {
  463. u32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  464. u32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  465. u32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  466. } success;
  467. union {
  468. u32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
  469. u32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
  470. u32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
  471. } failed;
  472. } __attribute__ ((packed));
  473. /* statistics command response */
  474. struct ipw_cmd_stats {
  475. u8 cmd_id;
  476. u8 seq_num;
  477. u16 good_sfd;
  478. u16 bad_plcp;
  479. u16 wrong_bssid;
  480. u16 valid_mpdu;
  481. u16 bad_mac_header;
  482. u16 reserved_frame_types;
  483. u16 rx_ina;
  484. u16 bad_crc32;
  485. u16 invalid_cts;
  486. u16 invalid_acks;
  487. u16 long_distance_ina_fina;
  488. u16 dsp_silence_unreachable;
  489. u16 accumulated_rssi;
  490. u16 rx_ovfl_frame_tossed;
  491. u16 rssi_silence_threshold;
  492. u16 rx_ovfl_frame_supplied;
  493. u16 last_rx_frame_signal;
  494. u16 last_rx_frame_noise;
  495. u16 rx_autodetec_no_ofdm;
  496. u16 rx_autodetec_no_barker;
  497. u16 reserved;
  498. } __attribute__ ((packed));
  499. struct notif_channel_result {
  500. u8 channel_num;
  501. struct ipw_cmd_stats stats;
  502. u8 uReserved;
  503. } __attribute__ ((packed));
  504. #define SCAN_COMPLETED_STATUS_COMPLETE 1
  505. #define SCAN_COMPLETED_STATUS_ABORTED 2
  506. struct notif_scan_complete {
  507. u8 scan_type;
  508. u8 num_channels;
  509. u8 status;
  510. u8 reserved;
  511. } __attribute__ ((packed));
  512. struct notif_frag_length {
  513. u16 frag_length;
  514. u16 reserved;
  515. } __attribute__ ((packed));
  516. struct notif_beacon_state {
  517. u32 state;
  518. u32 number;
  519. } __attribute__ ((packed));
  520. struct notif_tgi_tx_key {
  521. u8 key_state;
  522. u8 security_type;
  523. u8 station_index;
  524. u8 reserved;
  525. } __attribute__ ((packed));
  526. #define SILENCE_OVER_THRESH (1)
  527. #define SILENCE_UNDER_THRESH (2)
  528. struct notif_link_deterioration {
  529. struct ipw_cmd_stats stats;
  530. u8 rate;
  531. u8 modulation;
  532. struct rate_histogram histogram;
  533. u8 silence_notification_type; /* SILENCE_OVER/UNDER_THRESH */
  534. u16 silence_count;
  535. } __attribute__ ((packed));
  536. struct notif_association {
  537. u8 state;
  538. } __attribute__ ((packed));
  539. struct notif_authenticate {
  540. u8 state;
  541. struct machdr24 addr;
  542. u16 status;
  543. } __attribute__ ((packed));
  544. struct notif_calibration {
  545. u8 data[104];
  546. } __attribute__ ((packed));
  547. struct notif_noise {
  548. u32 value;
  549. } __attribute__ ((packed));
  550. struct ipw_rx_notification {
  551. u8 reserved[8];
  552. u8 subtype;
  553. u8 flags;
  554. u16 size;
  555. union {
  556. struct notif_association assoc;
  557. struct notif_authenticate auth;
  558. struct notif_channel_result channel_result;
  559. struct notif_scan_complete scan_complete;
  560. struct notif_frag_length frag_len;
  561. struct notif_beacon_state beacon_state;
  562. struct notif_tgi_tx_key tgi_tx_key;
  563. struct notif_link_deterioration link_deterioration;
  564. struct notif_calibration calibration;
  565. struct notif_noise noise;
  566. u8 raw[0];
  567. } u;
  568. } __attribute__ ((packed));
  569. struct ipw_rx_frame {
  570. u32 reserved1;
  571. u8 parent_tsf[4]; // fw_use[0] is boolean for OUR_TSF_IS_GREATER
  572. u8 received_channel; // The channel that this frame was received on.
  573. // Note that for .11b this does not have to be
  574. // the same as the channel that it was sent.
  575. // Filled by LMAC
  576. u8 frameStatus;
  577. u8 rate;
  578. u8 rssi;
  579. u8 agc;
  580. u8 rssi_dbm;
  581. u16 signal;
  582. u16 noise;
  583. u8 antennaAndPhy;
  584. u8 control; // control bit should be on in bg
  585. u8 rtscts_rate; // rate of rts or cts (in rts cts sequence rate
  586. // is identical)
  587. u8 rtscts_seen; // 0x1 RTS seen ; 0x2 CTS seen
  588. u16 length;
  589. u8 data[0];
  590. } __attribute__ ((packed));
  591. struct ipw_rx_header {
  592. u8 message_type;
  593. u8 rx_seq_num;
  594. u8 control_bits;
  595. u8 reserved;
  596. } __attribute__ ((packed));
  597. struct ipw_rx_packet {
  598. struct ipw_rx_header header;
  599. union {
  600. struct ipw_rx_frame frame;
  601. struct ipw_rx_notification notification;
  602. } u;
  603. } __attribute__ ((packed));
  604. #define IPW_RX_NOTIFICATION_SIZE sizeof(struct ipw_rx_header) + 12
  605. #define IPW_RX_FRAME_SIZE (unsigned int)(sizeof(struct ipw_rx_header) + \
  606. sizeof(struct ipw_rx_frame))
  607. struct ipw_rx_mem_buffer {
  608. dma_addr_t dma_addr;
  609. struct ipw_rx_buffer *rxb;
  610. struct sk_buff *skb;
  611. struct list_head list;
  612. }; /* Not transferred over network, so not __attribute__ ((packed)) */
  613. struct ipw_rx_queue {
  614. struct ipw_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
  615. struct ipw_rx_mem_buffer *queue[RX_QUEUE_SIZE];
  616. u32 processed; /* Internal index to last handled Rx packet */
  617. u32 read; /* Shared index to newest available Rx buffer */
  618. u32 write; /* Shared index to oldest written Rx packet */
  619. u32 free_count; /* Number of pre-allocated buffers in rx_free */
  620. /* Each of these lists is used as a FIFO for ipw_rx_mem_buffers */
  621. struct list_head rx_free; /* Own an SKBs */
  622. struct list_head rx_used; /* No SKB allocated */
  623. spinlock_t lock;
  624. }; /* Not transferred over network, so not __attribute__ ((packed)) */
  625. struct alive_command_responce {
  626. u8 alive_command;
  627. u8 sequence_number;
  628. u16 software_revision;
  629. u8 device_identifier;
  630. u8 reserved1[5];
  631. u16 reserved2;
  632. u16 reserved3;
  633. u16 clock_settle_time;
  634. u16 powerup_settle_time;
  635. u16 reserved4;
  636. u8 time_stamp[5]; /* month, day, year, hours, minutes */
  637. u8 ucode_valid;
  638. } __attribute__ ((packed));
  639. #define IPW_MAX_RATES 12
  640. struct ipw_rates {
  641. u8 num_rates;
  642. u8 rates[IPW_MAX_RATES];
  643. } __attribute__ ((packed));
  644. struct command_block {
  645. unsigned int control;
  646. u32 source_addr;
  647. u32 dest_addr;
  648. unsigned int status;
  649. } __attribute__ ((packed));
  650. #define CB_NUMBER_OF_ELEMENTS_SMALL 64
  651. struct fw_image_desc {
  652. unsigned long last_cb_index;
  653. unsigned long current_cb_index;
  654. struct command_block cb_list[CB_NUMBER_OF_ELEMENTS_SMALL];
  655. void *v_addr;
  656. unsigned long p_addr;
  657. unsigned long len;
  658. };
  659. struct ipw_sys_config {
  660. u8 bt_coexistence;
  661. u8 reserved1;
  662. u8 answer_broadcast_ssid_probe;
  663. u8 accept_all_data_frames;
  664. u8 accept_non_directed_frames;
  665. u8 exclude_unicast_unencrypted;
  666. u8 disable_unicast_decryption;
  667. u8 exclude_multicast_unencrypted;
  668. u8 disable_multicast_decryption;
  669. u8 antenna_diversity;
  670. u8 pass_crc_to_host;
  671. u8 dot11g_auto_detection;
  672. u8 enable_cts_to_self;
  673. u8 enable_multicast_filtering;
  674. u8 bt_coexist_collision_thr;
  675. u8 silence_threshold;
  676. u8 accept_all_mgmt_bcpr;
  677. u8 accept_all_mgtm_frames;
  678. u8 pass_noise_stats_to_host;
  679. u8 reserved3;
  680. } __attribute__ ((packed));
  681. struct ipw_multicast_addr {
  682. u8 num_of_multicast_addresses;
  683. u8 reserved[3];
  684. u8 mac1[6];
  685. u8 mac2[6];
  686. u8 mac3[6];
  687. u8 mac4[6];
  688. } __attribute__ ((packed));
  689. #define DCW_WEP_KEY_INDEX_MASK 0x03 /* bits [0:1] */
  690. #define DCW_WEP_KEY_SEC_TYPE_MASK 0x30 /* bits [4:5] */
  691. #define DCW_WEP_KEY_SEC_TYPE_WEP 0x00
  692. #define DCW_WEP_KEY_SEC_TYPE_CCM 0x20
  693. #define DCW_WEP_KEY_SEC_TYPE_TKIP 0x30
  694. #define DCW_WEP_KEY_INVALID_SIZE 0x00 /* 0 = Invalid key */
  695. #define DCW_WEP_KEY64Bit_SIZE 0x05 /* 64-bit encryption */
  696. #define DCW_WEP_KEY128Bit_SIZE 0x0D /* 128-bit encryption */
  697. #define DCW_CCM_KEY128Bit_SIZE 0x10 /* 128-bit key */
  698. //#define DCW_WEP_KEY128BitIV_SIZE 0x10 /* 128-bit key and 128-bit IV */
  699. struct ipw_wep_key {
  700. u8 cmd_id;
  701. u8 seq_num;
  702. u8 key_index;
  703. u8 key_size;
  704. u8 key[16];
  705. } __attribute__ ((packed));
  706. struct ipw_tgi_tx_key {
  707. u8 key_id;
  708. u8 security_type;
  709. u8 station_index;
  710. u8 flags;
  711. u8 key[16];
  712. u32 tx_counter[2];
  713. } __attribute__ ((packed));
  714. #define IPW_SCAN_CHANNELS 54
  715. struct ipw_scan_request {
  716. u8 scan_type;
  717. u16 dwell_time;
  718. u8 channels_list[IPW_SCAN_CHANNELS];
  719. u8 channels_reserved[3];
  720. } __attribute__ ((packed));
  721. enum {
  722. IPW_SCAN_PASSIVE_TILL_FIRST_BEACON_SCAN = 0,
  723. IPW_SCAN_PASSIVE_FULL_DWELL_SCAN,
  724. IPW_SCAN_ACTIVE_DIRECT_SCAN,
  725. IPW_SCAN_ACTIVE_BROADCAST_SCAN,
  726. IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN,
  727. IPW_SCAN_TYPES
  728. };
  729. struct ipw_scan_request_ext {
  730. u32 full_scan_index;
  731. u8 channels_list[IPW_SCAN_CHANNELS];
  732. u8 scan_type[IPW_SCAN_CHANNELS / 2];
  733. u8 reserved;
  734. u16 dwell_time[IPW_SCAN_TYPES];
  735. } __attribute__ ((packed));
  736. static inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index)
  737. {
  738. if (index % 2)
  739. return scan->scan_type[index / 2] & 0x0F;
  740. else
  741. return (scan->scan_type[index / 2] & 0xF0) >> 4;
  742. }
  743. static inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan,
  744. u8 index, u8 scan_type)
  745. {
  746. if (index % 2)
  747. scan->scan_type[index / 2] =
  748. (scan->scan_type[index / 2] & 0xF0) | (scan_type & 0x0F);
  749. else
  750. scan->scan_type[index / 2] =
  751. (scan->scan_type[index / 2] & 0x0F) |
  752. ((scan_type & 0x0F) << 4);
  753. }
  754. struct ipw_associate {
  755. u8 channel;
  756. u8 auth_type:4, auth_key:4;
  757. u8 assoc_type;
  758. u8 reserved;
  759. u16 policy_support;
  760. u8 preamble_length;
  761. u8 ieee_mode;
  762. u8 bssid[ETH_ALEN];
  763. u32 assoc_tsf_msw;
  764. u32 assoc_tsf_lsw;
  765. u16 capability;
  766. u16 listen_interval;
  767. u16 beacon_interval;
  768. u8 dest[ETH_ALEN];
  769. u16 atim_window;
  770. u8 smr;
  771. u8 reserved1;
  772. u16 reserved2;
  773. } __attribute__ ((packed));
  774. struct ipw_supported_rates {
  775. u8 ieee_mode;
  776. u8 num_rates;
  777. u8 purpose;
  778. u8 reserved;
  779. u8 supported_rates[IPW_MAX_RATES];
  780. } __attribute__ ((packed));
  781. struct ipw_rts_threshold {
  782. u16 rts_threshold;
  783. u16 reserved;
  784. } __attribute__ ((packed));
  785. struct ipw_frag_threshold {
  786. u16 frag_threshold;
  787. u16 reserved;
  788. } __attribute__ ((packed));
  789. struct ipw_retry_limit {
  790. u8 short_retry_limit;
  791. u8 long_retry_limit;
  792. u16 reserved;
  793. } __attribute__ ((packed));
  794. struct ipw_dino_config {
  795. u32 dino_config_addr;
  796. u16 dino_config_size;
  797. u8 dino_response;
  798. u8 reserved;
  799. } __attribute__ ((packed));
  800. struct ipw_aironet_info {
  801. u8 id;
  802. u8 length;
  803. u16 reserved;
  804. } __attribute__ ((packed));
  805. struct ipw_rx_key {
  806. u8 station_index;
  807. u8 key_type;
  808. u8 key_id;
  809. u8 key_flag;
  810. u8 key[16];
  811. u8 station_address[6];
  812. u8 key_index;
  813. u8 reserved;
  814. } __attribute__ ((packed));
  815. struct ipw_country_channel_info {
  816. u8 first_channel;
  817. u8 no_channels;
  818. s8 max_tx_power;
  819. } __attribute__ ((packed));
  820. struct ipw_country_info {
  821. u8 id;
  822. u8 length;
  823. u8 country_str[3];
  824. struct ipw_country_channel_info groups[7];
  825. } __attribute__ ((packed));
  826. struct ipw_channel_tx_power {
  827. u8 channel_number;
  828. s8 tx_power;
  829. } __attribute__ ((packed));
  830. #define SCAN_ASSOCIATED_INTERVAL (HZ)
  831. #define SCAN_INTERVAL (HZ / 10)
  832. #define MAX_A_CHANNELS 37
  833. #define MAX_B_CHANNELS 14
  834. struct ipw_tx_power {
  835. u8 num_channels;
  836. u8 ieee_mode;
  837. struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS];
  838. } __attribute__ ((packed));
  839. struct ipw_rsn_capabilities {
  840. u8 id;
  841. u8 length;
  842. u16 version;
  843. } __attribute__ ((packed));
  844. struct ipw_sensitivity_calib {
  845. u16 beacon_rssi_raw;
  846. u16 reserved;
  847. } __attribute__ ((packed));
  848. /**
  849. * Host command structure.
  850. *
  851. * On input, the following fields should be filled:
  852. * - cmd
  853. * - len
  854. * - status_len
  855. * - param (if needed)
  856. *
  857. * On output,
  858. * - \a status contains status;
  859. * - \a param filled with status parameters.
  860. */
  861. struct ipw_cmd {
  862. u32 cmd; /**< Host command */
  863. u32 status;/**< Status */
  864. u32 status_len;
  865. /**< How many 32 bit parameters in the status */
  866. u32 len; /**< incoming parameters length, bytes */
  867. /**
  868. * command parameters.
  869. * There should be enough space for incoming and
  870. * outcoming parameters.
  871. * Incoming parameters listed 1-st, followed by outcoming params.
  872. * nParams=(len+3)/4+status_len
  873. */
  874. u32 param[0];
  875. } __attribute__ ((packed));
  876. #define STATUS_HCMD_ACTIVE (1<<0) /**< host command in progress */
  877. #define STATUS_INT_ENABLED (1<<1)
  878. #define STATUS_RF_KILL_HW (1<<2)
  879. #define STATUS_RF_KILL_SW (1<<3)
  880. #define STATUS_RF_KILL_MASK (STATUS_RF_KILL_HW | STATUS_RF_KILL_SW)
  881. #define STATUS_INIT (1<<5)
  882. #define STATUS_AUTH (1<<6)
  883. #define STATUS_ASSOCIATED (1<<7)
  884. #define STATUS_STATE_MASK (STATUS_INIT | STATUS_AUTH | STATUS_ASSOCIATED)
  885. #define STATUS_ASSOCIATING (1<<8)
  886. #define STATUS_DISASSOCIATING (1<<9)
  887. #define STATUS_ROAMING (1<<10)
  888. #define STATUS_EXIT_PENDING (1<<11)
  889. #define STATUS_DISASSOC_PENDING (1<<12)
  890. #define STATUS_STATE_PENDING (1<<13)
  891. #define STATUS_SCAN_PENDING (1<<20)
  892. #define STATUS_SCANNING (1<<21)
  893. #define STATUS_SCAN_ABORTING (1<<22)
  894. #define STATUS_SCAN_FORCED (1<<23)
  895. #define STATUS_LED_LINK_ON (1<<24)
  896. #define STATUS_LED_ACT_ON (1<<25)
  897. #define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */
  898. #define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */
  899. #define STATUS_DIRECT_DWORD (1<<30) /* sysfs entry configured for access */
  900. #define STATUS_SECURITY_UPDATED (1<<31) /* Security sync needed */
  901. #define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */
  902. #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */
  903. #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */
  904. #define CFG_CUSTOM_MAC (1<<3)
  905. #define CFG_PREAMBLE_LONG (1<<4)
  906. #define CFG_ADHOC_PERSIST (1<<5)
  907. #define CFG_ASSOCIATE (1<<6)
  908. #define CFG_FIXED_RATE (1<<7)
  909. #define CFG_ADHOC_CREATE (1<<8)
  910. #define CFG_NO_LED (1<<9)
  911. #define CFG_BACKGROUND_SCAN (1<<10)
  912. #define CFG_SPEED_SCAN (1<<11)
  913. #define CFG_NET_STATS (1<<12)
  914. #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */
  915. #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */
  916. #define MAX_STATIONS 32
  917. #define IPW_INVALID_STATION (0xff)
  918. struct ipw_station_entry {
  919. u8 mac_addr[ETH_ALEN];
  920. u8 reserved;
  921. u8 support_mode;
  922. };
  923. #define AVG_ENTRIES 8
  924. struct average {
  925. s16 entries[AVG_ENTRIES];
  926. u8 pos;
  927. u8 init;
  928. s32 sum;
  929. };
  930. #define MAX_SPEED_SCAN 100
  931. #define IPW_IBSS_MAC_HASH_SIZE 31
  932. struct ipw_ibss_seq {
  933. u8 mac[ETH_ALEN];
  934. u16 seq_num;
  935. u16 frag_num;
  936. unsigned long packet_time;
  937. struct list_head list;
  938. };
  939. struct ipw_error_elem {
  940. u32 desc;
  941. u32 time;
  942. u32 blink1;
  943. u32 blink2;
  944. u32 link1;
  945. u32 link2;
  946. u32 data;
  947. };
  948. struct ipw_event {
  949. u32 event;
  950. u32 time;
  951. u32 data;
  952. } __attribute__ ((packed));
  953. struct ipw_fw_error {
  954. unsigned long jiffies;
  955. u32 status;
  956. u32 config;
  957. u32 elem_len;
  958. u32 log_len;
  959. struct ipw_error_elem *elem;
  960. struct ipw_event *log;
  961. u8 payload[0];
  962. } __attribute__ ((packed));
  963. struct ipw_priv {
  964. /* ieee device used by generic ieee processing code */
  965. struct ieee80211_device *ieee;
  966. spinlock_t lock;
  967. struct mutex mutex;
  968. /* basic pci-network driver stuff */
  969. struct pci_dev *pci_dev;
  970. struct net_device *net_dev;
  971. /* pci hardware address support */
  972. void __iomem *hw_base;
  973. unsigned long hw_len;
  974. struct fw_image_desc sram_desc;
  975. /* result of ucode download */
  976. struct alive_command_responce dino_alive;
  977. wait_queue_head_t wait_command_queue;
  978. wait_queue_head_t wait_state;
  979. /* Rx and Tx DMA processing queues */
  980. struct ipw_rx_queue *rxq;
  981. struct clx2_tx_queue txq_cmd;
  982. struct clx2_tx_queue txq[4];
  983. u32 status;
  984. u32 config;
  985. u32 capability;
  986. u8 last_rx_rssi;
  987. u8 last_noise;
  988. struct average average_missed_beacons;
  989. struct average average_rssi;
  990. struct average average_noise;
  991. u32 port_type;
  992. int rx_bufs_min; /**< minimum number of bufs in Rx queue */
  993. int rx_pend_max; /**< maximum pending buffers for one IRQ */
  994. u32 hcmd_seq; /**< sequence number for hcmd */
  995. u32 disassociate_threshold;
  996. u32 roaming_threshold;
  997. struct ipw_associate assoc_request;
  998. struct ieee80211_network *assoc_network;
  999. unsigned long ts_scan_abort;
  1000. struct ipw_supported_rates rates;
  1001. struct ipw_rates phy[3]; /**< PHY restrictions, per band */
  1002. struct ipw_rates supp; /**< software defined */
  1003. struct ipw_rates extended; /**< use for corresp. IE, AP only */
  1004. struct notif_link_deterioration last_link_deterioration; /** for statistics */
  1005. struct ipw_cmd *hcmd; /**< host command currently executed */
  1006. wait_queue_head_t hcmd_wq; /**< host command waits for execution */
  1007. u32 tsf_bcn[2]; /**< TSF from latest beacon */
  1008. struct notif_calibration calib; /**< last calibration */
  1009. /* ordinal interface with firmware */
  1010. u32 table0_addr;
  1011. u32 table0_len;
  1012. u32 table1_addr;
  1013. u32 table1_len;
  1014. u32 table2_addr;
  1015. u32 table2_len;
  1016. /* context information */
  1017. u8 essid[IW_ESSID_MAX_SIZE];
  1018. u8 essid_len;
  1019. u8 nick[IW_ESSID_MAX_SIZE];
  1020. u16 rates_mask;
  1021. u8 channel;
  1022. struct ipw_sys_config sys_config;
  1023. u32 power_mode;
  1024. u8 bssid[ETH_ALEN];
  1025. u16 rts_threshold;
  1026. u8 mac_addr[ETH_ALEN];
  1027. u8 num_stations;
  1028. u8 stations[MAX_STATIONS][ETH_ALEN];
  1029. u8 short_retry_limit;
  1030. u8 long_retry_limit;
  1031. u32 notif_missed_beacons;
  1032. /* Statistics and counters normalized with each association */
  1033. u32 last_missed_beacons;
  1034. u32 last_tx_packets;
  1035. u32 last_rx_packets;
  1036. u32 last_tx_failures;
  1037. u32 last_rx_err;
  1038. u32 last_rate;
  1039. u32 missed_adhoc_beacons;
  1040. u32 missed_beacons;
  1041. u32 rx_packets;
  1042. u32 tx_packets;
  1043. u32 quality;
  1044. u8 speed_scan[MAX_SPEED_SCAN];
  1045. u8 speed_scan_pos;
  1046. u16 last_seq_num;
  1047. u16 last_frag_num;
  1048. unsigned long last_packet_time;
  1049. struct list_head ibss_mac_hash[IPW_IBSS_MAC_HASH_SIZE];
  1050. /* eeprom */
  1051. u8 eeprom[0x100]; /* 256 bytes of eeprom */
  1052. u8 country[4];
  1053. int eeprom_delay;
  1054. struct iw_statistics wstats;
  1055. struct iw_public_data wireless_data;
  1056. struct workqueue_struct *workqueue;
  1057. struct work_struct adhoc_check;
  1058. struct work_struct associate;
  1059. struct work_struct disassociate;
  1060. struct work_struct system_config;
  1061. struct work_struct rx_replenish;
  1062. struct work_struct request_scan;
  1063. struct work_struct adapter_restart;
  1064. struct work_struct rf_kill;
  1065. struct work_struct up;
  1066. struct work_struct down;
  1067. struct work_struct gather_stats;
  1068. struct work_struct abort_scan;
  1069. struct work_struct roam;
  1070. struct work_struct scan_check;
  1071. struct work_struct link_up;
  1072. struct work_struct link_down;
  1073. struct tasklet_struct irq_tasklet;
  1074. /* LED related variables and work_struct */
  1075. u8 nic_type;
  1076. u32 led_activity_on;
  1077. u32 led_activity_off;
  1078. u32 led_association_on;
  1079. u32 led_association_off;
  1080. u32 led_ofdm_on;
  1081. u32 led_ofdm_off;
  1082. struct work_struct led_link_on;
  1083. struct work_struct led_link_off;
  1084. struct work_struct led_act_off;
  1085. struct work_struct merge_networks;
  1086. struct ipw_cmd_log *cmdlog;
  1087. int cmdlog_len;
  1088. int cmdlog_pos;
  1089. #define IPW_2200BG 1
  1090. #define IPW_2915ABG 2
  1091. u8 adapter;
  1092. s8 tx_power;
  1093. #ifdef CONFIG_PM
  1094. u32 pm_state[16];
  1095. #endif
  1096. struct ipw_fw_error *error;
  1097. /* network state */
  1098. /* Used to pass the current INTA value from ISR to Tasklet */
  1099. u32 isr_inta;
  1100. /* QoS */
  1101. struct ipw_qos_info qos_data;
  1102. struct work_struct qos_activate;
  1103. /*********************************/
  1104. /* debugging info */
  1105. u32 indirect_dword;
  1106. u32 direct_dword;
  1107. u32 indirect_byte;
  1108. }; /*ipw_priv */
  1109. /* debug macros */
  1110. #ifdef CONFIG_IPW2200_DEBUG
  1111. #define IPW_DEBUG(level, fmt, args...) \
  1112. do { if (ipw_debug_level & (level)) \
  1113. printk(KERN_DEBUG DRV_NAME": %c %s " fmt, \
  1114. in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
  1115. #else
  1116. #define IPW_DEBUG(level, fmt, args...) do {} while (0)
  1117. #endif /* CONFIG_IPW2200_DEBUG */
  1118. /*
  1119. * To use the debug system;
  1120. *
  1121. * If you are defining a new debug classification, simply add it to the #define
  1122. * list here in the form of:
  1123. *
  1124. * #define IPW_DL_xxxx VALUE
  1125. *
  1126. * shifting value to the left one bit from the previous entry. xxxx should be
  1127. * the name of the classification (for example, WEP)
  1128. *
  1129. * You then need to either add a IPW_xxxx_DEBUG() macro definition for your
  1130. * classification, or use IPW_DEBUG(IPW_DL_xxxx, ...) whenever you want
  1131. * to send output to that classification.
  1132. *
  1133. * To add your debug level to the list of levels seen when you perform
  1134. *
  1135. * % cat /proc/net/ipw/debug_level
  1136. *
  1137. * you simply need to add your entry to the ipw_debug_levels array.
  1138. *
  1139. * If you do not see debug_level in /proc/net/ipw then you do not have
  1140. * CONFIG_IPW2200_DEBUG defined in your kernel configuration
  1141. *
  1142. */
  1143. #define IPW_DL_ERROR (1<<0)
  1144. #define IPW_DL_WARNING (1<<1)
  1145. #define IPW_DL_INFO (1<<2)
  1146. #define IPW_DL_WX (1<<3)
  1147. #define IPW_DL_HOST_COMMAND (1<<5)
  1148. #define IPW_DL_STATE (1<<6)
  1149. #define IPW_DL_NOTIF (1<<10)
  1150. #define IPW_DL_SCAN (1<<11)
  1151. #define IPW_DL_ASSOC (1<<12)
  1152. #define IPW_DL_DROP (1<<13)
  1153. #define IPW_DL_IOCTL (1<<14)
  1154. #define IPW_DL_MANAGE (1<<15)
  1155. #define IPW_DL_FW (1<<16)
  1156. #define IPW_DL_RF_KILL (1<<17)
  1157. #define IPW_DL_FW_ERRORS (1<<18)
  1158. #define IPW_DL_LED (1<<19)
  1159. #define IPW_DL_ORD (1<<20)
  1160. #define IPW_DL_FRAG (1<<21)
  1161. #define IPW_DL_WEP (1<<22)
  1162. #define IPW_DL_TX (1<<23)
  1163. #define IPW_DL_RX (1<<24)
  1164. #define IPW_DL_ISR (1<<25)
  1165. #define IPW_DL_FW_INFO (1<<26)
  1166. #define IPW_DL_IO (1<<27)
  1167. #define IPW_DL_TRACE (1<<28)
  1168. #define IPW_DL_STATS (1<<29)
  1169. #define IPW_DL_MERGE (1<<30)
  1170. #define IPW_DL_QOS (1<<31)
  1171. #define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a)
  1172. #define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a)
  1173. #define IPW_DEBUG_INFO(f, a...) IPW_DEBUG(IPW_DL_INFO, f, ## a)
  1174. #define IPW_DEBUG_WX(f, a...) IPW_DEBUG(IPW_DL_WX, f, ## a)
  1175. #define IPW_DEBUG_SCAN(f, a...) IPW_DEBUG(IPW_DL_SCAN, f, ## a)
  1176. #define IPW_DEBUG_STATUS(f, a...) IPW_DEBUG(IPW_DL_STATUS, f, ## a)
  1177. #define IPW_DEBUG_TRACE(f, a...) IPW_DEBUG(IPW_DL_TRACE, f, ## a)
  1178. #define IPW_DEBUG_RX(f, a...) IPW_DEBUG(IPW_DL_RX, f, ## a)
  1179. #define IPW_DEBUG_TX(f, a...) IPW_DEBUG(IPW_DL_TX, f, ## a)
  1180. #define IPW_DEBUG_ISR(f, a...) IPW_DEBUG(IPW_DL_ISR, f, ## a)
  1181. #define IPW_DEBUG_MANAGEMENT(f, a...) IPW_DEBUG(IPW_DL_MANAGE, f, ## a)
  1182. #define IPW_DEBUG_LED(f, a...) IPW_DEBUG(IPW_DL_LED, f, ## a)
  1183. #define IPW_DEBUG_WEP(f, a...) IPW_DEBUG(IPW_DL_WEP, f, ## a)
  1184. #define IPW_DEBUG_HC(f, a...) IPW_DEBUG(IPW_DL_HOST_COMMAND, f, ## a)
  1185. #define IPW_DEBUG_FRAG(f, a...) IPW_DEBUG(IPW_DL_FRAG, f, ## a)
  1186. #define IPW_DEBUG_FW(f, a...) IPW_DEBUG(IPW_DL_FW, f, ## a)
  1187. #define IPW_DEBUG_RF_KILL(f, a...) IPW_DEBUG(IPW_DL_RF_KILL, f, ## a)
  1188. #define IPW_DEBUG_DROP(f, a...) IPW_DEBUG(IPW_DL_DROP, f, ## a)
  1189. #define IPW_DEBUG_IO(f, a...) IPW_DEBUG(IPW_DL_IO, f, ## a)
  1190. #define IPW_DEBUG_ORD(f, a...) IPW_DEBUG(IPW_DL_ORD, f, ## a)
  1191. #define IPW_DEBUG_FW_INFO(f, a...) IPW_DEBUG(IPW_DL_FW_INFO, f, ## a)
  1192. #define IPW_DEBUG_NOTIF(f, a...) IPW_DEBUG(IPW_DL_NOTIF, f, ## a)
  1193. #define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a)
  1194. #define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a)
  1195. #define IPW_DEBUG_STATS(f, a...) IPW_DEBUG(IPW_DL_STATS, f, ## a)
  1196. #define IPW_DEBUG_MERGE(f, a...) IPW_DEBUG(IPW_DL_MERGE, f, ## a)
  1197. #define IPW_DEBUG_QOS(f, a...) IPW_DEBUG(IPW_DL_QOS, f, ## a)
  1198. #include <linux/ctype.h>
  1199. /*
  1200. * Register bit definitions
  1201. */
  1202. #define IPW_INTA_RW 0x00000008
  1203. #define IPW_INTA_MASK_R 0x0000000C
  1204. #define IPW_INDIRECT_ADDR 0x00000010
  1205. #define IPW_INDIRECT_DATA 0x00000014
  1206. #define IPW_AUTOINC_ADDR 0x00000018
  1207. #define IPW_AUTOINC_DATA 0x0000001C
  1208. #define IPW_RESET_REG 0x00000020
  1209. #define IPW_GP_CNTRL_RW 0x00000024
  1210. #define IPW_READ_INT_REGISTER 0xFF4
  1211. #define IPW_GP_CNTRL_BIT_INIT_DONE 0x00000004
  1212. #define IPW_REGISTER_DOMAIN1_END 0x00001000
  1213. #define IPW_SRAM_READ_INT_REGISTER 0x00000ff4
  1214. #define IPW_SHARED_LOWER_BOUND 0x00000200
  1215. #define IPW_INTERRUPT_AREA_LOWER_BOUND 0x00000f80
  1216. #define IPW_NIC_SRAM_LOWER_BOUND 0x00000000
  1217. #define IPW_NIC_SRAM_UPPER_BOUND 0x00030000
  1218. #define IPW_BIT_INT_HOST_SRAM_READ_INT_REGISTER (1 << 29)
  1219. #define IPW_GP_CNTRL_BIT_CLOCK_READY 0x00000001
  1220. #define IPW_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY 0x00000002
  1221. /*
  1222. * RESET Register Bit Indexes
  1223. */
  1224. #define CBD_RESET_REG_PRINCETON_RESET (1<<0)
  1225. #define IPW_START_STANDBY (1<<2)
  1226. #define IPW_ACTIVITY_LED (1<<4)
  1227. #define IPW_ASSOCIATED_LED (1<<5)
  1228. #define IPW_OFDM_LED (1<<6)
  1229. #define IPW_RESET_REG_SW_RESET (1<<7)
  1230. #define IPW_RESET_REG_MASTER_DISABLED (1<<8)
  1231. #define IPW_RESET_REG_STOP_MASTER (1<<9)
  1232. #define IPW_GATE_ODMA (1<<25)
  1233. #define IPW_GATE_IDMA (1<<26)
  1234. #define IPW_ARC_KESHET_CONFIG (1<<27)
  1235. #define IPW_GATE_ADMA (1<<29)
  1236. #define IPW_CSR_CIS_UPPER_BOUND 0x00000200
  1237. #define IPW_DOMAIN_0_END 0x1000
  1238. #define CLX_MEM_BAR_SIZE 0x1000
  1239. /* Dino/baseband control registers bits */
  1240. #define DINO_ENABLE_SYSTEM 0x80 /* 1 = baseband processor on, 0 = reset */
  1241. #define DINO_ENABLE_CS 0x40 /* 1 = enable ucode load */
  1242. #define DINO_RXFIFO_DATA 0x01 /* 1 = data available */
  1243. #define IPW_BASEBAND_CONTROL_STATUS 0X00200000
  1244. #define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004
  1245. #define IPW_BASEBAND_RX_FIFO_READ 0X00200004
  1246. #define IPW_BASEBAND_CONTROL_STORE 0X00200010
  1247. #define IPW_INTERNAL_CMD_EVENT 0X00300004
  1248. #define IPW_BASEBAND_POWER_DOWN 0x00000001
  1249. #define IPW_MEM_HALT_AND_RESET 0x003000e0
  1250. /* defgroup bits_halt_reset MEM_HALT_AND_RESET register bits */
  1251. #define IPW_BIT_HALT_RESET_ON 0x80000000
  1252. #define IPW_BIT_HALT_RESET_OFF 0x00000000
  1253. #define CB_LAST_VALID 0x20000000
  1254. #define CB_INT_ENABLED 0x40000000
  1255. #define CB_VALID 0x80000000
  1256. #define CB_SRC_LE 0x08000000
  1257. #define CB_DEST_LE 0x04000000
  1258. #define CB_SRC_AUTOINC 0x00800000
  1259. #define CB_SRC_IO_GATED 0x00400000
  1260. #define CB_DEST_AUTOINC 0x00080000
  1261. #define CB_SRC_SIZE_LONG 0x00200000
  1262. #define CB_DEST_SIZE_LONG 0x00020000
  1263. /* DMA DEFINES */
  1264. #define DMA_CONTROL_SMALL_CB_CONST_VALUE 0x00540000
  1265. #define DMA_CB_STOP_AND_ABORT 0x00000C00
  1266. #define DMA_CB_START 0x00000100
  1267. #define IPW_SHARED_SRAM_SIZE 0x00030000
  1268. #define IPW_SHARED_SRAM_DMA_CONTROL 0x00027000
  1269. #define CB_MAX_LENGTH 0x1FFF
  1270. #define IPW_HOST_EEPROM_DATA_SRAM_SIZE 0xA18
  1271. #define IPW_EEPROM_IMAGE_SIZE 0x100
  1272. /* DMA defs */
  1273. #define IPW_DMA_I_CURRENT_CB 0x003000D0
  1274. #define IPW_DMA_O_CURRENT_CB 0x003000D4
  1275. #define IPW_DMA_I_DMA_CONTROL 0x003000A4
  1276. #define IPW_DMA_I_CB_BASE 0x003000A0
  1277. #define IPW_TX_CMD_QUEUE_BD_BASE 0x00000200
  1278. #define IPW_TX_CMD_QUEUE_BD_SIZE 0x00000204
  1279. #define IPW_TX_QUEUE_0_BD_BASE 0x00000208
  1280. #define IPW_TX_QUEUE_0_BD_SIZE (0x0000020C)
  1281. #define IPW_TX_QUEUE_1_BD_BASE 0x00000210
  1282. #define IPW_TX_QUEUE_1_BD_SIZE 0x00000214
  1283. #define IPW_TX_QUEUE_2_BD_BASE 0x00000218
  1284. #define IPW_TX_QUEUE_2_BD_SIZE (0x0000021C)
  1285. #define IPW_TX_QUEUE_3_BD_BASE 0x00000220
  1286. #define IPW_TX_QUEUE_3_BD_SIZE 0x00000224
  1287. #define IPW_RX_BD_BASE 0x00000240
  1288. #define IPW_RX_BD_SIZE 0x00000244
  1289. #define IPW_RFDS_TABLE_LOWER 0x00000500
  1290. #define IPW_TX_CMD_QUEUE_READ_INDEX 0x00000280
  1291. #define IPW_TX_QUEUE_0_READ_INDEX 0x00000284
  1292. #define IPW_TX_QUEUE_1_READ_INDEX 0x00000288
  1293. #define IPW_TX_QUEUE_2_READ_INDEX (0x0000028C)
  1294. #define IPW_TX_QUEUE_3_READ_INDEX 0x00000290
  1295. #define IPW_RX_READ_INDEX (0x000002A0)
  1296. #define IPW_TX_CMD_QUEUE_WRITE_INDEX (0x00000F80)
  1297. #define IPW_TX_QUEUE_0_WRITE_INDEX (0x00000F84)
  1298. #define IPW_TX_QUEUE_1_WRITE_INDEX (0x00000F88)
  1299. #define IPW_TX_QUEUE_2_WRITE_INDEX (0x00000F8C)
  1300. #define IPW_TX_QUEUE_3_WRITE_INDEX (0x00000F90)
  1301. #define IPW_RX_WRITE_INDEX (0x00000FA0)
  1302. /*
  1303. * EEPROM Related Definitions
  1304. */
  1305. #define IPW_EEPROM_DATA_SRAM_ADDRESS (IPW_SHARED_LOWER_BOUND + 0x814)
  1306. #define IPW_EEPROM_DATA_SRAM_SIZE (IPW_SHARED_LOWER_BOUND + 0x818)
  1307. #define IPW_EEPROM_LOAD_DISABLE (IPW_SHARED_LOWER_BOUND + 0x81C)
  1308. #define IPW_EEPROM_DATA (IPW_SHARED_LOWER_BOUND + 0x820)
  1309. #define IPW_EEPROM_UPPER_ADDRESS (IPW_SHARED_LOWER_BOUND + 0x9E0)
  1310. #define IPW_STATION_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0xA0C)
  1311. #define IPW_STATION_TABLE_UPPER (IPW_SHARED_LOWER_BOUND + 0xB0C)
  1312. #define IPW_REQUEST_ATIM (IPW_SHARED_LOWER_BOUND + 0xB0C)
  1313. #define IPW_ATIM_SENT (IPW_SHARED_LOWER_BOUND + 0xB10)
  1314. #define IPW_WHO_IS_AWAKE (IPW_SHARED_LOWER_BOUND + 0xB14)
  1315. #define IPW_DURING_ATIM_WINDOW (IPW_SHARED_LOWER_BOUND + 0xB18)
  1316. #define MSB 1
  1317. #define LSB 0
  1318. #define WORD_TO_BYTE(_word) ((_word) * sizeof(u16))
  1319. #define GET_EEPROM_ADDR(_wordoffset,_byteoffset) \
  1320. ( WORD_TO_BYTE(_wordoffset) + (_byteoffset) )
  1321. /* EEPROM access by BYTE */
  1322. #define EEPROM_PME_CAPABILITY (GET_EEPROM_ADDR(0x09,MSB)) /* 1 byte */
  1323. #define EEPROM_MAC_ADDRESS (GET_EEPROM_ADDR(0x21,LSB)) /* 6 byte */
  1324. #define EEPROM_VERSION (GET_EEPROM_ADDR(0x24,MSB)) /* 1 byte */
  1325. #define EEPROM_NIC_TYPE (GET_EEPROM_ADDR(0x25,LSB)) /* 1 byte */
  1326. #define EEPROM_SKU_CAPABILITY (GET_EEPROM_ADDR(0x25,MSB)) /* 1 byte */
  1327. #define EEPROM_COUNTRY_CODE (GET_EEPROM_ADDR(0x26,LSB)) /* 3 bytes */
  1328. #define EEPROM_IBSS_CHANNELS_BG (GET_EEPROM_ADDR(0x28,LSB)) /* 2 bytes */
  1329. #define EEPROM_IBSS_CHANNELS_A (GET_EEPROM_ADDR(0x29,MSB)) /* 5 bytes */
  1330. #define EEPROM_BSS_CHANNELS_BG (GET_EEPROM_ADDR(0x2c,LSB)) /* 2 bytes */
  1331. #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */
  1332. /* NIC type as found in the one byte EEPROM_NIC_TYPE offset */
  1333. #define EEPROM_NIC_TYPE_0 0
  1334. #define EEPROM_NIC_TYPE_1 1
  1335. #define EEPROM_NIC_TYPE_2 2
  1336. #define EEPROM_NIC_TYPE_3 3
  1337. #define EEPROM_NIC_TYPE_4 4
  1338. /* Bluetooth Coexistence capabilities as found in EEPROM_SKU_CAPABILITY */
  1339. #define EEPROM_SKU_CAP_BT_CHANNEL_SIG 0x01 /* we can tell BT our channel # */
  1340. #define EEPROM_SKU_CAP_BT_PRIORITY 0x02 /* BT can take priority over us */
  1341. #define EEPROM_SKU_CAP_BT_OOB 0x04 /* we can signal BT out-of-band */
  1342. #define FW_MEM_REG_LOWER_BOUND 0x00300000
  1343. #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40)
  1344. #define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04)
  1345. #define EEPROM_BIT_SK (1<<0)
  1346. #define EEPROM_BIT_CS (1<<1)
  1347. #define EEPROM_BIT_DI (1<<2)
  1348. #define EEPROM_BIT_DO (1<<4)
  1349. #define EEPROM_CMD_READ 0x2
  1350. /* Interrupts masks */
  1351. #define IPW_INTA_NONE 0x00000000
  1352. #define IPW_INTA_BIT_RX_TRANSFER 0x00000002
  1353. #define IPW_INTA_BIT_STATUS_CHANGE 0x00000010
  1354. #define IPW_INTA_BIT_BEACON_PERIOD_EXPIRED 0x00000020
  1355. //Inta Bits for CF
  1356. #define IPW_INTA_BIT_TX_CMD_QUEUE 0x00000800
  1357. #define IPW_INTA_BIT_TX_QUEUE_1 0x00001000
  1358. #define IPW_INTA_BIT_TX_QUEUE_2 0x00002000
  1359. #define IPW_INTA_BIT_TX_QUEUE_3 0x00004000
  1360. #define IPW_INTA_BIT_TX_QUEUE_4 0x00008000
  1361. #define IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE 0x00010000
  1362. #define IPW_INTA_BIT_PREPARE_FOR_POWER_DOWN 0x00100000
  1363. #define IPW_INTA_BIT_POWER_DOWN 0x00200000
  1364. #define IPW_INTA_BIT_FW_INITIALIZATION_DONE 0x01000000
  1365. #define IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE 0x02000000
  1366. #define IPW_INTA_BIT_RF_KILL_DONE 0x04000000
  1367. #define IPW_INTA_BIT_FATAL_ERROR 0x40000000
  1368. #define IPW_INTA_BIT_PARITY_ERROR 0x80000000
  1369. /* Interrupts enabled at init time. */
  1370. #define IPW_INTA_MASK_ALL \
  1371. (IPW_INTA_BIT_TX_QUEUE_1 | \
  1372. IPW_INTA_BIT_TX_QUEUE_2 | \
  1373. IPW_INTA_BIT_TX_QUEUE_3 | \
  1374. IPW_INTA_BIT_TX_QUEUE_4 | \
  1375. IPW_INTA_BIT_TX_CMD_QUEUE | \
  1376. IPW_INTA_BIT_RX_TRANSFER | \
  1377. IPW_INTA_BIT_FATAL_ERROR | \
  1378. IPW_INTA_BIT_PARITY_ERROR | \
  1379. IPW_INTA_BIT_STATUS_CHANGE | \
  1380. IPW_INTA_BIT_FW_INITIALIZATION_DONE | \
  1381. IPW_INTA_BIT_BEACON_PERIOD_EXPIRED | \
  1382. IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE | \
  1383. IPW_INTA_BIT_PREPARE_FOR_POWER_DOWN | \
  1384. IPW_INTA_BIT_POWER_DOWN | \
  1385. IPW_INTA_BIT_RF_KILL_DONE )
  1386. /* FW event log definitions */
  1387. #define EVENT_ELEM_SIZE (3 * sizeof(u32))
  1388. #define EVENT_START_OFFSET (1 * sizeof(u32) + 2 * sizeof(u16))
  1389. /* FW error log definitions */
  1390. #define ERROR_ELEM_SIZE (7 * sizeof(u32))
  1391. #define ERROR_START_OFFSET (1 * sizeof(u32))
  1392. /* TX power level (dbm) */
  1393. #define IPW_TX_POWER_MIN -12
  1394. #define IPW_TX_POWER_MAX 20
  1395. #define IPW_TX_POWER_DEFAULT IPW_TX_POWER_MAX
  1396. enum {
  1397. IPW_FW_ERROR_OK = 0,
  1398. IPW_FW_ERROR_FAIL,
  1399. IPW_FW_ERROR_MEMORY_UNDERFLOW,
  1400. IPW_FW_ERROR_MEMORY_OVERFLOW,
  1401. IPW_FW_ERROR_BAD_PARAM,
  1402. IPW_FW_ERROR_BAD_CHECKSUM,
  1403. IPW_FW_ERROR_NMI_INTERRUPT,
  1404. IPW_FW_ERROR_BAD_DATABASE,
  1405. IPW_FW_ERROR_ALLOC_FAIL,
  1406. IPW_FW_ERROR_DMA_UNDERRUN,
  1407. IPW_FW_ERROR_DMA_STATUS,
  1408. IPW_FW_ERROR_DINO_ERROR,
  1409. IPW_FW_ERROR_EEPROM_ERROR,
  1410. IPW_FW_ERROR_SYSASSERT,
  1411. IPW_FW_ERROR_FATAL_ERROR
  1412. };
  1413. #define AUTH_OPEN 0
  1414. #define AUTH_SHARED_KEY 1
  1415. #define AUTH_LEAP 2
  1416. #define AUTH_IGNORE 3
  1417. #define HC_ASSOCIATE 0
  1418. #define HC_REASSOCIATE 1
  1419. #define HC_DISASSOCIATE 2
  1420. #define HC_IBSS_START 3
  1421. #define HC_IBSS_RECONF 4
  1422. #define HC_DISASSOC_QUIET 5
  1423. #define HC_QOS_SUPPORT_ASSOC 0x01
  1424. #define IPW_RATE_CAPABILITIES 1
  1425. #define IPW_RATE_CONNECT 0
  1426. /*
  1427. * Rate values and masks
  1428. */
  1429. #define IPW_TX_RATE_1MB 0x0A
  1430. #define IPW_TX_RATE_2MB 0x14
  1431. #define IPW_TX_RATE_5MB 0x37
  1432. #define IPW_TX_RATE_6MB 0x0D
  1433. #define IPW_TX_RATE_9MB 0x0F
  1434. #define IPW_TX_RATE_11MB 0x6E
  1435. #define IPW_TX_RATE_12MB 0x05
  1436. #define IPW_TX_RATE_18MB 0x07
  1437. #define IPW_TX_RATE_24MB 0x09
  1438. #define IPW_TX_RATE_36MB 0x0B
  1439. #define IPW_TX_RATE_48MB 0x01
  1440. #define IPW_TX_RATE_54MB 0x03
  1441. #define IPW_ORD_TABLE_ID_MASK 0x0000FF00
  1442. #define IPW_ORD_TABLE_VALUE_MASK 0x000000FF
  1443. #define IPW_ORD_TABLE_0_MASK 0x0000F000
  1444. #define IPW_ORD_TABLE_1_MASK 0x0000F100
  1445. #define IPW_ORD_TABLE_2_MASK 0x0000F200
  1446. #define IPW_ORD_TABLE_3_MASK 0x0000F300
  1447. #define IPW_ORD_TABLE_4_MASK 0x0000F400
  1448. #define IPW_ORD_TABLE_5_MASK 0x0000F500
  1449. #define IPW_ORD_TABLE_6_MASK 0x0000F600
  1450. #define IPW_ORD_TABLE_7_MASK 0x0000F700
  1451. /*
  1452. * Table 0 Entries (all entries are 32 bits)
  1453. */
  1454. enum {
  1455. IPW_ORD_STAT_TX_CURR_RATE = IPW_ORD_TABLE_0_MASK + 1,
  1456. IPW_ORD_STAT_FRAG_TRESHOLD,
  1457. IPW_ORD_STAT_RTS_THRESHOLD,
  1458. IPW_ORD_STAT_TX_HOST_REQUESTS,
  1459. IPW_ORD_STAT_TX_HOST_COMPLETE,
  1460. IPW_ORD_STAT_TX_DIR_DATA,
  1461. IPW_ORD_STAT_TX_DIR_DATA_B_1,
  1462. IPW_ORD_STAT_TX_DIR_DATA_B_2,
  1463. IPW_ORD_STAT_TX_DIR_DATA_B_5_5,
  1464. IPW_ORD_STAT_TX_DIR_DATA_B_11,
  1465. /* Hole */
  1466. IPW_ORD_STAT_TX_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 19,
  1467. IPW_ORD_STAT_TX_DIR_DATA_G_2,
  1468. IPW_ORD_STAT_TX_DIR_DATA_G_5_5,
  1469. IPW_ORD_STAT_TX_DIR_DATA_G_6,
  1470. IPW_ORD_STAT_TX_DIR_DATA_G_9,
  1471. IPW_ORD_STAT_TX_DIR_DATA_G_11,
  1472. IPW_ORD_STAT_TX_DIR_DATA_G_12,
  1473. IPW_ORD_STAT_TX_DIR_DATA_G_18,
  1474. IPW_ORD_STAT_TX_DIR_DATA_G_24,
  1475. IPW_ORD_STAT_TX_DIR_DATA_G_36,
  1476. IPW_ORD_STAT_TX_DIR_DATA_G_48,
  1477. IPW_ORD_STAT_TX_DIR_DATA_G_54,
  1478. IPW_ORD_STAT_TX_NON_DIR_DATA,
  1479. IPW_ORD_STAT_TX_NON_DIR_DATA_B_1,
  1480. IPW_ORD_STAT_TX_NON_DIR_DATA_B_2,
  1481. IPW_ORD_STAT_TX_NON_DIR_DATA_B_5_5,
  1482. IPW_ORD_STAT_TX_NON_DIR_DATA_B_11,
  1483. /* Hole */
  1484. IPW_ORD_STAT_TX_NON_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 44,
  1485. IPW_ORD_STAT_TX_NON_DIR_DATA_G_2,
  1486. IPW_ORD_STAT_TX_NON_DIR_DATA_G_5_5,
  1487. IPW_ORD_STAT_TX_NON_DIR_DATA_G_6,
  1488. IPW_ORD_STAT_TX_NON_DIR_DATA_G_9,
  1489. IPW_ORD_STAT_TX_NON_DIR_DATA_G_11,
  1490. IPW_ORD_STAT_TX_NON_DIR_DATA_G_12,
  1491. IPW_ORD_STAT_TX_NON_DIR_DATA_G_18,
  1492. IPW_ORD_STAT_TX_NON_DIR_DATA_G_24,
  1493. IPW_ORD_STAT_TX_NON_DIR_DATA_G_36,
  1494. IPW_ORD_STAT_TX_NON_DIR_DATA_G_48,
  1495. IPW_ORD_STAT_TX_NON_DIR_DATA_G_54,
  1496. IPW_ORD_STAT_TX_RETRY,
  1497. IPW_ORD_STAT_TX_FAILURE,
  1498. IPW_ORD_STAT_RX_ERR_CRC,
  1499. IPW_ORD_STAT_RX_ERR_ICV,
  1500. IPW_ORD_STAT_RX_NO_BUFFER,
  1501. IPW_ORD_STAT_FULL_SCANS,
  1502. IPW_ORD_STAT_PARTIAL_SCANS,
  1503. IPW_ORD_STAT_TGH_ABORTED_SCANS,
  1504. IPW_ORD_STAT_TX_TOTAL_BYTES,
  1505. IPW_ORD_STAT_CURR_RSSI_RAW,
  1506. IPW_ORD_STAT_RX_BEACON,
  1507. IPW_ORD_STAT_MISSED_BEACONS,
  1508. IPW_ORD_TABLE_0_LAST
  1509. };
  1510. #define IPW_RSSI_TO_DBM 112
  1511. /* Table 1 Entries
  1512. */
  1513. enum {
  1514. IPW_ORD_TABLE_1_LAST = IPW_ORD_TABLE_1_MASK | 1,
  1515. };
  1516. /*
  1517. * Table 2 Entries
  1518. *
  1519. * FW_VERSION: 16 byte string
  1520. * FW_DATE: 16 byte string (only 14 bytes used)
  1521. * UCODE_VERSION: 4 byte version code
  1522. * UCODE_DATE: 5 bytes code code
  1523. * ADDAPTER_MAC: 6 byte MAC address
  1524. * RTC: 4 byte clock
  1525. */
  1526. enum {
  1527. IPW_ORD_STAT_FW_VERSION = IPW_ORD_TABLE_2_MASK | 1,
  1528. IPW_ORD_STAT_FW_DATE,
  1529. IPW_ORD_STAT_UCODE_VERSION,
  1530. IPW_ORD_STAT_UCODE_DATE,
  1531. IPW_ORD_STAT_ADAPTER_MAC,
  1532. IPW_ORD_STAT_RTC,
  1533. IPW_ORD_TABLE_2_LAST
  1534. };
  1535. /* Table 3 */
  1536. enum {
  1537. IPW_ORD_STAT_TX_PACKET = IPW_ORD_TABLE_3_MASK | 0,
  1538. IPW_ORD_STAT_TX_PACKET_FAILURE,
  1539. IPW_ORD_STAT_TX_PACKET_SUCCESS,
  1540. IPW_ORD_STAT_TX_PACKET_ABORTED,
  1541. IPW_ORD_TABLE_3_LAST
  1542. };
  1543. /* Table 4 */
  1544. enum {
  1545. IPW_ORD_TABLE_4_LAST = IPW_ORD_TABLE_4_MASK
  1546. };
  1547. /* Table 5 */
  1548. enum {
  1549. IPW_ORD_STAT_AVAILABLE_AP_COUNT = IPW_ORD_TABLE_5_MASK,
  1550. IPW_ORD_STAT_AP_ASSNS,
  1551. IPW_ORD_STAT_ROAM,
  1552. IPW_ORD_STAT_ROAM_CAUSE_MISSED_BEACONS,
  1553. IPW_ORD_STAT_ROAM_CAUSE_UNASSOC,
  1554. IPW_ORD_STAT_ROAM_CAUSE_RSSI,
  1555. IPW_ORD_STAT_ROAM_CAUSE_LINK_QUALITY,
  1556. IPW_ORD_STAT_ROAM_CAUSE_AP_LOAD_BALANCE,
  1557. IPW_ORD_STAT_ROAM_CAUSE_AP_NO_TX,
  1558. IPW_ORD_STAT_LINK_UP,
  1559. IPW_ORD_STAT_LINK_DOWN,
  1560. IPW_ORD_ANTENNA_DIVERSITY,
  1561. IPW_ORD_CURR_FREQ,
  1562. IPW_ORD_TABLE_5_LAST
  1563. };
  1564. /* Table 6 */
  1565. enum {
  1566. IPW_ORD_COUNTRY_CODE = IPW_ORD_TABLE_6_MASK,
  1567. IPW_ORD_CURR_BSSID,
  1568. IPW_ORD_CURR_SSID,
  1569. IPW_ORD_TABLE_6_LAST
  1570. };
  1571. /* Table 7 */
  1572. enum {
  1573. IPW_ORD_STAT_PERCENT_MISSED_BEACONS = IPW_ORD_TABLE_7_MASK,
  1574. IPW_ORD_STAT_PERCENT_TX_RETRIES,
  1575. IPW_ORD_STAT_PERCENT_LINK_QUALITY,
  1576. IPW_ORD_STAT_CURR_RSSI_DBM,
  1577. IPW_ORD_TABLE_7_LAST
  1578. };
  1579. #define IPW_ERROR_LOG (IPW_SHARED_LOWER_BOUND + 0x410)
  1580. #define IPW_EVENT_LOG (IPW_SHARED_LOWER_BOUND + 0x414)
  1581. #define IPW_ORDINALS_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0x500)
  1582. #define IPW_ORDINALS_TABLE_0 (IPW_SHARED_LOWER_BOUND + 0x180)
  1583. #define IPW_ORDINALS_TABLE_1 (IPW_SHARED_LOWER_BOUND + 0x184)
  1584. #define IPW_ORDINALS_TABLE_2 (IPW_SHARED_LOWER_BOUND + 0x188)
  1585. #define IPW_MEM_FIXED_OVERRIDE (IPW_SHARED_LOWER_BOUND + 0x41C)
  1586. struct ipw_fixed_rate {
  1587. u16 tx_rates;
  1588. u16 reserved;
  1589. } __attribute__ ((packed));
  1590. #define IPW_INDIRECT_ADDR_MASK (~0x3ul)
  1591. struct host_cmd {
  1592. u8 cmd;
  1593. u8 len;
  1594. u16 reserved;
  1595. u32 *param;
  1596. } __attribute__ ((packed));
  1597. struct ipw_cmd_log {
  1598. unsigned long jiffies;
  1599. int retcode;
  1600. struct host_cmd cmd;
  1601. };
  1602. /* SysConfig command parameters ... */
  1603. /* bt_coexistence param */
  1604. #define CFG_BT_COEXISTENCE_SIGNAL_CHNL 0x01 /* tell BT our chnl # */
  1605. #define CFG_BT_COEXISTENCE_DEFER 0x02 /* defer our Tx if BT traffic */
  1606. #define CFG_BT_COEXISTENCE_KILL 0x04 /* kill our Tx if BT traffic */
  1607. #define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 /* multimedia extensions */
  1608. #define CFG_BT_COEXISTENCE_OOB 0x10 /* signal BT via out-of-band */
  1609. /* clear-to-send to self param */
  1610. #define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x00
  1611. #define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x01
  1612. #define CFG_CTS_TO_ITSELF_ENABLED_DEF CFG_CTS_TO_ITSELF_ENABLED_MIN
  1613. /* Antenna diversity param (h/w can select best antenna, based on signal) */
  1614. #define CFG_SYS_ANTENNA_BOTH 0x00 /* NIC selects best antenna */
  1615. #define CFG_SYS_ANTENNA_A 0x01 /* force antenna A */
  1616. #define CFG_SYS_ANTENNA_B 0x03 /* force antenna B */
  1617. #define CFG_SYS_ANTENNA_SLOW_DIV 0x02 /* consider background noise */
  1618. /*
  1619. * The definitions below were lifted off the ipw2100 driver, which only
  1620. * supports 'b' mode, so I'm sure these are not exactly correct.
  1621. *
  1622. * Somebody fix these!!
  1623. */
  1624. #define REG_MIN_CHANNEL 0
  1625. #define REG_MAX_CHANNEL 14
  1626. #define REG_CHANNEL_MASK 0x00003FFF
  1627. #define IPW_IBSS_11B_DEFAULT_MASK 0x87ff
  1628. #define IPW_MAX_CONFIG_RETRIES 10
  1629. #endif /* __ipw2200_h__ */