Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2005-2011 Atheros Communications Inc. |
| 3 | * Copyright (c) 2011-2013 Qualcomm Atheros, Inc. |
| 4 | * |
| 5 | * Permission to use, copy, modify, and/or distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above |
| 7 | * copyright notice and this permission notice appear in all copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ |
| 17 | |
| 18 | #ifndef _CORE_H_ |
| 19 | #define _CORE_H_ |
| 20 | |
| 21 | #include <linux/completion.h> |
| 22 | #include <linux/if_ether.h> |
| 23 | #include <linux/types.h> |
| 24 | #include <linux/pci.h> |
| 25 | |
Michal Kazior | edb8236 | 2013-07-05 16:15:14 +0300 | [diff] [blame] | 26 | #include "htt.h" |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 27 | #include "htc.h" |
| 28 | #include "hw.h" |
| 29 | #include "targaddrs.h" |
| 30 | #include "wmi.h" |
| 31 | #include "../ath.h" |
| 32 | #include "../regd.h" |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 33 | #include "../dfs_pattern_detector.h" |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 34 | |
| 35 | #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB) |
| 36 | #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) |
| 37 | #define WO(_f) ((_f##_OFFSET) >> 2) |
| 38 | |
| 39 | #define ATH10K_SCAN_ID 0 |
| 40 | #define WMI_READY_TIMEOUT (5 * HZ) |
| 41 | #define ATH10K_FLUSH_TIMEOUT_HZ (5*HZ) |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 42 | #define ATH10K_NUM_CHANS 38 |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 43 | |
| 44 | /* Antenna noise floor */ |
| 45 | #define ATH10K_DEFAULT_NOISE_FLOOR -95 |
| 46 | |
Bartosz Markowski | 7109861 | 2013-11-14 09:01:15 +0100 | [diff] [blame] | 47 | #define ATH10K_MAX_NUM_MGMT_PENDING 128 |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 48 | |
Kalle Valo | 5a13e76 | 2014-01-20 11:01:46 +0200 | [diff] [blame] | 49 | /* number of failed packets */ |
| 50 | #define ATH10K_KICKOUT_THRESHOLD 50 |
| 51 | |
| 52 | /* |
| 53 | * Use insanely high numbers to make sure that the firmware implementation |
| 54 | * won't start, we have the same functionality already in hostapd. Unit |
| 55 | * is seconds. |
| 56 | */ |
| 57 | #define ATH10K_KEEPALIVE_MIN_IDLE 3747 |
| 58 | #define ATH10K_KEEPALIVE_MAX_IDLE 3895 |
| 59 | #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900 |
| 60 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 61 | struct ath10k; |
| 62 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 63 | struct ath10k_skb_cb { |
| 64 | dma_addr_t paddr; |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 65 | u8 vdev_id; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 66 | |
| 67 | struct { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 68 | u8 tid; |
| 69 | bool is_offchan; |
Michal Kazior | a16942e | 2014-02-27 18:50:04 +0200 | [diff] [blame] | 70 | struct ath10k_htt_txbuf *txbuf; |
| 71 | u32 txbuf_paddr; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 72 | } __packed htt; |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 73 | |
| 74 | struct { |
| 75 | bool dtim_zero; |
| 76 | bool deliver_cab; |
| 77 | } bcn; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 78 | } __packed; |
| 79 | |
| 80 | static inline struct ath10k_skb_cb *ATH10K_SKB_CB(struct sk_buff *skb) |
| 81 | { |
| 82 | BUILD_BUG_ON(sizeof(struct ath10k_skb_cb) > |
| 83 | IEEE80211_TX_INFO_DRIVER_DATA_SIZE); |
| 84 | return (struct ath10k_skb_cb *)&IEEE80211_SKB_CB(skb)->driver_data; |
| 85 | } |
| 86 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 87 | static inline u32 host_interest_item_address(u32 item_offset) |
| 88 | { |
| 89 | return QCA988X_HOST_INTEREST_ADDRESS + item_offset; |
| 90 | } |
| 91 | |
| 92 | struct ath10k_bmi { |
| 93 | bool done_sent; |
| 94 | }; |
| 95 | |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 96 | #define ATH10K_MAX_MEM_REQS 16 |
| 97 | |
| 98 | struct ath10k_mem_chunk { |
| 99 | void *vaddr; |
| 100 | dma_addr_t paddr; |
| 101 | u32 len; |
| 102 | u32 req_id; |
| 103 | }; |
| 104 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 105 | struct ath10k_wmi { |
| 106 | enum ath10k_htc_ep_id eid; |
| 107 | struct completion service_ready; |
| 108 | struct completion unified_ready; |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 109 | wait_queue_head_t tx_credits_wq; |
Bartosz Markowski | ce42870 | 2013-09-26 17:47:05 +0200 | [diff] [blame] | 110 | struct wmi_cmd_map *cmd; |
Bartosz Markowski | 6d1506e | 2013-09-26 17:47:15 +0200 | [diff] [blame] | 111 | struct wmi_vdev_param_map *vdev_param; |
Bartosz Markowski | 226a339 | 2013-09-26 17:47:16 +0200 | [diff] [blame] | 112 | struct wmi_pdev_param_map *pdev_param; |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 113 | |
| 114 | u32 num_mem_chunks; |
| 115 | struct ath10k_mem_chunk mem_chunks[ATH10K_MAX_MEM_REQS]; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 116 | }; |
| 117 | |
| 118 | struct ath10k_peer_stat { |
| 119 | u8 peer_macaddr[ETH_ALEN]; |
| 120 | u32 peer_rssi; |
| 121 | u32 peer_tx_rate; |
| 122 | }; |
| 123 | |
| 124 | struct ath10k_target_stats { |
| 125 | /* PDEV stats */ |
| 126 | s32 ch_noise_floor; |
| 127 | u32 tx_frame_count; |
| 128 | u32 rx_frame_count; |
| 129 | u32 rx_clear_count; |
| 130 | u32 cycle_count; |
| 131 | u32 phy_err_count; |
| 132 | u32 chan_tx_power; |
| 133 | |
| 134 | /* PDEV TX stats */ |
| 135 | s32 comp_queued; |
| 136 | s32 comp_delivered; |
| 137 | s32 msdu_enqued; |
| 138 | s32 mpdu_enqued; |
| 139 | s32 wmm_drop; |
| 140 | s32 local_enqued; |
| 141 | s32 local_freed; |
| 142 | s32 hw_queued; |
| 143 | s32 hw_reaped; |
| 144 | s32 underrun; |
| 145 | s32 tx_abort; |
| 146 | s32 mpdus_requed; |
| 147 | u32 tx_ko; |
| 148 | u32 data_rc; |
| 149 | u32 self_triggers; |
| 150 | u32 sw_retry_failure; |
| 151 | u32 illgl_rate_phy_err; |
| 152 | u32 pdev_cont_xretry; |
| 153 | u32 pdev_tx_timeout; |
| 154 | u32 pdev_resets; |
| 155 | u32 phy_underrun; |
| 156 | u32 txop_ovf; |
| 157 | |
| 158 | /* PDEV RX stats */ |
| 159 | s32 mid_ppdu_route_change; |
| 160 | s32 status_rcvd; |
| 161 | s32 r0_frags; |
| 162 | s32 r1_frags; |
| 163 | s32 r2_frags; |
| 164 | s32 r3_frags; |
| 165 | s32 htt_msdus; |
| 166 | s32 htt_mpdus; |
| 167 | s32 loc_msdus; |
| 168 | s32 loc_mpdus; |
| 169 | s32 oversize_amsdu; |
| 170 | s32 phy_errs; |
| 171 | s32 phy_err_drop; |
| 172 | s32 mpdu_errs; |
| 173 | |
| 174 | /* VDEV STATS */ |
| 175 | |
| 176 | /* PEER STATS */ |
| 177 | u8 peers; |
| 178 | struct ath10k_peer_stat peer_stat[TARGET_NUM_PEERS]; |
| 179 | |
| 180 | /* TODO: Beacon filter stats */ |
| 181 | |
| 182 | }; |
| 183 | |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 184 | struct ath10k_dfs_stats { |
| 185 | u32 phy_errors; |
| 186 | u32 pulses_total; |
| 187 | u32 pulses_detected; |
| 188 | u32 pulses_discarded; |
| 189 | u32 radar_detected; |
| 190 | }; |
| 191 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 192 | #define ATH10K_MAX_NUM_PEER_IDS (1 << 11) /* htt rx_desc limit */ |
| 193 | |
| 194 | struct ath10k_peer { |
| 195 | struct list_head list; |
| 196 | int vdev_id; |
| 197 | u8 addr[ETH_ALEN]; |
| 198 | DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS); |
| 199 | struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1]; |
| 200 | }; |
| 201 | |
Michal Kazior | 9797feb | 2014-02-14 14:49:48 +0100 | [diff] [blame] | 202 | struct ath10k_sta { |
| 203 | struct ath10k_vif *arvif; |
| 204 | |
| 205 | /* the following are protected by ar->data_lock */ |
| 206 | u32 changed; /* IEEE80211_RC_* */ |
| 207 | u32 bw; |
| 208 | u32 nss; |
| 209 | u32 smps; |
| 210 | |
| 211 | struct work_struct update_wk; |
| 212 | }; |
| 213 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 214 | #define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ) |
| 215 | |
| 216 | struct ath10k_vif { |
Michal Kazior | 0579119 | 2013-10-16 15:44:45 +0300 | [diff] [blame] | 217 | struct list_head list; |
| 218 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 219 | u32 vdev_id; |
| 220 | enum wmi_vdev_type vdev_type; |
| 221 | enum wmi_vdev_subtype vdev_subtype; |
| 222 | u32 beacon_interval; |
| 223 | u32 dtim_period; |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 224 | struct sk_buff *beacon; |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 225 | /* protected by data_lock */ |
| 226 | bool beacon_sent; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 227 | |
| 228 | struct ath10k *ar; |
| 229 | struct ieee80211_vif *vif; |
| 230 | |
Michal Kazior | c930f74 | 2014-01-23 11:38:25 +0100 | [diff] [blame] | 231 | bool is_started; |
| 232 | bool is_up; |
| 233 | u32 aid; |
| 234 | u8 bssid[ETH_ALEN]; |
| 235 | |
Michal Kazior | cc4827b | 2013-10-16 15:44:45 +0300 | [diff] [blame] | 236 | struct work_struct wep_key_work; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 237 | struct ieee80211_key_conf *wep_keys[WMI_MAX_KEY_INDEX + 1]; |
Michal Kazior | cc4827b | 2013-10-16 15:44:45 +0300 | [diff] [blame] | 238 | u8 def_wep_key_idx; |
| 239 | u8 def_wep_key_newidx; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 240 | |
| 241 | u16 tx_seq_no; |
| 242 | |
| 243 | union { |
| 244 | struct { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 245 | u32 uapsd; |
| 246 | } sta; |
| 247 | struct { |
| 248 | /* 127 stations; wmi limit */ |
| 249 | u8 tim_bitmap[16]; |
| 250 | u8 tim_len; |
| 251 | u32 ssid_len; |
| 252 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
| 253 | bool hidden_ssid; |
| 254 | /* P2P_IE with NoA attribute for P2P_GO case */ |
| 255 | u32 noa_len; |
| 256 | u8 *noa_data; |
| 257 | } ap; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 258 | } u; |
Janusz Dziedzic | 51ab1a0 | 2014-01-08 09:08:33 +0100 | [diff] [blame] | 259 | |
| 260 | u8 fixed_rate; |
| 261 | u8 fixed_nss; |
Janusz Dziedzic | 9f81f72 | 2014-01-17 20:04:14 +0100 | [diff] [blame] | 262 | u8 force_sgi; |
Marek Kwaczynski | e81bd10 | 2014-03-11 12:58:00 +0200 | [diff] [blame^] | 263 | bool use_cts_prot; |
| 264 | int num_legacy_stations; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 265 | }; |
| 266 | |
| 267 | struct ath10k_vif_iter { |
| 268 | u32 vdev_id; |
| 269 | struct ath10k_vif *arvif; |
| 270 | }; |
| 271 | |
| 272 | struct ath10k_debug { |
| 273 | struct dentry *debugfs_phy; |
| 274 | |
| 275 | struct ath10k_target_stats target_stats; |
| 276 | u32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE]; |
| 277 | |
| 278 | struct completion event_stats_compl; |
Kalle Valo | a3d135e | 2013-09-03 11:44:10 +0300 | [diff] [blame] | 279 | |
| 280 | unsigned long htt_stats_mask; |
| 281 | struct delayed_work htt_stats_dwork; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 282 | struct ath10k_dfs_stats dfs_stats; |
| 283 | struct ath_dfs_pool_stats dfs_pool_stats; |
Kalle Valo | f118a3e | 2014-01-03 12:59:31 +0200 | [diff] [blame] | 284 | |
| 285 | u32 fw_dbglog_mask; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 286 | }; |
| 287 | |
Michal Kazior | f7843d7 | 2013-07-16 09:38:52 +0200 | [diff] [blame] | 288 | enum ath10k_state { |
| 289 | ATH10K_STATE_OFF = 0, |
| 290 | ATH10K_STATE_ON, |
Michal Kazior | affd321 | 2013-07-16 09:54:35 +0200 | [diff] [blame] | 291 | |
| 292 | /* When doing firmware recovery the device is first powered down. |
| 293 | * mac80211 is supposed to call in to start() hook later on. It is |
| 294 | * however possible that driver unloading and firmware crash overlap. |
| 295 | * mac80211 can wait on conf_mutex in stop() while the device is |
| 296 | * stopped in ath10k_core_restart() work holding conf_mutex. The state |
| 297 | * RESTARTED means that the device is up and mac80211 has started hw |
| 298 | * reconfiguration. Once mac80211 is done with the reconfiguration we |
| 299 | * set the state to STATE_ON in restart_complete(). */ |
| 300 | ATH10K_STATE_RESTARTING, |
| 301 | ATH10K_STATE_RESTARTED, |
| 302 | |
| 303 | /* The device has crashed while restarting hw. This state is like ON |
| 304 | * but commands are blocked in HTC and -ECOMM response is given. This |
| 305 | * prevents completion timeouts and makes the driver more responsive to |
| 306 | * userspace commands. This is also prevents recursive recovery. */ |
| 307 | ATH10K_STATE_WEDGED, |
Michal Kazior | f7843d7 | 2013-07-16 09:38:52 +0200 | [diff] [blame] | 308 | }; |
| 309 | |
Michal Kazior | 0d9b043 | 2013-08-09 10:13:33 +0200 | [diff] [blame] | 310 | enum ath10k_fw_features { |
| 311 | /* wmi_mgmt_rx_hdr contains extra RSSI information */ |
| 312 | ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX = 0, |
| 313 | |
Bartosz Markowski | ce42870 | 2013-09-26 17:47:05 +0200 | [diff] [blame] | 314 | /* firmware from 10X branch */ |
| 315 | ATH10K_FW_FEATURE_WMI_10X = 1, |
| 316 | |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 317 | /* firmware support tx frame management over WMI, otherwise it's HTT */ |
| 318 | ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX = 2, |
| 319 | |
Bartosz Markowski | d354181 | 2013-12-10 16:20:40 +0100 | [diff] [blame] | 320 | /* Firmware does not support P2P */ |
| 321 | ATH10K_FW_FEATURE_NO_P2P = 3, |
| 322 | |
Michal Kazior | 0d9b043 | 2013-08-09 10:13:33 +0200 | [diff] [blame] | 323 | /* keep last */ |
| 324 | ATH10K_FW_FEATURE_COUNT, |
| 325 | }; |
| 326 | |
Marek Puzyniak | e8a50f8 | 2013-11-20 09:59:47 +0200 | [diff] [blame] | 327 | enum ath10k_dev_flags { |
| 328 | /* Indicates that ath10k device is during CAC phase of DFS */ |
| 329 | ATH10K_CAC_RUNNING, |
Kalle Valo | 650b91f | 2013-11-20 10:00:49 +0200 | [diff] [blame] | 330 | ATH10K_FLAG_FIRST_BOOT_DONE, |
Marek Puzyniak | e8a50f8 | 2013-11-20 09:59:47 +0200 | [diff] [blame] | 331 | }; |
| 332 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 333 | struct ath10k { |
| 334 | struct ath_common ath_common; |
| 335 | struct ieee80211_hw *hw; |
| 336 | struct device *dev; |
| 337 | u8 mac_addr[ETH_ALEN]; |
| 338 | |
Kalle Valo | e01ae68 | 2013-09-01 11:22:14 +0300 | [diff] [blame] | 339 | u32 chip_id; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 340 | u32 target_version; |
| 341 | u8 fw_version_major; |
| 342 | u32 fw_version_minor; |
| 343 | u16 fw_version_release; |
| 344 | u16 fw_version_build; |
| 345 | u32 phy_capability; |
| 346 | u32 hw_min_tx_power; |
| 347 | u32 hw_max_tx_power; |
| 348 | u32 ht_cap_info; |
| 349 | u32 vht_cap_info; |
Michal Kazior | 8865bee4 | 2013-07-24 12:36:46 +0200 | [diff] [blame] | 350 | u32 num_rf_chains; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 351 | |
Michal Kazior | 0d9b043 | 2013-08-09 10:13:33 +0200 | [diff] [blame] | 352 | DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT); |
| 353 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 354 | struct targetdef *targetdef; |
| 355 | struct hostdef *hostdef; |
| 356 | |
| 357 | bool p2p; |
| 358 | |
| 359 | struct { |
| 360 | void *priv; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 361 | const struct ath10k_hif_ops *ops; |
| 362 | } hif; |
| 363 | |
Marek Puzyniak | 9042e17 | 2014-02-10 17:14:23 +0100 | [diff] [blame] | 364 | struct completion target_suspend; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 365 | |
| 366 | struct ath10k_bmi bmi; |
Michal Kazior | edb8236 | 2013-07-05 16:15:14 +0300 | [diff] [blame] | 367 | struct ath10k_wmi wmi; |
Michal Kazior | cd003fa | 2013-07-05 16:15:13 +0300 | [diff] [blame] | 368 | struct ath10k_htc htc; |
Michal Kazior | edb8236 | 2013-07-05 16:15:14 +0300 | [diff] [blame] | 369 | struct ath10k_htt htt; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 370 | |
| 371 | struct ath10k_hw_params { |
| 372 | u32 id; |
| 373 | const char *name; |
| 374 | u32 patch_load_addr; |
| 375 | |
| 376 | struct ath10k_hw_params_fw { |
| 377 | const char *dir; |
| 378 | const char *fw; |
| 379 | const char *otp; |
| 380 | const char *board; |
| 381 | } fw; |
| 382 | } hw_params; |
| 383 | |
Kalle Valo | 3652791 | 2013-09-27 19:54:55 +0300 | [diff] [blame] | 384 | const struct firmware *board; |
Kalle Valo | 958df3a | 2013-09-27 19:55:01 +0300 | [diff] [blame] | 385 | const void *board_data; |
| 386 | size_t board_len; |
| 387 | |
Michal Kazior | 2938505 | 2013-07-16 09:38:58 +0200 | [diff] [blame] | 388 | const struct firmware *otp; |
Kalle Valo | 958df3a | 2013-09-27 19:55:01 +0300 | [diff] [blame] | 389 | const void *otp_data; |
| 390 | size_t otp_len; |
| 391 | |
Michal Kazior | 2938505 | 2013-07-16 09:38:58 +0200 | [diff] [blame] | 392 | const struct firmware *firmware; |
Kalle Valo | 958df3a | 2013-09-27 19:55:01 +0300 | [diff] [blame] | 393 | const void *firmware_data; |
| 394 | size_t firmware_len; |
Michal Kazior | 2938505 | 2013-07-16 09:38:58 +0200 | [diff] [blame] | 395 | |
Kalle Valo | 1a22243 | 2013-09-27 19:55:07 +0300 | [diff] [blame] | 396 | int fw_api; |
| 397 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 398 | struct { |
| 399 | struct completion started; |
| 400 | struct completion completed; |
| 401 | struct completion on_channel; |
| 402 | struct timer_list timeout; |
| 403 | bool is_roc; |
| 404 | bool in_progress; |
| 405 | bool aborting; |
| 406 | int vdev_id; |
| 407 | int roc_freq; |
| 408 | } scan; |
| 409 | |
| 410 | struct { |
| 411 | struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; |
| 412 | } mac; |
| 413 | |
| 414 | /* should never be NULL; needed for regular htt rx */ |
| 415 | struct ieee80211_channel *rx_channel; |
| 416 | |
| 417 | /* valid during scan; needed for mgmt rx during scan */ |
| 418 | struct ieee80211_channel *scan_channel; |
| 419 | |
Michal Kazior | c930f74 | 2014-01-23 11:38:25 +0100 | [diff] [blame] | 420 | /* current operating channel definition */ |
| 421 | struct cfg80211_chan_def chandef; |
| 422 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 423 | int free_vdev_map; |
| 424 | int monitor_vdev_id; |
| 425 | bool monitor_enabled; |
| 426 | bool monitor_present; |
| 427 | unsigned int filter_flags; |
Marek Puzyniak | e8a50f8 | 2013-11-20 09:59:47 +0200 | [diff] [blame] | 428 | unsigned long dev_flags; |
Marek Puzyniak | 7d9b40b | 2013-11-20 10:00:28 +0200 | [diff] [blame] | 429 | u32 dfs_block_radar_events; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 430 | |
| 431 | struct wmi_pdev_set_wmm_params_arg wmm_params; |
| 432 | struct completion install_key_done; |
| 433 | |
| 434 | struct completion vdev_setup_done; |
| 435 | |
| 436 | struct workqueue_struct *workqueue; |
| 437 | |
| 438 | /* prevents concurrent FW reconfiguration */ |
| 439 | struct mutex conf_mutex; |
| 440 | |
| 441 | /* protects shared structure data */ |
| 442 | spinlock_t data_lock; |
| 443 | |
Michal Kazior | 0579119 | 2013-10-16 15:44:45 +0300 | [diff] [blame] | 444 | struct list_head arvifs; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 445 | struct list_head peers; |
| 446 | wait_queue_head_t peer_mapping_wq; |
| 447 | |
Bartosz Markowski | 0e759f3 | 2014-01-02 14:38:33 +0100 | [diff] [blame] | 448 | /* number of created peers; protected by data_lock */ |
| 449 | int num_peers; |
| 450 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 451 | struct work_struct offchan_tx_work; |
| 452 | struct sk_buff_head offchan_tx_queue; |
| 453 | struct completion offchan_tx_completed; |
| 454 | struct sk_buff *offchan_tx_skb; |
| 455 | |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 456 | struct work_struct wmi_mgmt_tx_work; |
| 457 | struct sk_buff_head wmi_mgmt_tx_queue; |
| 458 | |
Michal Kazior | f7843d7 | 2013-07-16 09:38:52 +0200 | [diff] [blame] | 459 | enum ath10k_state state; |
| 460 | |
Michal Kazior | affd321 | 2013-07-16 09:54:35 +0200 | [diff] [blame] | 461 | struct work_struct restart_work; |
| 462 | |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 463 | /* cycle count is reported twice for each visited channel during scan. |
| 464 | * access protected by data_lock */ |
| 465 | u32 survey_last_rx_clear_count; |
| 466 | u32 survey_last_cycle_count; |
| 467 | struct survey_info survey[ATH10K_NUM_CHANS]; |
| 468 | |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 469 | struct dfs_pattern_detector *dfs_detector; |
| 470 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 471 | #ifdef CONFIG_ATH10K_DEBUGFS |
| 472 | struct ath10k_debug debug; |
| 473 | #endif |
| 474 | }; |
| 475 | |
| 476 | struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 477 | const struct ath10k_hif_ops *hif_ops); |
| 478 | void ath10k_core_destroy(struct ath10k *ar); |
| 479 | |
Michal Kazior | dd30a36 | 2013-07-16 09:38:51 +0200 | [diff] [blame] | 480 | int ath10k_core_start(struct ath10k *ar); |
Marek Puzyniak | 00f5482 | 2014-02-10 17:14:24 +0100 | [diff] [blame] | 481 | int ath10k_wait_for_suspend(struct ath10k *ar, u32 suspend_opt); |
Michal Kazior | dd30a36 | 2013-07-16 09:38:51 +0200 | [diff] [blame] | 482 | void ath10k_core_stop(struct ath10k *ar); |
Kalle Valo | e01ae68 | 2013-09-01 11:22:14 +0300 | [diff] [blame] | 483 | int ath10k_core_register(struct ath10k *ar, u32 chip_id); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 484 | void ath10k_core_unregister(struct ath10k *ar); |
| 485 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 486 | #endif /* _CORE_H_ */ |