ipw2100.h 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /******************************************************************************
  3. Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved.
  4. Contact Information:
  5. Intel Linux Wireless <[email protected]>
  6. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  7. ******************************************************************************/
  8. #ifndef _IPW2100_H
  9. #define _IPW2100_H
  10. #include <linux/sched.h>
  11. #include <linux/interrupt.h>
  12. #include <linux/netdevice.h>
  13. #include <linux/etherdevice.h>
  14. #include <linux/list.h>
  15. #include <linux/delay.h>
  16. #include <linux/skbuff.h>
  17. #include <asm/io.h>
  18. #include <linux/socket.h>
  19. #include <linux/if_arp.h>
  20. #include <linux/wireless.h>
  21. #include <net/iw_handler.h> // new driver API
  22. #ifdef CONFIG_IPW2100_MONITOR
  23. #include <net/ieee80211_radiotap.h>
  24. #endif
  25. #include <linux/workqueue.h>
  26. #include <linux/mutex.h>
  27. #include "libipw.h"
  28. struct ipw2100_priv;
  29. struct ipw2100_tx_packet;
  30. struct ipw2100_rx_packet;
  31. #define IPW_DL_UNINIT 0x80000000
  32. #define IPW_DL_NONE 0x00000000
  33. #define IPW_DL_ALL 0x7FFFFFFF
  34. /*
  35. * To use the debug system;
  36. *
  37. * If you are defining a new debug classification, simply add it to the #define
  38. * list here in the form of:
  39. *
  40. * #define IPW_DL_xxxx VALUE
  41. *
  42. * shifting value to the left one bit from the previous entry. xxxx should be
  43. * the name of the classification (for example, WEP)
  44. *
  45. * You then need to either add a IPW2100_xxxx_DEBUG() macro definition for your
  46. * classification, or use IPW_DEBUG(IPW_DL_xxxx, ...) whenever you want
  47. * to send output to that classification.
  48. *
  49. * To add your debug level to the list of levels seen when you perform
  50. *
  51. * % cat /proc/net/ipw2100/debug_level
  52. *
  53. * you simply need to add your entry to the ipw2100_debug_levels array.
  54. *
  55. * If you do not see debug_level in /proc/net/ipw2100 then you do not have
  56. * CONFIG_IPW2100_DEBUG defined in your kernel configuration
  57. *
  58. */
  59. #define IPW_DL_ERROR (1<<0)
  60. #define IPW_DL_WARNING (1<<1)
  61. #define IPW_DL_INFO (1<<2)
  62. #define IPW_DL_WX (1<<3)
  63. #define IPW_DL_HC (1<<5)
  64. #define IPW_DL_STATE (1<<6)
  65. #define IPW_DL_NOTIF (1<<10)
  66. #define IPW_DL_SCAN (1<<11)
  67. #define IPW_DL_ASSOC (1<<12)
  68. #define IPW_DL_DROP (1<<13)
  69. #define IPW_DL_IOCTL (1<<14)
  70. #define IPW_DL_RF_KILL (1<<17)
  71. #define IPW_DL_MANAGE (1<<15)
  72. #define IPW_DL_FW (1<<16)
  73. #define IPW_DL_FRAG (1<<21)
  74. #define IPW_DL_WEP (1<<22)
  75. #define IPW_DL_TX (1<<23)
  76. #define IPW_DL_RX (1<<24)
  77. #define IPW_DL_ISR (1<<25)
  78. #define IPW_DL_IO (1<<26)
  79. #define IPW_DL_TRACE (1<<28)
  80. #define IPW_DEBUG_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a)
  81. #define IPW_DEBUG_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a)
  82. #define IPW_DEBUG_INFO(f...) IPW_DEBUG(IPW_DL_INFO, ## f)
  83. #define IPW_DEBUG_WX(f...) IPW_DEBUG(IPW_DL_WX, ## f)
  84. #define IPW_DEBUG_SCAN(f...) IPW_DEBUG(IPW_DL_SCAN, ## f)
  85. #define IPW_DEBUG_NOTIF(f...) IPW_DEBUG(IPW_DL_NOTIF, ## f)
  86. #define IPW_DEBUG_TRACE(f...) IPW_DEBUG(IPW_DL_TRACE, ## f)
  87. #define IPW_DEBUG_RX(f...) IPW_DEBUG(IPW_DL_RX, ## f)
  88. #define IPW_DEBUG_TX(f...) IPW_DEBUG(IPW_DL_TX, ## f)
  89. #define IPW_DEBUG_ISR(f...) IPW_DEBUG(IPW_DL_ISR, ## f)
  90. #define IPW_DEBUG_MANAGEMENT(f...) IPW_DEBUG(IPW_DL_MANAGE, ## f)
  91. #define IPW_DEBUG_WEP(f...) IPW_DEBUG(IPW_DL_WEP, ## f)
  92. #define IPW_DEBUG_HC(f...) IPW_DEBUG(IPW_DL_HC, ## f)
  93. #define IPW_DEBUG_FRAG(f...) IPW_DEBUG(IPW_DL_FRAG, ## f)
  94. #define IPW_DEBUG_FW(f...) IPW_DEBUG(IPW_DL_FW, ## f)
  95. #define IPW_DEBUG_RF_KILL(f...) IPW_DEBUG(IPW_DL_RF_KILL, ## f)
  96. #define IPW_DEBUG_DROP(f...) IPW_DEBUG(IPW_DL_DROP, ## f)
  97. #define IPW_DEBUG_IO(f...) IPW_DEBUG(IPW_DL_IO, ## f)
  98. #define IPW_DEBUG_IOCTL(f...) IPW_DEBUG(IPW_DL_IOCTL, ## f)
  99. #define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a)
  100. #define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a)
  101. enum {
  102. IPW_HW_STATE_DISABLED = 1,
  103. IPW_HW_STATE_ENABLED = 0
  104. };
  105. extern const char *port_type_str[];
  106. extern const char *band_str[];
  107. #define NUMBER_OF_BD_PER_COMMAND_PACKET 1
  108. #define NUMBER_OF_BD_PER_DATA_PACKET 2
  109. #define IPW_MAX_BDS 6
  110. #define NUMBER_OF_OVERHEAD_BDS_PER_PACKETR 2
  111. #define NUMBER_OF_BDS_TO_LEAVE_FOR_COMMANDS 1
  112. #define REQUIRED_SPACE_IN_RING_FOR_COMMAND_PACKET \
  113. (IPW_BD_QUEUE_W_R_MIN_SPARE + NUMBER_OF_BD_PER_COMMAND_PACKET)
  114. struct bd_status {
  115. union {
  116. struct {
  117. u8 nlf:1, txType:2, intEnabled:1, reserved:4;
  118. } fields;
  119. u8 field;
  120. } info;
  121. } __packed;
  122. struct ipw2100_bd {
  123. u32 host_addr;
  124. u32 buf_length;
  125. struct bd_status status;
  126. /* number of fragments for frame (should be set only for
  127. * 1st TBD) */
  128. u8 num_fragments;
  129. u8 reserved[6];
  130. } __packed;
  131. #define IPW_BD_QUEUE_LENGTH(n) (1<<n)
  132. #define IPW_BD_ALIGNMENT(L) (L*sizeof(struct ipw2100_bd))
  133. #define IPW_BD_STATUS_TX_FRAME_802_3 0x00
  134. #define IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT 0x01
  135. #define IPW_BD_STATUS_TX_FRAME_COMMAND 0x02
  136. #define IPW_BD_STATUS_TX_FRAME_802_11 0x04
  137. #define IPW_BD_STATUS_TX_INTERRUPT_ENABLE 0x08
  138. struct ipw2100_bd_queue {
  139. /* driver (virtual) pointer to queue */
  140. struct ipw2100_bd *drv;
  141. /* firmware (physical) pointer to queue */
  142. dma_addr_t nic;
  143. /* Length of phy memory allocated for BDs */
  144. u32 size;
  145. /* Number of BDs in queue (and in array) */
  146. u32 entries;
  147. /* Number of available BDs (invalid for NIC BDs) */
  148. u32 available;
  149. /* Offset of oldest used BD in array (next one to
  150. * check for completion) */
  151. u32 oldest;
  152. /* Offset of next available (unused) BD */
  153. u32 next;
  154. };
  155. #define RX_QUEUE_LENGTH 256
  156. #define TX_QUEUE_LENGTH 256
  157. #define HW_QUEUE_LENGTH 256
  158. #define TX_PENDED_QUEUE_LENGTH (TX_QUEUE_LENGTH / NUMBER_OF_BD_PER_DATA_PACKET)
  159. #define STATUS_TYPE_MASK 0x0000000f
  160. #define COMMAND_STATUS_VAL 0
  161. #define STATUS_CHANGE_VAL 1
  162. #define P80211_DATA_VAL 2
  163. #define P8023_DATA_VAL 3
  164. #define HOST_NOTIFICATION_VAL 4
  165. #define IPW2100_RSSI_TO_DBM (-98)
  166. struct ipw2100_status {
  167. u32 frame_size;
  168. u16 status_fields;
  169. u8 flags;
  170. #define IPW_STATUS_FLAG_DECRYPTED (1<<0)
  171. #define IPW_STATUS_FLAG_WEP_ENCRYPTED (1<<1)
  172. #define IPW_STATUS_FLAG_CRC_ERROR (1<<2)
  173. u8 rssi;
  174. } __packed;
  175. struct ipw2100_status_queue {
  176. /* driver (virtual) pointer to queue */
  177. struct ipw2100_status *drv;
  178. /* firmware (physical) pointer to queue */
  179. dma_addr_t nic;
  180. /* Length of phy memory allocated for BDs */
  181. u32 size;
  182. };
  183. #define HOST_COMMAND_PARAMS_REG_LEN 100
  184. #define CMD_STATUS_PARAMS_REG_LEN 3
  185. #define IPW_WPA_CAPABILITIES 0x1
  186. #define IPW_WPA_LISTENINTERVAL 0x2
  187. #define IPW_WPA_AP_ADDRESS 0x4
  188. #define IPW_MAX_VAR_IE_LEN ((HOST_COMMAND_PARAMS_REG_LEN - 4) * sizeof(u32))
  189. struct ipw2100_wpa_assoc_frame {
  190. u16 fixed_ie_mask;
  191. struct {
  192. u16 capab_info;
  193. u16 listen_interval;
  194. u8 current_ap[ETH_ALEN];
  195. } fixed_ies;
  196. u32 var_ie_len;
  197. u8 var_ie[IPW_MAX_VAR_IE_LEN];
  198. };
  199. #define IPW_BSS 1
  200. #define IPW_MONITOR 2
  201. #define IPW_IBSS 3
  202. /**
  203. * @struct _tx_cmd - HWCommand
  204. * @brief H/W command structure.
  205. */
  206. struct ipw2100_cmd_header {
  207. u32 host_command_reg;
  208. u32 host_command_reg1;
  209. u32 sequence;
  210. u32 host_command_len_reg;
  211. u32 host_command_params_reg[HOST_COMMAND_PARAMS_REG_LEN];
  212. u32 cmd_status_reg;
  213. u32 cmd_status_params_reg[CMD_STATUS_PARAMS_REG_LEN];
  214. u32 rxq_base_ptr;
  215. u32 rxq_next_ptr;
  216. u32 rxq_host_ptr;
  217. u32 txq_base_ptr;
  218. u32 txq_next_ptr;
  219. u32 txq_host_ptr;
  220. u32 tx_status_reg;
  221. u32 reserved;
  222. u32 status_change_reg;
  223. u32 reserved1[3];
  224. u32 *ordinal1_ptr;
  225. u32 *ordinal2_ptr;
  226. } __packed;
  227. struct ipw2100_data_header {
  228. u32 host_command_reg;
  229. u32 host_command_reg1;
  230. u8 encrypted; // BOOLEAN in win! TRUE if frame is enc by driver
  231. u8 needs_encryption; // BOOLEAN in win! TRUE if frma need to be enc in NIC
  232. u8 wep_index; // 0 no key, 1-4 key index, 0xff immediate key
  233. u8 key_size; // 0 no imm key, 0x5 64bit encr, 0xd 128bit encr, 0x10 128bit encr and 128bit IV
  234. u8 key[16];
  235. u8 reserved[10]; // f/w reserved
  236. u8 src_addr[ETH_ALEN];
  237. u8 dst_addr[ETH_ALEN];
  238. u16 fragment_size;
  239. } __packed;
  240. /* Host command data structure */
  241. struct host_command {
  242. u32 host_command; // COMMAND ID
  243. u32 host_command1; // COMMAND ID
  244. u32 host_command_sequence; // UNIQUE COMMAND NUMBER (ID)
  245. u32 host_command_length; // LENGTH
  246. u32 host_command_parameters[HOST_COMMAND_PARAMS_REG_LEN]; // COMMAND PARAMETERS
  247. } __packed;
  248. typedef enum {
  249. POWER_ON_RESET,
  250. EXIT_POWER_DOWN_RESET,
  251. SW_RESET,
  252. EEPROM_RW,
  253. SW_RE_INIT
  254. } ipw2100_reset_event;
  255. enum {
  256. COMMAND = 0xCAFE,
  257. DATA,
  258. RX
  259. };
  260. struct ipw2100_tx_packet {
  261. int type;
  262. int index;
  263. union {
  264. struct { /* COMMAND */
  265. struct ipw2100_cmd_header *cmd;
  266. dma_addr_t cmd_phys;
  267. } c_struct;
  268. struct { /* DATA */
  269. struct ipw2100_data_header *data;
  270. dma_addr_t data_phys;
  271. struct libipw_txb *txb;
  272. } d_struct;
  273. } info;
  274. int jiffy_start;
  275. struct list_head list;
  276. };
  277. struct ipw2100_rx_packet {
  278. struct ipw2100_rx *rxp;
  279. dma_addr_t dma_addr;
  280. int jiffy_start;
  281. struct sk_buff *skb;
  282. struct list_head list;
  283. };
  284. #define FRAG_DISABLED (1<<31)
  285. #define RTS_DISABLED (1<<31)
  286. #define MAX_RTS_THRESHOLD 2304U
  287. #define MIN_RTS_THRESHOLD 1U
  288. #define DEFAULT_RTS_THRESHOLD 1000U
  289. #define DEFAULT_BEACON_INTERVAL 100U
  290. #define DEFAULT_SHORT_RETRY_LIMIT 7U
  291. #define DEFAULT_LONG_RETRY_LIMIT 4U
  292. struct ipw2100_ordinals {
  293. u32 table1_addr;
  294. u32 table2_addr;
  295. u32 table1_size;
  296. u32 table2_size;
  297. };
  298. /* Host Notification header */
  299. struct ipw2100_notification {
  300. u32 hnhdr_subtype; /* type of host notification */
  301. u32 hnhdr_size; /* size in bytes of data
  302. or number of entries, if table.
  303. Does NOT include header */
  304. } __packed;
  305. #define MAX_KEY_SIZE 16
  306. #define MAX_KEYS 8
  307. #define IPW2100_WEP_ENABLE (1<<1)
  308. #define IPW2100_WEP_DROP_CLEAR (1<<2)
  309. #define IPW_NONE_CIPHER (1<<0)
  310. #define IPW_WEP40_CIPHER (1<<1)
  311. #define IPW_TKIP_CIPHER (1<<2)
  312. #define IPW_CCMP_CIPHER (1<<4)
  313. #define IPW_WEP104_CIPHER (1<<5)
  314. #define IPW_CKIP_CIPHER (1<<6)
  315. #define IPW_AUTH_OPEN 0
  316. #define IPW_AUTH_SHARED 1
  317. #define IPW_AUTH_LEAP 2
  318. #define IPW_AUTH_LEAP_CISCO_ID 0x80
  319. struct statistic {
  320. int value;
  321. int hi;
  322. int lo;
  323. };
  324. #define INIT_STAT(x) do { \
  325. (x)->value = (x)->hi = 0; \
  326. (x)->lo = 0x7fffffff; \
  327. } while (0)
  328. #define SET_STAT(x,y) do { \
  329. (x)->value = y; \
  330. if ((x)->value > (x)->hi) (x)->hi = (x)->value; \
  331. if ((x)->value < (x)->lo) (x)->lo = (x)->value; \
  332. } while (0)
  333. #define INC_STAT(x) do { if (++(x)->value > (x)->hi) (x)->hi = (x)->value; } \
  334. while (0)
  335. #define DEC_STAT(x) do { if (--(x)->value < (x)->lo) (x)->lo = (x)->value; } \
  336. while (0)
  337. #define IPW2100_ERROR_QUEUE 5
  338. /* Power management code: enable or disable? */
  339. enum {
  340. #ifdef CONFIG_PM
  341. IPW2100_PM_DISABLED = 0,
  342. PM_STATE_SIZE = 16,
  343. #else
  344. IPW2100_PM_DISABLED = 1,
  345. PM_STATE_SIZE = 0,
  346. #endif
  347. };
  348. #define STATUS_POWERED (1<<0)
  349. #define STATUS_CMD_ACTIVE (1<<1) /**< host command in progress */
  350. #define STATUS_RUNNING (1<<2) /* Card initialized, but not enabled */
  351. #define STATUS_ENABLED (1<<3) /* Card enabled -- can scan,Tx,Rx */
  352. #define STATUS_STOPPING (1<<4) /* Card is in shutdown phase */
  353. #define STATUS_INITIALIZED (1<<5) /* Card is ready for external calls */
  354. #define STATUS_ASSOCIATING (1<<9) /* Associated, but no BSSID yet */
  355. #define STATUS_ASSOCIATED (1<<10) /* Associated and BSSID valid */
  356. #define STATUS_INT_ENABLED (1<<11)
  357. #define STATUS_RF_KILL_HW (1<<12)
  358. #define STATUS_RF_KILL_SW (1<<13)
  359. #define STATUS_RF_KILL_MASK (STATUS_RF_KILL_HW | STATUS_RF_KILL_SW)
  360. #define STATUS_EXIT_PENDING (1<<14)
  361. #define STATUS_SCAN_PENDING (1<<23)
  362. #define STATUS_SCANNING (1<<24)
  363. #define STATUS_SCAN_ABORTING (1<<25)
  364. #define STATUS_SCAN_COMPLETE (1<<26)
  365. #define STATUS_WX_EVENT_PENDING (1<<27)
  366. #define STATUS_RESET_PENDING (1<<29)
  367. #define STATUS_SECURITY_UPDATED (1<<30) /* Security sync needed */
  368. /* Internal NIC states */
  369. #define IPW_STATE_INITIALIZED (1<<0)
  370. #define IPW_STATE_COUNTRY_FOUND (1<<1)
  371. #define IPW_STATE_ASSOCIATED (1<<2)
  372. #define IPW_STATE_ASSN_LOST (1<<3)
  373. #define IPW_STATE_ASSN_CHANGED (1<<4)
  374. #define IPW_STATE_SCAN_COMPLETE (1<<5)
  375. #define IPW_STATE_ENTERED_PSP (1<<6)
  376. #define IPW_STATE_LEFT_PSP (1<<7)
  377. #define IPW_STATE_RF_KILL (1<<8)
  378. #define IPW_STATE_DISABLED (1<<9)
  379. #define IPW_STATE_POWER_DOWN (1<<10)
  380. #define IPW_STATE_SCANNING (1<<11)
  381. #define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */
  382. #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */
  383. #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */
  384. #define CFG_CUSTOM_MAC (1<<3)
  385. #define CFG_LONG_PREAMBLE (1<<4)
  386. #define CFG_ASSOCIATE (1<<6)
  387. #define CFG_FIXED_RATE (1<<7)
  388. #define CFG_ADHOC_CREATE (1<<8)
  389. #define CFG_PASSIVE_SCAN (1<<10)
  390. #ifdef CONFIG_IPW2100_MONITOR
  391. #define CFG_CRC_CHECK (1<<11)
  392. #endif
  393. #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */
  394. #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */
  395. struct ipw2100_priv {
  396. void __iomem *ioaddr;
  397. int stop_hang_check; /* Set 1 when shutting down to kill hang_check */
  398. int stop_rf_kill; /* Set 1 when shutting down to kill rf_kill */
  399. struct libipw_device *ieee;
  400. unsigned long status;
  401. unsigned long config;
  402. unsigned long capability;
  403. /* Statistics */
  404. int resets;
  405. time64_t reset_backoff;
  406. /* Context */
  407. u8 essid[IW_ESSID_MAX_SIZE];
  408. u8 essid_len;
  409. u8 bssid[ETH_ALEN];
  410. u8 channel;
  411. int last_mode;
  412. time64_t connect_start;
  413. time64_t last_reset;
  414. u32 channel_mask;
  415. u32 fatal_error;
  416. u32 fatal_errors[IPW2100_ERROR_QUEUE];
  417. u32 fatal_index;
  418. int eeprom_version;
  419. int firmware_version;
  420. unsigned long hw_features;
  421. int hangs;
  422. u32 last_rtc;
  423. int dump_raw; /* 1 to dump raw bytes in /sys/.../memory */
  424. u8 *snapshot[0x30];
  425. u8 mandatory_bssid_mac[ETH_ALEN];
  426. u8 mac_addr[ETH_ALEN];
  427. int power_mode;
  428. int messages_sent;
  429. int short_retry_limit;
  430. int long_retry_limit;
  431. u32 rts_threshold;
  432. u32 frag_threshold;
  433. int in_isr;
  434. u32 tx_rates;
  435. int tx_power;
  436. u32 beacon_interval;
  437. char nick[IW_ESSID_MAX_SIZE + 1];
  438. struct ipw2100_status_queue status_queue;
  439. struct statistic txq_stat;
  440. struct statistic rxq_stat;
  441. struct ipw2100_bd_queue rx_queue;
  442. struct ipw2100_bd_queue tx_queue;
  443. struct ipw2100_rx_packet *rx_buffers;
  444. struct statistic fw_pend_stat;
  445. struct list_head fw_pend_list;
  446. struct statistic msg_free_stat;
  447. struct statistic msg_pend_stat;
  448. struct list_head msg_free_list;
  449. struct list_head msg_pend_list;
  450. struct ipw2100_tx_packet *msg_buffers;
  451. struct statistic tx_free_stat;
  452. struct statistic tx_pend_stat;
  453. struct list_head tx_free_list;
  454. struct list_head tx_pend_list;
  455. struct ipw2100_tx_packet *tx_buffers;
  456. struct ipw2100_ordinals ordinals;
  457. struct pci_dev *pci_dev;
  458. struct proc_dir_entry *dir_dev;
  459. struct net_device *net_dev;
  460. struct iw_statistics wstats;
  461. struct iw_public_data wireless_data;
  462. struct tasklet_struct irq_tasklet;
  463. struct delayed_work reset_work;
  464. struct delayed_work security_work;
  465. struct delayed_work wx_event_work;
  466. struct delayed_work hang_check;
  467. struct delayed_work rf_kill;
  468. struct delayed_work scan_event;
  469. int user_requested_scan;
  470. /* Track time in suspend, using CLOCK_BOOTTIME */
  471. time64_t suspend_at;
  472. time64_t suspend_time;
  473. u32 interrupts;
  474. int tx_interrupts;
  475. int rx_interrupts;
  476. int inta_other;
  477. spinlock_t low_lock;
  478. struct mutex action_mutex;
  479. struct mutex adapter_mutex;
  480. wait_queue_head_t wait_command_queue;
  481. };
  482. /*********************************************************
  483. * Host Command -> From Driver to FW
  484. *********************************************************/
  485. /**
  486. * Host command identifiers
  487. */
  488. #define HOST_COMPLETE 2
  489. #define SYSTEM_CONFIG 6
  490. #define SSID 8
  491. #define MANDATORY_BSSID 9
  492. #define AUTHENTICATION_TYPE 10
  493. #define ADAPTER_ADDRESS 11
  494. #define PORT_TYPE 12
  495. #define INTERNATIONAL_MODE 13
  496. #define CHANNEL 14
  497. #define RTS_THRESHOLD 15
  498. #define FRAG_THRESHOLD 16
  499. #define POWER_MODE 17
  500. #define TX_RATES 18
  501. #define BASIC_TX_RATES 19
  502. #define WEP_KEY_INFO 20
  503. #define WEP_KEY_INDEX 25
  504. #define WEP_FLAGS 26
  505. #define ADD_MULTICAST 27
  506. #define CLEAR_ALL_MULTICAST 28
  507. #define BEACON_INTERVAL 29
  508. #define ATIM_WINDOW 30
  509. #define CLEAR_STATISTICS 31
  510. #define SEND 33
  511. #define TX_POWER_INDEX 36
  512. #define BROADCAST_SCAN 43
  513. #define CARD_DISABLE 44
  514. #define PREFERRED_BSSID 45
  515. #define SET_SCAN_OPTIONS 46
  516. #define SCAN_DWELL_TIME 47
  517. #define SWEEP_TABLE 48
  518. #define AP_OR_STATION_TABLE 49
  519. #define GROUP_ORDINALS 50
  520. #define SHORT_RETRY_LIMIT 51
  521. #define LONG_RETRY_LIMIT 52
  522. #define HOST_PRE_POWER_DOWN 58
  523. #define CARD_DISABLE_PHY_OFF 61
  524. #define MSDU_TX_RATES 62
  525. /* Rogue AP Detection */
  526. #define SET_STATION_STAT_BITS 64
  527. #define CLEAR_STATIONS_STAT_BITS 65
  528. #define LEAP_ROGUE_MODE 66 //TODO tbw replaced by CFG_LEAP_ROGUE_AP
  529. #define SET_SECURITY_INFORMATION 67
  530. #define DISASSOCIATION_BSSID 68
  531. #define SET_WPA_IE 69
  532. /* system configuration bit mask: */
  533. #define IPW_CFG_MONITOR 0x00004
  534. #define IPW_CFG_PREAMBLE_AUTO 0x00010
  535. #define IPW_CFG_IBSS_AUTO_START 0x00020
  536. #define IPW_CFG_LOOPBACK 0x00100
  537. #define IPW_CFG_ANSWER_BCSSID_PROBE 0x00800
  538. #define IPW_CFG_BT_SIDEBAND_SIGNAL 0x02000
  539. #define IPW_CFG_802_1x_ENABLE 0x04000
  540. #define IPW_CFG_BSS_MASK 0x08000
  541. #define IPW_CFG_IBSS_MASK 0x10000
  542. #define IPW_SCAN_NOASSOCIATE (1<<0)
  543. #define IPW_SCAN_MIXED_CELL (1<<1)
  544. /* RESERVED (1<<2) */
  545. #define IPW_SCAN_PASSIVE (1<<3)
  546. #define IPW_NIC_FATAL_ERROR 0x2A7F0
  547. #define IPW_ERROR_ADDR(x) (x & 0x3FFFF)
  548. #define IPW_ERROR_CODE(x) ((x & 0xFF000000) >> 24)
  549. #define IPW2100_ERR_C3_CORRUPTION (0x10 << 24)
  550. #define IPW2100_ERR_MSG_TIMEOUT (0x11 << 24)
  551. #define IPW2100_ERR_FW_LOAD (0x12 << 24)
  552. #define IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND 0x200
  553. #define IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x0D80
  554. #define IPW_MEM_HOST_SHARED_RX_BD_BASE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x40)
  555. #define IPW_MEM_HOST_SHARED_RX_STATUS_BASE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x44)
  556. #define IPW_MEM_HOST_SHARED_RX_BD_SIZE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x48)
  557. #define IPW_MEM_HOST_SHARED_RX_READ_INDEX (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0xa0)
  558. #define IPW_MEM_HOST_SHARED_TX_QUEUE_BD_BASE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x00)
  559. #define IPW_MEM_HOST_SHARED_TX_QUEUE_BD_SIZE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x04)
  560. #define IPW_MEM_HOST_SHARED_TX_QUEUE_READ_INDEX (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x80)
  561. #define IPW_MEM_HOST_SHARED_RX_WRITE_INDEX \
  562. (IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND + 0x20)
  563. #define IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX \
  564. (IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND)
  565. #define IPW_MEM_HOST_SHARED_ORDINALS_TABLE_1 (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x180)
  566. #define IPW_MEM_HOST_SHARED_ORDINALS_TABLE_2 (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x184)
  567. #define IPW2100_INTA_TX_TRANSFER (0x00000001) // Bit 0 (LSB)
  568. #define IPW2100_INTA_RX_TRANSFER (0x00000002) // Bit 1
  569. #define IPW2100_INTA_TX_COMPLETE (0x00000004) // Bit 2
  570. #define IPW2100_INTA_EVENT_INTERRUPT (0x00000008) // Bit 3
  571. #define IPW2100_INTA_STATUS_CHANGE (0x00000010) // Bit 4
  572. #define IPW2100_INTA_BEACON_PERIOD_EXPIRED (0x00000020) // Bit 5
  573. #define IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE (0x00010000) // Bit 16
  574. #define IPW2100_INTA_FW_INIT_DONE (0x01000000) // Bit 24
  575. #define IPW2100_INTA_FW_CALIBRATION_CALC (0x02000000) // Bit 25
  576. #define IPW2100_INTA_FATAL_ERROR (0x40000000) // Bit 30
  577. #define IPW2100_INTA_PARITY_ERROR (0x80000000) // Bit 31 (MSB)
  578. #define IPW_AUX_HOST_RESET_REG_PRINCETON_RESET (0x00000001)
  579. #define IPW_AUX_HOST_RESET_REG_FORCE_NMI (0x00000002)
  580. #define IPW_AUX_HOST_RESET_REG_PCI_HOST_CLUSTER_FATAL_NMI (0x00000004)
  581. #define IPW_AUX_HOST_RESET_REG_CORE_FATAL_NMI (0x00000008)
  582. #define IPW_AUX_HOST_RESET_REG_SW_RESET (0x00000080)
  583. #define IPW_AUX_HOST_RESET_REG_MASTER_DISABLED (0x00000100)
  584. #define IPW_AUX_HOST_RESET_REG_STOP_MASTER (0x00000200)
  585. #define IPW_AUX_HOST_GP_CNTRL_BIT_CLOCK_READY (0x00000001) // Bit 0 (LSB)
  586. #define IPW_AUX_HOST_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY (0x00000002) // Bit 1
  587. #define IPW_AUX_HOST_GP_CNTRL_BIT_INIT_DONE (0x00000004) // Bit 2
  588. #define IPW_AUX_HOST_GP_CNTRL_BITS_SYS_CONFIG (0x000007c0) // Bits 6-10
  589. #define IPW_AUX_HOST_GP_CNTRL_BIT_BUS_TYPE (0x00000200) // Bit 9
  590. #define IPW_AUX_HOST_GP_CNTRL_BIT_BAR0_BLOCK_SIZE (0x00000400) // Bit 10
  591. #define IPW_AUX_HOST_GP_CNTRL_BIT_USB_MODE (0x20000000) // Bit 29
  592. #define IPW_AUX_HOST_GP_CNTRL_BIT_HOST_FORCES_SYS_CLK (0x40000000) // Bit 30
  593. #define IPW_AUX_HOST_GP_CNTRL_BIT_FW_FORCES_SYS_CLK (0x80000000) // Bit 31 (MSB)
  594. #define IPW_BIT_GPIO_GPIO1_MASK 0x0000000C
  595. #define IPW_BIT_GPIO_GPIO3_MASK 0x000000C0
  596. #define IPW_BIT_GPIO_GPIO1_ENABLE 0x00000008
  597. #define IPW_BIT_GPIO_RF_KILL 0x00010000
  598. #define IPW_BIT_GPIO_LED_OFF 0x00002000 // Bit 13 = 1
  599. #define IPW_REG_DOMAIN_0_OFFSET 0x0000
  600. #define IPW_REG_DOMAIN_1_OFFSET IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND
  601. #define IPW_REG_INTA IPW_REG_DOMAIN_0_OFFSET + 0x0008
  602. #define IPW_REG_INTA_MASK IPW_REG_DOMAIN_0_OFFSET + 0x000C
  603. #define IPW_REG_INDIRECT_ACCESS_ADDRESS IPW_REG_DOMAIN_0_OFFSET + 0x0010
  604. #define IPW_REG_INDIRECT_ACCESS_DATA IPW_REG_DOMAIN_0_OFFSET + 0x0014
  605. #define IPW_REG_AUTOINCREMENT_ADDRESS IPW_REG_DOMAIN_0_OFFSET + 0x0018
  606. #define IPW_REG_AUTOINCREMENT_DATA IPW_REG_DOMAIN_0_OFFSET + 0x001C
  607. #define IPW_REG_RESET_REG IPW_REG_DOMAIN_0_OFFSET + 0x0020
  608. #define IPW_REG_GP_CNTRL IPW_REG_DOMAIN_0_OFFSET + 0x0024
  609. #define IPW_REG_GPIO IPW_REG_DOMAIN_0_OFFSET + 0x0030
  610. #define IPW_REG_FW_TYPE IPW_REG_DOMAIN_1_OFFSET + 0x0188
  611. #define IPW_REG_FW_VERSION IPW_REG_DOMAIN_1_OFFSET + 0x018C
  612. #define IPW_REG_FW_COMPATIBILITY_VERSION IPW_REG_DOMAIN_1_OFFSET + 0x0190
  613. #define IPW_REG_INDIRECT_ADDR_MASK 0x00FFFFFC
  614. #define IPW_INTERRUPT_MASK 0xC1010013
  615. #define IPW2100_CONTROL_REG 0x220000
  616. #define IPW2100_CONTROL_PHY_OFF 0x8
  617. #define IPW2100_COMMAND 0x00300004
  618. #define IPW2100_COMMAND_PHY_ON 0x0
  619. #define IPW2100_COMMAND_PHY_OFF 0x1
  620. /* in DEBUG_AREA, values of memory always 0xd55555d5 */
  621. #define IPW_REG_DOA_DEBUG_AREA_START IPW_REG_DOMAIN_0_OFFSET + 0x0090
  622. #define IPW_REG_DOA_DEBUG_AREA_END IPW_REG_DOMAIN_0_OFFSET + 0x00FF
  623. #define IPW_DATA_DOA_DEBUG_VALUE 0xd55555d5
  624. #define IPW_INTERNAL_REGISTER_HALT_AND_RESET 0x003000e0
  625. #define IPW_WAIT_CLOCK_STABILIZATION_DELAY 50 // micro seconds
  626. #define IPW_WAIT_RESET_ARC_COMPLETE_DELAY 10 // micro seconds
  627. #define IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY 10 // micro seconds
  628. // BD ring queue read/write difference
  629. #define IPW_BD_QUEUE_W_R_MIN_SPARE 2
  630. #define IPW_CACHE_LINE_LENGTH_DEFAULT 0x80
  631. #define IPW_CARD_DISABLE_PHY_OFF_COMPLETE_WAIT 100 // 100 milli
  632. #define IPW_PREPARE_POWER_DOWN_COMPLETE_WAIT 100 // 100 milli
  633. #define IPW_HEADER_802_11_SIZE sizeof(struct libipw_hdr_3addr)
  634. #define IPW_MAX_80211_PAYLOAD_SIZE 2304U
  635. #define IPW_MAX_802_11_PAYLOAD_LENGTH 2312
  636. #define IPW_MAX_ACCEPTABLE_TX_FRAME_LENGTH 1536
  637. #define IPW_MIN_ACCEPTABLE_RX_FRAME_LENGTH 60
  638. #define IPW_MAX_ACCEPTABLE_RX_FRAME_LENGTH \
  639. (IPW_MAX_ACCEPTABLE_TX_FRAME_LENGTH + IPW_HEADER_802_11_SIZE - \
  640. sizeof(struct ethhdr))
  641. #define IPW_802_11_FCS_LENGTH 4
  642. #define IPW_RX_NIC_BUFFER_LENGTH \
  643. (IPW_MAX_802_11_PAYLOAD_LENGTH + IPW_HEADER_802_11_SIZE + \
  644. IPW_802_11_FCS_LENGTH)
  645. #define IPW_802_11_PAYLOAD_OFFSET \
  646. (sizeof(struct libipw_hdr_3addr) + \
  647. sizeof(struct libipw_snap_hdr))
  648. struct ipw2100_rx {
  649. union {
  650. unsigned char payload[IPW_RX_NIC_BUFFER_LENGTH];
  651. struct libipw_hdr_4addr header;
  652. u32 status;
  653. struct ipw2100_notification notification;
  654. struct ipw2100_cmd_header command;
  655. } rx_data;
  656. } __packed;
  657. /* Bit 0-7 are for 802.11b tx rates - . Bit 5-7 are reserved */
  658. #define TX_RATE_1_MBIT 0x0001
  659. #define TX_RATE_2_MBIT 0x0002
  660. #define TX_RATE_5_5_MBIT 0x0004
  661. #define TX_RATE_11_MBIT 0x0008
  662. #define TX_RATE_MASK 0x000F
  663. #define DEFAULT_TX_RATES 0x000F
  664. #define IPW_POWER_MODE_CAM 0x00 //(always on)
  665. #define IPW_POWER_INDEX_1 0x01
  666. #define IPW_POWER_INDEX_2 0x02
  667. #define IPW_POWER_INDEX_3 0x03
  668. #define IPW_POWER_INDEX_4 0x04
  669. #define IPW_POWER_INDEX_5 0x05
  670. #define IPW_POWER_AUTO 0x06
  671. #define IPW_POWER_MASK 0x0F
  672. #define IPW_POWER_ENABLED 0x10
  673. #define IPW_POWER_LEVEL(x) ((x) & IPW_POWER_MASK)
  674. #define IPW_TX_POWER_AUTO 0
  675. #define IPW_TX_POWER_ENHANCED 1
  676. #define IPW_TX_POWER_DEFAULT 32
  677. #define IPW_TX_POWER_MIN 0
  678. #define IPW_TX_POWER_MAX 16
  679. #define IPW_TX_POWER_MIN_DBM (-12)
  680. #define IPW_TX_POWER_MAX_DBM 16
  681. #define FW_SCAN_DONOT_ASSOCIATE 0x0001 // Dont Attempt to Associate after Scan
  682. #define FW_SCAN_PASSIVE 0x0008 // Force PASSSIVE Scan
  683. #define REG_MIN_CHANNEL 0
  684. #define REG_MAX_CHANNEL 14
  685. #define REG_CHANNEL_MASK 0x00003FFF
  686. #define IPW_IBSS_11B_DEFAULT_MASK 0x87ff
  687. #define DIVERSITY_EITHER 0 // Use both antennas
  688. #define DIVERSITY_ANTENNA_A 1 // Use antenna A
  689. #define DIVERSITY_ANTENNA_B 2 // Use antenna B
  690. #define HOST_COMMAND_WAIT 0
  691. #define HOST_COMMAND_NO_WAIT 1
  692. #define LOCK_NONE 0
  693. #define LOCK_DRIVER 1
  694. #define LOCK_FW 2
  695. #define TYPE_SWEEP_ORD 0x000D
  696. #define TYPE_IBSS_STTN_ORD 0x000E
  697. #define TYPE_BSS_AP_ORD 0x000F
  698. #define TYPE_RAW_BEACON_ENTRY 0x0010
  699. #define TYPE_CALIBRATION_DATA 0x0011
  700. #define TYPE_ROGUE_AP_DATA 0x0012
  701. #define TYPE_ASSOCIATION_REQUEST 0x0013
  702. #define TYPE_REASSOCIATION_REQUEST 0x0014
  703. #define HW_FEATURE_RFKILL 0x0001
  704. #define RF_KILLSWITCH_OFF 1
  705. #define RF_KILLSWITCH_ON 0
  706. #define IPW_COMMAND_POOL_SIZE 40
  707. #define IPW_START_ORD_TAB_1 1
  708. #define IPW_START_ORD_TAB_2 1000
  709. #define IPW_ORD_TAB_1_ENTRY_SIZE sizeof(u32)
  710. #define IS_ORDINAL_TABLE_ONE(mgr,id) \
  711. ((id >= IPW_START_ORD_TAB_1) && (id < mgr->table1_size))
  712. #define IS_ORDINAL_TABLE_TWO(mgr,id) \
  713. ((id >= IPW_START_ORD_TAB_2) && (id < (mgr->table2_size + IPW_START_ORD_TAB_2)))
  714. #define BSS_ID_LENGTH 6
  715. // Fixed size data: Ordinal Table 1
  716. typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW
  717. // Transmit statistics
  718. IPW_ORD_STAT_TX_HOST_REQUESTS = 1, // # of requested Host Tx's (MSDU)
  719. IPW_ORD_STAT_TX_HOST_COMPLETE, // # of successful Host Tx's (MSDU)
  720. IPW_ORD_STAT_TX_DIR_DATA, // # of successful Directed Tx's (MSDU)
  721. IPW_ORD_STAT_TX_DIR_DATA1 = 4, // # of successful Directed Tx's (MSDU) @ 1MB
  722. IPW_ORD_STAT_TX_DIR_DATA2, // # of successful Directed Tx's (MSDU) @ 2MB
  723. IPW_ORD_STAT_TX_DIR_DATA5_5, // # of successful Directed Tx's (MSDU) @ 5_5MB
  724. IPW_ORD_STAT_TX_DIR_DATA11, // # of successful Directed Tx's (MSDU) @ 11MB
  725. IPW_ORD_STAT_TX_DIR_DATA22, // # of successful Directed Tx's (MSDU) @ 22MB
  726. IPW_ORD_STAT_TX_NODIR_DATA1 = 13, // # of successful Non_Directed Tx's (MSDU) @ 1MB
  727. IPW_ORD_STAT_TX_NODIR_DATA2, // # of successful Non_Directed Tx's (MSDU) @ 2MB
  728. IPW_ORD_STAT_TX_NODIR_DATA5_5, // # of successful Non_Directed Tx's (MSDU) @ 5.5MB
  729. IPW_ORD_STAT_TX_NODIR_DATA11, // # of successful Non_Directed Tx's (MSDU) @ 11MB
  730. IPW_ORD_STAT_NULL_DATA = 21, // # of successful NULL data Tx's
  731. IPW_ORD_STAT_TX_RTS, // # of successful Tx RTS
  732. IPW_ORD_STAT_TX_CTS, // # of successful Tx CTS
  733. IPW_ORD_STAT_TX_ACK, // # of successful Tx ACK
  734. IPW_ORD_STAT_TX_ASSN, // # of successful Association Tx's
  735. IPW_ORD_STAT_TX_ASSN_RESP, // # of successful Association response Tx's
  736. IPW_ORD_STAT_TX_REASSN, // # of successful Reassociation Tx's
  737. IPW_ORD_STAT_TX_REASSN_RESP, // # of successful Reassociation response Tx's
  738. IPW_ORD_STAT_TX_PROBE, // # of probes successfully transmitted
  739. IPW_ORD_STAT_TX_PROBE_RESP, // # of probe responses successfully transmitted
  740. IPW_ORD_STAT_TX_BEACON, // # of tx beacon
  741. IPW_ORD_STAT_TX_ATIM, // # of Tx ATIM
  742. IPW_ORD_STAT_TX_DISASSN, // # of successful Disassociation TX
  743. IPW_ORD_STAT_TX_AUTH, // # of successful Authentication Tx
  744. IPW_ORD_STAT_TX_DEAUTH, // # of successful Deauthentication TX
  745. IPW_ORD_STAT_TX_TOTAL_BYTES = 41, // Total successful Tx data bytes
  746. IPW_ORD_STAT_TX_RETRIES, // # of Tx retries
  747. IPW_ORD_STAT_TX_RETRY1, // # of Tx retries at 1MBPS
  748. IPW_ORD_STAT_TX_RETRY2, // # of Tx retries at 2MBPS
  749. IPW_ORD_STAT_TX_RETRY5_5, // # of Tx retries at 5.5MBPS
  750. IPW_ORD_STAT_TX_RETRY11, // # of Tx retries at 11MBPS
  751. IPW_ORD_STAT_TX_FAILURES = 51, // # of Tx Failures
  752. IPW_ORD_STAT_TX_ABORT_AT_HOP, //NS // # of Tx's aborted at hop time
  753. IPW_ORD_STAT_TX_MAX_TRIES_IN_HOP, // # of times max tries in a hop failed
  754. IPW_ORD_STAT_TX_ABORT_LATE_DMA, //NS // # of times tx aborted due to late dma setup
  755. IPW_ORD_STAT_TX_ABORT_STX, //NS // # of times backoff aborted
  756. IPW_ORD_STAT_TX_DISASSN_FAIL, // # of times disassociation failed
  757. IPW_ORD_STAT_TX_ERR_CTS, // # of missed/bad CTS frames
  758. IPW_ORD_STAT_TX_BPDU, //NS // # of spanning tree BPDUs sent
  759. IPW_ORD_STAT_TX_ERR_ACK, // # of tx err due to acks
  760. // Receive statistics
  761. IPW_ORD_STAT_RX_HOST = 61, // # of packets passed to host
  762. IPW_ORD_STAT_RX_DIR_DATA, // # of directed packets
  763. IPW_ORD_STAT_RX_DIR_DATA1, // # of directed packets at 1MB
  764. IPW_ORD_STAT_RX_DIR_DATA2, // # of directed packets at 2MB
  765. IPW_ORD_STAT_RX_DIR_DATA5_5, // # of directed packets at 5.5MB
  766. IPW_ORD_STAT_RX_DIR_DATA11, // # of directed packets at 11MB
  767. IPW_ORD_STAT_RX_DIR_DATA22, // # of directed packets at 22MB
  768. IPW_ORD_STAT_RX_NODIR_DATA = 71, // # of nondirected packets
  769. IPW_ORD_STAT_RX_NODIR_DATA1, // # of nondirected packets at 1MB
  770. IPW_ORD_STAT_RX_NODIR_DATA2, // # of nondirected packets at 2MB
  771. IPW_ORD_STAT_RX_NODIR_DATA5_5, // # of nondirected packets at 5.5MB
  772. IPW_ORD_STAT_RX_NODIR_DATA11, // # of nondirected packets at 11MB
  773. IPW_ORD_STAT_RX_NULL_DATA = 80, // # of null data rx's
  774. IPW_ORD_STAT_RX_POLL, //NS // # of poll rx
  775. IPW_ORD_STAT_RX_RTS, // # of Rx RTS
  776. IPW_ORD_STAT_RX_CTS, // # of Rx CTS
  777. IPW_ORD_STAT_RX_ACK, // # of Rx ACK
  778. IPW_ORD_STAT_RX_CFEND, // # of Rx CF End
  779. IPW_ORD_STAT_RX_CFEND_ACK, // # of Rx CF End + CF Ack
  780. IPW_ORD_STAT_RX_ASSN, // # of Association Rx's
  781. IPW_ORD_STAT_RX_ASSN_RESP, // # of Association response Rx's
  782. IPW_ORD_STAT_RX_REASSN, // # of Reassociation Rx's
  783. IPW_ORD_STAT_RX_REASSN_RESP, // # of Reassociation response Rx's
  784. IPW_ORD_STAT_RX_PROBE, // # of probe Rx's
  785. IPW_ORD_STAT_RX_PROBE_RESP, // # of probe response Rx's
  786. IPW_ORD_STAT_RX_BEACON, // # of Rx beacon
  787. IPW_ORD_STAT_RX_ATIM, // # of Rx ATIM
  788. IPW_ORD_STAT_RX_DISASSN, // # of disassociation Rx
  789. IPW_ORD_STAT_RX_AUTH, // # of authentication Rx
  790. IPW_ORD_STAT_RX_DEAUTH, // # of deauthentication Rx
  791. IPW_ORD_STAT_RX_TOTAL_BYTES = 101, // Total rx data bytes received
  792. IPW_ORD_STAT_RX_ERR_CRC, // # of packets with Rx CRC error
  793. IPW_ORD_STAT_RX_ERR_CRC1, // # of Rx CRC errors at 1MB
  794. IPW_ORD_STAT_RX_ERR_CRC2, // # of Rx CRC errors at 2MB
  795. IPW_ORD_STAT_RX_ERR_CRC5_5, // # of Rx CRC errors at 5.5MB
  796. IPW_ORD_STAT_RX_ERR_CRC11, // # of Rx CRC errors at 11MB
  797. IPW_ORD_STAT_RX_DUPLICATE1 = 112, // # of duplicate rx packets at 1MB
  798. IPW_ORD_STAT_RX_DUPLICATE2, // # of duplicate rx packets at 2MB
  799. IPW_ORD_STAT_RX_DUPLICATE5_5, // # of duplicate rx packets at 5.5MB
  800. IPW_ORD_STAT_RX_DUPLICATE11, // # of duplicate rx packets at 11MB
  801. IPW_ORD_STAT_RX_DUPLICATE = 119, // # of duplicate rx packets
  802. IPW_ORD_PERS_DB_LOCK = 120, // # locking fw permanent db
  803. IPW_ORD_PERS_DB_SIZE, // # size of fw permanent db
  804. IPW_ORD_PERS_DB_ADDR, // # address of fw permanent db
  805. IPW_ORD_STAT_RX_INVALID_PROTOCOL, // # of rx frames with invalid protocol
  806. IPW_ORD_SYS_BOOT_TIME, // # Boot time
  807. IPW_ORD_STAT_RX_NO_BUFFER, // # of rx frames rejected due to no buffer
  808. IPW_ORD_STAT_RX_ABORT_LATE_DMA, //NS // # of rx frames rejected due to dma setup too late
  809. IPW_ORD_STAT_RX_ABORT_AT_HOP, //NS // # of rx frames aborted due to hop
  810. IPW_ORD_STAT_RX_MISSING_FRAG, // # of rx frames dropped due to missing fragment
  811. IPW_ORD_STAT_RX_ORPHAN_FRAG, // # of rx frames dropped due to non-sequential fragment
  812. IPW_ORD_STAT_RX_ORPHAN_FRAME, // # of rx frames dropped due to unmatched 1st frame
  813. IPW_ORD_STAT_RX_FRAG_AGEOUT, // # of rx frames dropped due to uncompleted frame
  814. IPW_ORD_STAT_RX_BAD_SSID, //NS // Bad SSID (unused)
  815. IPW_ORD_STAT_RX_ICV_ERRORS, // # of ICV errors during decryption
  816. // PSP Statistics
  817. IPW_ORD_STAT_PSP_SUSPENSION = 137, // # of times adapter suspended
  818. IPW_ORD_STAT_PSP_BCN_TIMEOUT, // # of beacon timeout
  819. IPW_ORD_STAT_PSP_POLL_TIMEOUT, // # of poll response timeouts
  820. IPW_ORD_STAT_PSP_NONDIR_TIMEOUT, // # of timeouts waiting for last broadcast/muticast pkt
  821. IPW_ORD_STAT_PSP_RX_DTIMS, // # of PSP DTIMs received
  822. IPW_ORD_STAT_PSP_RX_TIMS, // # of PSP TIMs received
  823. IPW_ORD_STAT_PSP_STATION_ID, // PSP Station ID
  824. // Association and roaming
  825. IPW_ORD_LAST_ASSN_TIME = 147, // RTC time of last association
  826. IPW_ORD_STAT_PERCENT_MISSED_BCNS, // current calculation of % missed beacons
  827. IPW_ORD_STAT_PERCENT_RETRIES, // current calculation of % missed tx retries
  828. IPW_ORD_ASSOCIATED_AP_PTR, // If associated, this is ptr to the associated
  829. // AP table entry. set to 0 if not associated
  830. IPW_ORD_AVAILABLE_AP_CNT, // # of AP's described in the AP table
  831. IPW_ORD_AP_LIST_PTR, // Ptr to list of available APs
  832. IPW_ORD_STAT_AP_ASSNS, // # of associations
  833. IPW_ORD_STAT_ASSN_FAIL, // # of association failures
  834. IPW_ORD_STAT_ASSN_RESP_FAIL, // # of failuresdue to response fail
  835. IPW_ORD_STAT_FULL_SCANS, // # of full scans
  836. IPW_ORD_CARD_DISABLED, // # Card Disabled
  837. IPW_ORD_STAT_ROAM_INHIBIT, // # of times roaming was inhibited due to ongoing activity
  838. IPW_FILLER_40,
  839. IPW_ORD_RSSI_AT_ASSN = 160, // RSSI of associated AP at time of association
  840. IPW_ORD_STAT_ASSN_CAUSE1, // # of reassociations due to no tx from AP in last N
  841. // hops or no prob_ responses in last 3 minutes
  842. IPW_ORD_STAT_ASSN_CAUSE2, // # of reassociations due to poor tx/rx quality
  843. IPW_ORD_STAT_ASSN_CAUSE3, // # of reassociations due to tx/rx quality with excessive
  844. // load at the AP
  845. IPW_ORD_STAT_ASSN_CAUSE4, // # of reassociations due to AP RSSI level fell below
  846. // eligible group
  847. IPW_ORD_STAT_ASSN_CAUSE5, // # of reassociations due to load leveling
  848. IPW_ORD_STAT_ASSN_CAUSE6, //NS // # of reassociations due to dropped by Ap
  849. IPW_FILLER_41,
  850. IPW_FILLER_42,
  851. IPW_FILLER_43,
  852. IPW_ORD_STAT_AUTH_FAIL, // # of times authentication failed
  853. IPW_ORD_STAT_AUTH_RESP_FAIL, // # of times authentication response failed
  854. IPW_ORD_STATION_TABLE_CNT, // # of entries in association table
  855. // Other statistics
  856. IPW_ORD_RSSI_AVG_CURR = 173, // Current avg RSSI
  857. IPW_ORD_STEST_RESULTS_CURR, //NS // Current self test results word
  858. IPW_ORD_STEST_RESULTS_CUM, //NS // Cummulative self test results word
  859. IPW_ORD_SELF_TEST_STATUS, //NS //
  860. IPW_ORD_POWER_MGMT_MODE, // Power mode - 0=CAM, 1=PSP
  861. IPW_ORD_POWER_MGMT_INDEX, //NS //
  862. IPW_ORD_COUNTRY_CODE, // IEEE country code as recv'd from beacon
  863. IPW_ORD_COUNTRY_CHANNELS, // channels supported by country
  864. // IPW_ORD_COUNTRY_CHANNELS:
  865. // For 11b the lower 2-byte are used for channels from 1-14
  866. // and the higher 2-byte are not used.
  867. IPW_ORD_RESET_CNT, // # of adapter resets (warm)
  868. IPW_ORD_BEACON_INTERVAL, // Beacon interval
  869. IPW_ORD_PRINCETON_VERSION = 184, //NS // Princeton Version
  870. IPW_ORD_ANTENNA_DIVERSITY, // TRUE if antenna diversity is disabled
  871. IPW_ORD_CCA_RSSI, //NS // CCA RSSI value (factory programmed)
  872. IPW_ORD_STAT_EEPROM_UPDATE, //NS // # of times config EEPROM updated
  873. IPW_ORD_DTIM_PERIOD, // # of beacon intervals between DTIMs
  874. IPW_ORD_OUR_FREQ, // current radio freq lower digits - channel ID
  875. IPW_ORD_RTC_TIME = 190, // current RTC time
  876. IPW_ORD_PORT_TYPE, // operating mode
  877. IPW_ORD_CURRENT_TX_RATE, // current tx rate
  878. IPW_ORD_SUPPORTED_RATES, // Bitmap of supported tx rates
  879. IPW_ORD_ATIM_WINDOW, // current ATIM Window
  880. IPW_ORD_BASIC_RATES, // bitmap of basic tx rates
  881. IPW_ORD_NIC_HIGHEST_RATE, // bitmap of basic tx rates
  882. IPW_ORD_AP_HIGHEST_RATE, // bitmap of basic tx rates
  883. IPW_ORD_CAPABILITIES, // Management frame capability field
  884. IPW_ORD_AUTH_TYPE, // Type of authentication
  885. IPW_ORD_RADIO_TYPE, // Adapter card platform type
  886. IPW_ORD_RTS_THRESHOLD = 201, // Min length of packet after which RTS handshaking is used
  887. IPW_ORD_INT_MODE, // International mode
  888. IPW_ORD_FRAGMENTATION_THRESHOLD, // protocol frag threshold
  889. IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, // EEPROM offset in SRAM
  890. IPW_ORD_EEPROM_SRAM_DB_BLOCK_SIZE, // EEPROM size in SRAM
  891. IPW_ORD_EEPROM_SKU_CAPABILITY, // EEPROM SKU Capability 206 =
  892. IPW_ORD_EEPROM_IBSS_11B_CHANNELS, // EEPROM IBSS 11b channel set
  893. IPW_ORD_MAC_VERSION = 209, // MAC Version
  894. IPW_ORD_MAC_REVISION, // MAC Revision
  895. IPW_ORD_RADIO_VERSION, // Radio Version
  896. IPW_ORD_NIC_MANF_DATE_TIME, // MANF Date/Time STAMP
  897. IPW_ORD_UCODE_VERSION, // Ucode Version
  898. IPW_ORD_HW_RF_SWITCH_STATE = 214, // HW RF Kill Switch State
  899. } ORDINALTABLE1;
  900. // ordinal table 2
  901. // Variable length data:
  902. #define IPW_FIRST_VARIABLE_LENGTH_ORDINAL 1001
  903. typedef enum _ORDINAL_TABLE_2 { // NS - means Not Supported by FW
  904. IPW_ORD_STAT_BASE = 1000, // contains number of variable ORDs
  905. IPW_ORD_STAT_ADAPTER_MAC = 1001, // 6 bytes: our adapter MAC address
  906. IPW_ORD_STAT_PREFERRED_BSSID = 1002, // 6 bytes: BSSID of the preferred AP
  907. IPW_ORD_STAT_MANDATORY_BSSID = 1003, // 6 bytes: BSSID of the mandatory AP
  908. IPW_FILL_1, //NS //
  909. IPW_ORD_STAT_COUNTRY_TEXT = 1005, // 36 bytes: Country name text, First two bytes are Country code
  910. IPW_ORD_STAT_ASSN_SSID = 1006, // 32 bytes: ESSID String
  911. IPW_ORD_STATION_TABLE = 1007, // ? bytes: Station/AP table (via Direct SSID Scans)
  912. IPW_ORD_STAT_SWEEP_TABLE = 1008, // ? bytes: Sweep/Host Table table (via Broadcast Scans)
  913. IPW_ORD_STAT_ROAM_LOG = 1009, // ? bytes: Roaming log
  914. IPW_ORD_STAT_RATE_LOG = 1010, //NS // 0 bytes: Rate log
  915. IPW_ORD_STAT_FIFO = 1011, //NS // 0 bytes: Fifo buffer data structures
  916. IPW_ORD_STAT_FW_VER_NUM = 1012, // 14 bytes: fw version ID string as in (a.bb.ccc; "0.08.011")
  917. IPW_ORD_STAT_FW_DATE = 1013, // 14 bytes: fw date string (mmm dd yyyy; "Mar 13 2002")
  918. IPW_ORD_STAT_ASSN_AP_BSSID = 1014, // 6 bytes: MAC address of associated AP
  919. IPW_ORD_STAT_DEBUG = 1015, //NS // ? bytes:
  920. IPW_ORD_STAT_NIC_BPA_NUM = 1016, // 11 bytes: NIC BPA number in ASCII
  921. IPW_ORD_STAT_UCODE_DATE = 1017, // 5 bytes: uCode date
  922. IPW_ORD_SECURITY_NGOTIATION_RESULT = 1018,
  923. } ORDINALTABLE2; // NS - means Not Supported by FW
  924. #define IPW_LAST_VARIABLE_LENGTH_ORDINAL 1018
  925. #ifndef WIRELESS_SPY
  926. #define WIRELESS_SPY // enable iwspy support
  927. #endif
  928. #define IPW_HOST_FW_SHARED_AREA0 0x0002f200
  929. #define IPW_HOST_FW_SHARED_AREA0_END 0x0002f510 // 0x310 bytes
  930. #define IPW_HOST_FW_SHARED_AREA1 0x0002f610
  931. #define IPW_HOST_FW_SHARED_AREA1_END 0x0002f630 // 0x20 bytes
  932. #define IPW_HOST_FW_SHARED_AREA2 0x0002fa00
  933. #define IPW_HOST_FW_SHARED_AREA2_END 0x0002fa20 // 0x20 bytes
  934. #define IPW_HOST_FW_SHARED_AREA3 0x0002fc00
  935. #define IPW_HOST_FW_SHARED_AREA3_END 0x0002fc10 // 0x10 bytes
  936. #define IPW_HOST_FW_INTERRUPT_AREA 0x0002ff80
  937. #define IPW_HOST_FW_INTERRUPT_AREA_END 0x00030000 // 0x80 bytes
  938. struct ipw2100_fw_chunk {
  939. unsigned char *buf;
  940. long len;
  941. long pos;
  942. struct list_head list;
  943. };
  944. struct ipw2100_fw_chunk_set {
  945. const void *data;
  946. unsigned long size;
  947. };
  948. struct ipw2100_fw {
  949. int version;
  950. struct ipw2100_fw_chunk_set fw;
  951. struct ipw2100_fw_chunk_set uc;
  952. const struct firmware *fw_entry;
  953. };
  954. #define MAX_FW_VERSION_LEN 14
  955. #endif /* _IPW2100_H */