core.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  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. #ifndef _CORE_H_
  18. #define _CORE_H_
  19. #include <linux/completion.h>
  20. #include <linux/if_ether.h>
  21. #include <linux/types.h>
  22. #include <linux/pci.h>
  23. #include <linux/uuid.h>
  24. #include <linux/time.h>
  25. #include "htt.h"
  26. #include "htc.h"
  27. #include "hw.h"
  28. #include "targaddrs.h"
  29. #include "wmi.h"
  30. #include "../ath.h"
  31. #include "../regd.h"
  32. #include "../dfs_pattern_detector.h"
  33. #include "spectral.h"
  34. #include "thermal.h"
  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. #define ATH10K_SCAN_ID 0
  39. #define WMI_READY_TIMEOUT (5 * HZ)
  40. #define ATH10K_FLUSH_TIMEOUT_HZ (5*HZ)
  41. #define ATH10K_NUM_CHANS 38
  42. /* Antenna noise floor */
  43. #define ATH10K_DEFAULT_NOISE_FLOOR -95
  44. #define ATH10K_MAX_NUM_MGMT_PENDING 128
  45. /* number of failed packets */
  46. #define ATH10K_KICKOUT_THRESHOLD 50
  47. /*
  48. * Use insanely high numbers to make sure that the firmware implementation
  49. * won't start, we have the same functionality already in hostapd. Unit
  50. * is seconds.
  51. */
  52. #define ATH10K_KEEPALIVE_MIN_IDLE 3747
  53. #define ATH10K_KEEPALIVE_MAX_IDLE 3895
  54. #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
  55. struct ath10k;
  56. enum ath10k_bus {
  57. ATH10K_BUS_PCI,
  58. };
  59. static inline const char *ath10k_bus_str(enum ath10k_bus bus)
  60. {
  61. switch (bus) {
  62. case ATH10K_BUS_PCI:
  63. return "pci";
  64. }
  65. return "unknown";
  66. }
  67. struct ath10k_skb_cb {
  68. dma_addr_t paddr;
  69. u8 eid;
  70. u8 vdev_id;
  71. struct {
  72. u8 tid;
  73. u16 freq;
  74. bool is_offchan;
  75. struct ath10k_htt_txbuf *txbuf;
  76. u32 txbuf_paddr;
  77. } __packed htt;
  78. struct {
  79. bool dtim_zero;
  80. bool deliver_cab;
  81. } bcn;
  82. } __packed;
  83. struct ath10k_skb_rxcb {
  84. dma_addr_t paddr;
  85. struct hlist_node hlist;
  86. };
  87. static inline struct ath10k_skb_cb *ATH10K_SKB_CB(struct sk_buff *skb)
  88. {
  89. BUILD_BUG_ON(sizeof(struct ath10k_skb_cb) >
  90. IEEE80211_TX_INFO_DRIVER_DATA_SIZE);
  91. return (struct ath10k_skb_cb *)&IEEE80211_SKB_CB(skb)->driver_data;
  92. }
  93. static inline struct ath10k_skb_rxcb *ATH10K_SKB_RXCB(struct sk_buff *skb)
  94. {
  95. BUILD_BUG_ON(sizeof(struct ath10k_skb_rxcb) > sizeof(skb->cb));
  96. return (struct ath10k_skb_rxcb *)skb->cb;
  97. }
  98. #define ATH10K_RXCB_SKB(rxcb) \
  99. container_of((void *)rxcb, struct sk_buff, cb)
  100. static inline u32 host_interest_item_address(u32 item_offset)
  101. {
  102. return QCA988X_HOST_INTEREST_ADDRESS + item_offset;
  103. }
  104. struct ath10k_bmi {
  105. bool done_sent;
  106. };
  107. struct ath10k_mem_chunk {
  108. void *vaddr;
  109. dma_addr_t paddr;
  110. u32 len;
  111. u32 req_id;
  112. };
  113. struct ath10k_wmi {
  114. enum ath10k_fw_wmi_op_version op_version;
  115. enum ath10k_htc_ep_id eid;
  116. struct completion service_ready;
  117. struct completion unified_ready;
  118. wait_queue_head_t tx_credits_wq;
  119. DECLARE_BITMAP(svc_map, WMI_SERVICE_MAX);
  120. struct wmi_cmd_map *cmd;
  121. struct wmi_vdev_param_map *vdev_param;
  122. struct wmi_pdev_param_map *pdev_param;
  123. const struct wmi_ops *ops;
  124. u32 num_mem_chunks;
  125. struct ath10k_mem_chunk mem_chunks[WMI_MAX_MEM_REQS];
  126. };
  127. struct ath10k_fw_stats_peer {
  128. struct list_head list;
  129. u8 peer_macaddr[ETH_ALEN];
  130. u32 peer_rssi;
  131. u32 peer_tx_rate;
  132. u32 peer_rx_rate; /* 10x only */
  133. };
  134. struct ath10k_fw_stats_vdev {
  135. struct list_head list;
  136. u32 vdev_id;
  137. u32 beacon_snr;
  138. u32 data_snr;
  139. u32 num_tx_frames[4];
  140. u32 num_rx_frames;
  141. u32 num_tx_frames_retries[4];
  142. u32 num_tx_frames_failures[4];
  143. u32 num_rts_fail;
  144. u32 num_rts_success;
  145. u32 num_rx_err;
  146. u32 num_rx_discard;
  147. u32 num_tx_not_acked;
  148. u32 tx_rate_history[10];
  149. u32 beacon_rssi_history[10];
  150. };
  151. struct ath10k_fw_stats_pdev {
  152. struct list_head list;
  153. /* PDEV stats */
  154. s32 ch_noise_floor;
  155. u32 tx_frame_count;
  156. u32 rx_frame_count;
  157. u32 rx_clear_count;
  158. u32 cycle_count;
  159. u32 phy_err_count;
  160. u32 chan_tx_power;
  161. u32 ack_rx_bad;
  162. u32 rts_bad;
  163. u32 rts_good;
  164. u32 fcs_bad;
  165. u32 no_beacons;
  166. u32 mib_int_count;
  167. /* PDEV TX stats */
  168. s32 comp_queued;
  169. s32 comp_delivered;
  170. s32 msdu_enqued;
  171. s32 mpdu_enqued;
  172. s32 wmm_drop;
  173. s32 local_enqued;
  174. s32 local_freed;
  175. s32 hw_queued;
  176. s32 hw_reaped;
  177. s32 underrun;
  178. s32 tx_abort;
  179. s32 mpdus_requed;
  180. u32 tx_ko;
  181. u32 data_rc;
  182. u32 self_triggers;
  183. u32 sw_retry_failure;
  184. u32 illgl_rate_phy_err;
  185. u32 pdev_cont_xretry;
  186. u32 pdev_tx_timeout;
  187. u32 pdev_resets;
  188. u32 phy_underrun;
  189. u32 txop_ovf;
  190. /* PDEV RX stats */
  191. s32 mid_ppdu_route_change;
  192. s32 status_rcvd;
  193. s32 r0_frags;
  194. s32 r1_frags;
  195. s32 r2_frags;
  196. s32 r3_frags;
  197. s32 htt_msdus;
  198. s32 htt_mpdus;
  199. s32 loc_msdus;
  200. s32 loc_mpdus;
  201. s32 oversize_amsdu;
  202. s32 phy_errs;
  203. s32 phy_err_drop;
  204. s32 mpdu_errs;
  205. };
  206. struct ath10k_fw_stats {
  207. struct list_head pdevs;
  208. struct list_head vdevs;
  209. struct list_head peers;
  210. };
  211. struct ath10k_dfs_stats {
  212. u32 phy_errors;
  213. u32 pulses_total;
  214. u32 pulses_detected;
  215. u32 pulses_discarded;
  216. u32 radar_detected;
  217. };
  218. #define ATH10K_MAX_NUM_PEER_IDS (1 << 11) /* htt rx_desc limit */
  219. struct ath10k_peer {
  220. struct list_head list;
  221. int vdev_id;
  222. u8 addr[ETH_ALEN];
  223. DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS);
  224. /* protected by ar->data_lock */
  225. struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
  226. };
  227. struct ath10k_sta {
  228. struct ath10k_vif *arvif;
  229. /* the following are protected by ar->data_lock */
  230. u32 changed; /* IEEE80211_RC_* */
  231. u32 bw;
  232. u32 nss;
  233. u32 smps;
  234. struct work_struct update_wk;
  235. #ifdef CONFIG_MAC80211_DEBUGFS
  236. /* protected by conf_mutex */
  237. bool aggr_mode;
  238. #endif
  239. };
  240. #define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ)
  241. enum ath10k_beacon_state {
  242. ATH10K_BEACON_SCHEDULED = 0,
  243. ATH10K_BEACON_SENDING,
  244. ATH10K_BEACON_SENT,
  245. };
  246. struct ath10k_vif {
  247. struct list_head list;
  248. u32 vdev_id;
  249. enum wmi_vdev_type vdev_type;
  250. enum wmi_vdev_subtype vdev_subtype;
  251. u32 beacon_interval;
  252. u32 dtim_period;
  253. struct sk_buff *beacon;
  254. /* protected by data_lock */
  255. enum ath10k_beacon_state beacon_state;
  256. void *beacon_buf;
  257. dma_addr_t beacon_paddr;
  258. struct ath10k *ar;
  259. struct ieee80211_vif *vif;
  260. bool is_started;
  261. bool is_up;
  262. bool spectral_enabled;
  263. bool ps;
  264. u32 aid;
  265. u8 bssid[ETH_ALEN];
  266. struct ieee80211_key_conf *wep_keys[WMI_MAX_KEY_INDEX + 1];
  267. s8 def_wep_key_idx;
  268. u16 tx_seq_no;
  269. union {
  270. struct {
  271. u32 uapsd;
  272. } sta;
  273. struct {
  274. /* 127 stations; wmi limit */
  275. u8 tim_bitmap[16];
  276. u8 tim_len;
  277. u32 ssid_len;
  278. u8 ssid[IEEE80211_MAX_SSID_LEN];
  279. bool hidden_ssid;
  280. /* P2P_IE with NoA attribute for P2P_GO case */
  281. u32 noa_len;
  282. u8 *noa_data;
  283. } ap;
  284. } u;
  285. u8 fixed_rate;
  286. u8 fixed_nss;
  287. u8 force_sgi;
  288. bool use_cts_prot;
  289. int num_legacy_stations;
  290. int txpower;
  291. struct wmi_wmm_params_all_arg wmm_params;
  292. };
  293. struct ath10k_vif_iter {
  294. u32 vdev_id;
  295. struct ath10k_vif *arvif;
  296. };
  297. /* used for crash-dump storage, protected by data-lock */
  298. struct ath10k_fw_crash_data {
  299. bool crashed_since_read;
  300. uuid_le uuid;
  301. struct timespec timestamp;
  302. __le32 registers[REG_DUMP_COUNT_QCA988X];
  303. };
  304. struct ath10k_debug {
  305. struct dentry *debugfs_phy;
  306. struct ath10k_fw_stats fw_stats;
  307. struct completion fw_stats_complete;
  308. bool fw_stats_done;
  309. unsigned long htt_stats_mask;
  310. struct delayed_work htt_stats_dwork;
  311. struct ath10k_dfs_stats dfs_stats;
  312. struct ath_dfs_pool_stats dfs_pool_stats;
  313. /* protected by conf_mutex */
  314. u32 fw_dbglog_mask;
  315. u32 fw_dbglog_level;
  316. u32 pktlog_filter;
  317. u32 reg_addr;
  318. u32 nf_cal_period;
  319. u8 htt_max_amsdu;
  320. u8 htt_max_ampdu;
  321. struct ath10k_fw_crash_data *fw_crash_data;
  322. };
  323. enum ath10k_state {
  324. ATH10K_STATE_OFF = 0,
  325. ATH10K_STATE_ON,
  326. /* When doing firmware recovery the device is first powered down.
  327. * mac80211 is supposed to call in to start() hook later on. It is
  328. * however possible that driver unloading and firmware crash overlap.
  329. * mac80211 can wait on conf_mutex in stop() while the device is
  330. * stopped in ath10k_core_restart() work holding conf_mutex. The state
  331. * RESTARTED means that the device is up and mac80211 has started hw
  332. * reconfiguration. Once mac80211 is done with the reconfiguration we
  333. * set the state to STATE_ON in reconfig_complete(). */
  334. ATH10K_STATE_RESTARTING,
  335. ATH10K_STATE_RESTARTED,
  336. /* The device has crashed while restarting hw. This state is like ON
  337. * but commands are blocked in HTC and -ECOMM response is given. This
  338. * prevents completion timeouts and makes the driver more responsive to
  339. * userspace commands. This is also prevents recursive recovery. */
  340. ATH10K_STATE_WEDGED,
  341. /* factory tests */
  342. ATH10K_STATE_UTF,
  343. };
  344. enum ath10k_firmware_mode {
  345. /* the default mode, standard 802.11 functionality */
  346. ATH10K_FIRMWARE_MODE_NORMAL,
  347. /* factory tests etc */
  348. ATH10K_FIRMWARE_MODE_UTF,
  349. };
  350. enum ath10k_fw_features {
  351. /* wmi_mgmt_rx_hdr contains extra RSSI information */
  352. ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX = 0,
  353. /* Firmware from 10X branch. Deprecated, don't use in new code. */
  354. ATH10K_FW_FEATURE_WMI_10X = 1,
  355. /* firmware support tx frame management over WMI, otherwise it's HTT */
  356. ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX = 2,
  357. /* Firmware does not support P2P */
  358. ATH10K_FW_FEATURE_NO_P2P = 3,
  359. /* Firmware 10.2 feature bit. The ATH10K_FW_FEATURE_WMI_10X feature
  360. * bit is required to be set as well. Deprecated, don't use in new
  361. * code.
  362. */
  363. ATH10K_FW_FEATURE_WMI_10_2 = 4,
  364. /* Some firmware revisions lack proper multi-interface client powersave
  365. * implementation. Enabling PS could result in connection drops,
  366. * traffic stalls, etc.
  367. */
  368. ATH10K_FW_FEATURE_MULTI_VIF_PS_SUPPORT = 5,
  369. /* keep last */
  370. ATH10K_FW_FEATURE_COUNT,
  371. };
  372. enum ath10k_dev_flags {
  373. /* Indicates that ath10k device is during CAC phase of DFS */
  374. ATH10K_CAC_RUNNING,
  375. ATH10K_FLAG_CORE_REGISTERED,
  376. /* Device has crashed and needs to restart. This indicates any pending
  377. * waiters should immediately cancel instead of waiting for a time out.
  378. */
  379. ATH10K_FLAG_CRASH_FLUSH,
  380. };
  381. enum ath10k_cal_mode {
  382. ATH10K_CAL_MODE_FILE,
  383. ATH10K_CAL_MODE_OTP,
  384. ATH10K_CAL_MODE_DT,
  385. };
  386. static inline const char *ath10k_cal_mode_str(enum ath10k_cal_mode mode)
  387. {
  388. switch (mode) {
  389. case ATH10K_CAL_MODE_FILE:
  390. return "file";
  391. case ATH10K_CAL_MODE_OTP:
  392. return "otp";
  393. case ATH10K_CAL_MODE_DT:
  394. return "dt";
  395. }
  396. return "unknown";
  397. }
  398. enum ath10k_scan_state {
  399. ATH10K_SCAN_IDLE,
  400. ATH10K_SCAN_STARTING,
  401. ATH10K_SCAN_RUNNING,
  402. ATH10K_SCAN_ABORTING,
  403. };
  404. static inline const char *ath10k_scan_state_str(enum ath10k_scan_state state)
  405. {
  406. switch (state) {
  407. case ATH10K_SCAN_IDLE:
  408. return "idle";
  409. case ATH10K_SCAN_STARTING:
  410. return "starting";
  411. case ATH10K_SCAN_RUNNING:
  412. return "running";
  413. case ATH10K_SCAN_ABORTING:
  414. return "aborting";
  415. }
  416. return "unknown";
  417. }
  418. struct ath10k {
  419. struct ath_common ath_common;
  420. struct ieee80211_hw *hw;
  421. struct device *dev;
  422. u8 mac_addr[ETH_ALEN];
  423. enum ath10k_hw_rev hw_rev;
  424. u32 chip_id;
  425. u32 target_version;
  426. u8 fw_version_major;
  427. u32 fw_version_minor;
  428. u16 fw_version_release;
  429. u16 fw_version_build;
  430. u32 phy_capability;
  431. u32 hw_min_tx_power;
  432. u32 hw_max_tx_power;
  433. u32 ht_cap_info;
  434. u32 vht_cap_info;
  435. u32 num_rf_chains;
  436. DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT);
  437. bool p2p;
  438. struct {
  439. enum ath10k_bus bus;
  440. const struct ath10k_hif_ops *ops;
  441. } hif;
  442. struct completion target_suspend;
  443. const struct ath10k_hw_regs *regs;
  444. struct ath10k_bmi bmi;
  445. struct ath10k_wmi wmi;
  446. struct ath10k_htc htc;
  447. struct ath10k_htt htt;
  448. struct ath10k_hw_params {
  449. u32 id;
  450. const char *name;
  451. u32 patch_load_addr;
  452. int uart_pin;
  453. struct ath10k_hw_params_fw {
  454. const char *dir;
  455. const char *fw;
  456. const char *otp;
  457. const char *board;
  458. size_t board_size;
  459. size_t board_ext_size;
  460. } fw;
  461. } hw_params;
  462. const struct firmware *board;
  463. const void *board_data;
  464. size_t board_len;
  465. const struct firmware *otp;
  466. const void *otp_data;
  467. size_t otp_len;
  468. const struct firmware *firmware;
  469. const void *firmware_data;
  470. size_t firmware_len;
  471. const struct firmware *cal_file;
  472. int fw_api;
  473. enum ath10k_cal_mode cal_mode;
  474. struct {
  475. struct completion started;
  476. struct completion completed;
  477. struct completion on_channel;
  478. struct delayed_work timeout;
  479. enum ath10k_scan_state state;
  480. bool is_roc;
  481. int vdev_id;
  482. int roc_freq;
  483. } scan;
  484. struct {
  485. struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
  486. } mac;
  487. /* should never be NULL; needed for regular htt rx */
  488. struct ieee80211_channel *rx_channel;
  489. /* valid during scan; needed for mgmt rx during scan */
  490. struct ieee80211_channel *scan_channel;
  491. /* current operating channel definition */
  492. struct cfg80211_chan_def chandef;
  493. unsigned long long free_vdev_map;
  494. bool monitor;
  495. int monitor_vdev_id;
  496. bool monitor_started;
  497. unsigned int filter_flags;
  498. unsigned long dev_flags;
  499. u32 dfs_block_radar_events;
  500. /* protected by conf_mutex */
  501. bool radar_enabled;
  502. int num_started_vdevs;
  503. /* Protected by conf-mutex */
  504. u8 supp_tx_chainmask;
  505. u8 supp_rx_chainmask;
  506. u8 cfg_tx_chainmask;
  507. u8 cfg_rx_chainmask;
  508. struct completion install_key_done;
  509. struct completion vdev_setup_done;
  510. struct workqueue_struct *workqueue;
  511. /* prevents concurrent FW reconfiguration */
  512. struct mutex conf_mutex;
  513. /* protects shared structure data */
  514. spinlock_t data_lock;
  515. struct list_head arvifs;
  516. struct list_head peers;
  517. wait_queue_head_t peer_mapping_wq;
  518. /* protected by conf_mutex */
  519. int num_peers;
  520. int num_stations;
  521. int max_num_peers;
  522. int max_num_stations;
  523. int max_num_vdevs;
  524. struct work_struct offchan_tx_work;
  525. struct sk_buff_head offchan_tx_queue;
  526. struct completion offchan_tx_completed;
  527. struct sk_buff *offchan_tx_skb;
  528. struct work_struct wmi_mgmt_tx_work;
  529. struct sk_buff_head wmi_mgmt_tx_queue;
  530. enum ath10k_state state;
  531. struct work_struct register_work;
  532. struct work_struct restart_work;
  533. /* cycle count is reported twice for each visited channel during scan.
  534. * access protected by data_lock */
  535. u32 survey_last_rx_clear_count;
  536. u32 survey_last_cycle_count;
  537. struct survey_info survey[ATH10K_NUM_CHANS];
  538. struct dfs_pattern_detector *dfs_detector;
  539. #ifdef CONFIG_ATH10K_DEBUGFS
  540. struct ath10k_debug debug;
  541. #endif
  542. struct {
  543. /* relay(fs) channel for spectral scan */
  544. struct rchan *rfs_chan_spec_scan;
  545. /* spectral_mode and spec_config are protected by conf_mutex */
  546. enum ath10k_spectral_mode mode;
  547. struct ath10k_spec_scan config;
  548. } spectral;
  549. struct {
  550. /* protected by conf_mutex */
  551. const struct firmware *utf;
  552. DECLARE_BITMAP(orig_fw_features, ATH10K_FW_FEATURE_COUNT);
  553. enum ath10k_fw_wmi_op_version orig_wmi_op_version;
  554. /* protected by data_lock */
  555. bool utf_monitor;
  556. } testmode;
  557. struct {
  558. /* protected by data_lock */
  559. u32 fw_crash_counter;
  560. u32 fw_warm_reset_counter;
  561. u32 fw_cold_reset_counter;
  562. } stats;
  563. struct ath10k_thermal thermal;
  564. /* must be last */
  565. u8 drv_priv[0] __aligned(sizeof(void *));
  566. };
  567. struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
  568. enum ath10k_bus bus,
  569. enum ath10k_hw_rev hw_rev,
  570. const struct ath10k_hif_ops *hif_ops);
  571. void ath10k_core_destroy(struct ath10k *ar);
  572. int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode);
  573. int ath10k_wait_for_suspend(struct ath10k *ar, u32 suspend_opt);
  574. void ath10k_core_stop(struct ath10k *ar);
  575. int ath10k_core_register(struct ath10k *ar, u32 chip_id);
  576. void ath10k_core_unregister(struct ath10k *ar);
  577. #endif /* _CORE_H_ */