aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945.h
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2008-12-18 21:37:15 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:59:01 -0500
commitd20b3c65f2a3e18ea86542e6ca4fe1c6d16c91df (patch)
tree78f8c8e4861160f0751240a8c65e2d8b0d9ab785 /drivers/net/wireless/iwlwifi/iwl-3945.h
parent1125eff3ae26b2e39c6bf940b5e0b8774ebd2896 (diff)
iwl3945: iwl3945_queue and iwl3945_channel_info replacement
This patch replaces the queue and channel info 3945 structures with the iwl ones. The initial goal was to replace the channel info structure. Once we do that, and then include iwl-dev.h instead of iwl-3945.h, we still get build errors due to several routines and macro redefinitions. This is why this patch also includes: - TFD39_MAX_PAYLOAD definition for 3945. - CMD_SIZE, CMD_HUGE, CMD_SKB duplication removal. - iwl3945_queue replacement in order to also get rid of the duplicated get_cmd_index routine. Getting rid of any of those needs the iwl-dev.h inclusion which then creates build errors due to definitions duplication. This is why we include all those in the same patch. Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com> Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h155
1 files changed, 6 insertions, 149 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index dd15b3203a6f..46bbd8180bad 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -48,6 +48,7 @@ extern struct pci_device_id iwl3945_hw_card_ids[];
48#include "iwl-3945-hw.h" 48#include "iwl-3945-hw.h"
49#include "iwl-debug.h" 49#include "iwl-debug.h"
50#include "iwl-power.h" 50#include "iwl-power.h"
51#include "iwl-dev.h"
51#include "iwl-3945-led.h" 52#include "iwl-3945-led.h"
52 53
53/* Highest firmware API version supported */ 54/* Highest firmware API version supported */
@@ -111,26 +112,7 @@ struct iwl3945_rx_mem_buffer {
111 struct list_head list; 112 struct list_head list;
112}; 113};
113 114
114/* 115int iwl3945_x2_queue_used(const struct iwl_queue *q, int i);
115 * Generic queue structure
116 *
117 * Contains common data for Rx and Tx queues
118 */
119struct iwl3945_queue {
120 int n_bd; /* number of BDs in this queue */
121 int write_ptr; /* 1-st empty entry (index) host_w*/
122 int read_ptr; /* last used entry (index) host_r*/
123 dma_addr_t dma_addr; /* physical addr for BD's */
124 int n_window; /* safe queue window */
125 u32 id;
126 int low_mark; /* low watermark, resume queue if free
127 * space more than this */
128 int high_mark; /* high watermark, stop queue if free
129 * space less than this */
130} __attribute__ ((packed));
131
132int iwl3945_queue_space(const struct iwl3945_queue *q);
133int iwl3945_x2_queue_used(const struct iwl3945_queue *q, int i);
134 116
135#define MAX_NUM_OF_TBS (20) 117#define MAX_NUM_OF_TBS (20)
136 118
@@ -152,7 +134,7 @@ struct iwl3945_tx_info {
152 * descriptors) and required locking structures. 134 * descriptors) and required locking structures.
153 */ 135 */
154struct iwl3945_tx_queue { 136struct iwl3945_tx_queue {
155 struct iwl3945_queue q; 137 struct iwl_queue q;
156 struct iwl3945_tfd_frame *bd; 138 struct iwl3945_tfd_frame *bd;
157 struct iwl3945_cmd *cmd; 139 struct iwl3945_cmd *cmd;
158 dma_addr_t dma_addr_cmd; 140 dma_addr_t dma_addr_cmd;
@@ -161,73 +143,6 @@ struct iwl3945_tx_queue {
161 int active; 143 int active;
162}; 144};
163 145
164#define IWL_NUM_SCAN_RATES (2)
165
166struct iwl3945_channel_tgd_info {
167 u8 type;
168 s8 max_power;
169};
170
171struct iwl3945_channel_tgh_info {
172 s64 last_radar_time;
173};
174
175/* current Tx power values to use, one for each rate for each channel.
176 * requested power is limited by:
177 * -- regulatory EEPROM limits for this channel
178 * -- hardware capabilities (clip-powers)
179 * -- spectrum management
180 * -- user preference (e.g. iwconfig)
181 * when requested power is set, base power index must also be set. */
182struct iwl3945_channel_power_info {
183 struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
184 s8 power_table_index; /* actual (compenst'd) index into gain table */
185 s8 base_power_index; /* gain index for power at factory temp. */
186 s8 requested_power; /* power (dBm) requested for this chnl/rate */
187};
188
189/* current scan Tx power values to use, one for each scan rate for each
190 * channel. */
191struct iwl3945_scan_power_info {
192 struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
193 s8 power_table_index; /* actual (compenst'd) index into gain table */
194 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
195};
196
197/*
198 * One for each channel, holds all channel setup data
199 * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
200 * with one another!
201 */
202#define IWL4965_MAX_RATE (33)
203
204struct iwl3945_channel_info {
205 struct iwl3945_channel_tgd_info tgd;
206 struct iwl3945_channel_tgh_info tgh;
207 struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */
208 struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for
209 * FAT channel */
210
211 u8 channel; /* channel number */
212 u8 flags; /* flags copied from EEPROM */
213 s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
214 s8 curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) */
215 s8 min_power; /* always 0 */
216 s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */
217
218 u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */
219 u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */
220 enum ieee80211_band band;
221
222 /* Radio/DSP gain settings for each "normal" data Tx rate.
223 * These include, in addition to RF and DSP gain, a few fields for
224 * remembering/modifying gain settings (indexes). */
225 struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE];
226
227 /* Radio/DSP gain settings for each scan rate, for directed scans. */
228 struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
229};
230
231struct iwl3945_clip_group { 146struct iwl3945_clip_group {
232 /* maximum power level to prevent clipping for each rate, derived by 147 /* maximum power level to prevent clipping for each rate, derived by
233 * us from this band's saturation power in EEPROM */ 148 * us from this band's saturation power in EEPROM */
@@ -266,15 +181,6 @@ struct iwl3945_frame {
266#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) 181#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
267#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) 182#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
268 183
269enum {
270 /* CMD_SIZE_NORMAL = 0, */
271 CMD_SIZE_HUGE = (1 << 0),
272 /* CMD_SYNC = 0, */
273 CMD_ASYNC = (1 << 1),
274 /* CMD_NO_SKB = 0, */
275 CMD_WANT_SKB = (1 << 2),
276};
277
278struct iwl3945_cmd; 184struct iwl3945_cmd;
279struct iwl3945_priv; 185struct iwl3945_priv;
280 186
@@ -328,7 +234,7 @@ struct iwl3945_host_cmd {
328 const void *data; 234 const void *data;
329}; 235};
330 236
331#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \ 237#define TFD39_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \
332 sizeof(struct iwl3945_cmd_meta)) 238 sizeof(struct iwl3945_cmd_meta))
333 239
334/* 240/*
@@ -453,13 +359,6 @@ struct iwl3945_station_entry {
453 struct iwl3945_hw_key keyinfo; 359 struct iwl3945_hw_key keyinfo;
454}; 360};
455 361
456/* one for each uCode image (inst/data, boot/init/runtime) */
457struct fw_desc {
458 void *v_addr; /* access by driver */
459 dma_addr_t p_addr; /* access by card's busmaster DMA */
460 u32 len; /* bytes */
461};
462
463/* uCode file layout */ 362/* uCode file layout */
464struct iwl3945_ucode { 363struct iwl3945_ucode {
465 __le32 ver; /* major/minor/API/serial */ 364 __le32 ver; /* major/minor/API/serial */
@@ -629,16 +528,6 @@ extern int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv);
629extern u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id, 528extern u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id,
630 u16 tx_rate, u8 flags); 529 u16 tx_rate, u8 flags);
631 530
632
633#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
634
635enum {
636 MEASUREMENT_READY = (1 << 0),
637 MEASUREMENT_ACTIVE = (1 << 1),
638};
639
640#endif
641
642#ifdef CONFIG_IWL3945_RFKILL 531#ifdef CONFIG_IWL3945_RFKILL
643struct iwl3945_priv; 532struct iwl3945_priv;
644 533
@@ -682,7 +571,7 @@ struct iwl3945_priv {
682 571
683 /* we allocate array of iwl3945_channel_info for NIC's valid channels. 572 /* we allocate array of iwl3945_channel_info for NIC's valid channels.
684 * Access via channel # using indirect index array */ 573 * Access via channel # using indirect index array */
685 struct iwl3945_channel_info *channel_info; /* channel info array */ 574 struct iwl_channel_info *channel_info; /* channel info array */
686 u8 channel_count; /* # of channels */ 575 u8 channel_count; /* # of channels */
687 576
688 /* each calibration channel group in the EEPROM has a derived 577 /* each calibration channel group in the EEPROM has a derived
@@ -873,39 +762,7 @@ static inline int iwl3945_is_associated(struct iwl3945_priv *priv)
873 return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; 762 return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
874} 763}
875 764
876static inline int is_channel_valid(const struct iwl3945_channel_info *ch_info) 765extern const struct iwl_channel_info *iwl3945_get_channel_info(
877{
878 if (ch_info == NULL)
879 return 0;
880 return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
881}
882
883static inline int is_channel_radar(const struct iwl3945_channel_info *ch_info)
884{
885 return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
886}
887
888static inline u8 is_channel_a_band(const struct iwl3945_channel_info *ch_info)
889{
890 return ch_info->band == IEEE80211_BAND_5GHZ;
891}
892
893static inline u8 is_channel_bg_band(const struct iwl3945_channel_info *ch_info)
894{
895 return ch_info->band == IEEE80211_BAND_2GHZ;
896}
897
898static inline int is_channel_passive(const struct iwl3945_channel_info *ch)
899{
900 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
901}
902
903static inline int is_channel_ibss(const struct iwl3945_channel_info *ch)
904{
905 return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
906}
907
908extern const struct iwl3945_channel_info *iwl3945_get_channel_info(
909 const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel); 766 const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel);
910 767
911extern int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate); 768extern int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate);