aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-dev.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-dev.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h140
1 files changed, 127 insertions, 13 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 0468fcc1ea9..afde713c806 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 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 6 * under the terms of version 2 of the GNU General Public License as
@@ -36,13 +36,15 @@
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <net/ieee80211_radiotap.h> 37#include <net/ieee80211_radiotap.h>
38 38
39#define DRV_NAME "iwlagn"
40#include "iwl-rfkill.h"
41#include "iwl-eeprom.h" 39#include "iwl-eeprom.h"
42#include "iwl-4965-hw.h"
43#include "iwl-csr.h" 40#include "iwl-csr.h"
44#include "iwl-prph.h" 41#include "iwl-prph.h"
42#include "iwl-fh.h"
45#include "iwl-debug.h" 43#include "iwl-debug.h"
44#include "iwl-rfkill.h"
45#include "iwl-4965-hw.h"
46#include "iwl-3945-hw.h"
47#include "iwl-3945-led.h"
46#include "iwl-led.h" 48#include "iwl-led.h"
47#include "iwl-power.h" 49#include "iwl-power.h"
48#include "iwl-agn-rs.h" 50#include "iwl-agn-rs.h"
@@ -55,6 +57,28 @@ extern struct iwl_cfg iwl5350_agn_cfg;
55extern struct iwl_cfg iwl5100_bg_cfg; 57extern struct iwl_cfg iwl5100_bg_cfg;
56extern struct iwl_cfg iwl5100_abg_cfg; 58extern struct iwl_cfg iwl5100_abg_cfg;
57extern struct iwl_cfg iwl5150_agn_cfg; 59extern struct iwl_cfg iwl5150_agn_cfg;
60extern struct iwl_cfg iwl6000_2ag_cfg;
61extern struct iwl_cfg iwl6000_2agn_cfg;
62extern struct iwl_cfg iwl6000_3agn_cfg;
63extern struct iwl_cfg iwl6050_2agn_cfg;
64extern struct iwl_cfg iwl6050_3agn_cfg;
65extern struct iwl_cfg iwl100_bgn_cfg;
66
67/* shared structures from iwl-5000.c */
68extern struct iwl_mod_params iwl50_mod_params;
69extern struct iwl_ops iwl5000_ops;
70extern struct iwl_lib_ops iwl5000_lib;
71extern struct iwl_hcmd_ops iwl5000_hcmd;
72extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils;
73
74/* shared functions from iwl-5000.c */
75extern u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len);
76extern u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd,
77 u8 *data);
78extern void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
79 __le32 *tx_flags);
80extern int iwl5000_calc_rssi(struct iwl_priv *priv,
81 struct iwl_rx_phy_res *rx_resp);
58 82
59/* CT-KILL constants */ 83/* CT-KILL constants */
60#define CT_KILL_THRESHOLD 110 /* in Celsius */ 84#define CT_KILL_THRESHOLD 110 /* in Celsius */
@@ -132,9 +156,12 @@ struct iwl_tx_info {
132 * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame 156 * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
133 * descriptors) and required locking structures. 157 * descriptors) and required locking structures.
134 */ 158 */
159#define TFD_TX_CMD_SLOTS 256
160#define TFD_CMD_SLOTS 32
161
135struct iwl_tx_queue { 162struct iwl_tx_queue {
136 struct iwl_queue q; 163 struct iwl_queue q;
137 struct iwl_tfd *tfds; 164 void *tfds;
138 struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS]; 165 struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS];
139 struct iwl_tx_info *txb; 166 struct iwl_tx_info *txb;
140 u8 need_update; 167 u8 need_update;
@@ -154,6 +181,36 @@ struct iwl4965_channel_tgh_info {
154 s64 last_radar_time; 181 s64 last_radar_time;
155}; 182};
156 183
184#define IWL4965_MAX_RATE (33)
185
186struct iwl3945_clip_group {
187 /* maximum power level to prevent clipping for each rate, derived by
188 * us from this band's saturation power in EEPROM */
189 const s8 clip_powers[IWL_MAX_RATES];
190};
191
192/* current Tx power values to use, one for each rate for each channel.
193 * requested power is limited by:
194 * -- regulatory EEPROM limits for this channel
195 * -- hardware capabilities (clip-powers)
196 * -- spectrum management
197 * -- user preference (e.g. iwconfig)
198 * when requested power is set, base power index must also be set. */
199struct iwl3945_channel_power_info {
200 struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
201 s8 power_table_index; /* actual (compenst'd) index into gain table */
202 s8 base_power_index; /* gain index for power at factory temp. */
203 s8 requested_power; /* power (dBm) requested for this chnl/rate */
204};
205
206/* current scan Tx power values to use, one for each scan rate for each
207 * channel. */
208struct iwl3945_scan_power_info {
209 struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
210 s8 power_table_index; /* actual (compenst'd) index into gain table */
211 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
212};
213
157/* 214/*
158 * One for each channel, holds all channel setup data 215 * One for each channel, holds all channel setup data
159 * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant 216 * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
@@ -184,8 +241,15 @@ struct iwl_channel_info {
184 s8 fat_scan_power; /* (dBm) eeprom, direct scans, any rate */ 241 s8 fat_scan_power; /* (dBm) eeprom, direct scans, any rate */
185 u8 fat_flags; /* flags copied from EEPROM */ 242 u8 fat_flags; /* flags copied from EEPROM */
186 u8 fat_extension_channel; /* HT_IE_EXT_CHANNEL_* */ 243 u8 fat_extension_channel; /* HT_IE_EXT_CHANNEL_* */
187};
188 244
245 /* Radio/DSP gain settings for each "normal" data Tx rate.
246 * These include, in addition to RF and DSP gain, a few fields for
247 * remembering/modifying gain settings (indexes). */
248 struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE];
249
250 /* Radio/DSP gain settings for each scan rate, for directed scans. */
251 struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
252};
189 253
190#define IWL_TX_FIFO_AC0 0 254#define IWL_TX_FIFO_AC0 0
191#define IWL_TX_FIFO_AC1 1 255#define IWL_TX_FIFO_AC1 1
@@ -370,7 +434,7 @@ struct iwl_hw_key {
370 u8 key[32]; 434 u8 key[32];
371}; 435};
372 436
373union iwl4965_ht_rate_supp { 437union iwl_ht_rate_supp {
374 u16 rates; 438 u16 rates;
375 struct { 439 struct {
376 u8 siso_rate; 440 u8 siso_rate;
@@ -430,6 +494,24 @@ struct iwl_qos_info {
430#define STA_PS_STATUS_WAKE 0 494#define STA_PS_STATUS_WAKE 0
431#define STA_PS_STATUS_SLEEP 1 495#define STA_PS_STATUS_SLEEP 1
432 496
497struct iwl3945_tid_data {
498 u16 seq_number;
499};
500
501struct iwl3945_hw_key {
502 enum ieee80211_key_alg alg;
503 int keylen;
504 u8 key[32];
505};
506
507struct iwl3945_station_entry {
508 struct iwl3945_addsta_cmd sta;
509 struct iwl3945_tid_data tid[MAX_TID_COUNT];
510 u8 used;
511 u8 ps_status;
512 struct iwl3945_hw_key keyinfo;
513};
514
433struct iwl_station_entry { 515struct iwl_station_entry {
434 struct iwl_addsta_cmd sta; 516 struct iwl_addsta_cmd sta;
435 struct iwl_tid_data tid[MAX_TID_COUNT]; 517 struct iwl_tid_data tid[MAX_TID_COUNT];
@@ -497,11 +579,13 @@ struct iwl_sensitivity_ranges {
497 * @max_txq_num: Max # Tx queues supported 579 * @max_txq_num: Max # Tx queues supported
498 * @dma_chnl_num: Number of Tx DMA/FIFO channels 580 * @dma_chnl_num: Number of Tx DMA/FIFO channels
499 * @scd_bc_tbls_size: size of scheduler byte count tables 581 * @scd_bc_tbls_size: size of scheduler byte count tables
582 * @tfd_size: TFD size
500 * @tx/rx_chains_num: Number of TX/RX chains 583 * @tx/rx_chains_num: Number of TX/RX chains
501 * @valid_tx/rx_ant: usable antennas 584 * @valid_tx/rx_ant: usable antennas
502 * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2) 585 * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
503 * @max_rxq_log: Log-base-2 of max_rxq_size 586 * @max_rxq_log: Log-base-2 of max_rxq_size
504 * @rx_buf_size: Rx buffer size 587 * @rx_buf_size: Rx buffer size
588 * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
505 * @max_stations: 589 * @max_stations:
506 * @bcast_sta_id: 590 * @bcast_sta_id:
507 * @fat_channel: is 40MHz width possible in band 2.4 591 * @fat_channel: is 40MHz width possible in band 2.4
@@ -516,6 +600,7 @@ struct iwl_hw_params {
516 u8 max_txq_num; 600 u8 max_txq_num;
517 u8 dma_chnl_num; 601 u8 dma_chnl_num;
518 u16 scd_bc_tbls_size; 602 u16 scd_bc_tbls_size;
603 u32 tfd_size;
519 u8 tx_chains_num; 604 u8 tx_chains_num;
520 u8 rx_chains_num; 605 u8 rx_chains_num;
521 u8 valid_tx_ant; 606 u8 valid_tx_ant;
@@ -523,6 +608,7 @@ struct iwl_hw_params {
523 u16 max_rxq_size; 608 u16 max_rxq_size;
524 u16 max_rxq_log; 609 u16 max_rxq_log;
525 u32 rx_buf_size; 610 u32 rx_buf_size;
611 u32 rx_wrt_ptr_reg;
526 u32 max_pkt_size; 612 u32 max_pkt_size;
527 u8 max_stations; 613 u8 max_stations;
528 u8 bcast_sta_id; 614 u8 bcast_sta_id;
@@ -755,7 +841,7 @@ struct iwl_priv {
755 841
756 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; 842 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
757 843
758#ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 844#if defined(CONFIG_IWLAGN_SPECTRUM_MEASUREMENT) || defined(CONFIG_IWL3945_SPECTRUM_MEASUREMENT)
759 /* spectrum measurement report caching */ 845 /* spectrum measurement report caching */
760 struct iwl_spectrum_notification measure_report; 846 struct iwl_spectrum_notification measure_report;
761 u8 measurement_status; 847 u8 measurement_status;
@@ -768,6 +854,10 @@ struct iwl_priv {
768 struct iwl_channel_info *channel_info; /* channel info array */ 854 struct iwl_channel_info *channel_info; /* channel info array */
769 u8 channel_count; /* # of channels */ 855 u8 channel_count; /* # of channels */
770 856
857 /* each calibration channel group in the EEPROM has a derived
858 * clip setting for each rate. 3945 only.*/
859 const struct iwl3945_clip_group clip39_groups[5];
860
771 /* thermal calibration */ 861 /* thermal calibration */
772 s32 temperature; /* degrees Kelvin */ 862 s32 temperature; /* degrees Kelvin */
773 s32 last_temperature; 863 s32 last_temperature;
@@ -781,7 +871,7 @@ struct iwl_priv {
781 unsigned long scan_start; 871 unsigned long scan_start;
782 unsigned long scan_pass_start; 872 unsigned long scan_pass_start;
783 unsigned long scan_start_tsf; 873 unsigned long scan_start_tsf;
784 struct iwl_scan_cmd *scan; 874 void *scan;
785 int scan_bands; 875 int scan_bands;
786 int one_direct_scan; 876 int one_direct_scan;
787 u8 direct_ssid_len; 877 u8 direct_ssid_len;
@@ -832,18 +922,25 @@ struct iwl_priv {
832 * 4965's initialize alive response contains some calibration data. */ 922 * 4965's initialize alive response contains some calibration data. */
833 struct iwl_init_alive_resp card_alive_init; 923 struct iwl_init_alive_resp card_alive_init;
834 struct iwl_alive_resp card_alive; 924 struct iwl_alive_resp card_alive;
835#ifdef CONFIG_IWLWIFI_RFKILL 925#if defined(CONFIG_IWLWIFI_RFKILL) || defined(CONFIG_IWL3945_RFKILL)
836 struct rfkill *rfkill; 926 struct rfkill *rfkill;
837#endif 927#endif
838 928
839#ifdef CONFIG_IWLWIFI_LEDS 929#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS)
840 struct iwl_led led[IWL_LED_TRG_MAX];
841 unsigned long last_blink_time; 930 unsigned long last_blink_time;
842 u8 last_blink_rate; 931 u8 last_blink_rate;
843 u8 allow_blinking; 932 u8 allow_blinking;
844 u64 led_tpt; 933 u64 led_tpt;
845#endif 934#endif
846 935
936#ifdef CONFIG_IWLWIFI_LEDS
937 struct iwl_led led[IWL_LED_TRG_MAX];
938#endif
939
940#ifdef CONFIG_IWL3945_LEDS
941 struct iwl3945_led led39[IWL_LED_TRG_MAX];
942 unsigned int rxtxpackets;
943#endif
847 u16 active_rate; 944 u16 active_rate;
848 u16 active_rate_basic; 945 u16 active_rate_basic;
849 946
@@ -893,7 +990,6 @@ struct iwl_priv {
893 u16 rates_mask; 990 u16 rates_mask;
894 991
895 u32 power_mode; 992 u32 power_mode;
896 u32 antenna;
897 u8 bssid[ETH_ALEN]; 993 u8 bssid[ETH_ALEN];
898 u16 rts_threshold; 994 u16 rts_threshold;
899 u8 mac_addr[ETH_ALEN]; 995 u8 mac_addr[ETH_ALEN];
@@ -929,6 +1025,10 @@ struct iwl_priv {
929 u16 beacon_int; 1025 u16 beacon_int;
930 struct ieee80211_vif *vif; 1026 struct ieee80211_vif *vif;
931 1027
1028 /*Added for 3945 */
1029 void *shared_virt;
1030 dma_addr_t shared_phys;
1031 /*End*/
932 struct iwl_hw_params hw_params; 1032 struct iwl_hw_params hw_params;
933 1033
934 1034
@@ -960,6 +1060,11 @@ struct iwl_priv {
960 struct delayed_work init_alive_start; 1060 struct delayed_work init_alive_start;
961 struct delayed_work alive_start; 1061 struct delayed_work alive_start;
962 struct delayed_work scan_check; 1062 struct delayed_work scan_check;
1063
1064 /*For 3945 only*/
1065 struct delayed_work thermal_periodic;
1066 struct delayed_work rfkill_poll;
1067
963 /* TX Power */ 1068 /* TX Power */
964 s8 tx_power_user_lmt; 1069 s8 tx_power_user_lmt;
965 s8 tx_power_channel_lmt; 1070 s8 tx_power_channel_lmt;
@@ -982,6 +1087,15 @@ struct iwl_priv {
982 u32 disable_tx_power_cal; 1087 u32 disable_tx_power_cal;
983 struct work_struct run_time_calib_work; 1088 struct work_struct run_time_calib_work;
984 struct timer_list statistics_periodic; 1089 struct timer_list statistics_periodic;
1090
1091 /*For 3945*/
1092#define IWL_DEFAULT_TX_POWER 0x0F
1093
1094 struct iwl3945_notif_statistics statistics_39;
1095
1096 struct iwl3945_station_entry stations_39[IWL_STATION_COUNT];
1097
1098 u32 sta_supp_rates;
985}; /*iwl_priv */ 1099}; /*iwl_priv */
986 1100
987static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id) 1101static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id)