iwlagn: hw_params moves to iwl_shared
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-dev.h
index 424c45c..57445c2 100644 (file)
@@ -48,6 +48,9 @@
 #include "iwl-power.h"
 #include "iwl-agn-rs.h"
 #include "iwl-agn-tt.h"
+#include "iwl-bus.h"
+#include "iwl-trans.h"
+#include "iwl-shared.h"
 
 #define DRV_NAME        "iwlagn"
 
@@ -228,12 +231,23 @@ struct iwl_channel_info {
 #define IWL_TX_FIFO_BE_IPAN    4
 #define IWL_TX_FIFO_VI_IPAN    IWL_TX_FIFO_VI
 #define IWL_TX_FIFO_VO_IPAN    5
+/* re-uses the VO FIFO, uCode will properly flush/schedule */
+#define IWL_TX_FIFO_AUX                5
 #define IWL_TX_FIFO_UNUSED     -1
 
-/* Minimum number of queues. MAX_NUM is defined in hw specific files.
- * Set the minimum to accommodate the 4 standard TX queues, 1 command
- * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */
-#define IWL_MIN_NUM_QUEUES     10
+/* AUX (TX during scan dwell) queue */
+#define IWL_AUX_QUEUE          10
+
+/*
+ * Minimum number of queues. MAX_NUM is defined in hw specific files.
+ * Set the minimum to accommodate
+ *  - 4 standard TX queues
+ *  - the command queue
+ *  - 4 PAN TX queues
+ *  - the PAN multicast queue, and
+ *  - the AUX (TX during scan dwell) queue.
+ */
+#define IWL_MIN_NUM_QUEUES     11
 
 /*
  * Command queue depends on iPAN support.
@@ -396,13 +410,6 @@ struct iwl_tid_data {
        struct iwl_ht_agg agg;
 };
 
-struct iwl_hw_key {
-       u32 cipher;
-       int keylen;
-       u8 keyidx;
-       u8 key[32];
-};
-
 union iwl_ht_rate_supp {
        u16 rates;
        struct {
@@ -455,7 +462,6 @@ struct iwl_station_entry {
        struct iwl_addsta_cmd sta;
        struct iwl_tid_data tid[MAX_TID_COUNT];
        u8 used, ctxid;
-       struct iwl_hw_key keyinfo;
        struct iwl_link_quality_cmd *lq;
 };
 
@@ -558,7 +564,8 @@ enum iwl_ucode_tlv_type {
        IWL_UCODE_TLV_INIT_ERRLOG_PTR   = 13,
        IWL_UCODE_TLV_ENHANCE_SENS_TBL  = 14,
        IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15,
-       /* 16 and 17 reserved for future use */
+       IWL_UCODE_TLV_WOWLAN_INST       = 16,
+       IWL_UCODE_TLV_WOWLAN_DATA       = 17,
        IWL_UCODE_TLV_FLAGS             = 18,
 };
 
@@ -569,11 +576,13 @@ enum iwl_ucode_tlv_type {
  * @IWL_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behaviour on hidden SSID,
  *     treats good CRC threshold as a boolean
  * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w).
+ * @IWL_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P.
  */
 enum iwl_ucode_tlv_flag {
        IWL_UCODE_TLV_FLAGS_PAN         = BIT(0),
        IWL_UCODE_TLV_FLAGS_NEWSCAN     = BIT(1),
        IWL_UCODE_TLV_FLAGS_MFP         = BIT(2),
+       IWL_UCODE_TLV_FLAGS_P2P         = BIT(3),
 };
 
 struct iwl_ucode_tlv {
@@ -639,54 +648,6 @@ struct iwl_sensitivity_ranges {
 #define CELSIUS_TO_KELVIN(x) ((x)+273)
 
 
-/**
- * struct iwl_hw_params
- * @max_txq_num: Max # Tx queues supported
- * @scd_bc_tbls_size: size of scheduler byte count tables
- * @tfd_size: TFD size
- * @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)
- * @max_rxq_log: Log-base-2 of max_rxq_size
- * @rx_page_order: Rx buffer page order
- * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
- * @max_stations:
- * @ht40_channel: is 40MHz width possible in band 2.4
- * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ)
- * @sw_crypto: 0 for hw, 1 for sw
- * @max_xxx_size: for ucode uses
- * @ct_kill_threshold: temperature threshold
- * @beacon_time_tsf_bits: number of valid tsf bits for beacon time
- * @calib_init_cfg: setup initial calibrations for the hw
- * @calib_rt_cfg: setup runtime calibrations for the hw
- * @struct iwl_sensitivity_ranges: range of sensitivity values
- */
-struct iwl_hw_params {
-       u8 max_txq_num;
-       u16 scd_bc_tbls_size;
-       u32 tfd_size;
-       u8  tx_chains_num;
-       u8  rx_chains_num;
-       u8  valid_tx_ant;
-       u8  valid_rx_ant;
-       u16 max_rxq_size;
-       u16 max_rxq_log;
-       u32 rx_page_order;
-       u8  max_stations;
-       u8  ht40_channel;
-       u8  max_beacon_itrvl;   /* in 1024 ms */
-       u32 max_inst_size;
-       u32 max_data_size;
-       u32 ct_kill_threshold; /* value in hw-dependent units */
-       u32 ct_kill_exit_threshold; /* value in hw-dependent units */
-                                   /* for 1000, 6000 series and up */
-       u16 beacon_time_tsf_bits;
-       u32 calib_init_cfg;
-       u32 calib_rt_cfg;
-       const struct iwl_sensitivity_ranges *sens;
-};
-
-
 /******************************************************************************
  *
  * Functions implemented in core module which are forward declared here
@@ -1158,6 +1119,8 @@ struct iwl_rxon_context {
 
        __le32 station_flags;
 
+       int beacon_int;
+
        struct {
                bool non_gf_sta_present;
                u8 protection;
@@ -1171,7 +1134,7 @@ struct iwl_rxon_context {
 enum iwl_scan_type {
        IWL_SCAN_NORMAL,
        IWL_SCAN_RADIO_RESET,
-       IWL_SCAN_OFFCH_TX,
+       IWL_SCAN_ROC,
 };
 
 enum iwlagn_ucode_type {
@@ -1193,83 +1156,16 @@ struct iwl_testmode_trace {
 };
 #endif
 
-struct iwl_bus;
-
-/**
- * struct iwl_bus_ops - bus specific operations
-
- * @get_pm_support: must returns true if the bus can go to sleep
- * @apm_config: will be called during the config of the APM configuration
- * @set_drv_data: set the priv pointer to the bus layer
- * @get_dev: returns the device struct
- * @get_irq: returns the irq number
- * @get_hw_id: prints the hw_id in the provided buffer
- * @write8: write a byte to register at offset ofs
- * @write32: write a dword to register at offset ofs
- * @wread32: read a dword at register at offset ofs
- */
-struct iwl_bus_ops {
-       bool (*get_pm_support)(struct iwl_bus *bus);
-       void (*apm_config)(struct iwl_bus *bus);
-       void (*set_drv_data)(struct iwl_bus *bus, void *priv);
-       struct device *(*get_dev)(const struct iwl_bus *bus);
-       unsigned int (*get_irq)(const struct iwl_bus *bus);
-       void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len);
-       void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val);
-       void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val);
-       u32 (*read32)(struct iwl_bus *bus, u32 ofs);
-};
-
-struct iwl_bus {
-       /* pointer to bus specific struct */
-       void *bus_specific;
-
-       /* Common data to all buses */
-       struct iwl_priv *priv; /* driver's context */
-       struct device *dev;
-       struct iwl_bus_ops *ops;
-       unsigned int irq;
-};
-
-struct iwl_trans;
-
-/**
- * struct iwl_trans_ops - transport specific operations
-
- * @rx_init: inits the rx memory, allocate it if needed
- * @rx_stop: stop the rx
- * @rx_free: frees the rx memory
- * @tx_init:inits the tx memory, allocate if needed
- * @tx_stop: stop the tx
- * @tx_free: frees the tx memory
- * @send_cmd:send a host command
- * @send_cmd_pdu:send a host command: flags can be CMD_*
- */
-struct iwl_trans_ops {
-       int (*rx_init)(struct iwl_priv *priv);
-       int (*rx_stop)(struct iwl_priv *priv);
-       void (*rx_free)(struct iwl_priv *priv);
-
-       int (*tx_init)(struct iwl_priv *priv);
-       int (*tx_stop)(struct iwl_priv *priv);
-       void (*tx_free)(struct iwl_priv *priv);
-
-       int (*send_cmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
-
-       int (*send_cmd_pdu)(struct iwl_priv *priv, u8 id, u32 flags, u16 len,
-                    const void *data);
-};
-
-struct iwl_trans {
-       const struct iwl_trans_ops *ops;
-};
-
 /* uCode ownership */
 #define IWL_OWNERSHIP_DRIVER   0
 #define IWL_OWNERSHIP_TM       1
 
 struct iwl_priv {
 
+       /*data shared among all the driver's layers */
+       struct iwl_shared _shrd;
+       struct iwl_shared *shrd;
+
        /* ieee device used by generic ieee processing code */
        struct ieee80211_hw *hw;
        struct ieee80211_channel *ieee_channels;
@@ -1335,7 +1231,7 @@ struct iwl_priv {
        spinlock_t reg_lock;    /* protect hw register access */
        struct mutex mutex;
 
-       struct iwl_bus bus;     /* bus specific data */
+       struct iwl_bus *bus;    /* bus specific data */
        struct iwl_trans trans;
 
        /* microcode/device supports multiple contexts */
@@ -1362,6 +1258,7 @@ struct iwl_priv {
 
        struct fw_img ucode_rt;
        struct fw_img ucode_init;
+       struct fw_img ucode_wowlan;
 
        enum iwlagn_ucode_type ucode_type;
        u8 ucode_write_complete;        /* the image write is complete */
@@ -1434,6 +1331,8 @@ struct iwl_priv {
 
        u8 mac80211_registered;
 
+       bool wowlan;
+
        /* eeprom -- this is in the card's little endian byte order */
        u8 *eeprom;
        int    nvm_device_type;
@@ -1469,56 +1368,50 @@ struct iwl_priv {
        } accum_stats, delta_stats, max_delta_stats;
 #endif
 
-       struct {
-               /* INT ICT Table */
-               __le32 *ict_tbl;
-               void *ict_tbl_vir;
-               dma_addr_t ict_tbl_dma;
-               dma_addr_t aligned_ict_tbl_dma;
-               int ict_index;
-               u32 inta;
-               bool use_ict;
-               /*
-                * reporting the number of tids has AGG on. 0 means
-                * no AGGREGATION
-                */
-               u8 agg_tids_count;
-
-               struct iwl_rx_phy_res last_phy_res;
-               bool last_phy_res_valid;
-
-               struct completion firmware_loading_complete;
-
-               u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
-               u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
-
-               /*
-                * chain noise reset and gain commands are the
-                * two extra calibration commands follows the standard
-                * phy calibration commands
-                */
-               u8 phy_calib_chain_noise_reset_cmd;
-               u8 phy_calib_chain_noise_gain_cmd;
-
-               /* counts reply_tx error */
-               struct reply_tx_error_statistics reply_tx_stats;
-               struct reply_agg_tx_error_statistics reply_agg_tx_stats;
-               /* notification wait support */
-               struct list_head notif_waits;
-               spinlock_t notif_wait_lock;
-               wait_queue_head_t notif_waitq;
-
-               /* remain-on-channel offload support */
-               struct ieee80211_channel *hw_roc_channel;
-               struct delayed_work hw_roc_work;
-               enum nl80211_channel_type hw_roc_chantype;
-               int hw_roc_duration;
-               bool hw_roc_setup;
-
-               struct sk_buff *offchan_tx_skb;
-               int offchan_tx_timeout;
-               struct ieee80211_channel *offchan_tx_chan;
-       } _agn;
+       /* INT ICT Table */
+       __le32 *ict_tbl;
+       void *ict_tbl_vir;
+       dma_addr_t ict_tbl_dma;
+       dma_addr_t aligned_ict_tbl_dma;
+       int ict_index;
+       u32 inta;
+       bool use_ict;
+       /*
+        * reporting the number of tids has AGG on. 0 means
+        * no AGGREGATION
+        */
+       u8 agg_tids_count;
+
+       struct iwl_rx_phy_res last_phy_res;
+       bool last_phy_res_valid;
+
+       struct completion firmware_loading_complete;
+
+       u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
+       u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
+
+       /*
+        * chain noise reset and gain commands are the
+        * two extra calibration commands follows the standard
+        * phy calibration commands
+        */
+       u8 phy_calib_chain_noise_reset_cmd;
+       u8 phy_calib_chain_noise_gain_cmd;
+
+       /* counts reply_tx error */
+       struct reply_tx_error_statistics reply_tx_stats;
+       struct reply_agg_tx_error_statistics reply_agg_tx_stats;
+       /* notification wait support */
+       struct list_head notif_waits;
+       spinlock_t notif_wait_lock;
+       wait_queue_head_t notif_waitq;
+
+       /* remain-on-channel offload support */
+       struct ieee80211_channel *hw_roc_channel;
+       struct delayed_work hw_roc_disable_work;
+       enum nl80211_channel_type hw_roc_chantype;
+       int hw_roc_duration;
+       bool hw_roc_setup;
 
        /* bt coex */
        u8 bt_enable_flag;
@@ -1539,8 +1432,6 @@ struct iwl_priv {
        struct iwl_rxon_context *cur_rssi_ctx;
        bool bt_is_sco;
 
-       struct iwl_hw_params hw_params;
-
        u32 inta_mask;
 
        struct workqueue_struct *workqueue;
@@ -1573,12 +1464,6 @@ struct iwl_priv {
        s8 tx_power_lmt_in_half_dbm; /* max tx power in half-dBm format */
        s8 tx_power_next;
 
-
-#ifdef CONFIG_IWLWIFI_DEBUG
-       /* debugging info */
-       u32 debug_level; /* per device debugging will override global
-                           iwl_debug_level if set */
-#endif /* CONFIG_IWLWIFI_DEBUG */
 #ifdef CONFIG_IWLWIFI_DEBUGFS
        /* debugfs */
        u16 tx_traffic_idx;
@@ -1588,6 +1473,7 @@ struct iwl_priv {
        struct dentry *debugfs_dir;
        u32 dbgfs_sram_offset, dbgfs_sram_len;
        bool disable_ht40;
+       void *wowlan_sram;
 #endif /* CONFIG_IWLWIFI_DEBUGFS */
 
        struct work_struct txpower_work;
@@ -1605,9 +1491,14 @@ struct iwl_priv {
        bool led_registered;
 #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL
        struct iwl_testmode_trace testmode_trace;
-#endif
        u32 tm_fixed_rate;
+#endif
 
+       /* WoWLAN GTK rekey data */
+       u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN];
+       __le64 replay_ctr;
+       __le16 last_seq_ctl;
+       bool have_rekey_data;
 }; /*iwl_priv */
 
 static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id)
@@ -1620,28 +1511,7 @@ static inline void iwl_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id)
        clear_bit(txq_id, &priv->txq_ctx_active_msk);
 }
 
-#ifdef CONFIG_IWLWIFI_DEBUG
-/*
- * iwl_get_debug_level: Return active debug level for device
- *
- * Using sysfs it is possible to set per device debug level. This debug
- * level will be used if set, otherwise the global debug level which can be
- * set via module parameter is used.
- */
-static inline u32 iwl_get_debug_level(struct iwl_priv *priv)
-{
-       if (priv->debug_level)
-               return priv->debug_level;
-       else
-               return iwl_debug_level;
-}
-#else
-static inline u32 iwl_get_debug_level(struct iwl_priv *priv)
-{
-       return iwl_debug_level;
-}
-#endif
-
+extern struct iwl_mod_params iwlagn_mod_params;
 
 static inline struct ieee80211_hdr *iwl_tx_queue_get_hdr(struct iwl_priv *priv,
                                                         int txq_id, int idx)
@@ -1719,11 +1589,11 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch)
 
 static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page)
 {
-       __free_pages(page, priv->hw_params.rx_page_order);
+       __free_pages(page, hw_params(priv).rx_page_order);
 }
 
 static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page)
 {
-       free_pages(page, priv->hw_params.rx_page_order);
+       free_pages(page, hw_params(priv).rx_page_order);
 }
 #endif                         /* __iwl_dev_h__ */