]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/iwlwifi/iwl-dev.h
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / iwlwifi / iwl-dev.h
index 9966d4e384ce75d37264345431be2122a5304c68..0468fcc1ea98ed58d42e6988cb248a7a162a3589 100644 (file)
@@ -19,7 +19,7 @@
  * file called LICENSE.
  *
  * Contact Information:
- * James P. Ketrenos <ipw2100-admin@linux.intel.com>
+ *  Intel Linux Wireless <ilw@linux.intel.com>
  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  *
  *****************************************************************************/
@@ -54,6 +54,7 @@ extern struct iwl_cfg iwl5100_agn_cfg;
 extern struct iwl_cfg iwl5350_agn_cfg;
 extern struct iwl_cfg iwl5100_bg_cfg;
 extern struct iwl_cfg iwl5100_abg_cfg;
+extern struct iwl_cfg iwl5150_agn_cfg;
 
 /* CT-KILL constants */
 #define CT_KILL_THRESHOLD      110 /* in Celsius */
@@ -113,11 +114,9 @@ struct iwl_queue {
                                * space less than this */
 } __attribute__ ((packed));
 
-#define MAX_NUM_OF_TBS          (20)
-
 /* One for each TFD */
 struct iwl_tx_info {
-       struct sk_buff *skb[MAX_NUM_OF_TBS];
+       struct sk_buff *skb[IWL_NUM_OF_TBS - 1];
 };
 
 /**
@@ -135,12 +134,13 @@ struct iwl_tx_info {
  */
 struct iwl_tx_queue {
        struct iwl_queue q;
-       struct iwl_tfd_frame *bd;
+       struct iwl_tfd *tfds;
        struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS];
        struct iwl_tx_info *txb;
-       int need_update;
-       int sched_retry;
-       int active;
+       u8 need_update;
+       u8 sched_retry;
+       u8 active;
+       u8 swq_id;
 };
 
 #define IWL_NUM_SCAN_RATES         (2)
@@ -186,12 +186,6 @@ struct iwl_channel_info {
        u8 fat_extension_channel; /* HT_IE_EXT_CHANNEL_* */
 };
 
-struct iwl4965_clip_group {
-       /* maximum power level to prevent clipping for each rate, derived by
-        *   us from this band's saturation power in EEPROM */
-       const s8 clip_powers[IWL_MAX_RATES];
-};
-
 
 #define IWL_TX_FIFO_AC0        0
 #define IWL_TX_FIFO_AC1        1
@@ -253,7 +247,8 @@ struct iwl_cmd_meta {
        /* The CMD_SIZE_HUGE flag bit indicates that the command
         * structure is stored at the end of the shared queue memory. */
        u32 flags;
-
+       DECLARE_PCI_UNMAP_ADDR(mapping)
+       DECLARE_PCI_UNMAP_LEN(len)
 } __attribute__ ((packed));
 
 #define IWL_CMD_MAX_PAYLOAD 320
@@ -269,24 +264,16 @@ struct iwl_cmd {
        struct iwl_cmd_meta meta;       /* driver data */
        struct iwl_cmd_header hdr;      /* uCode API */
        union {
-               struct iwl_addsta_cmd addsta;
-               struct iwl_led_cmd led;
                u32 flags;
                u8 val8;
                u16 val16;
                u32 val32;
-               struct iwl4965_bt_cmd bt;
-               struct iwl4965_rxon_time_cmd rxon_time;
-               struct iwl_powertable_cmd powertable;
-               struct iwl_qosparam_cmd qosparam;
                struct iwl_tx_cmd tx;
-               struct iwl4965_rxon_assoc_cmd rxon_assoc;
-               struct iwl_rem_sta_cmd rm_sta;
-               u8 *indirect;
                u8 payload[IWL_CMD_MAX_PAYLOAD];
        } __attribute__ ((packed)) cmd;
 } __attribute__ ((packed));
 
+
 struct iwl_host_cmd {
        u8 id;
        u16 len;
@@ -309,7 +296,6 @@ struct iwl_host_cmd {
 
 /**
  * struct iwl_rx_queue - Rx queue
- * @processed: Internal index to last handled Rx packet
  * @read: Shared index to newest available Rx buffer
  * @write: Shared index to oldest written Rx packet
  * @free_count: Number of pre-allocated buffers in rx_free
@@ -324,26 +310,19 @@ struct iwl_rx_queue {
        dma_addr_t dma_addr;
        struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
        struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
-       u32 processed;
        u32 read;
        u32 write;
        u32 free_count;
        struct list_head rx_free;
        struct list_head rx_used;
        int need_update;
+       struct iwl_rb_status *rb_stts;
+       dma_addr_t rb_stts_dma;
        spinlock_t lock;
 };
 
 #define IWL_SUPPORTED_RATES_IE_LEN         8
 
-#define SCAN_INTERVAL 100
-
-#define MAX_A_CHANNELS  252
-#define MIN_A_CHANNELS  7
-
-#define MAX_B_CHANNELS  14
-#define MIN_B_CHANNELS  1
-
 #define MAX_TID_COUNT        9
 
 #define IWL_INVALID_RATE     0xFF
@@ -413,9 +392,8 @@ struct iwl_ht_info {
        u8 max_amsdu_size;
        u8 ampdu_factor;
        u8 mpdu_density;
-       u8 supp_mcs_set[16];
+       struct ieee80211_mcs_info mcs;
        /* BSS related data */
-       u8 control_channel;
        u8 extension_chan_offset;
        u8 tx_chan_width;
        u8 ht_protection;
@@ -444,7 +422,6 @@ union iwl_qos_capabity {
 
 /* QoS structures */
 struct iwl_qos_info {
-       int qos_enable;
        int qos_active;
        union iwl_qos_capabity qos_cap;
        struct iwl_qosparam_cmd def_qos_parm;
@@ -470,7 +447,7 @@ struct fw_desc {
 
 /* uCode file layout */
 struct iwl_ucode {
-       __le32 ver;             /* major/minor/subminor */
+       __le32 ver;             /* major/minor/API/serial */
        __le32 inst_size;       /* bytes of runtime instructions */
        __le32 data_size;       /* bytes of runtime data */
        __le32 init_size;       /* bytes of initialization instructions */
@@ -511,11 +488,15 @@ struct iwl_sensitivity_ranges {
 };
 
 
-#define IWL_FAT_CHANNEL_52 BIT(IEEE80211_BAND_5GHZ)
+#define KELVIN_TO_CELSIUS(x) ((x)-273)
+#define CELSIUS_TO_KELVIN(x) ((x)+273)
+
 
 /**
  * struct iwl_hw_params
  * @max_txq_num: Max # Tx queues supported
+ * @dma_chnl_num: Number of Tx DMA/FIFO channels
+ * @scd_bc_tbls_size: size of scheduler byte count tables
  * @tx/rx_chains_num: Number of TX/RX chains
  * @valid_tx/rx_ant: usable antennas
  * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
@@ -528,11 +509,13 @@ struct iwl_sensitivity_ranges {
  * @sw_crypto: 0 for hw, 1 for sw
  * @max_xxx_size: for ucode uses
  * @ct_kill_threshold: temperature threshold
+ * @calib_init_cfg: setup initial calibrations for the hw
  * @struct iwl_sensitivity_ranges: range of sensitivity values
- * @first_ampdu_q: first HW queue available for ampdu
  */
 struct iwl_hw_params {
-       u16 max_txq_num;
+       u8 max_txq_num;
+       u8 dma_chnl_num;
+       u16 scd_bc_tbls_size;
        u8  tx_chains_num;
        u8  rx_chains_num;
        u8  valid_tx_ant;
@@ -549,22 +532,10 @@ struct iwl_hw_params {
        u32 max_data_size;
        u32 max_bsm_size;
        u32 ct_kill_threshold; /* value in hw-dependent units */
+       u32 calib_init_cfg;
        const struct iwl_sensitivity_ranges *sens;
-       u8 first_ampdu_q;
 };
 
-#define HT_SHORT_GI_20MHZ      (1 << 0)
-#define HT_SHORT_GI_40MHZ      (1 << 1)
-
-
-#define IWL_RX_HDR(x) ((struct iwl4965_rx_frame_hdr *)(\
-                      x->u.rx_frame.stats.payload + \
-                      x->u.rx_frame.stats.phy_count))
-#define IWL_RX_END(x) ((struct iwl4965_rx_frame_end *)(\
-                      IWL_RX_HDR(x)->payload + \
-                      le16_to_cpu(IWL_RX_HDR(x)->len)))
-#define IWL_RX_STATS(x) (&x->u.rx_frame.stats)
-#define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload)
 
 /******************************************************************************
  *
@@ -581,13 +552,8 @@ struct iwl_hw_params {
  * iwl4965_mac_     <-- mac80211 callback
  *
  ****************************************************************************/
-struct iwl_addsta_cmd;
-extern int iwl_send_add_sta(struct iwl_priv *priv,
-                           struct iwl_addsta_cmd *sta, u8 flags);
-extern u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr,
-                       int is_ap, u8 flags, struct ieee80211_ht_info *ht_info);
-extern void iwl4965_update_chain_flags(struct iwl_priv *priv);
-extern int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
+extern void iwl_update_chain_flags(struct iwl_priv *priv);
+extern int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
 extern const u8 iwl_bcast_addr[ETH_ALEN];
 extern int iwl_rxq_stop(struct iwl_priv *priv);
 extern void iwl_txq_ctx_stop(struct iwl_priv *priv);
@@ -611,19 +577,15 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
 }
 
 
-struct iwl_priv;
-
-
-/* Structures, enum, and defines specific to the 4965 */
-
-#define IWL_KW_SIZE 0x1000     /*4k */
-
-struct iwl_kw {
-       dma_addr_t dma_addr;
-       void *v_addr;
+struct iwl_dma_ptr {
+       dma_addr_t dma;
+       void *addr;
        size_t size;
 };
 
+#define HT_SHORT_GI_20MHZ      (1 << 0)
+#define HT_SHORT_GI_40MHZ      (1 << 1)
+
 #define IWL_CHANNEL_WIDTH_20MHZ   0
 #define IWL_CHANNEL_WIDTH_40MHZ   1
 
@@ -638,7 +600,6 @@ struct iwl_kw {
 #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
 
 /* Sensitivity and chain noise calibration */
-#define INTERFERENCE_DATA_AVAILABLE    __constant_cpu_to_le32(1)
 #define INITIALIZATION_VALUE           0xFFFF
 #define CAL_NUM_OF_BEACONS             20
 #define MAXIMUM_ALLOWED_PATHLOSS       15
@@ -691,13 +652,20 @@ enum iwl4965_calib_enabled_state {
        IWL_CALIB_ENABLED = 1,
 };
 
-struct statistics_general_data {
-       u32 beacon_silence_rssi_a;
-       u32 beacon_silence_rssi_b;
-       u32 beacon_silence_rssi_c;
-       u32 beacon_energy_a;
-       u32 beacon_energy_b;
-       u32 beacon_energy_c;
+
+/*
+ * enum iwl_calib
+ * defines the order in which results of initial calibrations
+ * should be sent to the runtime uCode
+ */
+enum iwl_calib {
+       IWL_CALIB_XTAL,
+       IWL_CALIB_DC,
+       IWL_CALIB_LO,
+       IWL_CALIB_TX_IQ,
+       IWL_CALIB_TX_IQ_PERD,
+       IWL_CALIB_BASE_BAND,
+       IWL_CALIB_MAX
 };
 
 /* Opaque calibration results */
@@ -766,7 +734,6 @@ enum {
 
 
 #define IWL_MAX_NUM_QUEUES     20 /* FIXME: do dynamic allocation */
-#define IWL_CALIB_MAX  3
 
 struct iwl_priv {
 
@@ -790,7 +757,7 @@ struct iwl_priv {
 
 #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT
        /* spectrum measurement report caching */
-       struct iwl4965_spectrum_notification measure_report;
+       struct iwl_spectrum_notification measure_report;
        u8 measurement_status;
 #endif
        /* ucode beacon time */
@@ -801,10 +768,6 @@ struct iwl_priv {
        struct iwl_channel_info *channel_info;  /* channel info array */
        u8 channel_count;       /* # of channels */
 
-       /* each calibration channel group in the EEPROM has a derived
-        * clip setting for each rate. */
-       const struct iwl4965_clip_group clip_groups[5];
-
        /* thermal calibration */
        s32 temperature;        /* degrees Kelvin */
        s32 last_temperature;
@@ -818,12 +781,13 @@ struct iwl_priv {
        unsigned long scan_start;
        unsigned long scan_pass_start;
        unsigned long scan_start_tsf;
+       struct iwl_scan_cmd *scan;
        int scan_bands;
        int one_direct_scan;
        u8 direct_ssid_len;
        u8 direct_ssid[IW_ESSID_MAX_SIZE];
-       struct iwl_scan_cmd *scan;
-       u32 scan_tx_ant[IEEE80211_NUM_BANDS];
+       u8 scan_tx_ant[IEEE80211_NUM_BANDS];
+       u8 mgmt_tx_ant;
 
        /* spinlock */
        spinlock_t lock;        /* protect general shared data */
@@ -840,6 +804,8 @@ struct iwl_priv {
        u8   rev_id;
 
        /* uCode images, save to reload in case of failure */
+       u32 ucode_ver;                  /* version of ucode, copy of
+                                          iwl_ucode.ver */
        struct fw_desc ucode_code;      /* runtime inst */
        struct fw_desc ucode_data;      /* runtime data original */
        struct fw_desc ucode_data_backup;       /* runtime data save/restore */
@@ -850,7 +816,7 @@ struct iwl_priv {
        u8 ucode_write_complete;        /* the image write is complete */
 
 
-       struct iwl4965_rxon_time_cmd rxon_timing;
+       struct iwl_rxon_time_cmd rxon_timing;
 
        /* We declare this const so it can only be
         * changed via explicit cast within the
@@ -882,7 +848,6 @@ struct iwl_priv {
        u16 active_rate_basic;
 
        u8 assoc_station_added;
-       u8 use_ant_b_for_management_frame;      /* Tx antenna selection */
        u8 start_calib;
        struct iwl_sensitivity_data sensitivity_data;
        struct iwl_chain_noise_data chain_noise_data;
@@ -903,12 +868,14 @@ struct iwl_priv {
        struct iwl_rx_queue rxq;
        struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES];
        unsigned long txq_ctx_active_msk;
-       struct iwl_kw kw;       /* keep warm address */
+       struct iwl_dma_ptr  kw; /* keep warm address */
+       struct iwl_dma_ptr  scd_bc_tbls;
+
        u32 scd_base_addr;      /* scheduler sram base address */
 
        unsigned long status;
 
-       int last_rx_rssi;       /* From Rx packet statisitics */
+       int last_rx_rssi;       /* From Rx packet statistics */
        int last_rx_noise;      /* From beacon statistics */
 
        /* counts mgmt, ctl, and data packets */
@@ -923,8 +890,6 @@ struct iwl_priv {
        unsigned long last_statistics_time;
 
        /* context information */
-       u8 essid[IW_ESSID_MAX_SIZE];
-       u8 essid_len;
        u16 rates_mask;
 
        u32 power_mode;
@@ -965,11 +930,7 @@ struct iwl_priv {
        struct ieee80211_vif *vif;
 
        struct iwl_hw_params hw_params;
-       /* driver/uCode shared Tx Byte Counts and Rx status */
-       void *shared_virt;
-       int rb_closed_offset;
-       /* Physical Pointer to Tx Byte Counts and Rx status */
-       dma_addr_t shared_phys;
+
 
        /* Current association information needed to configure the
         * hardware */
@@ -992,7 +953,6 @@ struct iwl_priv {
        struct work_struct report_work;
        struct work_struct request_scan;
        struct work_struct beacon_update;
-       struct work_struct set_monitor;
 
        struct tasklet_struct irq_tasklet;
 
@@ -1004,9 +964,6 @@ struct iwl_priv {
        s8 tx_power_user_lmt;
        s8 tx_power_channel_lmt;
 
-#ifdef CONFIG_PM
-       u32 pm_state[16];
-#endif
 
 #ifdef CONFIG_IWLWIFI_DEBUG
        /* debugging info */
@@ -1091,26 +1048,4 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch)
        return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
 }
 
-#ifdef CONFIG_IWLWIFI_DEBUG
-static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level,
-                                     void *p, u32 len)
-{
-       if (!(priv->debug_level & level))
-               return;
-
-       print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1,
-                       p, len, 1);
-}
-#else
-static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level,
-                                     void *p, u32 len)
-{
-}
-#endif
-
-extern const struct iwl_channel_info *iwl_get_channel_info(
-       const struct iwl_priv *priv, enum ieee80211_band band, u16 channel);
-
-/* Requires full declaration of iwl_priv before including */
-
 #endif                         /* __iwl_dev_h__ */