1 /******************************************************************************
 
   3  * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved.
 
   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.
 
   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
 
  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
 
  18  * The full GNU General Public License is included in this distribution in the
 
  19  * file called LICENSE.
 
  21  * Contact Information:
 
  22  * James P. Ketrenos <ipw2100-admin@linux.intel.com>
 
  23  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
 
  25  *****************************************************************************/
 
  27 #ifndef __iwl_priv_h__
 
  28 #define __iwl_priv_h__
 
  30 #include <linux/workqueue.h>
 
  32 #ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT
 
  35         MEASUREMENT_READY = (1 << 0),
 
  36         MEASUREMENT_ACTIVE = (1 << 1),
 
  43         /* ieee device used by generic ieee processing code */
 
  44         struct ieee80211_hw *hw;
 
  45         struct ieee80211_channel *ieee_channels;
 
  46         struct ieee80211_rate *ieee_rates;
 
  48         /* temporary frame storage list */
 
  49         struct list_head free_frames;
 
  55         void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
 
  56                                        struct iwl_rx_mem_buffer *rxb);
 
  58         const struct ieee80211_hw_mode *modes;
 
  60 #ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT
 
  61         /* spectrum measurement report caching */
 
  62         struct iwl_spectrum_notification measure_report;
 
  63         u8 measurement_status;
 
  65         /* ucode beacon time */
 
  66         u32 ucode_beacon_time;
 
  68         /* we allocate array of iwl_channel_info for NIC's valid channels.
 
  69          *    Access via channel # using indirect index array */
 
  70         struct iwl_channel_info *channel_info;  /* channel info array */
 
  71         u8 channel_count;       /* # of channels */
 
  73         /* each calibration channel group in the EEPROM has a derived
 
  74          * clip setting for each rate. */
 
  75         const struct iwl_clip_group clip_groups[5];
 
  77         /* thermal calibration */
 
  78         s32 temperature;        /* degrees Kelvin */
 
  81         /* Scan related variables */
 
  82         unsigned long last_scan_jiffies;
 
  83         unsigned long scan_start;
 
  84         unsigned long scan_pass_start;
 
  85         unsigned long scan_start_tsf;
 
  89         u8 direct_ssid[IW_ESSID_MAX_SIZE];
 
  90         struct iwl_scan_cmd *scan;
 
  91         u8 only_active_channel;
 
  94         spinlock_t lock;        /* protect general shared data */
 
  95         spinlock_t hcmd_lock;   /* protect hcmd */
 
  98         /* basic pci-network driver stuff */
 
  99         struct pci_dev *pci_dev;
 
 101         /* pci hardware address support */
 
 102         void __iomem *hw_base;
 
 104         /* uCode images, save to reload in case of failure */
 
 105         struct fw_image_desc ucode_code;        /* runtime inst */
 
 106         struct fw_image_desc ucode_data;        /* runtime data original */
 
 107         struct fw_image_desc ucode_data_backup; /* runtime data save/restore */
 
 108         struct fw_image_desc ucode_init;        /* initialization inst */
 
 109         struct fw_image_desc ucode_init_data;   /* initialization data */
 
 110         struct fw_image_desc ucode_boot;        /* bootstrap inst */
 
 113         struct iwl_rxon_time_cmd rxon_timing;
 
 115         /* We declare this const so it can only be
 
 116          * changed via explicit cast within the
 
 117          * routines that actually update the physical
 
 119         const struct iwl_rxon_cmd active_rxon;
 
 120         struct iwl_rxon_cmd staging_rxon;
 
 122         int error_recovering;
 
 123         struct iwl_rxon_cmd recovery_rxon;
 
 125         /* 1st responses from initialize and runtime uCode images.
 
 126          * 4965's initialize alive response contains some calibration data. */
 
 127         struct iwl_init_alive_resp card_alive_init;
 
 128         struct iwl_alive_resp card_alive;
 
 131         /* LED related variables */
 
 132         struct iwl_activity_blink activity;
 
 133         unsigned long led_packets;
 
 138         u16 active_rate_basic;
 
 140         u8 call_post_assoc_from_beacon;
 
 141         u8 assoc_station_added;
 
 143         u8 use_ant_b_for_management_frame;      /* Tx antenna selection */
 
 147         u8 channel_width;       /* 0=20MHZ, 1=40MHZ */
 
 148         u8 current_channel_width;
 
 149         u8 valid_antenna;       /* Bit mask of antennas actually connected */
 
 150 #ifdef CONFIG_IWLWIFI_SENSITIVITY
 
 151         struct iwl_sensitivity_data sensitivity_data;
 
 152         struct iwl_chain_noise_data chain_noise_data;
 
 154         __le16 sensitivity_tbl[HD_TABLE_SIZE];
 
 155 #endif /*CONFIG_IWLWIFI_SENSITIVITY*/
 
 157 #ifdef CONFIG_IWLWIFI_HT
 
 158         struct sta_ht_info current_assoc_ht;
 
 160         u8 active_rate_ht[2];
 
 161         u8 last_phy_res[100];
 
 163         /* Rate scaling data */
 
 164         struct iwl_lq_mngr lq_mngr;
 
 167         /* Rate scaling data */
 
 171         wait_queue_head_t wait_command_queue;
 
 173         int activity_timer_active;
 
 175         /* Rx and Tx DMA processing queues */
 
 176         struct iwl_rx_queue rxq;
 
 177         struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES];
 
 179         unsigned long txq_ctx_active_msk;
 
 180         struct iwl_kw kw;       /* keep warm address */
 
 181         u32 scd_base_addr;      /* scheduler sram base address */
 
 184         unsigned long status;
 
 187         int last_rx_rssi;       /* From Rx packet statisitics */
 
 188         int last_rx_noise;      /* From beacon statistics */
 
 190         struct iwl_power_mgr power_data;
 
 192         struct iwl_notif_statistics statistics;
 
 193         unsigned long last_statistics_time;
 
 195         /* context information */
 
 196         u8 essid[IW_ESSID_MAX_SIZE];
 
 204         u8 mac_addr[ETH_ALEN];
 
 206         /*station table variables */
 
 209         struct iwl_station_entry stations[IWL_STATION_COUNT];
 
 211         /* Indication if ieee80211_ops->open has been called */
 
 214         u8 mac80211_registered;
 
 217         u32 notif_missed_beacons;
 
 219         /* Rx'd packet timing information */
 
 220         u32 last_beacon_time;
 
 223         /* Duplicate packet detection */
 
 226         unsigned long last_packet_time;
 
 227         struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE];
 
 230         struct iwl_eeprom eeprom;
 
 234         struct sk_buff *ibss_beacon;
 
 236         /* Last Rx'd beacon timestamp */
 
 240         struct iwl_driver_hw_info hw_setting;
 
 243         /* Current association information needed to configure the
 
 246         u16 assoc_capability;
 
 249 #ifdef CONFIG_IWLWIFI_QOS
 
 250         struct iwl_qos_info qos_data;
 
 251 #endif /*CONFIG_IWLWIFI_QOS */
 
 253         struct workqueue_struct *workqueue;
 
 255         struct work_struct up;
 
 256         struct work_struct restart;
 
 257         struct work_struct calibrated_work;
 
 258         struct work_struct scan_completed;
 
 259         struct work_struct rx_replenish;
 
 260         struct work_struct rf_kill;
 
 261         struct work_struct abort_scan;
 
 262         struct work_struct update_link_led;
 
 263         struct work_struct auth_work;
 
 264         struct work_struct report_work;
 
 265         struct work_struct request_scan;
 
 266         struct work_struct beacon_update;
 
 268         struct tasklet_struct irq_tasklet;
 
 270         struct delayed_work init_alive_start;
 
 271         struct delayed_work alive_start;
 
 272         struct delayed_work activity_timer;
 
 273         struct delayed_work thermal_periodic;
 
 274         struct delayed_work gather_stats;
 
 275         struct delayed_work scan_check;
 
 276         struct delayed_work post_associate;
 
 278 #define IWL_DEFAULT_TX_POWER 0x0F
 
 279         s8 user_txpower_limit;
 
 280         s8 max_channel_txpower_limit;
 
 281         u32 cck_power_index_compensation;
 
 287 #ifdef CONFIG_IWLWIFI_DEBUG
 
 290         atomic_t restrict_refcnt;
 
 294         struct work_struct txpower_work;
 
 295 #ifdef CONFIG_IWLWIFI_SENSITIVITY
 
 296         struct work_struct sensitivity_work;
 
 298         struct work_struct statistics_work;
 
 299         struct timer_list statistics_periodic;
 
 301 #ifdef CONFIG_IWLWIFI_HT_AGG
 
 302         struct work_struct agg_work;
 
 308 #endif /* __iwl_priv_h__ */