iwl-3945.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called LICENSE.
  20. *
  21. * Contact Information:
  22. * Intel Linux Wireless <ilw@linux.intel.com>
  23. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  24. *
  25. *****************************************************************************/
  26. /*
  27. * Please use this file (iwl-3945.h) for driver implementation definitions.
  28. * Please use iwl-3945-commands.h for uCode API definitions.
  29. * Please use iwl-3945-hw.h for hardware-related definitions.
  30. */
  31. #ifndef __iwl_3945_h__
  32. #define __iwl_3945_h__
  33. #include <linux/pci.h> /* for struct pci_device_id */
  34. #include <linux/kernel.h>
  35. #include <net/ieee80211_radiotap.h>
  36. /*used for rfkill*/
  37. #include <linux/rfkill.h>
  38. #include <linux/input.h>
  39. /* Hardware specific file defines the PCI IDs table for that hardware module */
  40. extern struct pci_device_id iwl3945_hw_card_ids[];
  41. #include "iwl-csr.h"
  42. #include "iwl-prph.h"
  43. #include "iwl-3945-hw.h"
  44. #include "iwl-debug.h"
  45. #include "iwl-power.h"
  46. #include "iwl-dev.h"
  47. #include "iwl-3945-led.h"
  48. /* Highest firmware API version supported */
  49. #define IWL3945_UCODE_API_MAX 2
  50. /* Lowest firmware API version supported */
  51. #define IWL3945_UCODE_API_MIN 1
  52. #define IWL3945_FW_PRE "iwlwifi-3945-"
  53. #define _IWL3945_MODULE_FIRMWARE(api) IWL3945_FW_PRE #api ".ucode"
  54. #define IWL3945_MODULE_FIRMWARE(api) _IWL3945_MODULE_FIRMWARE(api)
  55. /* Default noise level to report when noise measurement is not available.
  56. * This may be because we're:
  57. * 1) Not associated (4965, no beacon statistics being sent to driver)
  58. * 2) Scanning (noise measurement does not apply to associated channel)
  59. * 3) Receiving CCK (3945 delivers noise info only for OFDM frames)
  60. * Use default noise value of -127 ... this is below the range of measurable
  61. * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user.
  62. * Also, -127 works better than 0 when averaging frames with/without
  63. * noise info (e.g. averaging might be done in app); measured dBm values are
  64. * always negative ... using a negative value as the default keeps all
  65. * averages within an s8's (used in some apps) range of negative values. */
  66. #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
  67. /* Module parameters accessible from iwl-*.c */
  68. extern int iwl3945_param_hwcrypto;
  69. extern int iwl3945_param_queues_num;
  70. struct iwl3945_sta_priv {
  71. struct iwl3945_rs_sta *rs_sta;
  72. };
  73. enum iwl3945_antenna {
  74. IWL_ANTENNA_DIVERSITY,
  75. IWL_ANTENNA_MAIN,
  76. IWL_ANTENNA_AUX
  77. };
  78. /*
  79. * RTS threshold here is total size [2347] minus 4 FCS bytes
  80. * Per spec:
  81. * a value of 0 means RTS on all data/management packets
  82. * a value > max MSDU size means no RTS
  83. * else RTS for data/management frames where MPDU is larger
  84. * than RTS value.
  85. */
  86. #define IWL_RX_BUF_SIZE 3000U
  87. #define DEFAULT_RTS_THRESHOLD 2347U
  88. #define MIN_RTS_THRESHOLD 0U
  89. #define MAX_RTS_THRESHOLD 2347U
  90. #define MAX_MSDU_SIZE 2304U
  91. #define MAX_MPDU_SIZE 2346U
  92. #define DEFAULT_BEACON_INTERVAL 100U
  93. #define DEFAULT_SHORT_RETRY_LIMIT 7U
  94. #define DEFAULT_LONG_RETRY_LIMIT 4U
  95. struct iwl3945_rx_mem_buffer {
  96. dma_addr_t dma_addr;
  97. struct sk_buff *skb;
  98. struct list_head list;
  99. };
  100. int iwl3945_x2_queue_used(const struct iwl_queue *q, int i);
  101. #define MAX_NUM_OF_TBS (20)
  102. /* One for each TFD */
  103. struct iwl3945_tx_info {
  104. struct sk_buff *skb[MAX_NUM_OF_TBS];
  105. };
  106. #include "iwl-agn-rs.h"
  107. #define IWL_TX_FIFO_AC0 0
  108. #define IWL_TX_FIFO_AC1 1
  109. #define IWL_TX_FIFO_AC2 2
  110. #define IWL_TX_FIFO_AC3 3
  111. #define IWL_TX_FIFO_HCCA_1 5
  112. #define IWL_TX_FIFO_HCCA_2 6
  113. #define IWL_TX_FIFO_NONE 7
  114. /* Minimum number of queues. MAX_NUM is defined in hw specific files */
  115. #define IWL_MIN_NUM_QUEUES 4
  116. #define IEEE80211_DATA_LEN 2304
  117. #define IEEE80211_4ADDR_LEN 30
  118. #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
  119. #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
  120. struct iwl3945_frame {
  121. union {
  122. struct ieee80211_hdr frame;
  123. struct iwl3945_tx_beacon_cmd beacon;
  124. u8 raw[IEEE80211_FRAME_LEN];
  125. u8 cmd[360];
  126. } u;
  127. struct list_head list;
  128. };
  129. #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
  130. #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
  131. #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
  132. struct iwl3945_cmd;
  133. struct iwl3945_priv;
  134. struct iwl3945_cmd_meta {
  135. struct iwl3945_cmd_meta *source;
  136. union {
  137. struct sk_buff *skb;
  138. int (*callback)(struct iwl3945_priv *priv,
  139. struct iwl3945_cmd *cmd, struct sk_buff *skb);
  140. } __attribute__ ((packed)) u;
  141. /* The CMD_SIZE_HUGE flag bit indicates that the command
  142. * structure is stored at the end of the shared queue memory. */
  143. u32 flags;
  144. } __attribute__ ((packed));
  145. /**
  146. * struct iwl3945_cmd
  147. *
  148. * For allocation of the command and tx queues, this establishes the overall
  149. * size of the largest command we send to uCode, except for a scan command
  150. * (which is relatively huge; space is allocated separately).
  151. */
  152. struct iwl3945_cmd {
  153. struct iwl3945_cmd_meta meta;
  154. struct iwl_cmd_header hdr;
  155. union {
  156. struct iwl3945_addsta_cmd addsta;
  157. struct iwl_led_cmd led;
  158. u32 flags;
  159. u8 val8;
  160. u16 val16;
  161. u32 val32;
  162. struct iwl_bt_cmd bt;
  163. struct iwl_rxon_time_cmd rxon_time;
  164. struct iwl_powertable_cmd powertable;
  165. struct iwl_qosparam_cmd qosparam;
  166. struct iwl3945_tx_cmd tx;
  167. struct iwl3945_tx_beacon_cmd tx_beacon;
  168. struct iwl3945_rxon_assoc_cmd rxon_assoc;
  169. u8 *indirect;
  170. u8 payload[360];
  171. } __attribute__ ((packed)) cmd;
  172. } __attribute__ ((packed));
  173. struct iwl3945_host_cmd {
  174. u8 id;
  175. u16 len;
  176. struct iwl3945_cmd_meta meta;
  177. const void *data;
  178. };
  179. #define TFD39_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \
  180. sizeof(struct iwl3945_cmd_meta))
  181. /*
  182. * RX related structures and functions
  183. */
  184. #define RX_FREE_BUFFERS 64
  185. #define RX_LOW_WATERMARK 8
  186. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  187. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  188. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  189. /**
  190. * struct iwl3945_rx_queue - Rx queue
  191. * @processed: Internal index to last handled Rx packet
  192. * @read: Shared index to newest available Rx buffer
  193. * @write: Shared index to oldest written Rx packet
  194. * @free_count: Number of pre-allocated buffers in rx_free
  195. * @rx_free: list of free SKBs for use
  196. * @rx_used: List of Rx buffers with no SKB
  197. * @need_update: flag to indicate we need to update read/write index
  198. *
  199. * NOTE: rx_free and rx_used are used as a FIFO for iwl3945_rx_mem_buffers
  200. */
  201. struct iwl3945_rx_queue {
  202. __le32 *bd;
  203. dma_addr_t dma_addr;
  204. struct iwl3945_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
  205. struct iwl3945_rx_mem_buffer *queue[RX_QUEUE_SIZE];
  206. u32 processed;
  207. u32 read;
  208. u32 write;
  209. u32 free_count;
  210. struct list_head rx_free;
  211. struct list_head rx_used;
  212. int need_update;
  213. spinlock_t lock;
  214. };
  215. #define IWL_SUPPORTED_RATES_IE_LEN 8
  216. #define SCAN_INTERVAL 100
  217. #define STATUS_HCMD_ACTIVE 0 /* host command in progress */
  218. #define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */
  219. #define STATUS_INT_ENABLED 2
  220. #define STATUS_RF_KILL_HW 3
  221. #define STATUS_RF_KILL_SW 4
  222. #define STATUS_INIT 5
  223. #define STATUS_ALIVE 6
  224. #define STATUS_READY 7
  225. #define STATUS_TEMPERATURE 8
  226. #define STATUS_GEO_CONFIGURED 9
  227. #define STATUS_EXIT_PENDING 10
  228. #define STATUS_IN_SUSPEND 11
  229. #define STATUS_STATISTICS 12
  230. #define STATUS_SCANNING 13
  231. #define STATUS_SCAN_ABORTING 14
  232. #define STATUS_SCAN_HW 15
  233. #define STATUS_POWER_PMI 16
  234. #define STATUS_FW_ERROR 17
  235. #define STATUS_CONF_PENDING 18
  236. #define MAX_TID_COUNT 9
  237. #define IWL_INVALID_RATE 0xFF
  238. #define IWL_INVALID_VALUE -1
  239. #define STA_PS_STATUS_WAKE 0
  240. #define STA_PS_STATUS_SLEEP 1
  241. struct iwl3945_ibss_seq {
  242. u8 mac[ETH_ALEN];
  243. u16 seq_num;
  244. u16 frag_num;
  245. unsigned long packet_time;
  246. struct list_head list;
  247. };
  248. /**
  249. * struct iwl3945_driver_hw_info
  250. * @max_txq_num: Max # Tx queues supported
  251. * @tx_cmd_len: Size of Tx command (but not including frame itself)
  252. * @tx_ant_num: Number of TX antennas
  253. * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
  254. * @rx_buf_size:
  255. * @max_pkt_size:
  256. * @max_rxq_log: Log-base-2 of max_rxq_size
  257. * @max_stations:
  258. * @bcast_sta_id:
  259. * @shared_virt: Pointer to driver/uCode shared Tx Byte Counts and Rx status
  260. * @shared_phys: Physical Pointer to Tx Byte Counts and Rx status
  261. */
  262. struct iwl3945_driver_hw_info {
  263. u16 max_txq_num;
  264. u16 tx_cmd_len;
  265. u16 tx_ant_num;
  266. u16 max_rxq_size;
  267. u32 rx_buf_size;
  268. u32 max_pkt_size;
  269. u16 max_rxq_log;
  270. u8 max_stations;
  271. u8 bcast_sta_id;
  272. void *shared_virt;
  273. dma_addr_t shared_phys;
  274. };
  275. #define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\
  276. x->u.rx_frame.stats.payload + \
  277. x->u.rx_frame.stats.phy_count))
  278. #define IWL_RX_END(x) ((struct iwl3945_rx_frame_end *)(\
  279. IWL_RX_HDR(x)->payload + \
  280. le16_to_cpu(IWL_RX_HDR(x)->len)))
  281. #define IWL_RX_STATS(x) (&x->u.rx_frame.stats)
  282. #define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload)
  283. /******************************************************************************
  284. *
  285. * Functions implemented in iwl-base.c which are forward declared here
  286. * for use by iwl-*.c
  287. *
  288. *****************************************************************************/
  289. struct iwl3945_addsta_cmd;
  290. extern int iwl3945_send_add_station(struct iwl3945_priv *priv,
  291. struct iwl3945_addsta_cmd *sta, u8 flags);
  292. extern u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *bssid,
  293. int is_ap, u8 flags);
  294. extern int iwl3945_power_init_handle(struct iwl3945_priv *priv);
  295. extern int iwl3945_eeprom_init(struct iwl3945_priv *priv);
  296. extern int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv);
  297. extern void iwl3945_rx_queue_reset(struct iwl3945_priv *priv,
  298. struct iwl3945_rx_queue *rxq);
  299. extern int iwl3945_calc_db_from_ratio(int sig_ratio);
  300. extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);
  301. extern int iwl3945_tx_queue_init(struct iwl3945_priv *priv,
  302. struct iwl3945_tx_queue *txq, int count, u32 id);
  303. extern void iwl3945_rx_replenish(void *data);
  304. extern void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq);
  305. extern int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len,
  306. const void *data);
  307. extern int __must_check iwl3945_send_cmd(struct iwl3945_priv *priv,
  308. struct iwl3945_host_cmd *cmd);
  309. extern unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv,
  310. struct ieee80211_hdr *hdr,int left);
  311. extern int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv,
  312. struct iwl3945_rx_queue *q);
  313. extern int iwl3945_send_statistics_request(struct iwl3945_priv *priv);
  314. extern void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb,
  315. u32 decrypt_res,
  316. struct ieee80211_rx_status *stats);
  317. /*
  318. * Currently used by iwl-3945-rs... look at restructuring so that it doesn't
  319. * call this... todo... fix that.
  320. */
  321. extern u8 iwl3945_sync_station(struct iwl3945_priv *priv, int sta_id,
  322. u16 tx_rate, u8 flags);
  323. /******************************************************************************
  324. *
  325. * Functions implemented in iwl-[34]*.c which are forward declared here
  326. * for use by iwl-base.c
  327. *
  328. * NOTE: The implementation of these functions are hardware specific
  329. * which is why they are in the hardware specific files (vs. iwl-base.c)
  330. *
  331. * Naming convention --
  332. * iwl3945_ <-- Its part of iwlwifi (should be changed to iwl3945_)
  333. * iwl3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
  334. * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
  335. * iwl3945_bg_ <-- Called from work queue context
  336. * iwl3945_mac_ <-- mac80211 callback
  337. *
  338. ****************************************************************************/
  339. extern void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv);
  340. extern void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv);
  341. extern void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv);
  342. extern int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv);
  343. extern int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv);
  344. extern int iwl3945_hw_nic_init(struct iwl3945_priv *priv);
  345. extern int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv);
  346. extern void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv);
  347. extern void iwl3945_hw_txq_ctx_stop(struct iwl3945_priv *priv);
  348. extern int iwl3945_hw_nic_reset(struct iwl3945_priv *priv);
  349. extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *tfd,
  350. dma_addr_t addr, u16 len);
  351. extern int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq);
  352. extern int iwl3945_hw_get_temperature(struct iwl3945_priv *priv);
  353. extern int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv,
  354. struct iwl3945_tx_queue *txq);
  355. extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
  356. struct iwl3945_frame *frame, u8 rate);
  357. extern int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv);
  358. extern void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
  359. struct iwl3945_cmd *cmd,
  360. struct ieee80211_tx_info *info,
  361. struct ieee80211_hdr *hdr,
  362. int sta_id, int tx_id);
  363. extern int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv);
  364. extern int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power);
  365. extern void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv,
  366. struct iwl3945_rx_mem_buffer *rxb);
  367. extern void iwl3945_disable_events(struct iwl3945_priv *priv);
  368. extern int iwl4965_get_temperature(const struct iwl3945_priv *priv);
  369. /**
  370. * iwl3945_hw_find_station - Find station id for a given BSSID
  371. * @bssid: MAC address of station ID to find
  372. *
  373. * NOTE: This should not be hardware specific but the code has
  374. * not yet been merged into a single common layer for managing the
  375. * station tables.
  376. */
  377. extern u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *bssid);
  378. extern int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel);
  379. /*
  380. * Forward declare iwl-3945.c functions for iwl-base.c
  381. */
  382. extern __le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv);
  383. extern int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv);
  384. extern void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv);
  385. extern int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv);
  386. extern u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id,
  387. u16 tx_rate, u8 flags);
  388. #ifdef CONFIG_IWL3945_RFKILL
  389. struct iwl3945_priv;
  390. void iwl3945_rfkill_set_hw_state(struct iwl3945_priv *priv);
  391. void iwl3945_rfkill_unregister(struct iwl3945_priv *priv);
  392. int iwl3945_rfkill_init(struct iwl3945_priv *priv);
  393. #else
  394. static inline void iwl3945_rfkill_set_hw_state(struct iwl3945_priv *priv) {}
  395. static inline void iwl3945_rfkill_unregister(struct iwl3945_priv *priv) {}
  396. static inline int iwl3945_rfkill_init(struct iwl3945_priv *priv) { return 0; }
  397. #endif
  398. struct iwl3945_priv {
  399. /* ieee device used by generic ieee processing code */
  400. struct ieee80211_hw *hw;
  401. struct ieee80211_channel *ieee_channels;
  402. struct ieee80211_rate *ieee_rates;
  403. struct iwl_cfg *cfg; /* device configuration */
  404. /* temporary frame storage list */
  405. struct list_head free_frames;
  406. int frames_count;
  407. enum ieee80211_band band;
  408. int alloc_rxb_skb;
  409. void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv,
  410. struct iwl3945_rx_mem_buffer *rxb);
  411. struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
  412. #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
  413. /* spectrum measurement report caching */
  414. struct iwl_spectrum_notification measure_report;
  415. u8 measurement_status;
  416. #endif
  417. /* ucode beacon time */
  418. u32 ucode_beacon_time;
  419. /* we allocate array of iwl3945_channel_info for NIC's valid channels.
  420. * Access via channel # using indirect index array */
  421. struct iwl_channel_info *channel_info; /* channel info array */
  422. u8 channel_count; /* # of channels */
  423. /* each calibration channel group in the EEPROM has a derived
  424. * clip setting for each rate. */
  425. const struct iwl3945_clip_group clip_groups[5];
  426. /* thermal calibration */
  427. s32 temperature; /* degrees Kelvin */
  428. s32 last_temperature;
  429. /* Scan related variables */
  430. unsigned long last_scan_jiffies;
  431. unsigned long next_scan_jiffies;
  432. unsigned long scan_start;
  433. unsigned long scan_pass_start;
  434. unsigned long scan_start_tsf;
  435. int scan_bands;
  436. int one_direct_scan;
  437. u8 direct_ssid_len;
  438. u8 direct_ssid[IW_ESSID_MAX_SIZE];
  439. struct iwl3945_scan_cmd *scan;
  440. /* spinlock */
  441. spinlock_t lock; /* protect general shared data */
  442. spinlock_t hcmd_lock; /* protect hcmd */
  443. struct mutex mutex;
  444. /* basic pci-network driver stuff */
  445. struct pci_dev *pci_dev;
  446. /* pci hardware address support */
  447. void __iomem *hw_base;
  448. /* uCode images, save to reload in case of failure */
  449. u32 ucode_ver; /* ucode version, copy of
  450. iwl_ucode.ver */
  451. struct fw_desc ucode_code; /* runtime inst */
  452. struct fw_desc ucode_data; /* runtime data original */
  453. struct fw_desc ucode_data_backup; /* runtime data save/restore */
  454. struct fw_desc ucode_init; /* initialization inst */
  455. struct fw_desc ucode_init_data; /* initialization data */
  456. struct fw_desc ucode_boot; /* bootstrap inst */
  457. struct iwl_rxon_time_cmd rxon_timing;
  458. /* We declare this const so it can only be
  459. * changed via explicit cast within the
  460. * routines that actually update the physical
  461. * hardware */
  462. const struct iwl3945_rxon_cmd active_rxon;
  463. struct iwl3945_rxon_cmd staging_rxon;
  464. int error_recovering;
  465. struct iwl3945_rxon_cmd recovery_rxon;
  466. /* 1st responses from initialize and runtime uCode images.
  467. * 4965's initialize alive response contains some calibration data. */
  468. /* FIXME: 4965 uses bigger structure for init */
  469. struct iwl_alive_resp card_alive_init;
  470. struct iwl_alive_resp card_alive;
  471. #ifdef CONFIG_IWL3945_RFKILL
  472. struct rfkill *rfkill;
  473. #endif
  474. #ifdef CONFIG_IWL3945_LEDS
  475. struct iwl3945_led led[IWL_LED_TRG_MAX];
  476. unsigned long last_blink_time;
  477. u8 last_blink_rate;
  478. u8 allow_blinking;
  479. unsigned int rxtxpackets;
  480. u64 led_tpt;
  481. #endif
  482. u16 active_rate;
  483. u16 active_rate_basic;
  484. u32 sta_supp_rates;
  485. u8 call_post_assoc_from_beacon;
  486. /* Rate scaling data */
  487. s8 data_retry_limit;
  488. u8 retry_rate;
  489. wait_queue_head_t wait_command_queue;
  490. int activity_timer_active;
  491. /* Rx and Tx DMA processing queues */
  492. struct iwl3945_rx_queue rxq;
  493. struct iwl3945_tx_queue txq[IWL39_MAX_NUM_QUEUES];
  494. unsigned long status;
  495. int last_rx_rssi; /* From Rx packet statisitics */
  496. int last_rx_noise; /* From beacon statistics */
  497. struct iwl3945_power_mgr power_data;
  498. struct iwl3945_notif_statistics statistics;
  499. unsigned long last_statistics_time;
  500. /* context information */
  501. u16 rates_mask;
  502. u32 power_mode;
  503. u32 antenna;
  504. u8 bssid[ETH_ALEN];
  505. u16 rts_threshold;
  506. u8 mac_addr[ETH_ALEN];
  507. /*station table variables */
  508. spinlock_t sta_lock;
  509. int num_stations;
  510. struct iwl3945_station_entry stations[IWL_STATION_COUNT];
  511. /* Indication if ieee80211_ops->open has been called */
  512. u8 is_open;
  513. u8 mac80211_registered;
  514. /* Rx'd packet timing information */
  515. u32 last_beacon_time;
  516. u64 last_tsf;
  517. /* eeprom */
  518. struct iwl3945_eeprom eeprom;
  519. enum nl80211_iftype iw_mode;
  520. struct sk_buff *ibss_beacon;
  521. /* Last Rx'd beacon timestamp */
  522. u64 timestamp;
  523. u16 beacon_int;
  524. struct iwl3945_driver_hw_info hw_setting;
  525. struct ieee80211_vif *vif;
  526. /* Current association information needed to configure the
  527. * hardware */
  528. u16 assoc_id;
  529. u16 assoc_capability;
  530. u8 ps_mode;
  531. struct iwl_qos_info qos_data;
  532. struct workqueue_struct *workqueue;
  533. struct work_struct up;
  534. struct work_struct restart;
  535. struct work_struct calibrated_work;
  536. struct work_struct scan_completed;
  537. struct work_struct rx_replenish;
  538. struct work_struct rf_kill;
  539. struct work_struct abort_scan;
  540. struct work_struct update_link_led;
  541. struct work_struct auth_work;
  542. struct work_struct report_work;
  543. struct work_struct request_scan;
  544. struct work_struct beacon_update;
  545. struct tasklet_struct irq_tasklet;
  546. struct delayed_work init_alive_start;
  547. struct delayed_work alive_start;
  548. struct delayed_work activity_timer;
  549. struct delayed_work thermal_periodic;
  550. struct delayed_work gather_stats;
  551. struct delayed_work scan_check;
  552. #define IWL_DEFAULT_TX_POWER 0x0F
  553. s8 user_txpower_limit;
  554. s8 max_channel_txpower_limit;
  555. #ifdef CONFIG_IWL3945_DEBUG
  556. /* debugging info */
  557. u32 debug_level;
  558. u32 framecnt_to_us;
  559. atomic_t restrict_refcnt;
  560. #endif
  561. }; /*iwl3945_priv */
  562. static inline int iwl3945_is_associated(struct iwl3945_priv *priv)
  563. {
  564. return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
  565. }
  566. extern const struct iwl_channel_info *iwl3945_get_channel_info(
  567. const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel);
  568. extern int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate);
  569. /* Requires full declaration of iwl3945_priv before including */
  570. #include "iwl-3945-io.h"
  571. #endif