1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
10 #include <linux/types.h>
11 #include <linux/interrupt.h>
12 #include <linux/irq.h>
13 #include <linux/bitfield.h>
14 #include <linux/dmi.h>
15 #include <linux/ctype.h>
16 #include <linux/firmware.h>
30 #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
32 #define ATH12K_TX_MGMT_NUM_PENDING_MAX 512
34 #define ATH12K_TX_MGMT_TARGET_MAX_SUPPORT_WMI 64
36 /* Pending management packets threshold for dropping probe responses */
37 #define ATH12K_PRB_RSP_DROP_THRESHOLD ((ATH12K_TX_MGMT_TARGET_MAX_SUPPORT_WMI * 3) / 4)
39 /* SMBIOS type containing Board Data File Name Extension */
40 #define ATH12K_SMBIOS_BDF_EXT_TYPE 0xF8
42 /* SMBIOS type structure length (excluding strings-set) */
43 #define ATH12K_SMBIOS_BDF_EXT_LENGTH 0x9
45 /* The magic used by QCA spec */
46 #define ATH12K_SMBIOS_BDF_EXT_MAGIC "BDF_"
48 #define ATH12K_INVALID_HW_MAC_ID 0xFF
49 #define ATH12K_RX_RATE_TABLE_NUM 320
50 #define ATH12K_RX_RATE_TABLE_11AX_NUM 576
52 #define ATH12K_MON_TIMER_INTERVAL 10
53 #define ATH12K_RESET_TIMEOUT_HZ (20 * HZ)
54 #define ATH12K_RESET_MAX_FAIL_COUNT_FIRST 3
55 #define ATH12K_RESET_MAX_FAIL_COUNT_FINAL 5
56 #define ATH12K_RESET_FAIL_TIMEOUT_HZ (20 * HZ)
57 #define ATH12K_RECONFIGURE_TIMEOUT_HZ (10 * HZ)
58 #define ATH12K_RECOVER_START_TIMEOUT_HZ (20 * HZ)
60 enum ath12k_bdf_search {
61 ATH12K_BDF_SEARCH_DEFAULT,
62 ATH12K_BDF_SEARCH_BUS_AND_BOARD,
73 #define ATH12K_HT_MCS_MAX 7
74 #define ATH12K_VHT_MCS_MAX 9
75 #define ATH12K_HE_MCS_MAX 11
77 enum ath12k_crypt_mode {
78 /* Only use hardware crypto engine */
80 /* Only use software crypto */
84 static inline enum wme_ac ath12k_tid_to_ac(u32 tid)
86 return (((tid == 0) || (tid == 3)) ? WME_AC_BE :
87 ((tid == 1) || (tid == 2)) ? WME_AC_BK :
88 ((tid == 4) || (tid == 5)) ? WME_AC_VI :
92 enum ath12k_skb_flags {
93 ATH12K_SKB_HW_80211_ENCAP = BIT(0),
94 ATH12K_SKB_CIPHER_SET = BIT(1),
97 struct ath12k_skb_cb {
100 struct ieee80211_vif *vif;
101 dma_addr_t paddr_ext_desc;
106 struct ath12k_skb_rxcb {
110 bool is_continuation;
113 struct hal_rx_desc *rx_desc;
124 ATH12K_HW_QCN9274_HW10,
125 ATH12K_HW_QCN9274_HW20,
126 ATH12K_HW_WCN7850_HW20
129 enum ath12k_firmware_mode {
130 /* the default mode, standard 802.11 functionality */
131 ATH12K_FIRMWARE_MODE_NORMAL,
133 /* factory tests etc */
134 ATH12K_FIRMWARE_MODE_FTM,
137 #define ATH12K_IRQ_NUM_MAX 57
138 #define ATH12K_EXT_IRQ_NUM_MAX 16
140 struct ath12k_ext_irq_grp {
141 struct ath12k_base *ab;
142 u32 irqs[ATH12K_EXT_IRQ_NUM_MAX];
146 struct napi_struct napi;
147 struct net_device napi_ndev;
150 struct ath12k_smbios_bdf {
151 struct dmi_header hdr;
157 #define HEHANDLE_CAP_PHYINFO_SIZE 3
158 #define HECAP_PHYINFO_SIZE 9
159 #define HECAP_MACINFO_SIZE 5
160 #define HECAP_TXRX_MCS_NSS_SIZE 2
161 #define HECAP_PPET16_PPET8_MAX_SIZE 25
163 #define HE_PPET16_PPET8_SIZE 8
165 /* 802.11ax PPE (PPDU packet Extension) threshold */
166 struct he_ppe_threshold {
169 u32 ppet16_ppet8_ru3_ru0[HE_PPET16_PPET8_SIZE];
173 u8 hecap_macinfo[HECAP_MACINFO_SIZE];
174 u32 hecap_rxmcsnssmap;
175 u32 hecap_txmcsnssmap;
176 u32 hecap_phyinfo[HEHANDLE_CAP_PHYINFO_SIZE];
177 struct he_ppe_threshold hecap_ppet;
184 WMI_HOST_TP_SCALE_MAX = 0,
185 WMI_HOST_TP_SCALE_50 = 1,
186 WMI_HOST_TP_SCALE_25 = 2,
187 WMI_HOST_TP_SCALE_12 = 3,
188 WMI_HOST_TP_SCALE_MIN = 4,
189 WMI_HOST_TP_SCALE_SIZE = 5,
192 enum ath12k_scan_state {
194 ATH12K_SCAN_STARTING,
196 ATH12K_SCAN_ABORTING,
199 enum ath12k_dev_flags {
201 ATH12K_FLAG_CRASH_FLUSH,
202 ATH12K_FLAG_RAW_MODE,
203 ATH12K_FLAG_HW_CRYPTO_DISABLED,
204 ATH12K_FLAG_RECOVERY,
205 ATH12K_FLAG_UNREGISTERING,
206 ATH12K_FLAG_REGISTERED,
207 ATH12K_FLAG_QMI_FAIL,
208 ATH12K_FLAG_HTC_SUSPEND_COMPLETE,
209 ATH12K_FLAG_CE_IRQ_ENABLED,
210 ATH12K_FLAG_EXT_IRQ_ENABLED,
213 enum ath12k_monitor_flags {
214 ATH12K_FLAG_MONITOR_ENABLED,
219 enum wmi_vdev_type vdev_type;
220 enum wmi_vdev_subtype vdev_subtype;
226 u8 hal_addr_search_flags;
230 struct ieee80211_vif *vif;
235 struct wmi_wmm_params_all_arg wmm_params;
236 struct list_head list;
242 /* 127 stations; wmi limit */
246 u8 ssid[IEEE80211_MAX_SSID_LEN];
248 /* P2P_IE with NoA attribute for P2P_GO case */
258 struct cfg80211_bitrate_mask bitrate_mask;
259 int num_legacy_stations;
260 int rtscts_prot_mode;
264 struct ieee80211_chanctx_conf chanctx;
272 struct ath12k_vif_iter {
274 struct ath12k_vif *arvif;
277 #define HAL_AST_IDX_INVALID 0xFFFF
278 #define HAL_RX_MAX_MCS 12
279 #define HAL_RX_MAX_MCS_HT 31
280 #define HAL_RX_MAX_MCS_VHT 9
281 #define HAL_RX_MAX_MCS_HE 11
282 #define HAL_RX_MAX_NSS 8
283 #define HAL_RX_MAX_NUM_LEGACY_RATES 12
284 #define ATH12K_RX_RATE_TABLE_11AX_NUM 576
285 #define ATH12K_RX_RATE_TABLE_NUM 320
287 struct ath12k_rx_peer_rate_stats {
288 u64 ht_mcs_count[HAL_RX_MAX_MCS_HT + 1];
289 u64 vht_mcs_count[HAL_RX_MAX_MCS_VHT + 1];
290 u64 he_mcs_count[HAL_RX_MAX_MCS_HE + 1];
291 u64 nss_count[HAL_RX_MAX_NSS];
292 u64 bw_count[HAL_RX_BW_MAX];
293 u64 gi_count[HAL_RX_GI_MAX];
294 u64 legacy_count[HAL_RX_MAX_NUM_LEGACY_RATES];
295 u64 rx_rate[ATH12K_RX_RATE_TABLE_11AX_NUM];
298 struct ath12k_rx_peer_stats {
301 u64 num_mpdu_fcs_err;
304 u64 other_msdu_count;
305 u64 ampdu_msdu_count;
306 u64 non_ampdu_msdu_count;
308 u64 beamformed_count;
309 u64 mcs_count[HAL_RX_MAX_MCS + 1];
310 u64 nss_count[HAL_RX_MAX_NSS];
311 u64 bw_count[HAL_RX_BW_MAX];
312 u64 gi_count[HAL_RX_GI_MAX];
313 u64 coding_count[HAL_RX_SU_MU_CODING_MAX];
314 u64 tid_count[IEEE80211_NUM_TIDS + 1];
315 u64 pream_cnt[HAL_RX_PREAMBLE_MAX];
316 u64 reception_type[HAL_RX_RECEPTION_TYPE_MAX];
319 u64 ru_alloc_cnt[HAL_RX_RU_ALLOC_TYPE_MAX];
320 struct ath12k_rx_peer_rate_stats pkt_stats;
321 struct ath12k_rx_peer_rate_stats byte_stats;
324 #define ATH12K_HE_MCS_NUM 12
325 #define ATH12K_VHT_MCS_NUM 10
326 #define ATH12K_BW_NUM 5
327 #define ATH12K_NSS_NUM 4
328 #define ATH12K_LEGACY_NUM 12
329 #define ATH12K_GI_NUM 4
330 #define ATH12K_HT_MCS_NUM 32
332 enum ath12k_pkt_rx_err {
333 ATH12K_PKT_RX_ERR_FCS,
334 ATH12K_PKT_RX_ERR_TKIP,
335 ATH12K_PKT_RX_ERR_CRYPT,
336 ATH12K_PKT_RX_ERR_PEER_IDX_INVAL,
337 ATH12K_PKT_RX_ERR_MAX,
340 enum ath12k_ampdu_subfrm_num {
341 ATH12K_AMPDU_SUBFRM_NUM_10,
342 ATH12K_AMPDU_SUBFRM_NUM_20,
343 ATH12K_AMPDU_SUBFRM_NUM_30,
344 ATH12K_AMPDU_SUBFRM_NUM_40,
345 ATH12K_AMPDU_SUBFRM_NUM_50,
346 ATH12K_AMPDU_SUBFRM_NUM_60,
347 ATH12K_AMPDU_SUBFRM_NUM_MORE,
348 ATH12K_AMPDU_SUBFRM_NUM_MAX,
351 enum ath12k_amsdu_subfrm_num {
352 ATH12K_AMSDU_SUBFRM_NUM_1,
353 ATH12K_AMSDU_SUBFRM_NUM_2,
354 ATH12K_AMSDU_SUBFRM_NUM_3,
355 ATH12K_AMSDU_SUBFRM_NUM_4,
356 ATH12K_AMSDU_SUBFRM_NUM_MORE,
357 ATH12K_AMSDU_SUBFRM_NUM_MAX,
360 enum ath12k_counter_type {
361 ATH12K_COUNTER_TYPE_BYTES,
362 ATH12K_COUNTER_TYPE_PKTS,
363 ATH12K_COUNTER_TYPE_MAX,
366 enum ath12k_stats_type {
367 ATH12K_STATS_TYPE_SUCC,
368 ATH12K_STATS_TYPE_FAIL,
369 ATH12K_STATS_TYPE_RETRY,
370 ATH12K_STATS_TYPE_AMPDU,
371 ATH12K_STATS_TYPE_MAX,
374 struct ath12k_htt_data_stats {
375 u64 legacy[ATH12K_COUNTER_TYPE_MAX][ATH12K_LEGACY_NUM];
376 u64 ht[ATH12K_COUNTER_TYPE_MAX][ATH12K_HT_MCS_NUM];
377 u64 vht[ATH12K_COUNTER_TYPE_MAX][ATH12K_VHT_MCS_NUM];
378 u64 he[ATH12K_COUNTER_TYPE_MAX][ATH12K_HE_MCS_NUM];
379 u64 bw[ATH12K_COUNTER_TYPE_MAX][ATH12K_BW_NUM];
380 u64 nss[ATH12K_COUNTER_TYPE_MAX][ATH12K_NSS_NUM];
381 u64 gi[ATH12K_COUNTER_TYPE_MAX][ATH12K_GI_NUM];
382 u64 transmit_type[ATH12K_COUNTER_TYPE_MAX][HAL_RX_RECEPTION_TYPE_MAX];
383 u64 ru_loc[ATH12K_COUNTER_TYPE_MAX][HAL_RX_RU_ALLOC_TYPE_MAX];
386 struct ath12k_htt_tx_stats {
387 struct ath12k_htt_data_stats stats[ATH12K_STATS_TYPE_MAX];
393 u32 mu_group[MAX_MU_GROUP_ID];
396 struct ath12k_per_ppdu_tx_stats {
405 struct ath12k_wbm_tx_stats {
406 u64 wbm_tx_comp_stats[HAL_WBM_REL_HTT_TX_COMP_STATUS_MAX];
410 struct ath12k_vif *arvif;
412 /* the following are protected by ar->data_lock */
413 u32 changed; /* IEEE80211_RC_* */
417 enum hal_pn_type pn_type;
419 struct work_struct update_wk;
420 struct rate_info txrate;
421 struct rate_info last_txrate;
425 struct ath12k_rx_peer_stats *rx_stats;
426 struct ath12k_wbm_tx_stats *wbm_tx_stats;
430 #define ATH12K_MIN_5G_FREQ 4150
431 #define ATH12K_MIN_6G_FREQ 5925
432 #define ATH12K_MAX_6G_FREQ 7115
433 #define ATH12K_NUM_CHANS 100
434 #define ATH12K_MAX_5G_CHAN 173
439 ATH12K_STATE_RESTARTING,
440 ATH12K_STATE_RESTARTED,
442 /* Add other states as required */
445 /* Antenna noise floor */
446 #define ATH12K_DEFAULT_NOISE_FLOOR -95
448 struct ath12k_fw_stats {
451 struct list_head pdevs;
452 struct list_head vdevs;
453 struct list_head bcn;
456 struct ath12k_per_peer_tx_stats {
473 #define ATH12K_FLUSH_TIMEOUT (5 * HZ)
474 #define ATH12K_VDEV_DELETE_TIMEOUT_HZ (5 * HZ)
477 struct ath12k_base *ab;
478 struct ath12k_pdev *pdev;
479 struct ath12k_hw *ah;
480 struct ath12k_wmi_pdev *wmi;
481 struct ath12k_pdev_dp dp;
482 u8 mac_addr[ETH_ALEN];
485 struct ath12k_he ar_he;
486 enum ath12k_state state;
489 struct completion started;
490 struct completion completed;
491 struct completion on_channel;
492 struct delayed_work timeout;
493 enum ath12k_scan_state state;
501 struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
502 struct ieee80211_sband_iftype_data
503 iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES];
506 unsigned long dev_flags;
507 unsigned int filter_flags;
508 unsigned long monitor_flags;
511 u32 txpower_limit_2g;
512 u32 txpower_limit_5g;
517 u32 max_num_stations;
518 bool monitor_present;
519 /* To synchronize concurrent synchronous mac80211 callback operations,
520 * concurrent debugfs configuration and concurrent FW statistics events.
522 struct mutex conf_mutex;
523 /* protects the radio specific data like debug stats, ppdu_stats_info stats,
524 * vdev_stop_status info, scan data, ath12k_sta info, ath12k_vif info,
525 * channel context data, survey info, test mode data.
527 spinlock_t data_lock;
529 struct list_head arvifs;
530 /* should never be NULL; needed for regular htt rx */
531 struct ieee80211_channel *rx_channel;
533 /* valid during scan; needed for mgmt rx during scan */
534 struct ieee80211_channel *scan_channel;
540 /* pdev_idx starts from 0 whereas pdev->pdev_id starts with 1 */
545 struct completion peer_assoc_done;
546 struct completion peer_delete_done;
548 int install_key_status;
549 struct completion install_key_done;
551 int last_wmi_vdev_start_status;
552 struct completion vdev_setup_done;
553 struct completion vdev_delete_done;
557 u32 num_started_vdevs;
558 u32 num_created_vdevs;
559 unsigned long long allocated_vdev_map;
561 struct idr txmgmt_idr;
562 /* protects txmgmt_idr data */
563 spinlock_t txmgmt_idr_lock;
564 atomic_t num_pending_mgmt_tx;
565 wait_queue_head_t txmgmt_empty_waitq;
567 /* cycle count is reported twice for each visited channel during scan.
568 * access protected by data_lock
570 u32 survey_last_rx_clear_count;
571 u32 survey_last_cycle_count;
573 /* Channel info events are expected to come in pairs without and with
574 * COMPLETE flag set respectively for each channel visit during scan.
576 * However there are deviations from this rule. This flag is used to
577 * avoid reporting garbage data.
579 bool ch_info_can_report_survey;
580 struct survey_info survey[ATH12K_NUM_CHANS];
581 struct completion bss_survey_done;
583 struct work_struct regd_update_work;
585 struct work_struct wmi_mgmt_tx_work;
586 struct sk_buff_head wmi_mgmt_tx_queue;
588 struct ath12k_per_peer_tx_stats peer_tx_stats;
589 struct list_head ppdu_stats_info;
590 u32 ppdu_stat_list_depth;
592 struct ath12k_per_peer_tx_stats cached_stats;
596 bool dfs_block_radar_events;
597 bool monitor_conf_enabled;
598 bool monitor_vdev_created;
599 bool monitor_started;
604 struct ieee80211_hw *hw;
607 struct ath12k radio[] __aligned(sizeof(void *));
610 struct ath12k_band_cap {
612 u32 max_bw_supported;
616 u32 he_cap_phy_info[PSOC_HOST_MAX_PHY_SIZE];
617 struct ath12k_wmi_ppe_threshold_arg he_ppet;
619 u32 eht_cap_mac_info[WMI_MAX_EHTCAP_MAC_SIZE];
620 u32 eht_cap_phy_info[WMI_MAX_EHTCAP_PHY_SIZE];
625 struct ath12k_wmi_ppe_threshold_arg eht_ppet;
626 u32 eht_cap_info_internal;
629 struct ath12k_pdev_cap {
637 u32 tx_chain_mask_shift;
638 u32 rx_chain_mask_shift;
639 struct ath12k_band_cap band[NUM_NL80211_BANDS];
642 struct mlo_timestamp {
644 u32 sync_timestamp_lo_us;
645 u32 sync_timestamp_hi_us;
656 struct ath12k_pdev_cap cap;
657 u8 mac_addr[ETH_ALEN];
658 struct mlo_timestamp timestamp;
661 struct ath12k_fw_pdev {
667 struct ath12k_board_data {
668 const struct firmware *fw;
673 struct ath12k_soc_dp_tx_err_stats {
674 /* TCL Ring Descriptor unavailable */
675 u32 desc_na[DP_TCL_NUM_RING_MAX];
676 /* Other failures during dp_tx due to mem allocation failure
677 * idr unavailable etc.
682 struct ath12k_soc_dp_stats {
685 u32 rxdma_error[HAL_REO_ENTR_RING_RXDMA_ECODE_MAX];
686 u32 reo_error[HAL_REO_DEST_RING_ERROR_CODE_MAX];
687 u32 hal_reo_error[DP_REO_DST_RING_MAX];
688 struct ath12k_soc_dp_tx_err_stats tx_err;
691 /* Master structure to hold the hw data which may be used in core module */
693 enum ath12k_hw_rev hw_rev;
694 struct platform_device *pdev;
696 struct ath12k_qmi qmi;
697 struct ath12k_wmi_base wmi_ab;
698 struct completion fw_ready;
700 /* HW channel counters frequency value in hertz common to all MACs */
703 struct ath12k_htc htc;
708 unsigned long mem_len;
712 const struct ath12k_hif_ops *ops;
716 struct timer_list rx_replenish_retry;
717 struct ath12k_hal hal;
718 /* To synchronize core_start/core_stop */
719 struct mutex core_lock;
720 /* Protects data like peers */
721 spinlock_t base_lock;
723 /* Single pdev device (struct ath12k_hw_params::single_pdev_only):
725 * Firmware maintains data for all bands but advertises a single
726 * phy to the host which is stored as a single element in this
731 * This array will contain as many elements as the number of
734 struct ath12k_pdev pdevs[MAX_RADIOS];
736 /* struct ath12k_hw_params::single_pdev_only devices use this to
737 * store phy specific data
739 struct ath12k_fw_pdev fw_pdev[MAX_RADIOS];
742 struct ath12k_pdev __rcu *pdevs_active[MAX_RADIOS];
744 /* Holds information of wiphy (hw) registration.
746 * In Multi/Single Link Operation case, all pdevs are registered as
747 * a single wiphy. In other (legacy/Non-MLO) cases, each pdev is
748 * registered as separate wiphys.
750 struct ath12k_hw *ah[MAX_RADIOS];
753 struct ath12k_wmi_hal_reg_capabilities_ext_arg hal_reg_cap[MAX_RADIOS];
754 unsigned long long free_vdev_map;
755 unsigned long long free_vdev_stats_id_map;
756 struct list_head peers;
757 wait_queue_head_t peer_mapping_wq;
758 u8 mac_addr[ETH_ALEN];
760 u32 wlan_init_status;
761 int irq_num[ATH12K_IRQ_NUM_MAX];
762 struct ath12k_ext_irq_grp ext_irq_grp[ATH12K_EXT_IRQ_GRP_NUM_MAX];
763 struct napi_struct *napi;
764 struct ath12k_wmi_target_cap_arg target_caps;
765 u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE];
766 bool pdevs_macaddr_valid;
768 const struct ath12k_hw_params *hw_params;
770 const struct firmware *cal_file;
772 /* Below regd's are protected by ab->data_lock */
773 /* This is the regd set for every radio
774 * by the firmware during initialization
776 struct ieee80211_regdomain *default_regd[MAX_RADIOS];
777 /* This regd is set during dynamic country setting
778 * This may or may not be used during the runtime
780 struct ieee80211_regdomain *new_regd[MAX_RADIOS];
782 /* Current DFS Regulatory */
783 enum ath12k_dfs_region dfs_region;
784 struct ath12k_soc_dp_stats soc_stats;
786 unsigned long dev_flags;
787 struct completion driver_recovery;
788 struct workqueue_struct *workqueue;
789 struct work_struct restart_work;
790 struct workqueue_struct *workqueue_aux;
791 struct work_struct reset_work;
792 atomic_t reset_count;
793 atomic_t recovery_count;
794 atomic_t recovery_start_count;
796 struct completion reset_complete;
797 struct completion reconfigure_complete;
798 struct completion recovery_start;
799 /* continuous recovery fail count */
800 atomic_t fail_cont_count;
801 unsigned long reset_fail_timeout;
803 /* protected by data_lock */
804 u32 fw_crash_counter;
806 u32 pktlog_defs_checksum;
808 struct ath12k_dbring_cap *db_caps;
811 struct timer_list mon_reap_timer;
813 struct completion htc_suspend;
815 u64 fw_soc_drop_count;
816 bool static_window_map;
818 struct work_struct rfkill_work;
819 /* true means radio is on */
820 bool rfkill_radio_on;
823 enum ath12k_bdf_search bdf_search;
826 u32 subsystem_vendor;
827 u32 subsystem_device;
833 const struct firmware *fw;
836 const u8 *amss_dualmac_data;
837 size_t amss_dualmac_len;
841 DECLARE_BITMAP(fw_features, ATH12K_FW_FEATURE_COUNT);
844 const struct hal_rx_ops *hal_rx_ops;
846 /* slo_capable denotes if the single/multi link operation
847 * is supported within the same chip (SoC).
852 u8 drv_priv[] __aligned(sizeof(void *));
855 struct ath12k_pdev_map {
856 struct ath12k_base *ab;
860 int ath12k_core_qmi_firmware_ready(struct ath12k_base *ab);
861 int ath12k_core_pre_init(struct ath12k_base *ab);
862 int ath12k_core_init(struct ath12k_base *ath12k);
863 void ath12k_core_deinit(struct ath12k_base *ath12k);
864 struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
865 enum ath12k_bus bus);
866 void ath12k_core_free(struct ath12k_base *ath12k);
867 int ath12k_core_fetch_board_data_api_1(struct ath12k_base *ab,
868 struct ath12k_board_data *bd,
870 int ath12k_core_fetch_bdf(struct ath12k_base *ath12k,
871 struct ath12k_board_data *bd);
872 void ath12k_core_free_bdf(struct ath12k_base *ab, struct ath12k_board_data *bd);
873 int ath12k_core_fetch_regdb(struct ath12k_base *ab, struct ath12k_board_data *bd);
874 int ath12k_core_check_dt(struct ath12k_base *ath12k);
875 int ath12k_core_check_smbios(struct ath12k_base *ab);
876 void ath12k_core_halt(struct ath12k *ar);
877 int ath12k_core_resume(struct ath12k_base *ab);
878 int ath12k_core_suspend(struct ath12k_base *ab);
880 const struct firmware *ath12k_core_firmware_request(struct ath12k_base *ab,
881 const char *filename);
882 u32 ath12k_core_get_max_station_per_radio(struct ath12k_base *ab);
883 u32 ath12k_core_get_max_peers_per_radio(struct ath12k_base *ab);
884 u32 ath12k_core_get_max_num_tids(struct ath12k_base *ab);
886 static inline const char *ath12k_scan_state_str(enum ath12k_scan_state state)
889 case ATH12K_SCAN_IDLE:
891 case ATH12K_SCAN_STARTING:
893 case ATH12K_SCAN_RUNNING:
895 case ATH12K_SCAN_ABORTING:
902 static inline struct ath12k_skb_cb *ATH12K_SKB_CB(struct sk_buff *skb)
904 BUILD_BUG_ON(sizeof(struct ath12k_skb_cb) >
905 IEEE80211_TX_INFO_DRIVER_DATA_SIZE);
906 return (struct ath12k_skb_cb *)&IEEE80211_SKB_CB(skb)->driver_data;
909 static inline struct ath12k_skb_rxcb *ATH12K_SKB_RXCB(struct sk_buff *skb)
911 BUILD_BUG_ON(sizeof(struct ath12k_skb_rxcb) > sizeof(skb->cb));
912 return (struct ath12k_skb_rxcb *)skb->cb;
915 static inline struct ath12k_vif *ath12k_vif_to_arvif(struct ieee80211_vif *vif)
917 return (struct ath12k_vif *)vif->drv_priv;
920 static inline struct ath12k_sta *ath12k_sta_to_arsta(struct ieee80211_sta *sta)
922 return (struct ath12k_sta *)sta->drv_priv;
925 static inline struct ath12k *ath12k_ab_to_ar(struct ath12k_base *ab,
928 return ab->pdevs[ath12k_hw_mac_id_to_pdev_id(ab->hw_params, mac_id)].ar;
931 static inline void ath12k_core_create_firmware_path(struct ath12k_base *ab,
932 const char *filename,
933 void *buf, size_t buf_len)
935 snprintf(buf, buf_len, "%s/%s/%s", ATH12K_FW_DIR,
936 ab->hw_params->fw.dir, filename);
939 static inline const char *ath12k_bus_str(enum ath12k_bus bus)
949 static inline struct ath12k_hw *ath12k_hw_to_ah(struct ieee80211_hw *hw)
954 static inline struct ath12k *ath12k_ah_to_ar(struct ath12k_hw *ah)
959 static inline struct ieee80211_hw *ath12k_ar_to_hw(struct ath12k *ar)
963 #endif /* _CORE_H_ */