Tomas Winkler | 82b9a12 | 2008-03-04 18:09:30 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 4 | * redistributing this file, you may do so under either license. |
| 5 | * |
| 6 | * GPL LICENSE SUMMARY |
| 7 | * |
Wey-Yi Guy | 901069c | 2011-04-05 09:42:00 -0700 | [diff] [blame^] | 8 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. |
Tomas Winkler | 82b9a12 | 2008-03-04 18:09:30 -0800 | [diff] [blame] | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of version 2 of the GNU General Public License as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
| 22 | * USA |
| 23 | * |
| 24 | * The full GNU General Public License is included in this distribution |
| 25 | * in the file called LICENSE.GPL. |
| 26 | * |
| 27 | * Contact Information: |
Winkler, Tomas | 759ef89 | 2008-12-09 11:28:58 -0800 | [diff] [blame] | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
Tomas Winkler | 82b9a12 | 2008-03-04 18:09:30 -0800 | [diff] [blame] | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 30 | * |
| 31 | * BSD LICENSE |
| 32 | * |
Wey-Yi Guy | 901069c | 2011-04-05 09:42:00 -0700 | [diff] [blame^] | 33 | * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. |
Tomas Winkler | 82b9a12 | 2008-03-04 18:09:30 -0800 | [diff] [blame] | 34 | * All rights reserved. |
| 35 | * |
| 36 | * Redistribution and use in source and binary forms, with or without |
| 37 | * modification, are permitted provided that the following conditions |
| 38 | * are met: |
| 39 | * |
| 40 | * * Redistributions of source code must retain the above copyright |
| 41 | * notice, this list of conditions and the following disclaimer. |
| 42 | * * Redistributions in binary form must reproduce the above copyright |
| 43 | * notice, this list of conditions and the following disclaimer in |
| 44 | * the documentation and/or other materials provided with the |
| 45 | * distribution. |
| 46 | * * Neither the name Intel Corporation nor the names of its |
| 47 | * contributors may be used to endorse or promote products derived |
| 48 | * from this software without specific prior written permission. |
| 49 | * |
| 50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 61 | *****************************************************************************/ |
| 62 | |
| 63 | #ifndef __iwl_core_h__ |
| 64 | #define __iwl_core_h__ |
| 65 | |
Johannes Berg | 266af4c7 | 2011-03-10 20:13:26 -0800 | [diff] [blame] | 66 | #include "iwl-dev.h" |
| 67 | |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 68 | /************************ |
| 69 | * forward declarations * |
| 70 | ************************/ |
| 71 | struct iwl_host_cmd; |
| 72 | struct iwl_cmd; |
| 73 | |
| 74 | |
Zhu Yi | 61b91c1 | 2009-12-24 15:31:10 +0800 | [diff] [blame] | 75 | #define IWLWIFI_VERSION "in-tree:" |
Wey-Yi Guy | 901069c | 2011-04-05 09:42:00 -0700 | [diff] [blame^] | 76 | #define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation" |
Tomas Winkler | a7b7520 | 2008-12-11 10:33:41 -0800 | [diff] [blame] | 77 | #define DRV_AUTHOR "<ilw@linux.intel.com>" |
Tomas Winkler | df48c32 | 2008-03-06 10:40:19 -0800 | [diff] [blame] | 78 | |
Tomas Winkler | 82b9a12 | 2008-03-04 18:09:30 -0800 | [diff] [blame] | 79 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ |
| 80 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ |
| 81 | .subvendor = PCI_ANY_ID, .subdevice = (subdev), \ |
| 82 | .driver_data = (kernel_ulong_t)&(cfg) |
| 83 | |
Wey-Yi Guy | a0ee74c | 2010-05-06 08:54:10 -0700 | [diff] [blame] | 84 | #define TIME_UNIT 1024 |
| 85 | |
Tomas Winkler | 82b9a12 | 2008-03-04 18:09:30 -0800 | [diff] [blame] | 86 | #define IWL_SKU_G 0x1 |
| 87 | #define IWL_SKU_A 0x2 |
| 88 | #define IWL_SKU_N 0x8 |
| 89 | |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 90 | #define IWL_CMD(x) case x: return #x |
| 91 | |
Tomas Winkler | 3c424c2 | 2008-04-15 16:01:42 -0700 | [diff] [blame] | 92 | struct iwl_hcmd_ops { |
Johannes Berg | 246ed35 | 2010-08-23 10:46:32 +0200 | [diff] [blame] | 93 | int (*rxon_assoc)(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
| 94 | int (*commit_rxon)(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
| 95 | void (*set_rxon_chain)(struct iwl_priv *priv, |
| 96 | struct iwl_rxon_context *ctx); |
Wey-Yi Guy | 2f748de | 2009-09-17 10:43:51 -0700 | [diff] [blame] | 97 | int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant); |
Johannes Berg | 65b52bd | 2010-04-13 01:04:31 -0700 | [diff] [blame] | 98 | void (*send_bt_config)(struct iwl_priv *priv); |
Johannes Berg | 52a02d1 | 2010-08-27 09:44:50 -0700 | [diff] [blame] | 99 | int (*set_pan_params)(struct iwl_priv *priv); |
Tomas Winkler | 3c424c2 | 2008-04-15 16:01:42 -0700 | [diff] [blame] | 100 | }; |
Abhijeet Kolekar | 79fa455 | 2009-04-08 11:26:39 -0700 | [diff] [blame] | 101 | |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 102 | struct iwl_hcmd_utils_ops { |
Gregory Greenman | c1adf9f | 2008-05-15 13:53:59 +0800 | [diff] [blame] | 103 | u16 (*get_hcmd_size)(u8 cmd_id, u16 len); |
Tomas Winkler | 133636d | 2008-05-05 10:22:34 +0800 | [diff] [blame] | 104 | u16 (*build_addsta_hcmd)(const struct iwl_addsta_cmd *cmd, u8 *data); |
Emmanuel Grumbach | f0832f1 | 2008-04-16 16:34:47 -0700 | [diff] [blame] | 105 | void (*gain_computation)(struct iwl_priv *priv, |
| 106 | u32 *average_noise, |
| 107 | u16 min_average_noise_antennat_i, |
Wey-Yi Guy | d8c07e7 | 2009-09-25 14:24:26 -0700 | [diff] [blame] | 108 | u32 min_average_noise, |
| 109 | u8 default_chain); |
Emmanuel Grumbach | f0832f1 | 2008-04-16 16:34:47 -0700 | [diff] [blame] | 110 | void (*chain_noise_reset)(struct iwl_priv *priv); |
Johannes Berg | 94597ab | 2010-08-09 10:57:02 -0700 | [diff] [blame] | 111 | void (*tx_cmd_protection)(struct iwl_priv *priv, |
| 112 | struct ieee80211_tx_info *info, |
| 113 | __le16 fc, __le32 *tx_flags); |
Tomas Winkler | caab8f1 | 2008-08-04 16:00:42 +0800 | [diff] [blame] | 114 | int (*calc_rssi)(struct iwl_priv *priv, |
| 115 | struct iwl_rx_phy_res *rx_resp); |
Johannes Berg | 3eecce5 | 2010-09-13 14:46:33 +0200 | [diff] [blame] | 116 | int (*request_scan)(struct iwl_priv *priv, struct ieee80211_vif *vif); |
Johannes Berg | a77029e | 2010-09-22 18:01:56 +0200 | [diff] [blame] | 117 | void (*post_scan)(struct iwl_priv *priv); |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 118 | }; |
| 119 | |
Wey-Yi Guy | 62161ae | 2009-05-21 13:44:23 -0700 | [diff] [blame] | 120 | struct iwl_apm_ops { |
| 121 | int (*init)(struct iwl_priv *priv); |
Wey-Yi Guy | 62161ae | 2009-05-21 13:44:23 -0700 | [diff] [blame] | 122 | void (*config)(struct iwl_priv *priv); |
Wey-Yi Guy | 62161ae | 2009-05-21 13:44:23 -0700 | [diff] [blame] | 123 | }; |
| 124 | |
Wey-Yi Guy | e39fdee | 2010-11-10 09:56:40 -0800 | [diff] [blame] | 125 | struct iwl_isr_ops { |
| 126 | irqreturn_t (*isr) (int irq, void *data); |
| 127 | void (*free)(struct iwl_priv *priv); |
| 128 | int (*alloc)(struct iwl_priv *priv); |
| 129 | int (*reset)(struct iwl_priv *priv); |
| 130 | void (*disable)(struct iwl_priv *priv); |
| 131 | }; |
| 132 | |
Abhijeet Kolekar | b8c7626 | 2010-04-08 15:29:07 -0700 | [diff] [blame] | 133 | struct iwl_debugfs_ops { |
| 134 | ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf, |
| 135 | size_t count, loff_t *ppos); |
| 136 | ssize_t (*tx_stats_read)(struct file *file, char __user *user_buf, |
| 137 | size_t count, loff_t *ppos); |
| 138 | ssize_t (*general_stats_read)(struct file *file, char __user *user_buf, |
| 139 | size_t count, loff_t *ppos); |
Wey-Yi Guy | ffb7d89 | 2010-07-14 08:09:55 -0700 | [diff] [blame] | 140 | ssize_t (*bt_stats_read)(struct file *file, char __user *user_buf, |
| 141 | size_t count, loff_t *ppos); |
Wey-Yi Guy | 54a9aa6 | 2010-09-05 10:49:42 -0700 | [diff] [blame] | 142 | ssize_t (*reply_tx_error)(struct file *file, char __user *user_buf, |
| 143 | size_t count, loff_t *ppos); |
Abhijeet Kolekar | b8c7626 | 2010-04-08 15:29:07 -0700 | [diff] [blame] | 144 | }; |
| 145 | |
Wey-Yi Guy | 62161ae | 2009-05-21 13:44:23 -0700 | [diff] [blame] | 146 | struct iwl_temp_ops { |
| 147 | void (*temperature)(struct iwl_priv *priv); |
Wey-Yi Guy | 62161ae | 2009-05-21 13:44:23 -0700 | [diff] [blame] | 148 | }; |
| 149 | |
Wey-Yi Guy | 0975cc8 | 2010-07-31 08:34:07 -0700 | [diff] [blame] | 150 | struct iwl_tt_ops { |
| 151 | bool (*lower_power_detection)(struct iwl_priv *priv); |
| 152 | u8 (*tt_power_mode)(struct iwl_priv *priv); |
| 153 | bool (*ct_kill_check)(struct iwl_priv *priv); |
| 154 | }; |
| 155 | |
Assaf Krauss | 6bc913b | 2008-03-11 16:17:18 -0700 | [diff] [blame] | 156 | struct iwl_lib_ops { |
Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 157 | /* set hw dependent parameters */ |
Tomas Winkler | 5425e49 | 2008-04-15 16:01:38 -0700 | [diff] [blame] | 158 | int (*set_hw_params)(struct iwl_priv *priv); |
Tomas Winkler | 30e553e | 2008-05-29 16:35:16 +0800 | [diff] [blame] | 159 | /* Handling TX */ |
Tomas Winkler | e2a722e | 2008-04-14 21:16:10 -0700 | [diff] [blame] | 160 | void (*txq_update_byte_cnt_tbl)(struct iwl_priv *priv, |
Ron Rindjunsky | 1646690 | 2008-05-05 10:22:50 +0800 | [diff] [blame] | 161 | struct iwl_tx_queue *txq, |
Tomas Winkler | e2a722e | 2008-04-14 21:16:10 -0700 | [diff] [blame] | 162 | u16 byte_cnt); |
Tomas Winkler | 972cf44 | 2008-05-29 16:35:13 +0800 | [diff] [blame] | 163 | void (*txq_inval_byte_cnt_tbl)(struct iwl_priv *priv, |
| 164 | struct iwl_tx_queue *txq); |
| 165 | void (*txq_set_sched)(struct iwl_priv *priv, u32 mask); |
Samuel Ortiz | 7aaa1d7 | 2009-01-19 15:30:26 -0800 | [diff] [blame] | 166 | int (*txq_attach_buf_to_tfd)(struct iwl_priv *priv, |
| 167 | struct iwl_tx_queue *txq, |
| 168 | dma_addr_t addr, |
| 169 | u16 len, u8 reset, u8 pad); |
| 170 | void (*txq_free_tfd)(struct iwl_priv *priv, |
| 171 | struct iwl_tx_queue *txq); |
Samuel Ortiz | a8e74e27 | 2009-01-23 13:45:14 -0800 | [diff] [blame] | 172 | int (*txq_init)(struct iwl_priv *priv, |
| 173 | struct iwl_tx_queue *txq); |
Emmanuel Grumbach | d4789ef | 2008-04-24 11:55:20 -0700 | [diff] [blame] | 174 | /* setup Rx handler */ |
| 175 | void (*rx_handler_setup)(struct iwl_priv *priv); |
Emmanuel Grumbach | 4e39317 | 2008-06-12 09:46:53 +0800 | [diff] [blame] | 176 | /* setup deferred work */ |
| 177 | void (*setup_deferred_work)(struct iwl_priv *priv); |
| 178 | /* cancel deferred work */ |
| 179 | void (*cancel_deferred_work)(struct iwl_priv *priv); |
Tomas Winkler | 57aab75 | 2008-04-14 21:16:03 -0700 | [diff] [blame] | 180 | /* check validity of rtc data address */ |
| 181 | int (*is_valid_rtc_data_addr)(u32 addr); |
Johannes Berg | 7102762 | 2011-04-05 09:41:51 -0700 | [diff] [blame] | 182 | |
Wey-Yi Guy | b03d7d0 | 2009-12-14 14:12:20 -0800 | [diff] [blame] | 183 | int (*dump_nic_event_log)(struct iwl_priv *priv, |
| 184 | bool full_log, char **buf, bool display); |
Reinette Chatre | b7a7940 | 2009-09-25 14:24:23 -0700 | [diff] [blame] | 185 | void (*dump_nic_error_log)(struct iwl_priv *priv); |
Wey-Yi Guy | 696bdee | 2009-12-10 14:37:25 -0800 | [diff] [blame] | 186 | void (*dump_csr)(struct iwl_priv *priv); |
Wey-Yi Guy | 1b3eb82 | 2010-01-15 13:43:39 -0800 | [diff] [blame] | 187 | int (*dump_fh)(struct iwl_priv *priv, char **buf, bool display); |
Wey-Yi Guy | 79d0732 | 2010-05-06 08:54:11 -0700 | [diff] [blame] | 188 | int (*set_channel_switch)(struct iwl_priv *priv, |
| 189 | struct ieee80211_channel_switch *ch_switch); |
Wey-Yi Guy | 62161ae | 2009-05-21 13:44:23 -0700 | [diff] [blame] | 190 | /* power management */ |
| 191 | struct iwl_apm_ops apm_ops; |
| 192 | |
Mohamed Abbas | 5da4b55 | 2008-04-21 15:41:51 -0700 | [diff] [blame] | 193 | /* power */ |
Tomas Winkler | 630fe9b | 2008-06-12 09:47:08 +0800 | [diff] [blame] | 194 | int (*send_tx_power) (struct iwl_priv *priv); |
Mohamed Abbas | 5da4b55 | 2008-04-21 15:41:51 -0700 | [diff] [blame] | 195 | void (*update_chain_flags)(struct iwl_priv *priv); |
Wey-Yi Guy | e39fdee | 2010-11-10 09:56:40 -0800 | [diff] [blame] | 196 | |
| 197 | /* isr */ |
| 198 | struct iwl_isr_ops isr_ops; |
Abhijeet Kolekar | 5bbe233 | 2009-04-08 11:26:35 -0700 | [diff] [blame] | 199 | |
Assaf Krauss | 6bc913b | 2008-03-11 16:17:18 -0700 | [diff] [blame] | 200 | /* eeprom operations (as defined in iwl-eeprom.h) */ |
| 201 | struct iwl_eeprom_ops eeprom_ops; |
Wey-Yi Guy | 62161ae | 2009-05-21 13:44:23 -0700 | [diff] [blame] | 202 | |
| 203 | /* temperature */ |
| 204 | struct iwl_temp_ops temp_ops; |
Stanislaw Gruszka | ad6e82a | 2011-02-28 14:33:16 +0100 | [diff] [blame] | 205 | |
Wey-Yi Guy | 716c74b | 2010-06-24 13:22:36 -0700 | [diff] [blame] | 206 | int (*txfifo_flush)(struct iwl_priv *priv, u16 flush_control); |
Wey-Yi Guy | 6555063 | 2010-06-24 13:18:35 -0700 | [diff] [blame] | 207 | void (*dev_txfifo_flush)(struct iwl_priv *priv, u16 flush_control); |
Wey-Yi Guy | 716c74b | 2010-06-24 13:22:36 -0700 | [diff] [blame] | 208 | |
Abhijeet Kolekar | b8c7626 | 2010-04-08 15:29:07 -0700 | [diff] [blame] | 209 | struct iwl_debugfs_ops debugfs_ops; |
Wey-Yi Guy | 0975cc8 | 2010-07-31 08:34:07 -0700 | [diff] [blame] | 210 | |
| 211 | /* thermal throttling */ |
| 212 | struct iwl_tt_ops tt_ops; |
Assaf Krauss | 6bc913b | 2008-03-11 16:17:18 -0700 | [diff] [blame] | 213 | }; |
| 214 | |
Johannes Berg | e932a60 | 2009-10-02 13:44:03 -0700 | [diff] [blame] | 215 | struct iwl_led_ops { |
| 216 | int (*cmd)(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd); |
Johannes Berg | e932a60 | 2009-10-02 13:44:03 -0700 | [diff] [blame] | 217 | }; |
| 218 | |
Shanyu Zhao | 6b5ce50 | 2010-09-14 16:23:32 -0700 | [diff] [blame] | 219 | /* NIC specific ops */ |
| 220 | struct iwl_nic_ops { |
| 221 | void (*additional_nic_config)(struct iwl_priv *priv); |
| 222 | }; |
| 223 | |
Johannes Berg | 2295c66 | 2010-10-23 09:15:41 -0700 | [diff] [blame] | 224 | struct iwl_legacy_ops { |
| 225 | void (*post_associate)(struct iwl_priv *priv); |
| 226 | void (*config_ap)(struct iwl_priv *priv); |
| 227 | /* station management */ |
| 228 | int (*update_bcast_stations)(struct iwl_priv *priv); |
| 229 | int (*manage_ibss_station)(struct iwl_priv *priv, |
| 230 | struct ieee80211_vif *vif, bool add); |
| 231 | }; |
| 232 | |
Assaf Krauss | 6bc913b | 2008-03-11 16:17:18 -0700 | [diff] [blame] | 233 | struct iwl_ops { |
| 234 | const struct iwl_lib_ops *lib; |
Tomas Winkler | 3c424c2 | 2008-04-15 16:01:42 -0700 | [diff] [blame] | 235 | const struct iwl_hcmd_ops *hcmd; |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 236 | const struct iwl_hcmd_utils_ops *utils; |
Johannes Berg | e932a60 | 2009-10-02 13:44:03 -0700 | [diff] [blame] | 237 | const struct iwl_led_ops *led; |
Shanyu Zhao | 6b5ce50 | 2010-09-14 16:23:32 -0700 | [diff] [blame] | 238 | const struct iwl_nic_ops *nic; |
Johannes Berg | 2295c66 | 2010-10-23 09:15:41 -0700 | [diff] [blame] | 239 | const struct iwl_legacy_ops *legacy; |
Johannes Berg | dc21b54 | 2010-10-23 09:15:39 -0700 | [diff] [blame] | 240 | const struct ieee80211_ops *ieee80211_ops; |
Assaf Krauss | 6bc913b | 2008-03-11 16:17:18 -0700 | [diff] [blame] | 241 | }; |
| 242 | |
Assaf Krauss | 00acbc9 | 2008-03-14 10:38:47 -0700 | [diff] [blame] | 243 | struct iwl_mod_params { |
Emmanuel Grumbach | fcc76c6 | 2008-04-15 16:01:47 -0700 | [diff] [blame] | 244 | int sw_crypto; /* def: 0 = using hardware encryption */ |
Assaf Krauss | 00acbc9 | 2008-03-14 10:38:47 -0700 | [diff] [blame] | 245 | int num_of_queues; /* def: HW dependent */ |
Reinette Chatre | c18bd87 | 2009-06-03 11:44:12 -0700 | [diff] [blame] | 246 | int disable_11n; /* def: 0 = 11n capabilities enabled */ |
Assaf Krauss | 00acbc9 | 2008-03-14 10:38:47 -0700 | [diff] [blame] | 247 | int amsdu_size_8K; /* def: 1 = enable 8K amsdu size */ |
| 248 | int antenna; /* def: 0 = both antennas (use diversity) */ |
Ester Kummer | 3a1081e | 2008-05-06 11:05:14 +0800 | [diff] [blame] | 249 | int restart_fw; /* def: 1 = restart firmware */ |
Stanislaw Gruszka | b7977ff | 2011-02-28 14:33:15 +0100 | [diff] [blame] | 250 | bool plcp_check; /* def: true = enable plcp health check */ |
| 251 | bool ack_check; /* def: false = disable ack health check */ |
Assaf Krauss | 00acbc9 | 2008-03-14 10:38:47 -0700 | [diff] [blame] | 252 | }; |
| 253 | |
Wey-Yi Guy | 7cb1b08 | 2010-10-06 08:10:00 -0700 | [diff] [blame] | 254 | /* |
Wey-Yi Guy | 415e499 | 2009-08-13 13:30:54 -0700 | [diff] [blame] | 255 | * @max_ll_items: max number of OTP blocks |
| 256 | * @shadow_ram_support: shadow support for OTP memory |
Wey-Yi Guy | f2d0d0e | 2009-09-11 10:38:14 -0700 | [diff] [blame] | 257 | * @led_compensation: compensate on the led on/off time per HW according |
| 258 | * to the deviation to achieve the desired led frequency. |
| 259 | * The detail algorithm is described in iwl-led.c |
Wey-Yi Guy | d8c07e7 | 2009-09-25 14:24:26 -0700 | [diff] [blame] | 260 | * @chain_noise_num_beacons: number of beacons used to compute chain noise |
Wey-Yi Guy | 6047b4f | 2009-10-23 13:42:27 -0700 | [diff] [blame] | 261 | * @adv_thermal_throttle: support advance thermal throttle |
Wey-Yi Guy | 480e840 | 2009-10-23 13:42:28 -0700 | [diff] [blame] | 262 | * @support_ct_kill_exit: support ct kill exit condition |
Wey-Yi Guy | 1933ac4 | 2009-10-30 14:36:18 -0700 | [diff] [blame] | 263 | * @support_wimax_coexist: support wimax/wifi co-exist |
Trieu 'Andrew' Nguyen | 3e4fb5f | 2010-01-22 14:22:46 -0800 | [diff] [blame] | 264 | * @plcp_delta_threshold: plcp error rate threshold used to trigger |
| 265 | * radio tuning when there is a high receiving plcp error rate |
Wey-Yi Guy | 4ff7397 | 2010-04-30 11:35:16 -0700 | [diff] [blame] | 266 | * @chain_noise_scale: default chain noise scale used for gain computation |
Stanislaw Gruszka | 22de94d | 2010-12-03 15:41:48 +0100 | [diff] [blame] | 267 | * @wd_timeout: TX queues watchdog timeout |
Wey-Yi Guy | 4ff7397 | 2010-04-30 11:35:16 -0700 | [diff] [blame] | 268 | * @temperature_kelvin: temperature report by uCode in kelvin |
| 269 | * @max_event_log_size: size of event log buffer size for ucode event logging |
| 270 | * @tx_power_by_driver: tx power calibration performed by driver |
| 271 | * instead of uCode |
| 272 | * @ucode_tracing: support ucode continuous tracing |
| 273 | * @sensitivity_calib_by_driver: driver has the capability to perform |
| 274 | * sensitivity calibration operation |
| 275 | * @chain_noise_calib_by_driver: driver has the capability to perform |
| 276 | * chain noise calibration operation |
Wey-Yi Guy | f81c1f4 | 2010-11-10 09:56:50 -0800 | [diff] [blame] | 277 | * @shadow_reg_enable: HW shadhow register bit |
Wey-Yi Guy | 8829c9e | 2010-11-10 11:05:38 -0800 | [diff] [blame] | 278 | */ |
Wey-Yi Guy | 7cb1b08 | 2010-10-06 08:10:00 -0700 | [diff] [blame] | 279 | struct iwl_base_params { |
Tomas Winkler | 073d3f5 | 2008-04-21 15:41:52 -0700 | [diff] [blame] | 280 | int eeprom_size; |
Wey-Yi Guy | 88804e2 | 2009-10-09 13:20:28 -0700 | [diff] [blame] | 281 | int num_of_queues; /* def: HW dependent */ |
| 282 | int num_of_ampdu_queues;/* def: HW dependent */ |
Ben Cahill | fadb358 | 2009-10-23 13:42:21 -0700 | [diff] [blame] | 283 | /* for iwl_apm_init() */ |
| 284 | u32 pll_cfg_val; |
| 285 | bool set_l0s; |
| 286 | bool use_bsm; |
| 287 | |
Wey-Yi Guy | 415e499 | 2009-08-13 13:30:54 -0700 | [diff] [blame] | 288 | const u16 max_ll_items; |
| 289 | const bool shadow_ram_support; |
Wey-Yi Guy | f2d0d0e | 2009-09-11 10:38:14 -0700 | [diff] [blame] | 290 | u16 led_compensation; |
Wey-Yi Guy | 47eef9b | 2009-09-17 10:43:44 -0700 | [diff] [blame] | 291 | const bool broken_powersave; |
Wey-Yi Guy | d8c07e7 | 2009-09-25 14:24:26 -0700 | [diff] [blame] | 292 | int chain_noise_num_beacons; |
Wey-Yi Guy | 6047b4f | 2009-10-23 13:42:27 -0700 | [diff] [blame] | 293 | bool adv_thermal_throttle; |
Wey-Yi Guy | 480e840 | 2009-10-23 13:42:28 -0700 | [diff] [blame] | 294 | bool support_ct_kill_exit; |
Wey-Yi Guy | 1933ac4 | 2009-10-30 14:36:18 -0700 | [diff] [blame] | 295 | const bool support_wimax_coexist; |
Trieu 'Andrew' Nguyen | 3e4fb5f | 2010-01-22 14:22:46 -0800 | [diff] [blame] | 296 | u8 plcp_delta_threshold; |
Ben Cahill | d4fe5ac | 2010-02-05 11:33:46 -0800 | [diff] [blame] | 297 | s32 chain_noise_scale; |
Stanislaw Gruszka | 22de94d | 2010-12-03 15:41:48 +0100 | [diff] [blame] | 298 | unsigned int wd_timeout; |
Wey-Yi Guy | 2f3f7f9 | 2010-03-18 10:56:32 -0700 | [diff] [blame] | 299 | bool temperature_kelvin; |
Wey-Yi Guy | 678b385 | 2010-03-26 12:54:37 -0700 | [diff] [blame] | 300 | u32 max_event_log_size; |
Wey-Yi Guy | 4e7033e | 2010-04-27 14:33:33 -0700 | [diff] [blame] | 301 | const bool tx_power_by_driver; |
Wey-Yi Guy | 6e5c800 | 2010-04-27 14:00:28 -0700 | [diff] [blame] | 302 | const bool ucode_tracing; |
Wey-Yi Guy | 65d1f89 | 2010-04-25 15:41:43 -0700 | [diff] [blame] | 303 | const bool sensitivity_calib_by_driver; |
| 304 | const bool chain_noise_calib_by_driver; |
Wey-Yi Guy | f81c1f4 | 2010-11-10 09:56:50 -0800 | [diff] [blame] | 305 | const bool shadow_reg_enable; |
Wey-Yi Guy | 7cb1b08 | 2010-10-06 08:10:00 -0700 | [diff] [blame] | 306 | }; |
| 307 | /* |
| 308 | * @advanced_bt_coexist: support advanced bt coexist |
| 309 | * @bt_init_traffic_load: specify initial bt traffic load |
| 310 | * @bt_prio_boost: default bt priority boost value |
| 311 | * @bt_statistics: use BT version of statistics notification |
| 312 | * @agg_time_limit: maximum number of uSec in aggregation |
| 313 | * @ampdu_factor: Maximum A-MPDU length factor |
| 314 | * @ampdu_density: Minimum A-MPDU spacing |
Wey-Yi Guy | e366176 | 2010-11-23 10:58:54 -0800 | [diff] [blame] | 315 | * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode |
Wey-Yi Guy | 7cb1b08 | 2010-10-06 08:10:00 -0700 | [diff] [blame] | 316 | */ |
| 317 | struct iwl_bt_params { |
Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 318 | bool advanced_bt_coexist; |
Wey-Yi Guy | a4b96cc | 2010-08-23 07:57:08 -0700 | [diff] [blame] | 319 | u8 bt_init_traffic_load; |
Wey-Yi Guy | 5d297d5 | 2010-08-23 07:57:09 -0700 | [diff] [blame] | 320 | u8 bt_prio_boost; |
Wey-Yi Guy | af8ee05 | 2010-07-14 08:08:05 -0700 | [diff] [blame] | 321 | const bool bt_statistics; |
Wey-Yi Guy | 7469701 | 2010-07-28 09:18:54 -0700 | [diff] [blame] | 322 | u16 agg_time_limit; |
Wey-Yi Guy | 172c1d1 | 2010-08-04 12:02:43 -0700 | [diff] [blame] | 323 | u8 ampdu_factor; |
| 324 | u8 ampdu_density; |
Wey-Yi Guy | e366176 | 2010-11-23 10:58:54 -0800 | [diff] [blame] | 325 | bool bt_sco_disable; |
Wey-Yi Guy | 6013270 | 2011-02-18 17:23:54 -0800 | [diff] [blame] | 326 | bool bt_session_2; |
Tomas Winkler | 82b9a12 | 2008-03-04 18:09:30 -0800 | [diff] [blame] | 327 | }; |
Wey-Yi Guy | 7cb1b08 | 2010-10-06 08:10:00 -0700 | [diff] [blame] | 328 | /* |
| 329 | * @use_rts_for_aggregation: use rts/cts protection for HT traffic |
| 330 | */ |
| 331 | struct iwl_ht_params { |
| 332 | const bool ht_greenfield_support; /* if used set to true */ |
| 333 | bool use_rts_for_aggregation; |
| 334 | }; |
| 335 | |
| 336 | /** |
| 337 | * struct iwl_cfg |
| 338 | * @fw_name_pre: Firmware filename prefix. The api version and extension |
| 339 | * (.ucode) will be added to filename before loading from disk. The |
| 340 | * filename is constructed as fw_name_pre<api>.ucode. |
| 341 | * @ucode_api_max: Highest version of uCode API supported by driver. |
| 342 | * @ucode_api_min: Lowest version of uCode API supported by driver. |
| 343 | * @pa_type: used by 6000 series only to identify the type of Power Amplifier |
| 344 | * @need_dc_calib: need to perform init dc calibration |
Shanyu Zhao | bf53f93 | 2010-09-21 16:54:01 -0700 | [diff] [blame] | 345 | * @need_temp_offset_calib: need to perform temperature offset calibration |
Wey-Yi Guy | 7cb1b08 | 2010-10-06 08:10:00 -0700 | [diff] [blame] | 346 | * @scan_antennas: available antenna for scan operation |
Wey-Yi Guy | 564b344 | 2010-11-09 09:21:34 -0800 | [diff] [blame] | 347 | * @led_mode: 0=blinking, 1=On(RF On)/Off(RF Off) |
Wey-Yi Guy | 35162ba | 2010-11-23 10:58:56 -0800 | [diff] [blame] | 348 | * @adv_pm: advance power management |
Wey-Yi Guy | 17423ea | 2010-12-06 11:51:39 -0800 | [diff] [blame] | 349 | * @rx_with_siso_diversity: 1x1 device with rx antenna diversity |
Wey-Yi Guy | 50619ac | 2010-12-07 08:06:31 -0800 | [diff] [blame] | 350 | * @internal_wimax_coex: internal wifi/wimax combo device |
Wey-Yi Guy | 52e6b85 | 2011-01-18 08:58:48 -0800 | [diff] [blame] | 351 | * @iq_invert: I/Q inversion |
Wey-Yi Guy | 7cb1b08 | 2010-10-06 08:10:00 -0700 | [diff] [blame] | 352 | * |
| 353 | * We enable the driver to be backward compatible wrt API version. The |
| 354 | * driver specifies which APIs it supports (with @ucode_api_max being the |
| 355 | * highest and @ucode_api_min the lowest). Firmware will only be loaded if |
| 356 | * it has a supported API version. The firmware's API version will be |
| 357 | * stored in @iwl_priv, enabling the driver to make runtime changes based |
| 358 | * on firmware version used. |
| 359 | * |
| 360 | * For example, |
| 361 | * if (IWL_UCODE_API(priv->ucode_ver) >= 2) { |
| 362 | * Driver interacts with Firmware API version >= 2. |
| 363 | * } else { |
| 364 | * Driver interacts with Firmware API version 1. |
| 365 | * } |
| 366 | * |
| 367 | * The ideal usage of this infrastructure is to treat a new ucode API |
| 368 | * release as a new hardware revision. That is, through utilizing the |
| 369 | * iwl_hcmd_utils_ops etc. we accommodate different command structures |
| 370 | * and flows between hardware versions (4965/5000) as well as their API |
| 371 | * versions. |
| 372 | * |
| 373 | */ |
| 374 | struct iwl_cfg { |
| 375 | /* params specific to an individual device within a device family */ |
| 376 | const char *name; |
| 377 | const char *fw_name_pre; |
| 378 | const unsigned int ucode_api_max; |
| 379 | const unsigned int ucode_api_min; |
| 380 | u8 valid_tx_ant; |
| 381 | u8 valid_rx_ant; |
| 382 | unsigned int sku; |
| 383 | u16 eeprom_ver; |
| 384 | u16 eeprom_calib_ver; |
| 385 | const struct iwl_ops *ops; |
| 386 | /* module based parameters which can be set from modprobe cmd */ |
| 387 | const struct iwl_mod_params *mod_params; |
| 388 | /* params not likely to change within a device family */ |
| 389 | struct iwl_base_params *base_params; |
| 390 | /* params likely to change within a device family */ |
| 391 | struct iwl_ht_params *ht_params; |
| 392 | struct iwl_bt_params *bt_params; |
| 393 | enum iwl_pa_type pa_type; /* if used set to IWL_PA_SYSTEM */ |
| 394 | const bool need_dc_calib; /* if used set to true */ |
Shanyu Zhao | bf53f93 | 2010-09-21 16:54:01 -0700 | [diff] [blame] | 395 | const bool need_temp_offset_calib; /* if used set to true */ |
Wey-Yi Guy | 7cb1b08 | 2010-10-06 08:10:00 -0700 | [diff] [blame] | 396 | u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; |
Wey-Yi Guy | 564b344 | 2010-11-09 09:21:34 -0800 | [diff] [blame] | 397 | enum iwl_led_mode led_mode; |
Wey-Yi Guy | 35162ba | 2010-11-23 10:58:56 -0800 | [diff] [blame] | 398 | const bool adv_pm; |
Wey-Yi Guy | 17423ea | 2010-12-06 11:51:39 -0800 | [diff] [blame] | 399 | const bool rx_with_siso_diversity; |
Wey-Yi Guy | 50619ac | 2010-12-07 08:06:31 -0800 | [diff] [blame] | 400 | const bool internal_wimax_coex; |
Wey-Yi Guy | 52e6b85 | 2011-01-18 08:58:48 -0800 | [diff] [blame] | 401 | const bool iq_invert; |
Wey-Yi Guy | 7cb1b08 | 2010-10-06 08:10:00 -0700 | [diff] [blame] | 402 | }; |
Tomas Winkler | 82b9a12 | 2008-03-04 18:09:30 -0800 | [diff] [blame] | 403 | |
Assaf Krauss | 1d0a082 | 2008-03-14 10:38:48 -0700 | [diff] [blame] | 404 | /*************************** |
| 405 | * L i b * |
| 406 | ***************************/ |
| 407 | |
Johannes Berg | dc21b54 | 2010-10-23 09:15:39 -0700 | [diff] [blame] | 408 | struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg); |
Abhijeet Kolekar | 488829f | 2009-03-26 10:14:10 -0700 | [diff] [blame] | 409 | int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, |
| 410 | const struct ieee80211_tx_queue_params *params); |
Johannes Berg | a85d7cc | 2010-07-31 08:34:10 -0700 | [diff] [blame] | 411 | int iwl_mac_tx_last_beacon(struct ieee80211_hw *hw); |
Johannes Berg | 246ed35 | 2010-08-23 10:46:32 +0200 | [diff] [blame] | 412 | void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
| 413 | int hw_decrypt); |
| 414 | int iwl_check_rxon_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
| 415 | int iwl_full_rxon_required(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
Johannes Berg | 246ed35 | 2010-08-23 10:46:32 +0200 | [diff] [blame] | 416 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch, |
| 417 | struct iwl_rxon_context *ctx); |
Wey-Yi Guy | 79d0732 | 2010-05-06 08:54:11 -0700 | [diff] [blame] | 418 | void iwl_set_flags_for_band(struct iwl_priv *priv, |
Johannes Berg | 246ed35 | 2010-08-23 10:46:32 +0200 | [diff] [blame] | 419 | struct iwl_rxon_context *ctx, |
Wey-Yi Guy | 79d0732 | 2010-05-06 08:54:11 -0700 | [diff] [blame] | 420 | enum ieee80211_band band, |
| 421 | struct ieee80211_vif *vif); |
Abhijeet Kolekar | 1402364 | 2010-06-02 21:15:10 -0700 | [diff] [blame] | 422 | u8 iwl_get_single_channel_number(struct iwl_priv *priv, |
| 423 | enum ieee80211_band band); |
Johannes Berg | fad95bf | 2009-09-11 10:38:15 -0700 | [diff] [blame] | 424 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); |
Johannes Berg | 7e6a588 | 2010-08-23 10:46:46 +0200 | [diff] [blame] | 425 | bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv, |
| 426 | struct iwl_rxon_context *ctx, |
| 427 | struct ieee80211_sta_ht_cap *ht_cap); |
Johannes Berg | 1dda6d2 | 2010-04-29 04:43:06 -0700 | [diff] [blame] | 428 | void iwl_connection_init_rx_config(struct iwl_priv *priv, |
Johannes Berg | d0fe478 | 2010-08-23 10:46:58 +0200 | [diff] [blame] | 429 | struct iwl_rxon_context *ctx); |
Wey-Yi Guy | 79d0732 | 2010-05-06 08:54:11 -0700 | [diff] [blame] | 430 | void iwl_set_rate(struct iwl_priv *priv); |
Samuel Ortiz | 8ccde88 | 2009-01-27 14:27:52 -0800 | [diff] [blame] | 431 | void iwl_irq_handle_error(struct iwl_priv *priv); |
Abhijeet Kolekar | cbb6ab9 | 2009-04-08 11:26:46 -0700 | [diff] [blame] | 432 | int iwl_mac_add_interface(struct ieee80211_hw *hw, |
Johannes Berg | 1ed32e4 | 2009-12-23 13:15:45 +0100 | [diff] [blame] | 433 | struct ieee80211_vif *vif); |
Abhijeet Kolekar | d805231 | 2009-04-08 11:26:47 -0700 | [diff] [blame] | 434 | void iwl_mac_remove_interface(struct ieee80211_hw *hw, |
Johannes Berg | 1ed32e4 | 2009-12-23 13:15:45 +0100 | [diff] [blame] | 435 | struct ieee80211_vif *vif); |
Johannes Berg | d4daaea | 2010-10-23 09:15:43 -0700 | [diff] [blame] | 436 | int iwl_mac_change_interface(struct ieee80211_hw *hw, |
| 437 | struct ieee80211_vif *vif, |
| 438 | enum nl80211_iftype newtype, bool newp2p); |
Wey-Yi Guy | 88804e2 | 2009-10-09 13:20:28 -0700 | [diff] [blame] | 439 | int iwl_alloc_txq_mem(struct iwl_priv *priv); |
| 440 | void iwl_free_txq_mem(struct iwl_priv *priv); |
Wey-Yi Guy | 708068d | 2010-11-10 09:56:41 -0800 | [diff] [blame] | 441 | |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 442 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 443 | int iwl_alloc_traffic_mem(struct iwl_priv *priv); |
| 444 | void iwl_free_traffic_mem(struct iwl_priv *priv); |
| 445 | void iwl_reset_traffic_log(struct iwl_priv *priv); |
| 446 | void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv, |
| 447 | u16 length, struct ieee80211_hdr *header); |
| 448 | void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv, |
| 449 | u16 length, struct ieee80211_hdr *header); |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 450 | const char *get_mgmt_string(int cmd); |
| 451 | const char *get_ctrl_string(int cmd); |
Wey-Yi Guy | 7163b8a | 2009-11-20 12:04:56 -0800 | [diff] [blame] | 452 | void iwl_clear_traffic_stats(struct iwl_priv *priv); |
Reinette Chatre | 450ccb3 | 2009-08-07 15:41:49 -0700 | [diff] [blame] | 453 | void iwl_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, |
| 454 | u16 len); |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 455 | #else |
| 456 | static inline int iwl_alloc_traffic_mem(struct iwl_priv *priv) |
| 457 | { |
| 458 | return 0; |
| 459 | } |
| 460 | static inline void iwl_free_traffic_mem(struct iwl_priv *priv) |
| 461 | { |
| 462 | } |
| 463 | static inline void iwl_reset_traffic_log(struct iwl_priv *priv) |
| 464 | { |
| 465 | } |
| 466 | static inline void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv, |
| 467 | u16 length, struct ieee80211_hdr *header) |
| 468 | { |
| 469 | } |
| 470 | static inline void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv, |
| 471 | u16 length, struct ieee80211_hdr *header) |
| 472 | { |
| 473 | } |
Reinette Chatre | 450ccb3 | 2009-08-07 15:41:49 -0700 | [diff] [blame] | 474 | static inline void iwl_update_stats(struct iwl_priv *priv, bool is_tx, |
| 475 | __le16 fc, u16 len) |
| 476 | { |
Reinette Chatre | 450ccb3 | 2009-08-07 15:41:49 -0700 | [diff] [blame] | 477 | } |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 478 | #endif |
Abhijeet Kolekar | 030f05e | 2009-02-18 15:54:28 -0800 | [diff] [blame] | 479 | |
| 480 | /***************************************************** |
Tomas Winkler | a55360e | 2008-05-05 10:22:28 +0800 | [diff] [blame] | 481 | * RX |
| 482 | ******************************************************/ |
Abhijeet Kolekar | 3e5d238 | 2009-03-17 21:51:49 -0700 | [diff] [blame] | 483 | void iwl_cmd_queue_free(struct iwl_priv *priv); |
Stanislaw Gruszka | 387f338 | 2011-02-28 14:33:13 +0100 | [diff] [blame] | 484 | void iwl_cmd_queue_unmap(struct iwl_priv *priv); |
Tomas Winkler | a55360e | 2008-05-05 10:22:28 +0800 | [diff] [blame] | 485 | int iwl_rx_queue_alloc(struct iwl_priv *priv); |
Abhijeet Kolekar | 7bfedc5 | 2010-02-03 13:47:56 -0800 | [diff] [blame] | 486 | void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, |
Tomas Winkler | a55360e | 2008-05-05 10:22:28 +0800 | [diff] [blame] | 487 | struct iwl_rx_queue *q); |
Tomas Winkler | a55360e | 2008-05-05 10:22:28 +0800 | [diff] [blame] | 488 | int iwl_rx_queue_space(const struct iwl_rx_queue *q); |
Tomas Winkler | 17b8892 | 2008-05-29 16:35:12 +0800 | [diff] [blame] | 489 | void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb); |
Stanislaw Gruszka | 466a19a | 2011-03-04 17:51:49 +0100 | [diff] [blame] | 490 | |
Wey-Yi Guy | 79d0732 | 2010-05-06 08:54:11 -0700 | [diff] [blame] | 491 | void iwl_chswitch_done(struct iwl_priv *priv, bool is_success); |
Tomas Winkler | a55360e | 2008-05-05 10:22:28 +0800 | [diff] [blame] | 492 | |
Tomas Winkler | a332f8d | 2008-05-29 16:35:08 +0800 | [diff] [blame] | 493 | /* TX helpers */ |
| 494 | |
Tomas Winkler | a55360e | 2008-05-05 10:22:28 +0800 | [diff] [blame] | 495 | /***************************************************** |
Ron Rindjunsky | 1053d35 | 2008-05-05 10:22:43 +0800 | [diff] [blame] | 496 | * TX |
| 497 | ******************************************************/ |
Abhijeet Kolekar | 7bfedc5 | 2010-02-03 13:47:56 -0800 | [diff] [blame] | 498 | void iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); |
Samuel Ortiz | a8e74e27 | 2009-01-23 13:45:14 -0800 | [diff] [blame] | 499 | int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, |
| 500 | int slots_num, u32 txq_id); |
Zhu Yi | de0f60ea | 2010-03-23 00:45:03 -0700 | [diff] [blame] | 501 | void iwl_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq, |
| 502 | int slots_num, u32 txq_id); |
Samuel Ortiz | a8e74e27 | 2009-01-23 13:45:14 -0800 | [diff] [blame] | 503 | void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id); |
Stanislaw Gruszka | 387f338 | 2011-02-28 14:33:13 +0100 | [diff] [blame] | 504 | void iwl_tx_queue_unmap(struct iwl_priv *priv, int txq_id); |
Stanislaw Gruszka | 22de94d | 2010-12-03 15:41:48 +0100 | [diff] [blame] | 505 | void iwl_setup_watchdog(struct iwl_priv *priv); |
Ron Rindjunsky | 1053d35 | 2008-05-05 10:22:43 +0800 | [diff] [blame] | 506 | /***************************************************** |
Tomas Winkler | 630fe9b | 2008-06-12 09:47:08 +0800 | [diff] [blame] | 507 | * TX power |
| 508 | ****************************************************/ |
| 509 | int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); |
| 510 | |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 511 | /******************************************************************************* |
Tomas Winkler | e7d326a | 2008-06-12 09:47:11 +0800 | [diff] [blame] | 512 | * Rate |
| 513 | ******************************************************************************/ |
| 514 | |
Johannes Berg | 76d0481 | 2010-08-23 10:46:47 +0200 | [diff] [blame] | 515 | u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv, |
| 516 | struct iwl_rxon_context *ctx); |
Samuel Ortiz | 8ccde88 | 2009-01-27 14:27:52 -0800 | [diff] [blame] | 517 | |
Tomas Winkler | e7d326a | 2008-06-12 09:47:11 +0800 | [diff] [blame] | 518 | /******************************************************************************* |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 519 | * Scanning |
| 520 | ******************************************************************************/ |
Tomas Winkler | f53696d | 2008-06-12 09:47:12 +0800 | [diff] [blame] | 521 | void iwl_init_scan_params(struct iwl_priv *priv); |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 522 | int iwl_scan_cancel(struct iwl_priv *priv); |
| 523 | int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); |
Stanislaw Gruszka | e7e16b9 | 2010-09-13 14:46:41 +0200 | [diff] [blame] | 524 | void iwl_force_scan_end(struct iwl_priv *priv); |
Johannes Berg | a060bbf | 2010-04-27 11:59:34 +0200 | [diff] [blame] | 525 | int iwl_mac_hw_scan(struct ieee80211_hw *hw, |
| 526 | struct ieee80211_vif *vif, |
| 527 | struct cfg80211_scan_request *req); |
Johannes Berg | 88be026 | 2010-04-07 00:21:36 -0700 | [diff] [blame] | 528 | void iwl_internal_short_hw_scan(struct iwl_priv *priv); |
Wey-Yi Guy | c04f9f2 | 2010-06-21 16:52:55 -0700 | [diff] [blame] | 529 | int iwl_force_reset(struct iwl_priv *priv, int mode, bool external); |
Johannes Berg | 1ecf9fc | 2009-04-20 14:36:56 -0700 | [diff] [blame] | 530 | u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, |
Johannes Berg | 3a0b9aa | 2010-05-12 03:33:12 -0700 | [diff] [blame] | 531 | const u8 *ta, const u8 *ie, int ie_len, int left); |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 532 | void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); |
Samuel Ortiz | 77fecfb8 | 2009-01-23 13:45:12 -0800 | [diff] [blame] | 533 | u16 iwl_get_active_dwell_time(struct iwl_priv *priv, |
| 534 | enum ieee80211_band band, |
| 535 | u8 n_probes); |
| 536 | u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, |
Johannes Berg | 1dda6d2 | 2010-04-29 04:43:06 -0700 | [diff] [blame] | 537 | enum ieee80211_band band, |
| 538 | struct ieee80211_vif *vif); |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 539 | void iwl_setup_scan_deferred_work(struct iwl_priv *priv); |
Stanislaw Gruszka | e7e16b9 | 2010-09-13 14:46:41 +0200 | [diff] [blame] | 540 | void iwl_cancel_scan_deferred_work(struct iwl_priv *priv); |
Johannes Berg | 266af4c7 | 2011-03-10 20:13:26 -0800 | [diff] [blame] | 541 | int __must_check iwl_scan_initiate(struct iwl_priv *priv, |
| 542 | struct ieee80211_vif *vif, |
| 543 | enum iwl_scan_type scan_type, |
| 544 | enum ieee80211_band band); |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 545 | |
Samuel Ortiz | 77fecfb8 | 2009-01-23 13:45:12 -0800 | [diff] [blame] | 546 | /* For faster active scanning, scan will move to the next channel if fewer than |
| 547 | * PLCP_QUIET_THRESH packets are heard on this channel within |
| 548 | * ACTIVE_QUIET_TIME after sending probe request. This shortens the dwell |
| 549 | * time if it's a quiet channel (nothing responded to our probe, and there's |
| 550 | * no other traffic). |
| 551 | * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ |
Harvey Harrison | c1b4aa3 | 2009-01-29 13:26:44 -0800 | [diff] [blame] | 552 | #define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ |
| 553 | #define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ |
Samuel Ortiz | 77fecfb8 | 2009-01-23 13:45:12 -0800 | [diff] [blame] | 554 | |
Johannes Berg | b6e4c55 | 2010-04-06 04:12:42 -0700 | [diff] [blame] | 555 | #define IWL_SCAN_CHECK_WATCHDOG (HZ * 7) |
Samuel Ortiz | 77fecfb8 | 2009-01-23 13:45:12 -0800 | [diff] [blame] | 556 | |
Tomas Winkler | 630fe9b | 2008-06-12 09:47:08 +0800 | [diff] [blame] | 557 | /***************************************************** |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 558 | * S e n d i n g H o s t C o m m a n d s * |
| 559 | *****************************************************/ |
| 560 | |
| 561 | const char *get_cmd_string(u8 cmd); |
Tomas Winkler | e547297 | 2008-03-28 16:21:12 -0700 | [diff] [blame] | 562 | int __must_check iwl_send_cmd_sync(struct iwl_priv *priv, |
| 563 | struct iwl_host_cmd *cmd); |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 564 | int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); |
Tomas Winkler | e547297 | 2008-03-28 16:21:12 -0700 | [diff] [blame] | 565 | int __must_check iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, |
| 566 | u16 len, const void *data); |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 567 | int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len, |
| 568 | const void *data, |
Johannes Berg | 5696aea | 2009-07-24 11:13:06 -0700 | [diff] [blame] | 569 | void (*callback)(struct iwl_priv *priv, |
| 570 | struct iwl_device_cmd *cmd, |
Zhu Yi | 2f30122 | 2009-10-09 17:19:45 +0800 | [diff] [blame] | 571 | struct iwl_rx_packet *pkt)); |
Tomas Winkler | fd4abac | 2008-05-15 13:54:07 +0800 | [diff] [blame] | 572 | |
| 573 | int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); |
Ester Kummer | 189a2b5 | 2008-05-15 13:54:18 +0800 | [diff] [blame] | 574 | |
Samuel Ortiz | c496294 | 2008-12-22 11:31:18 +0800 | [diff] [blame] | 575 | |
Ester Kummer | 189a2b5 | 2008-05-15 13:54:18 +0800 | [diff] [blame] | 576 | /***************************************************** |
Winkler, Tomas | 0ad91a3 | 2008-12-02 12:14:00 -0800 | [diff] [blame] | 577 | * PCI * |
| 578 | *****************************************************/ |
Mohamed Abbas | ef850d7 | 2009-05-22 11:01:50 -0700 | [diff] [blame] | 579 | |
Tomas Winkler | 3fdb68d | 2009-02-10 15:19:02 -0800 | [diff] [blame] | 580 | static inline u16 iwl_pcie_link_ctl(struct iwl_priv *priv) |
| 581 | { |
| 582 | int pos; |
| 583 | u16 pci_lnk_ctl; |
| 584 | pos = pci_find_capability(priv->pci_dev, PCI_CAP_ID_EXP); |
| 585 | pci_read_config_word(priv->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); |
| 586 | return pci_lnk_ctl; |
| 587 | } |
Wey-Yi Guy | b74e31a | 2010-03-01 17:23:50 -0800 | [diff] [blame] | 588 | |
Stanislaw Gruszka | 22de94d | 2010-12-03 15:41:48 +0100 | [diff] [blame] | 589 | void iwl_bg_watchdog(unsigned long data); |
Wey-Yi Guy | a0ee74c | 2010-05-06 08:54:10 -0700 | [diff] [blame] | 590 | u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval); |
| 591 | __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base, |
| 592 | u32 addon, u32 beacon_interval); |
Wey-Yi Guy | b74e31a | 2010-03-01 17:23:50 -0800 | [diff] [blame] | 593 | |
Wey-Yi Guy | 6da3a13 | 2009-03-26 10:14:08 -0700 | [diff] [blame] | 594 | #ifdef CONFIG_PM |
John W. Linville | f60dc01 | 2010-10-25 16:12:37 -0400 | [diff] [blame] | 595 | int iwl_pci_suspend(struct device *device); |
| 596 | int iwl_pci_resume(struct device *device); |
| 597 | extern const struct dev_pm_ops iwl_pm_ops; |
| 598 | |
| 599 | #define IWL_PM_OPS (&iwl_pm_ops) |
| 600 | |
| 601 | #else /* !CONFIG_PM */ |
| 602 | |
| 603 | #define IWL_PM_OPS NULL |
| 604 | |
| 605 | #endif /* !CONFIG_PM */ |
Winkler, Tomas | 0ad91a3 | 2008-12-02 12:14:00 -0800 | [diff] [blame] | 606 | |
| 607 | /***************************************************** |
Ester Kummer | 189a2b5 | 2008-05-15 13:54:18 +0800 | [diff] [blame] | 608 | * Error Handling Debugging |
| 609 | ******************************************************/ |
Wey-Yi Guy | 3a3ff72 | 2009-11-20 12:05:05 -0800 | [diff] [blame] | 610 | void iwl_dump_nic_error_log(struct iwl_priv *priv); |
Wey-Yi Guy | b03d7d0 | 2009-12-14 14:12:20 -0800 | [diff] [blame] | 611 | int iwl_dump_nic_event_log(struct iwl_priv *priv, |
| 612 | bool full_log, char **buf, bool display); |
Reinette Chatre | b7a7940 | 2009-09-25 14:24:23 -0700 | [diff] [blame] | 613 | #ifdef CONFIG_IWLWIFI_DEBUG |
Johannes Berg | 246ed35 | 2010-08-23 10:46:32 +0200 | [diff] [blame] | 614 | void iwl_print_rx_config_cmd(struct iwl_priv *priv, |
| 615 | struct iwl_rxon_context *ctx); |
Reinette Chatre | b7a7940 | 2009-09-25 14:24:23 -0700 | [diff] [blame] | 616 | #else |
Johannes Berg | 246ed35 | 2010-08-23 10:46:32 +0200 | [diff] [blame] | 617 | static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv, |
| 618 | struct iwl_rxon_context *ctx) |
Wey-Yi Guy | a643565 | 2009-11-06 14:52:46 -0800 | [diff] [blame] | 619 | { |
| 620 | } |
Reinette Chatre | b7a7940 | 2009-09-25 14:24:23 -0700 | [diff] [blame] | 621 | #endif |
| 622 | |
Wey-Yi Guy | a83b914 | 2009-04-08 11:39:32 -0700 | [diff] [blame] | 623 | void iwl_clear_isr_stats(struct iwl_priv *priv); |
Ester Kummer | 189a2b5 | 2008-05-15 13:54:18 +0800 | [diff] [blame] | 624 | |
Samuel Ortiz | 534166d | 2009-01-23 13:45:16 -0800 | [diff] [blame] | 625 | /***************************************************** |
| 626 | * GEOS |
| 627 | ******************************************************/ |
| 628 | int iwlcore_init_geos(struct iwl_priv *priv); |
| 629 | void iwlcore_free_geos(struct iwl_priv *priv); |
Tomas Winkler | 76eff18 | 2008-10-14 12:32:45 -0700 | [diff] [blame] | 630 | |
Tomas Winkler | fee1247 | 2008-04-03 16:05:21 -0700 | [diff] [blame] | 631 | /*************** DRIVER STATUS FUNCTIONS *****/ |
| 632 | |
| 633 | #define STATUS_HCMD_ACTIVE 0 /* host command in progress */ |
Reinette Chatre | d2dfe6d | 2010-02-18 22:03:04 -0800 | [diff] [blame] | 634 | /* 1 is unused (used to be STATUS_HCMD_SYNC_ACTIVE) */ |
Tomas Winkler | fee1247 | 2008-04-03 16:05:21 -0700 | [diff] [blame] | 635 | #define STATUS_INT_ENABLED 2 |
| 636 | #define STATUS_RF_KILL_HW 3 |
Wey-Yi Guy | 7812b16 | 2009-10-02 13:43:58 -0700 | [diff] [blame] | 637 | #define STATUS_CT_KILL 4 |
Tomas Winkler | fee1247 | 2008-04-03 16:05:21 -0700 | [diff] [blame] | 638 | #define STATUS_INIT 5 |
| 639 | #define STATUS_ALIVE 6 |
| 640 | #define STATUS_READY 7 |
| 641 | #define STATUS_TEMPERATURE 8 |
| 642 | #define STATUS_GEO_CONFIGURED 9 |
| 643 | #define STATUS_EXIT_PENDING 10 |
Tomas Winkler | fee1247 | 2008-04-03 16:05:21 -0700 | [diff] [blame] | 644 | #define STATUS_STATISTICS 12 |
| 645 | #define STATUS_SCANNING 13 |
| 646 | #define STATUS_SCAN_ABORTING 14 |
| 647 | #define STATUS_SCAN_HW 15 |
| 648 | #define STATUS_POWER_PMI 16 |
| 649 | #define STATUS_FW_ERROR 17 |
Tomas Winkler | fee1247 | 2008-04-03 16:05:21 -0700 | [diff] [blame] | 650 | |
| 651 | |
| 652 | static inline int iwl_is_ready(struct iwl_priv *priv) |
| 653 | { |
| 654 | /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are |
| 655 | * set but EXIT_PENDING is not */ |
| 656 | return test_bit(STATUS_READY, &priv->status) && |
| 657 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) && |
| 658 | !test_bit(STATUS_EXIT_PENDING, &priv->status); |
| 659 | } |
| 660 | |
| 661 | static inline int iwl_is_alive(struct iwl_priv *priv) |
| 662 | { |
| 663 | return test_bit(STATUS_ALIVE, &priv->status); |
| 664 | } |
| 665 | |
| 666 | static inline int iwl_is_init(struct iwl_priv *priv) |
| 667 | { |
| 668 | return test_bit(STATUS_INIT, &priv->status); |
| 669 | } |
| 670 | |
Adel Gadllah | 80fcc9e | 2008-07-01 17:49:50 +0200 | [diff] [blame] | 671 | static inline int iwl_is_rfkill_hw(struct iwl_priv *priv) |
| 672 | { |
| 673 | return test_bit(STATUS_RF_KILL_HW, &priv->status); |
| 674 | } |
| 675 | |
Tomas Winkler | fee1247 | 2008-04-03 16:05:21 -0700 | [diff] [blame] | 676 | static inline int iwl_is_rfkill(struct iwl_priv *priv) |
| 677 | { |
Johannes Berg | a60e77e | 2009-06-04 18:26:06 +0200 | [diff] [blame] | 678 | return iwl_is_rfkill_hw(priv); |
Tomas Winkler | fee1247 | 2008-04-03 16:05:21 -0700 | [diff] [blame] | 679 | } |
| 680 | |
Wey-Yi Guy | 7812b16 | 2009-10-02 13:43:58 -0700 | [diff] [blame] | 681 | static inline int iwl_is_ctkill(struct iwl_priv *priv) |
| 682 | { |
| 683 | return test_bit(STATUS_CT_KILL, &priv->status); |
| 684 | } |
| 685 | |
Tomas Winkler | fee1247 | 2008-04-03 16:05:21 -0700 | [diff] [blame] | 686 | static inline int iwl_is_ready_rf(struct iwl_priv *priv) |
| 687 | { |
| 688 | |
| 689 | if (iwl_is_rfkill(priv)) |
| 690 | return 0; |
| 691 | |
| 692 | return iwl_is_ready(priv); |
| 693 | } |
| 694 | |
Johannes Berg | 65b52bd | 2010-04-13 01:04:31 -0700 | [diff] [blame] | 695 | extern void iwl_send_bt_config(struct iwl_priv *priv); |
Wey-Yi Guy | ef8d552 | 2009-11-13 11:56:28 -0800 | [diff] [blame] | 696 | extern int iwl_send_statistics_request(struct iwl_priv *priv, |
| 697 | u8 flags, bool clear); |
Abhijeet Kolekar | d68b603 | 2009-10-02 13:44:04 -0700 | [diff] [blame] | 698 | void iwl_apm_stop(struct iwl_priv *priv); |
Ben Cahill | fadb358 | 2009-10-23 13:42:21 -0700 | [diff] [blame] | 699 | int iwl_apm_init(struct iwl_priv *priv); |
Tomas Winkler | 7e8c519 | 2008-04-15 16:01:43 -0700 | [diff] [blame] | 700 | |
Johannes Berg | 47313e3 | 2010-08-23 10:46:55 +0200 | [diff] [blame] | 701 | int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
Johannes Berg | 246ed35 | 2010-08-23 10:46:32 +0200 | [diff] [blame] | 702 | static inline int iwl_send_rxon_assoc(struct iwl_priv *priv, |
| 703 | struct iwl_rxon_context *ctx) |
Tomas Winkler | 7e8c519 | 2008-04-15 16:01:43 -0700 | [diff] [blame] | 704 | { |
Johannes Berg | 246ed35 | 2010-08-23 10:46:32 +0200 | [diff] [blame] | 705 | return priv->cfg->ops->hcmd->rxon_assoc(priv, ctx); |
Tomas Winkler | 7e8c519 | 2008-04-15 16:01:43 -0700 | [diff] [blame] | 706 | } |
Johannes Berg | 246ed35 | 2010-08-23 10:46:32 +0200 | [diff] [blame] | 707 | static inline int iwlcore_commit_rxon(struct iwl_priv *priv, |
| 708 | struct iwl_rxon_context *ctx) |
Abhijeet Kolekar | e0158e6 | 2009-04-08 11:26:37 -0700 | [diff] [blame] | 709 | { |
Johannes Berg | 246ed35 | 2010-08-23 10:46:32 +0200 | [diff] [blame] | 710 | return priv->cfg->ops->hcmd->commit_rxon(priv, ctx); |
Abhijeet Kolekar | e0158e6 | 2009-04-08 11:26:37 -0700 | [diff] [blame] | 711 | } |
Ron Rindjunsky | 3c57601 | 2008-05-29 16:35:19 +0800 | [diff] [blame] | 712 | static inline const struct ieee80211_supported_band *iwl_get_hw_mode( |
| 713 | struct iwl_priv *priv, enum ieee80211_band band) |
| 714 | { |
| 715 | return priv->hw->wiphy->bands[band]; |
| 716 | } |
Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 717 | |
Stanislaw Gruszka | 88e58fc | 2011-01-28 16:47:47 +0100 | [diff] [blame] | 718 | static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv) |
| 719 | { |
| 720 | return priv->cfg->bt_params && |
| 721 | priv->cfg->bt_params->advanced_bt_coexist; |
| 722 | } |
| 723 | |
Stanislaw Gruszka | 9f60e7e | 2011-01-28 16:47:51 +0100 | [diff] [blame] | 724 | static inline bool iwl_bt_statistics(struct iwl_priv *priv) |
| 725 | { |
| 726 | return priv->cfg->bt_params && priv->cfg->bt_params->bt_statistics; |
| 727 | } |
| 728 | |
Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 729 | extern bool bt_coex_active; |
Wey-Yi Guy | bee008b | 2010-08-23 07:57:04 -0700 | [diff] [blame] | 730 | extern bool bt_siso_mode; |
Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 731 | |
Johannes Berg | e649437 | 2011-04-05 09:41:58 -0700 | [diff] [blame] | 732 | |
| 733 | void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand); |
| 734 | |
Tomas Winkler | 82b9a12 | 2008-03-04 18:09:30 -0800 | [diff] [blame] | 735 | #endif /* __iwl_core_h__ */ |