1*fc05d6c1Sstsp /* $OpenBSD: qwxvar.h,v 1.26 2024/05/28 08:34:52 stsp Exp $ */
2c2498839Sstsp
3c2498839Sstsp /*
4c2498839Sstsp * Copyright (c) 2018-2019 The Linux Foundation.
5c2498839Sstsp * All rights reserved.
6c2498839Sstsp *
7c2498839Sstsp * Redistribution and use in source and binary forms, with or without
8c2498839Sstsp * modification, are permitted (subject to the limitations in the disclaimer
9c2498839Sstsp * below) provided that the following conditions are met:
10c2498839Sstsp *
11c2498839Sstsp * * Redistributions of source code must retain the above copyright notice,
12c2498839Sstsp * this list of conditions and the following disclaimer.
13c2498839Sstsp *
14c2498839Sstsp * * Redistributions in binary form must reproduce the above copyright
15c2498839Sstsp * notice, this list of conditions and the following disclaimer in the
16c2498839Sstsp * documentation and/or other materials provided with the distribution.
17c2498839Sstsp *
18c2498839Sstsp * * Neither the name of [Owner Organization] nor the names of its
19c2498839Sstsp * contributors may be used to endorse or promote products derived from
20c2498839Sstsp * this software without specific prior written permission.
21c2498839Sstsp *
22c2498839Sstsp * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
23c2498839Sstsp * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
24c2498839Sstsp * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
25c2498839Sstsp * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26c2498839Sstsp * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
27c2498839Sstsp * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28c2498839Sstsp * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29c2498839Sstsp * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
30c2498839Sstsp * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31c2498839Sstsp * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32c2498839Sstsp * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
33c2498839Sstsp * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34c2498839Sstsp */
35c2498839Sstsp
36c2498839Sstsp #ifdef QWX_DEBUG
37c2498839Sstsp #define DPRINTF(x...) do { if (qwx_debug) printf(x); } while(0)
38c2498839Sstsp #define DNPRINTF(n,x...) do { if (qwx_debug & n) printf(x); } while(0)
39c2498839Sstsp #define QWX_D_MISC 0x00000001
40c2498839Sstsp #define QWX_D_MHI 0x00000002
41c2498839Sstsp #define QWX_D_QMI 0x00000004
42c2498839Sstsp #define QWX_D_WMI 0x00000008
43c2498839Sstsp #define QWX_D_HTC 0x00000010
44c2498839Sstsp #define QWX_D_HTT 0x00000020
45c2498839Sstsp #define QWX_D_MAC 0x00000040
46c2498839Sstsp #define QWX_D_MGMT 0x00000080
47c2498839Sstsp #define QWX_D_CE 0x00000100
48c2498839Sstsp extern uint32_t qwx_debug;
49c2498839Sstsp #else
50c2498839Sstsp #define DPRINTF(x...)
51c2498839Sstsp #define DNPRINTF(n,x...)
52c2498839Sstsp #endif
53c2498839Sstsp
54c2498839Sstsp struct qwx_softc;
55c2498839Sstsp
56c2498839Sstsp #define ATH11K_EXT_IRQ_GRP_NUM_MAX 11
57c2498839Sstsp
58c2498839Sstsp struct ath11k_hw_ring_mask {
59c2498839Sstsp uint8_t tx[ATH11K_EXT_IRQ_GRP_NUM_MAX];
60c2498839Sstsp uint8_t rx_mon_status[ATH11K_EXT_IRQ_GRP_NUM_MAX];
61c2498839Sstsp uint8_t rx[ATH11K_EXT_IRQ_GRP_NUM_MAX];
62c2498839Sstsp uint8_t rx_err[ATH11K_EXT_IRQ_GRP_NUM_MAX];
63c2498839Sstsp uint8_t rx_wbm_rel[ATH11K_EXT_IRQ_GRP_NUM_MAX];
64c2498839Sstsp uint8_t reo_status[ATH11K_EXT_IRQ_GRP_NUM_MAX];
65c2498839Sstsp uint8_t rxdma2host[ATH11K_EXT_IRQ_GRP_NUM_MAX];
66c2498839Sstsp uint8_t host2rxdma[ATH11K_EXT_IRQ_GRP_NUM_MAX];
67c2498839Sstsp };
68c2498839Sstsp
69c2498839Sstsp #define ATH11K_FW_DIR "qwx"
70c2498839Sstsp
71c2498839Sstsp #define ATH11K_BOARD_MAGIC "QCA-ATH11K-BOARD"
72a533396bSstsp #define ATH11K_BOARD_API2_FILE "board-2"
73a533396bSstsp #define ATH11K_DEFAULT_BOARD_FILE "board"
74a533396bSstsp #define ATH11K_DEFAULT_CAL_FILE "caldata"
75a533396bSstsp #define ATH11K_AMSS_FILE "amss"
76a533396bSstsp #define ATH11K_M3_FILE "m3"
77a533396bSstsp #define ATH11K_REGDB_FILE "regdb"
78c2498839Sstsp
79c2498839Sstsp #define QWX_FW_BUILD_ID_MASK "QC_IMAGE_VERSION_STRING="
80c2498839Sstsp
81c2498839Sstsp struct ath11k_hw_tcl2wbm_rbm_map {
82c2498839Sstsp uint8_t tcl_ring_num;
83c2498839Sstsp uint8_t wbm_ring_num;
84c2498839Sstsp uint8_t rbm_id;
85c2498839Sstsp };
86c2498839Sstsp
87c2498839Sstsp /**
88c2498839Sstsp * enum hal_rx_buf_return_buf_manager
89c2498839Sstsp *
90c2498839Sstsp * @HAL_RX_BUF_RBM_WBM_IDLE_BUF_LIST: Buffer returned to WBM idle buffer list
91c2498839Sstsp * @HAL_RX_BUF_RBM_WBM_IDLE_DESC_LIST: Descriptor returned to WBM idle
92c2498839Sstsp * descriptor list.
93c2498839Sstsp * @HAL_RX_BUF_RBM_FW_BM: Buffer returned to FW
94c2498839Sstsp * @HAL_RX_BUF_RBM_SW0_BM: For Tx completion -- returned to host
95c2498839Sstsp * @HAL_RX_BUF_RBM_SW1_BM: For Tx completion -- returned to host
96c2498839Sstsp * @HAL_RX_BUF_RBM_SW2_BM: For Tx completion -- returned to host
97c2498839Sstsp * @HAL_RX_BUF_RBM_SW3_BM: For Rx release -- returned to host
98c2498839Sstsp */
99c2498839Sstsp
100c2498839Sstsp enum hal_rx_buf_return_buf_manager {
101c2498839Sstsp HAL_RX_BUF_RBM_WBM_IDLE_BUF_LIST,
102c2498839Sstsp HAL_RX_BUF_RBM_WBM_IDLE_DESC_LIST,
103c2498839Sstsp HAL_RX_BUF_RBM_FW_BM,
104c2498839Sstsp HAL_RX_BUF_RBM_SW0_BM,
105c2498839Sstsp HAL_RX_BUF_RBM_SW1_BM,
106c2498839Sstsp HAL_RX_BUF_RBM_SW2_BM,
107c2498839Sstsp HAL_RX_BUF_RBM_SW3_BM,
108c2498839Sstsp HAL_RX_BUF_RBM_SW4_BM,
109c2498839Sstsp };
110c2498839Sstsp
111c2498839Sstsp struct ath11k_hw_hal_params {
112c2498839Sstsp enum hal_rx_buf_return_buf_manager rx_buf_rbm;
113c2498839Sstsp const struct ath11k_hw_tcl2wbm_rbm_map *tcl2wbm_rbm_map;
114c2498839Sstsp };
115c2498839Sstsp
116d2c51456Sstsp struct hal_tx_info {
117d2c51456Sstsp uint16_t meta_data_flags; /* %HAL_TCL_DATA_CMD_INFO0_META_ */
118d2c51456Sstsp uint8_t ring_id;
119d2c51456Sstsp uint32_t desc_id;
120d2c51456Sstsp enum hal_tcl_desc_type type;
121d2c51456Sstsp enum hal_tcl_encap_type encap_type;
122d2c51456Sstsp uint64_t paddr;
123d2c51456Sstsp uint32_t data_len;
124d2c51456Sstsp uint32_t pkt_offset;
125d2c51456Sstsp enum hal_encrypt_type encrypt_type;
126d2c51456Sstsp uint32_t flags0; /* %HAL_TCL_DATA_CMD_INFO1_ */
127d2c51456Sstsp uint32_t flags1; /* %HAL_TCL_DATA_CMD_INFO2_ */
128d2c51456Sstsp uint16_t addr_search_flags; /* %HAL_TCL_DATA_CMD_INFO0_ADDR(X/Y)_ */
129d2c51456Sstsp uint16_t bss_ast_hash;
130d2c51456Sstsp uint16_t bss_ast_idx;
131d2c51456Sstsp uint8_t tid;
132d2c51456Sstsp uint8_t search_type; /* %HAL_TX_ADDR_SEARCH_ */
133d2c51456Sstsp uint8_t lmac_id;
134d2c51456Sstsp uint8_t dscp_tid_tbl_idx;
135d2c51456Sstsp bool enable_mesh;
136d2c51456Sstsp uint8_t rbm_id;
137d2c51456Sstsp };
138d2c51456Sstsp
139d2c51456Sstsp /* TODO: Check if the actual desc macros can be used instead */
140d2c51456Sstsp #define HAL_TX_STATUS_FLAGS_FIRST_MSDU BIT(0)
141d2c51456Sstsp #define HAL_TX_STATUS_FLAGS_LAST_MSDU BIT(1)
142d2c51456Sstsp #define HAL_TX_STATUS_FLAGS_MSDU_IN_AMSDU BIT(2)
143d2c51456Sstsp #define HAL_TX_STATUS_FLAGS_RATE_STATS_VALID BIT(3)
144d2c51456Sstsp #define HAL_TX_STATUS_FLAGS_RATE_LDPC BIT(4)
145d2c51456Sstsp #define HAL_TX_STATUS_FLAGS_RATE_STBC BIT(5)
146d2c51456Sstsp #define HAL_TX_STATUS_FLAGS_OFDMA BIT(6)
147d2c51456Sstsp
148d2c51456Sstsp #define HAL_TX_STATUS_DESC_LEN sizeof(struct hal_wbm_release_ring)
149d2c51456Sstsp
150d2c51456Sstsp /* Tx status parsed from srng desc */
151d2c51456Sstsp struct hal_tx_status {
152d2c51456Sstsp enum hal_wbm_rel_src_module buf_rel_source;
153d2c51456Sstsp enum hal_wbm_tqm_rel_reason status;
154d2c51456Sstsp uint8_t ack_rssi;
155d2c51456Sstsp uint32_t flags; /* %HAL_TX_STATUS_FLAGS_ */
156d2c51456Sstsp uint32_t ppdu_id;
157d2c51456Sstsp uint8_t try_cnt;
158d2c51456Sstsp uint8_t tid;
159d2c51456Sstsp uint16_t peer_id;
160d2c51456Sstsp uint32_t rate_stats;
161d2c51456Sstsp };
162d2c51456Sstsp
163c2498839Sstsp struct ath11k_hw_params {
164c2498839Sstsp const char *name;
165c2498839Sstsp uint16_t hw_rev;
166c2498839Sstsp uint8_t max_radios;
167c2498839Sstsp uint32_t bdf_addr;
168c2498839Sstsp
169c2498839Sstsp struct {
170c2498839Sstsp const char *dir;
171c2498839Sstsp size_t board_size;
172c2498839Sstsp size_t cal_offset;
173c2498839Sstsp } fw;
174c2498839Sstsp
175c2498839Sstsp const struct ath11k_hw_ops *hw_ops;
176c2498839Sstsp const struct ath11k_hw_ring_mask *ring_mask;
177c2498839Sstsp
178c2498839Sstsp bool internal_sleep_clock;
179c2498839Sstsp
180c2498839Sstsp const struct ath11k_hw_regs *regs;
181c2498839Sstsp uint32_t qmi_service_ins_id;
182c2498839Sstsp const struct ce_attr *host_ce_config;
183c2498839Sstsp uint32_t ce_count;
184c2498839Sstsp const struct ce_pipe_config *target_ce_config;
185c2498839Sstsp uint32_t target_ce_count;
186c2498839Sstsp const struct service_to_pipe *svc_to_ce_map;
187c2498839Sstsp uint32_t svc_to_ce_map_len;
188c2498839Sstsp
189c2498839Sstsp bool single_pdev_only;
190c2498839Sstsp
191c2498839Sstsp bool rxdma1_enable;
192c2498839Sstsp int num_rxmda_per_pdev;
193c2498839Sstsp bool rx_mac_buf_ring;
194c2498839Sstsp bool vdev_start_delay;
195c2498839Sstsp bool htt_peer_map_v2;
196c2498839Sstsp #if notyet
197c2498839Sstsp struct {
198c2498839Sstsp uint8_t fft_sz;
199c2498839Sstsp uint8_t fft_pad_sz;
200c2498839Sstsp uint8_t summary_pad_sz;
201c2498839Sstsp uint8_t fft_hdr_len;
202c2498839Sstsp uint16_t max_fft_bins;
203c2498839Sstsp bool fragment_160mhz;
204c2498839Sstsp } spectral;
205c2498839Sstsp
206c2498839Sstsp uint16_t interface_modes;
207c2498839Sstsp bool supports_monitor;
208c2498839Sstsp bool full_monitor_mode;
209c2498839Sstsp #endif
210c2498839Sstsp bool supports_shadow_regs;
211c2498839Sstsp bool idle_ps;
212c2498839Sstsp bool supports_sta_ps;
213c2498839Sstsp bool cold_boot_calib;
214c2498839Sstsp bool cbcal_restart_fw;
215c2498839Sstsp int fw_mem_mode;
216c2498839Sstsp uint32_t num_vdevs;
217c2498839Sstsp uint32_t num_peers;
218c2498839Sstsp bool supports_suspend;
219c2498839Sstsp uint32_t hal_desc_sz;
220c2498839Sstsp bool supports_regdb;
221c2498839Sstsp bool fix_l1ss;
222c2498839Sstsp bool credit_flow;
223c2498839Sstsp uint8_t max_tx_ring;
224c2498839Sstsp const struct ath11k_hw_hal_params *hal_params;
225c2498839Sstsp #if notyet
226c2498839Sstsp bool supports_dynamic_smps_6ghz;
227c2498839Sstsp bool alloc_cacheable_memory;
228c2498839Sstsp bool supports_rssi_stats;
229c2498839Sstsp #endif
230c2498839Sstsp bool fw_wmi_diag_event;
231c2498839Sstsp bool current_cc_support;
232c2498839Sstsp bool dbr_debug_support;
233c2498839Sstsp bool global_reset;
234c2498839Sstsp #ifdef notyet
235c2498839Sstsp const struct cfg80211_sar_capa *bios_sar_capa;
236c2498839Sstsp #endif
237c2498839Sstsp bool m3_fw_support;
238c2498839Sstsp bool fixed_bdf_addr;
239c2498839Sstsp bool fixed_mem_region;
240c2498839Sstsp bool static_window_map;
241c2498839Sstsp bool hybrid_bus_type;
242c2498839Sstsp bool fixed_fw_mem;
243c2498839Sstsp #if notyet
244c2498839Sstsp bool support_off_channel_tx;
245c2498839Sstsp bool supports_multi_bssid;
246c2498839Sstsp
247c2498839Sstsp struct {
248c2498839Sstsp uint32_t start;
249c2498839Sstsp uint32_t end;
250c2498839Sstsp } sram_dump;
251c2498839Sstsp
252c2498839Sstsp bool tcl_ring_retry;
253c2498839Sstsp #endif
254c2498839Sstsp uint32_t tx_ring_size;
255c2498839Sstsp bool smp2p_wow_exit;
256c2498839Sstsp };
257c2498839Sstsp
258c2498839Sstsp struct ath11k_hw_ops {
259c2498839Sstsp uint8_t (*get_hw_mac_from_pdev_id)(int pdev_id);
260c2498839Sstsp void (*wmi_init_config)(struct qwx_softc *sc,
261c2498839Sstsp struct target_resource_config *config);
262c2498839Sstsp int (*mac_id_to_pdev_id)(struct ath11k_hw_params *hw, int mac_id);
263c2498839Sstsp int (*mac_id_to_srng_id)(struct ath11k_hw_params *hw, int mac_id);
26440c12381Sstsp #if notyet
265c2498839Sstsp void (*tx_mesh_enable)(struct ath11k_base *ab,
266c2498839Sstsp struct hal_tcl_data_cmd *tcl_cmd);
267*fc05d6c1Sstsp #endif
268*fc05d6c1Sstsp int (*rx_desc_get_first_msdu)(struct hal_rx_desc *desc);
269*fc05d6c1Sstsp #if notyet
270c2498839Sstsp bool (*rx_desc_get_last_msdu)(struct hal_rx_desc *desc);
2712bc5c218Sstsp #endif
272c2498839Sstsp uint8_t (*rx_desc_get_l3_pad_bytes)(struct hal_rx_desc *desc);
273c2498839Sstsp uint8_t *(*rx_desc_get_hdr_status)(struct hal_rx_desc *desc);
2742bc5c218Sstsp int (*rx_desc_encrypt_valid)(struct hal_rx_desc *desc);
275c2498839Sstsp uint32_t (*rx_desc_get_encrypt_type)(struct hal_rx_desc *desc);
276c2498839Sstsp uint8_t (*rx_desc_get_decap_type)(struct hal_rx_desc *desc);
2772bc5c218Sstsp #ifdef notyet
278c2498839Sstsp uint8_t (*rx_desc_get_mesh_ctl)(struct hal_rx_desc *desc);
279c2498839Sstsp bool (*rx_desc_get_ldpc_support)(struct hal_rx_desc *desc);
280c2498839Sstsp bool (*rx_desc_get_mpdu_seq_ctl_vld)(struct hal_rx_desc *desc);
281c2498839Sstsp bool (*rx_desc_get_mpdu_fc_valid)(struct hal_rx_desc *desc);
282c2498839Sstsp uint16_t (*rx_desc_get_mpdu_start_seq_no)(struct hal_rx_desc *desc);
2832bc5c218Sstsp #endif
284c2498839Sstsp uint16_t (*rx_desc_get_msdu_len)(struct hal_rx_desc *desc);
2852bc5c218Sstsp #ifdef notyet
286c2498839Sstsp uint8_t (*rx_desc_get_msdu_sgi)(struct hal_rx_desc *desc);
287c2498839Sstsp uint8_t (*rx_desc_get_msdu_rate_mcs)(struct hal_rx_desc *desc);
288c2498839Sstsp uint8_t (*rx_desc_get_msdu_rx_bw)(struct hal_rx_desc *desc);
2892bc5c218Sstsp #endif
290c2498839Sstsp uint32_t (*rx_desc_get_msdu_freq)(struct hal_rx_desc *desc);
2912bc5c218Sstsp #ifdef notyet
292c2498839Sstsp uint8_t (*rx_desc_get_msdu_pkt_type)(struct hal_rx_desc *desc);
293c2498839Sstsp uint8_t (*rx_desc_get_msdu_nss)(struct hal_rx_desc *desc);
294c2498839Sstsp uint8_t (*rx_desc_get_mpdu_tid)(struct hal_rx_desc *desc);
295c2498839Sstsp uint16_t (*rx_desc_get_mpdu_peer_id)(struct hal_rx_desc *desc);
296c2498839Sstsp void (*rx_desc_copy_attn_end_tlv)(struct hal_rx_desc *fdesc,
297c2498839Sstsp struct hal_rx_desc *ldesc);
298c2498839Sstsp uint32_t (*rx_desc_get_mpdu_start_tag)(struct hal_rx_desc *desc);
299c2498839Sstsp uint32_t (*rx_desc_get_mpdu_ppdu_id)(struct hal_rx_desc *desc);
300c2498839Sstsp void (*rx_desc_set_msdu_len)(struct hal_rx_desc *desc, uint16_t len);
3012bc5c218Sstsp #endif
302c2498839Sstsp struct rx_attention *(*rx_desc_get_attention)(struct hal_rx_desc *desc);
3032bc5c218Sstsp #ifdef notyet
304c2498839Sstsp uint8_t *(*rx_desc_get_msdu_payload)(struct hal_rx_desc *desc);
3059c0e8c5eSstsp #endif
3069c0e8c5eSstsp void (*reo_setup)(struct qwx_softc *);
3079c0e8c5eSstsp #ifdef notyet
308c2498839Sstsp uint16_t (*mpdu_info_get_peerid)(uint8_t *tlv_data);
309c2498839Sstsp bool (*rx_desc_mac_addr2_valid)(struct hal_rx_desc *desc);
310c2498839Sstsp uint8_t* (*rx_desc_mpdu_start_addr2)(struct hal_rx_desc *desc);
311c2498839Sstsp uint32_t (*get_ring_selector)(struct sk_buff *skb);
312c2498839Sstsp #endif
313c2498839Sstsp };
314c2498839Sstsp
315c2498839Sstsp extern const struct ath11k_hw_ops ipq8074_ops;
316c2498839Sstsp extern const struct ath11k_hw_ops ipq6018_ops;
317c2498839Sstsp extern const struct ath11k_hw_ops qca6390_ops;
318c2498839Sstsp extern const struct ath11k_hw_ops qcn9074_ops;
319c2498839Sstsp extern const struct ath11k_hw_ops wcn6855_ops;
320c2498839Sstsp extern const struct ath11k_hw_ops wcn6750_ops;
321c2498839Sstsp
322c2498839Sstsp extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_ipq8074;
323c2498839Sstsp extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390;
324c2498839Sstsp extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qcn9074;
325c2498839Sstsp extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_wcn6750;
326c2498839Sstsp
327c2498839Sstsp struct ath11k_hw_regs {
328c2498839Sstsp uint32_t hal_tcl1_ring_base_lsb;
329c2498839Sstsp uint32_t hal_tcl1_ring_base_msb;
330c2498839Sstsp uint32_t hal_tcl1_ring_id;
331c2498839Sstsp uint32_t hal_tcl1_ring_misc;
332c2498839Sstsp uint32_t hal_tcl1_ring_tp_addr_lsb;
333c2498839Sstsp uint32_t hal_tcl1_ring_tp_addr_msb;
334c2498839Sstsp uint32_t hal_tcl1_ring_consumer_int_setup_ix0;
335c2498839Sstsp uint32_t hal_tcl1_ring_consumer_int_setup_ix1;
336c2498839Sstsp uint32_t hal_tcl1_ring_msi1_base_lsb;
337c2498839Sstsp uint32_t hal_tcl1_ring_msi1_base_msb;
338c2498839Sstsp uint32_t hal_tcl1_ring_msi1_data;
339c2498839Sstsp uint32_t hal_tcl2_ring_base_lsb;
340c2498839Sstsp uint32_t hal_tcl_ring_base_lsb;
341c2498839Sstsp
342c2498839Sstsp uint32_t hal_tcl_status_ring_base_lsb;
343c2498839Sstsp
344c2498839Sstsp uint32_t hal_reo1_ring_base_lsb;
345c2498839Sstsp uint32_t hal_reo1_ring_base_msb;
346c2498839Sstsp uint32_t hal_reo1_ring_id;
347c2498839Sstsp uint32_t hal_reo1_ring_misc;
348c2498839Sstsp uint32_t hal_reo1_ring_hp_addr_lsb;
349c2498839Sstsp uint32_t hal_reo1_ring_hp_addr_msb;
350c2498839Sstsp uint32_t hal_reo1_ring_producer_int_setup;
351c2498839Sstsp uint32_t hal_reo1_ring_msi1_base_lsb;
352c2498839Sstsp uint32_t hal_reo1_ring_msi1_base_msb;
353c2498839Sstsp uint32_t hal_reo1_ring_msi1_data;
354c2498839Sstsp uint32_t hal_reo2_ring_base_lsb;
355c2498839Sstsp uint32_t hal_reo1_aging_thresh_ix_0;
356c2498839Sstsp uint32_t hal_reo1_aging_thresh_ix_1;
357c2498839Sstsp uint32_t hal_reo1_aging_thresh_ix_2;
358c2498839Sstsp uint32_t hal_reo1_aging_thresh_ix_3;
359c2498839Sstsp
360c2498839Sstsp uint32_t hal_reo1_ring_hp;
361c2498839Sstsp uint32_t hal_reo1_ring_tp;
362c2498839Sstsp uint32_t hal_reo2_ring_hp;
363c2498839Sstsp
364c2498839Sstsp uint32_t hal_reo_tcl_ring_base_lsb;
365c2498839Sstsp uint32_t hal_reo_tcl_ring_hp;
366c2498839Sstsp
367c2498839Sstsp uint32_t hal_reo_status_ring_base_lsb;
368c2498839Sstsp uint32_t hal_reo_status_hp;
369c2498839Sstsp
370c2498839Sstsp uint32_t hal_reo_cmd_ring_base_lsb;
371c2498839Sstsp uint32_t hal_reo_cmd_ring_hp;
372c2498839Sstsp
373c2498839Sstsp uint32_t hal_sw2reo_ring_base_lsb;
374c2498839Sstsp uint32_t hal_sw2reo_ring_hp;
375c2498839Sstsp
376c2498839Sstsp uint32_t hal_seq_wcss_umac_ce0_src_reg;
377c2498839Sstsp uint32_t hal_seq_wcss_umac_ce0_dst_reg;
378c2498839Sstsp uint32_t hal_seq_wcss_umac_ce1_src_reg;
379c2498839Sstsp uint32_t hal_seq_wcss_umac_ce1_dst_reg;
380c2498839Sstsp
381c2498839Sstsp uint32_t hal_wbm_idle_link_ring_base_lsb;
382c2498839Sstsp uint32_t hal_wbm_idle_link_ring_misc;
383c2498839Sstsp
384c2498839Sstsp uint32_t hal_wbm_release_ring_base_lsb;
385c2498839Sstsp
386c2498839Sstsp uint32_t hal_wbm0_release_ring_base_lsb;
387c2498839Sstsp uint32_t hal_wbm1_release_ring_base_lsb;
388c2498839Sstsp
389c2498839Sstsp uint32_t pcie_qserdes_sysclk_en_sel;
390c2498839Sstsp uint32_t pcie_pcs_osc_dtct_config_base;
391c2498839Sstsp
392c2498839Sstsp uint32_t hal_shadow_base_addr;
393c2498839Sstsp uint32_t hal_reo1_misc_ctl;
394c2498839Sstsp };
395c2498839Sstsp
396c2498839Sstsp extern const struct ath11k_hw_regs ipq8074_regs;
397c2498839Sstsp extern const struct ath11k_hw_regs qca6390_regs;
398c2498839Sstsp extern const struct ath11k_hw_regs qcn9074_regs;
399c2498839Sstsp extern const struct ath11k_hw_regs wcn6855_regs;
400c2498839Sstsp extern const struct ath11k_hw_regs wcn6750_regs;
401c2498839Sstsp
402c2498839Sstsp enum ath11k_dev_flags {
403c2498839Sstsp ATH11K_CAC_RUNNING,
404c2498839Sstsp ATH11K_FLAG_CORE_REGISTERED,
405c2498839Sstsp ATH11K_FLAG_CRASH_FLUSH,
406c2498839Sstsp ATH11K_FLAG_RAW_MODE,
407c2498839Sstsp ATH11K_FLAG_HW_CRYPTO_DISABLED,
408c2498839Sstsp ATH11K_FLAG_BTCOEX,
409c2498839Sstsp ATH11K_FLAG_RECOVERY,
410c2498839Sstsp ATH11K_FLAG_UNREGISTERING,
411c2498839Sstsp ATH11K_FLAG_REGISTERED,
412c2498839Sstsp ATH11K_FLAG_QMI_FAIL,
413c2498839Sstsp ATH11K_FLAG_HTC_SUSPEND_COMPLETE,
414c2498839Sstsp ATH11K_FLAG_CE_IRQ_ENABLED,
415c2498839Sstsp ATH11K_FLAG_EXT_IRQ_ENABLED,
416c2498839Sstsp ATH11K_FLAG_FIXED_MEM_RGN,
417c2498839Sstsp ATH11K_FLAG_DEVICE_INIT_DONE,
418c2498839Sstsp ATH11K_FLAG_MULTI_MSI_VECTORS,
419c2498839Sstsp };
420c2498839Sstsp
421c2498839Sstsp enum ath11k_scan_state {
422c2498839Sstsp ATH11K_SCAN_IDLE,
423c2498839Sstsp ATH11K_SCAN_STARTING,
424c2498839Sstsp ATH11K_SCAN_RUNNING,
425c2498839Sstsp ATH11K_SCAN_ABORTING,
426c2498839Sstsp };
427c2498839Sstsp
428c2498839Sstsp enum ath11k_11d_state {
429c2498839Sstsp ATH11K_11D_IDLE,
430c2498839Sstsp ATH11K_11D_PREPARING,
431c2498839Sstsp ATH11K_11D_RUNNING,
432c2498839Sstsp };
433c2498839Sstsp
434c2498839Sstsp /* enum ath11k_spectral_mode:
435c2498839Sstsp *
436c2498839Sstsp * @SPECTRAL_DISABLED: spectral mode is disabled
437c2498839Sstsp * @SPECTRAL_BACKGROUND: hardware sends samples when it is not busy with
438c2498839Sstsp * something else.
439c2498839Sstsp * @SPECTRAL_MANUAL: spectral scan is enabled, triggering for samples
440c2498839Sstsp * is performed manually.
441c2498839Sstsp */
442c2498839Sstsp enum ath11k_spectral_mode {
443c2498839Sstsp ATH11K_SPECTRAL_DISABLED = 0,
444c2498839Sstsp ATH11K_SPECTRAL_BACKGROUND,
445c2498839Sstsp ATH11K_SPECTRAL_MANUAL,
446c2498839Sstsp };
447c2498839Sstsp
448c2498839Sstsp #define QWX_SCAN_11D_INTERVAL 600000
449c2498839Sstsp #define QWX_11D_INVALID_VDEV_ID 0xFFFF
450c2498839Sstsp
451c2498839Sstsp struct qwx_ops {
452c2498839Sstsp uint32_t (*read32)(struct qwx_softc *, uint32_t);
453c2498839Sstsp void (*write32)(struct qwx_softc *, uint32_t, uint32_t);
454c2498839Sstsp int (*start)(struct qwx_softc *);
455c2498839Sstsp void (*stop)(struct qwx_softc *);
456c2498839Sstsp int (*power_up)(struct qwx_softc *);
457c2498839Sstsp void (*power_down)(struct qwx_softc *);
458c2498839Sstsp int (*submit_xfer)(struct qwx_softc *, struct mbuf *);
459c2498839Sstsp void (*irq_enable)(struct qwx_softc *sc);
460c2498839Sstsp void (*irq_disable)(struct qwx_softc *sc);
461c2498839Sstsp int (*map_service_to_pipe)(struct qwx_softc *, uint16_t,
462c2498839Sstsp uint8_t *, uint8_t *);
463c2498839Sstsp int (*get_user_msi_vector)(struct qwx_softc *, char *,
464c2498839Sstsp int *, uint32_t *, uint32_t *);
465c2498839Sstsp };
466c2498839Sstsp
467c2498839Sstsp struct qwx_dmamem {
468c2498839Sstsp bus_dmamap_t map;
469c2498839Sstsp bus_dma_segment_t seg;
470c2498839Sstsp size_t size;
471c2498839Sstsp caddr_t kva;
472c2498839Sstsp };
473c2498839Sstsp
474c2498839Sstsp struct qwx_dmamem *qwx_dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t);
475c2498839Sstsp void qwx_dmamem_free(bus_dma_tag_t, struct qwx_dmamem *);
476c2498839Sstsp
477c2498839Sstsp #define QWX_DMA_MAP(_adm) ((_adm)->map)
478c2498839Sstsp #define QWX_DMA_LEN(_adm) ((_adm)->size)
479c2498839Sstsp #define QWX_DMA_DVA(_adm) ((_adm)->map->dm_segs[0].ds_addr)
480c2498839Sstsp #define QWX_DMA_KVA(_adm) ((void *)(_adm)->kva)
481c2498839Sstsp
482c2498839Sstsp struct hal_srng_params {
483c2498839Sstsp bus_addr_t ring_base_paddr;
484c2498839Sstsp uint32_t *ring_base_vaddr;
485c2498839Sstsp int num_entries;
486c2498839Sstsp uint32_t intr_batch_cntr_thres_entries;
487c2498839Sstsp uint32_t intr_timer_thres_us;
488c2498839Sstsp uint32_t flags;
489c2498839Sstsp uint32_t max_buffer_len;
490c2498839Sstsp uint32_t low_threshold;
491c2498839Sstsp uint64_t msi_addr;
492c2498839Sstsp uint32_t msi_data;
493c2498839Sstsp
494c2498839Sstsp /* Add more params as needed */
495c2498839Sstsp };
496c2498839Sstsp
497c2498839Sstsp enum hal_srng_dir {
498c2498839Sstsp HAL_SRNG_DIR_SRC,
499c2498839Sstsp HAL_SRNG_DIR_DST
500c2498839Sstsp };
501c2498839Sstsp
502c2498839Sstsp /* srng flags */
503c2498839Sstsp #define HAL_SRNG_FLAGS_MSI_SWAP 0x00000008
504c2498839Sstsp #define HAL_SRNG_FLAGS_RING_PTR_SWAP 0x00000010
505c2498839Sstsp #define HAL_SRNG_FLAGS_DATA_TLV_SWAP 0x00000020
506c2498839Sstsp #define HAL_SRNG_FLAGS_LOW_THRESH_INTR_EN 0x00010000
507c2498839Sstsp #define HAL_SRNG_FLAGS_MSI_INTR 0x00020000
508c2498839Sstsp #define HAL_SRNG_FLAGS_CACHED 0x20000000
509c2498839Sstsp #define HAL_SRNG_FLAGS_LMAC_RING 0x80000000
510c2498839Sstsp #define HAL_SRNG_FLAGS_REMAP_CE_RING 0x10000000
511c2498839Sstsp
512c2498839Sstsp #define HAL_SRNG_TLV_HDR_TAG GENMASK(9, 1)
513c2498839Sstsp #define HAL_SRNG_TLV_HDR_LEN GENMASK(25, 10)
514c2498839Sstsp
515c2498839Sstsp /* Common SRNG ring structure for source and destination rings */
516c2498839Sstsp struct hal_srng {
517c2498839Sstsp /* Unique SRNG ring ID */
518c2498839Sstsp uint8_t ring_id;
519c2498839Sstsp
520c2498839Sstsp /* Ring initialization done */
521c2498839Sstsp uint8_t initialized;
522c2498839Sstsp
523c2498839Sstsp /* Interrupt/MSI value assigned to this ring */
524c2498839Sstsp int irq;
525c2498839Sstsp
526c2498839Sstsp /* Physical base address of the ring */
527c2498839Sstsp bus_addr_t ring_base_paddr;
528c2498839Sstsp
529c2498839Sstsp /* Virtual base address of the ring */
530c2498839Sstsp uint32_t *ring_base_vaddr;
531c2498839Sstsp
532c2498839Sstsp /* Number of entries in ring */
533c2498839Sstsp uint32_t num_entries;
534c2498839Sstsp
535c2498839Sstsp /* Ring size */
536c2498839Sstsp uint32_t ring_size;
537c2498839Sstsp
538c2498839Sstsp /* Ring size mask */
539c2498839Sstsp uint32_t ring_size_mask;
540c2498839Sstsp
541c2498839Sstsp /* Size of ring entry */
542c2498839Sstsp uint32_t entry_size;
543c2498839Sstsp
544c2498839Sstsp /* Interrupt timer threshold - in micro seconds */
545c2498839Sstsp uint32_t intr_timer_thres_us;
546c2498839Sstsp
547c2498839Sstsp /* Interrupt batch counter threshold - in number of ring entries */
548c2498839Sstsp uint32_t intr_batch_cntr_thres_entries;
549c2498839Sstsp
550c2498839Sstsp /* MSI Address */
551c2498839Sstsp bus_addr_t msi_addr;
552c2498839Sstsp
553c2498839Sstsp /* MSI data */
554c2498839Sstsp uint32_t msi_data;
555c2498839Sstsp
556c2498839Sstsp /* Misc flags */
557c2498839Sstsp uint32_t flags;
558c2498839Sstsp #ifdef notyet
559c2498839Sstsp /* Lock for serializing ring index updates */
560c2498839Sstsp spinlock_t lock;
561c2498839Sstsp #endif
562c2498839Sstsp /* Start offset of SRNG register groups for this ring
563c2498839Sstsp * TBD: See if this is required - register address can be derived
564c2498839Sstsp * from ring ID
565c2498839Sstsp */
566c2498839Sstsp uint32_t hwreg_base[HAL_SRNG_NUM_REG_GRP];
567c2498839Sstsp
568c2498839Sstsp uint64_t timestamp;
569c2498839Sstsp
570c2498839Sstsp /* Source or Destination ring */
571c2498839Sstsp enum hal_srng_dir ring_dir;
572c2498839Sstsp
573c2498839Sstsp union {
574c2498839Sstsp struct {
575c2498839Sstsp /* SW tail pointer */
576c2498839Sstsp uint32_t tp;
577c2498839Sstsp
578c2498839Sstsp /* Shadow head pointer location to be updated by HW */
579c2498839Sstsp volatile uint32_t *hp_addr;
580c2498839Sstsp
581c2498839Sstsp /* Cached head pointer */
582c2498839Sstsp uint32_t cached_hp;
583c2498839Sstsp
584c2498839Sstsp /* Tail pointer location to be updated by SW - This
585c2498839Sstsp * will be a register address and need not be
586c2498839Sstsp * accessed through SW structure
587c2498839Sstsp */
588c2498839Sstsp uint32_t *tp_addr;
589c2498839Sstsp
590c2498839Sstsp /* Current SW loop cnt */
591c2498839Sstsp uint32_t loop_cnt;
592c2498839Sstsp
593c2498839Sstsp /* max transfer size */
594c2498839Sstsp uint16_t max_buffer_length;
595c2498839Sstsp
596c2498839Sstsp /* head pointer at access end */
597c2498839Sstsp uint32_t last_hp;
598c2498839Sstsp } dst_ring;
599c2498839Sstsp
600c2498839Sstsp struct {
601c2498839Sstsp /* SW head pointer */
602c2498839Sstsp uint32_t hp;
603c2498839Sstsp
604c2498839Sstsp /* SW reap head pointer */
605c2498839Sstsp uint32_t reap_hp;
606c2498839Sstsp
607c2498839Sstsp /* Shadow tail pointer location to be updated by HW */
608c2498839Sstsp uint32_t *tp_addr;
609c2498839Sstsp
610c2498839Sstsp /* Cached tail pointer */
611c2498839Sstsp uint32_t cached_tp;
612c2498839Sstsp
613c2498839Sstsp /* Head pointer location to be updated by SW - This
614c2498839Sstsp * will be a register address and need not be accessed
615c2498839Sstsp * through SW structure
616c2498839Sstsp */
617c2498839Sstsp uint32_t *hp_addr;
618c2498839Sstsp
619c2498839Sstsp /* Low threshold - in number of ring entries */
620c2498839Sstsp uint32_t low_threshold;
621c2498839Sstsp
622c2498839Sstsp /* tail pointer at access end */
623c2498839Sstsp uint32_t last_tp;
624c2498839Sstsp } src_ring;
625c2498839Sstsp } u;
626c2498839Sstsp };
627c2498839Sstsp
628c2498839Sstsp enum hal_ring_type {
629c2498839Sstsp HAL_REO_DST,
630c2498839Sstsp HAL_REO_EXCEPTION,
631c2498839Sstsp HAL_REO_REINJECT,
632c2498839Sstsp HAL_REO_CMD,
633c2498839Sstsp HAL_REO_STATUS,
634c2498839Sstsp HAL_TCL_DATA,
635c2498839Sstsp HAL_TCL_CMD,
636c2498839Sstsp HAL_TCL_STATUS,
637c2498839Sstsp HAL_CE_SRC,
638c2498839Sstsp HAL_CE_DST,
639c2498839Sstsp HAL_CE_DST_STATUS,
640c2498839Sstsp HAL_WBM_IDLE_LINK,
641c2498839Sstsp HAL_SW2WBM_RELEASE,
642c2498839Sstsp HAL_WBM2SW_RELEASE,
643c2498839Sstsp HAL_RXDMA_BUF,
644c2498839Sstsp HAL_RXDMA_DST,
645c2498839Sstsp HAL_RXDMA_MONITOR_BUF,
646c2498839Sstsp HAL_RXDMA_MONITOR_STATUS,
647c2498839Sstsp HAL_RXDMA_MONITOR_DST,
648c2498839Sstsp HAL_RXDMA_MONITOR_DESC,
649c2498839Sstsp HAL_RXDMA_DIR_BUF,
650c2498839Sstsp HAL_MAX_RING_TYPES,
651c2498839Sstsp };
652c2498839Sstsp
653c2498839Sstsp /* HW SRNG configuration table */
654c2498839Sstsp struct hal_srng_config {
655c2498839Sstsp int start_ring_id;
656c2498839Sstsp uint16_t max_rings;
657c2498839Sstsp uint16_t entry_size;
658c2498839Sstsp uint32_t reg_start[HAL_SRNG_NUM_REG_GRP];
659c2498839Sstsp uint16_t reg_size[HAL_SRNG_NUM_REG_GRP];
660c2498839Sstsp uint8_t lmac_ring;
661c2498839Sstsp enum hal_srng_dir ring_dir;
662c2498839Sstsp uint32_t max_size;
663c2498839Sstsp };
664c2498839Sstsp
665c2498839Sstsp #define QWX_NUM_SRNG_CFG 21
666c2498839Sstsp
6673acc5c6dSstsp struct hal_reo_status_header {
6683acc5c6dSstsp uint16_t cmd_num;
6693acc5c6dSstsp enum hal_reo_cmd_status cmd_status;
6703acc5c6dSstsp uint16_t cmd_exe_time;
6713acc5c6dSstsp uint32_t timestamp;
6723acc5c6dSstsp };
6733acc5c6dSstsp
6743acc5c6dSstsp struct hal_reo_status_queue_stats {
6753acc5c6dSstsp uint16_t ssn;
6763acc5c6dSstsp uint16_t curr_idx;
6773acc5c6dSstsp uint32_t pn[4];
6783acc5c6dSstsp uint32_t last_rx_queue_ts;
6793acc5c6dSstsp uint32_t last_rx_dequeue_ts;
6803acc5c6dSstsp uint32_t rx_bitmap[8]; /* Bitmap from 0-255 */
6813acc5c6dSstsp uint32_t curr_mpdu_cnt;
6823acc5c6dSstsp uint32_t curr_msdu_cnt;
6833acc5c6dSstsp uint16_t fwd_due_to_bar_cnt;
6843acc5c6dSstsp uint16_t dup_cnt;
6853acc5c6dSstsp uint32_t frames_in_order_cnt;
6863acc5c6dSstsp uint32_t num_mpdu_processed_cnt;
6873acc5c6dSstsp uint32_t num_msdu_processed_cnt;
6883acc5c6dSstsp uint32_t total_num_processed_byte_cnt;
6893acc5c6dSstsp uint32_t late_rx_mpdu_cnt;
6903acc5c6dSstsp uint32_t reorder_hole_cnt;
6913acc5c6dSstsp uint8_t timeout_cnt;
6923acc5c6dSstsp uint8_t bar_rx_cnt;
6933acc5c6dSstsp uint8_t num_window_2k_jump_cnt;
6943acc5c6dSstsp };
6953acc5c6dSstsp
6963acc5c6dSstsp struct hal_reo_status_flush_queue {
6973acc5c6dSstsp bool err_detected;
6983acc5c6dSstsp };
6993acc5c6dSstsp
7003acc5c6dSstsp enum hal_reo_status_flush_cache_err_code {
7013acc5c6dSstsp HAL_REO_STATUS_FLUSH_CACHE_ERR_CODE_SUCCESS,
7023acc5c6dSstsp HAL_REO_STATUS_FLUSH_CACHE_ERR_CODE_IN_USE,
7033acc5c6dSstsp HAL_REO_STATUS_FLUSH_CACHE_ERR_CODE_NOT_FOUND,
7043acc5c6dSstsp };
7053acc5c6dSstsp
7063acc5c6dSstsp struct hal_reo_status_flush_cache {
7073acc5c6dSstsp bool err_detected;
7083acc5c6dSstsp enum hal_reo_status_flush_cache_err_code err_code;
7093acc5c6dSstsp bool cache_controller_flush_status_hit;
7103acc5c6dSstsp uint8_t cache_controller_flush_status_desc_type;
7113acc5c6dSstsp uint8_t cache_controller_flush_status_client_id;
7123acc5c6dSstsp uint8_t cache_controller_flush_status_err;
7133acc5c6dSstsp uint8_t cache_controller_flush_status_cnt;
7143acc5c6dSstsp };
7153acc5c6dSstsp
7163acc5c6dSstsp enum hal_reo_status_unblock_cache_type {
7173acc5c6dSstsp HAL_REO_STATUS_UNBLOCK_BLOCKING_RESOURCE,
7183acc5c6dSstsp HAL_REO_STATUS_UNBLOCK_ENTIRE_CACHE_USAGE,
7193acc5c6dSstsp };
7203acc5c6dSstsp
7213acc5c6dSstsp struct hal_reo_status_unblock_cache {
7223acc5c6dSstsp bool err_detected;
7233acc5c6dSstsp enum hal_reo_status_unblock_cache_type unblock_type;
7243acc5c6dSstsp };
7253acc5c6dSstsp
7263acc5c6dSstsp struct hal_reo_status_flush_timeout_list {
7273acc5c6dSstsp bool err_detected;
7283acc5c6dSstsp bool list_empty;
7293acc5c6dSstsp uint16_t release_desc_cnt;
7303acc5c6dSstsp uint16_t fwd_buf_cnt;
7313acc5c6dSstsp };
7323acc5c6dSstsp
7333acc5c6dSstsp enum hal_reo_threshold_idx {
7343acc5c6dSstsp HAL_REO_THRESHOLD_IDX_DESC_COUNTER0,
7353acc5c6dSstsp HAL_REO_THRESHOLD_IDX_DESC_COUNTER1,
7363acc5c6dSstsp HAL_REO_THRESHOLD_IDX_DESC_COUNTER2,
7373acc5c6dSstsp HAL_REO_THRESHOLD_IDX_DESC_COUNTER_SUM,
7383acc5c6dSstsp };
7393acc5c6dSstsp
7403acc5c6dSstsp struct hal_reo_status_desc_thresh_reached {
7413acc5c6dSstsp enum hal_reo_threshold_idx threshold_idx;
7423acc5c6dSstsp uint32_t link_desc_counter0;
7433acc5c6dSstsp uint32_t link_desc_counter1;
7443acc5c6dSstsp uint32_t link_desc_counter2;
7453acc5c6dSstsp uint32_t link_desc_counter_sum;
7463acc5c6dSstsp };
7473acc5c6dSstsp
7483acc5c6dSstsp struct hal_reo_status {
7493acc5c6dSstsp struct hal_reo_status_header uniform_hdr;
7503acc5c6dSstsp uint8_t loop_cnt;
7513acc5c6dSstsp union {
7523acc5c6dSstsp struct hal_reo_status_queue_stats queue_stats;
7533acc5c6dSstsp struct hal_reo_status_flush_queue flush_queue;
7543acc5c6dSstsp struct hal_reo_status_flush_cache flush_cache;
7553acc5c6dSstsp struct hal_reo_status_unblock_cache unblock_cache;
7563acc5c6dSstsp struct hal_reo_status_flush_timeout_list timeout_list;
7573acc5c6dSstsp struct hal_reo_status_desc_thresh_reached desc_thresh_reached;
7583acc5c6dSstsp } u;
7593acc5c6dSstsp };
7603acc5c6dSstsp
761c2498839Sstsp /* HAL context to be used to access SRNG APIs (currently used by data path
762c2498839Sstsp * and transport (CE) modules)
763c2498839Sstsp */
764c2498839Sstsp struct ath11k_hal {
765c2498839Sstsp /* HAL internal state for all SRNG rings.
766c2498839Sstsp */
767c2498839Sstsp struct hal_srng srng_list[HAL_SRNG_RING_ID_MAX];
768c2498839Sstsp
769c2498839Sstsp /* SRNG configuration table */
770c2498839Sstsp struct hal_srng_config srng_config[QWX_NUM_SRNG_CFG];
771c2498839Sstsp
772c2498839Sstsp /* Remote pointer memory for HW/FW updates */
773c2498839Sstsp struct qwx_dmamem *rdpmem;
774c2498839Sstsp struct {
775c2498839Sstsp uint32_t *vaddr;
776c2498839Sstsp bus_addr_t paddr;
777c2498839Sstsp } rdp;
778c2498839Sstsp
779c2498839Sstsp /* Shared memory for ring pointer updates from host to FW */
780c2498839Sstsp struct qwx_dmamem *wrpmem;
781c2498839Sstsp struct {
782c2498839Sstsp uint32_t *vaddr;
783c2498839Sstsp bus_addr_t paddr;
784c2498839Sstsp } wrp;
785c2498839Sstsp
786c2498839Sstsp /* Available REO blocking resources bitmap */
787c2498839Sstsp uint8_t avail_blk_resource;
788c2498839Sstsp
789c2498839Sstsp uint8_t current_blk_index;
790c2498839Sstsp
791c2498839Sstsp /* shadow register configuration */
792c2498839Sstsp uint32_t shadow_reg_addr[HAL_SHADOW_NUM_REGS];
793c2498839Sstsp int num_shadow_reg_configured;
794c2498839Sstsp #ifdef notyet
795c2498839Sstsp struct lock_class_key srng_key[HAL_SRNG_RING_ID_MAX];
796c2498839Sstsp #endif
797c2498839Sstsp };
798c2498839Sstsp
799bb5c86a2Sstsp enum hal_pn_type {
800bb5c86a2Sstsp HAL_PN_TYPE_NONE,
801bb5c86a2Sstsp HAL_PN_TYPE_WPA,
802bb5c86a2Sstsp HAL_PN_TYPE_WAPI_EVEN,
803bb5c86a2Sstsp HAL_PN_TYPE_WAPI_UNEVEN,
804bb5c86a2Sstsp };
805bb5c86a2Sstsp
806c2498839Sstsp enum hal_ce_desc {
807c2498839Sstsp HAL_CE_DESC_SRC,
808c2498839Sstsp HAL_CE_DESC_DST,
809c2498839Sstsp HAL_CE_DESC_DST_STATUS,
810c2498839Sstsp };
811c2498839Sstsp
812c2498839Sstsp struct ce_ie_addr {
813c2498839Sstsp uint32_t ie1_reg_addr;
814c2498839Sstsp uint32_t ie2_reg_addr;
815c2498839Sstsp uint32_t ie3_reg_addr;
816c2498839Sstsp };
817c2498839Sstsp
818c2498839Sstsp struct ce_remap {
819c2498839Sstsp uint32_t base;
820c2498839Sstsp uint32_t size;
821c2498839Sstsp };
822c2498839Sstsp
823c2498839Sstsp struct ce_attr {
824c2498839Sstsp /* CE_ATTR_* values */
825c2498839Sstsp unsigned int flags;
826c2498839Sstsp
827c2498839Sstsp /* #entries in source ring - Must be a power of 2 */
828c2498839Sstsp unsigned int src_nentries;
829c2498839Sstsp
830c2498839Sstsp /*
831c2498839Sstsp * Max source send size for this CE.
832c2498839Sstsp * This is also the minimum size of a destination buffer.
833c2498839Sstsp */
834c2498839Sstsp unsigned int src_sz_max;
835c2498839Sstsp
836c2498839Sstsp /* #entries in destination ring - Must be a power of 2 */
837c2498839Sstsp unsigned int dest_nentries;
838c2498839Sstsp
839c2498839Sstsp void (*recv_cb)(struct qwx_softc *, struct mbuf *);
840c2498839Sstsp void (*send_cb)(struct qwx_softc *, struct mbuf *);
841c2498839Sstsp };
842c2498839Sstsp
843c2498839Sstsp #define CE_DESC_RING_ALIGN 8
844c2498839Sstsp
8452bc5c218Sstsp struct qwx_rx_msdu {
8462bc5c218Sstsp TAILQ_ENTRY(qwx_rx_msdu) entry;
847c2498839Sstsp struct mbuf *m;
8482bc5c218Sstsp struct ieee80211_rxinfo rxi;
849c2498839Sstsp int is_first_msdu;
850c2498839Sstsp int is_last_msdu;
851c2498839Sstsp int is_continuation;
852c2498839Sstsp int is_mcbc;
853c2498839Sstsp int is_eapol;
854c2498839Sstsp struct hal_rx_desc *rx_desc;
855c2498839Sstsp uint8_t err_rel_src;
856c2498839Sstsp uint8_t err_code;
857c2498839Sstsp uint8_t mac_id;
858c2498839Sstsp uint8_t unmapped;
859c2498839Sstsp uint8_t is_frag;
860c2498839Sstsp uint8_t tid;
861c2498839Sstsp uint16_t peer_id;
862c2498839Sstsp uint16_t seq_no;
863c2498839Sstsp };
864c2498839Sstsp
8652bc5c218Sstsp TAILQ_HEAD(qwx_rx_msdu_list, qwx_rx_msdu);
8662bc5c218Sstsp
8672bc5c218Sstsp struct qwx_rx_data {
8682bc5c218Sstsp struct mbuf *m;
8692bc5c218Sstsp bus_dmamap_t map;
8702bc5c218Sstsp struct qwx_rx_msdu rx_msdu;
8712bc5c218Sstsp };
8722bc5c218Sstsp
873c2498839Sstsp struct qwx_tx_data {
874919f5ec6Sstsp struct ieee80211_node *ni;
875c2498839Sstsp struct mbuf *m;
876c2498839Sstsp bus_dmamap_t map;
877c2498839Sstsp uint8_t eid;
878c2498839Sstsp uint8_t flags;
879c2498839Sstsp uint32_t cipher;
88088b28198Sstsp };
881c2498839Sstsp
882c2498839Sstsp struct qwx_ce_ring {
883c2498839Sstsp /* Number of entries in this ring; must be power of 2 */
884c2498839Sstsp unsigned int nentries;
885c2498839Sstsp unsigned int nentries_mask;
886c2498839Sstsp
887c2498839Sstsp /* For dest ring, this is the next index to be processed
888c2498839Sstsp * by software after it was/is received into.
889c2498839Sstsp *
890c2498839Sstsp * For src ring, this is the last descriptor that was sent
891c2498839Sstsp * and completion processed by software.
892c2498839Sstsp *
893c2498839Sstsp * Regardless of src or dest ring, this is an invariant
894c2498839Sstsp * (modulo ring size):
895c2498839Sstsp * write index >= read index >= sw_index
896c2498839Sstsp */
897c2498839Sstsp unsigned int sw_index;
898c2498839Sstsp /* cached copy */
899c2498839Sstsp unsigned int write_index;
900c2498839Sstsp
901c2498839Sstsp /* Start of DMA-coherent area reserved for descriptors */
902c2498839Sstsp /* Host address space */
903c2498839Sstsp caddr_t base_addr;
904c2498839Sstsp
905c2498839Sstsp /* DMA map for Tx/Rx descriptors. */
906c2498839Sstsp bus_dmamap_t dmap;
907c2498839Sstsp bus_dma_segment_t dsegs;
908c2498839Sstsp int nsegs;
909c2498839Sstsp size_t desc_sz;
910c2498839Sstsp
911c2498839Sstsp /* HAL ring id */
912c2498839Sstsp uint32_t hal_ring_id;
913c2498839Sstsp
914c2498839Sstsp /*
915c2498839Sstsp * Per-transfer data.
916c2498839Sstsp * Size and type of this data depends on how the ring is used.
917c2498839Sstsp *
918c2498839Sstsp * For transfers using DMA, the context contains pointers to
919c2498839Sstsp * struct qwx_rx_data if this ring is a dest ring, or struct
920c2498839Sstsp * qwx_tx_data if this ring is a src ring. DMA maps are allocated
921c2498839Sstsp * when the device is started via sc->ops.start, and will be used
922c2498839Sstsp * to load mbufs for DMA transfers.
923c2498839Sstsp * In this case, the pointers MUST NOT be cleared until the device
924c2498839Sstsp * is stopped. Otherwise we'd lose track of our DMA mappings!
925c2498839Sstsp * The Linux ath11k driver works differently because it can store
926c2498839Sstsp * DMA mapping information in a Linux socket buffer structure, which
927c2498839Sstsp * is not possible with mbufs.
928c2498839Sstsp *
929c2498839Sstsp * Keep last.
930c2498839Sstsp */
931c2498839Sstsp void *per_transfer_context[0];
932c2498839Sstsp };
933c2498839Sstsp
934c2498839Sstsp void qwx_htc_tx_completion_handler(struct qwx_softc *, struct mbuf *);
935c2498839Sstsp void qwx_htc_rx_completion_handler(struct qwx_softc *, struct mbuf *);
936c2498839Sstsp void qwx_dp_htt_htc_t2h_msg_handler(struct qwx_softc *, struct mbuf *);
937c2498839Sstsp
938c2498839Sstsp struct qwx_dp;
939c2498839Sstsp
94023f67261Sstsp struct qwx_dp_htt_wbm_tx_status {
94123f67261Sstsp uint32_t msdu_id;
94223f67261Sstsp int acked;
94323f67261Sstsp int ack_rssi;
94423f67261Sstsp uint16_t peer_id;
94523f67261Sstsp };
94623f67261Sstsp
947c2498839Sstsp #define DP_NUM_CLIENTS_MAX 64
948c2498839Sstsp #define DP_AVG_TIDS_PER_CLIENT 2
949c2498839Sstsp #define DP_NUM_TIDS_MAX (DP_NUM_CLIENTS_MAX * DP_AVG_TIDS_PER_CLIENT)
950c2498839Sstsp #define DP_AVG_MSDUS_PER_FLOW 128
951c2498839Sstsp #define DP_AVG_FLOWS_PER_TID 2
952c2498839Sstsp #define DP_AVG_MPDUS_PER_TID_MAX 128
953c2498839Sstsp #define DP_AVG_MSDUS_PER_MPDU 4
954c2498839Sstsp
955c2498839Sstsp #define DP_RX_HASH_ENABLE 1 /* Enable hash based Rx steering */
956c2498839Sstsp
957c2498839Sstsp #define DP_BA_WIN_SZ_MAX 256
958c2498839Sstsp
959c2498839Sstsp #define DP_TCL_NUM_RING_MAX 3
960c2498839Sstsp #define DP_TCL_NUM_RING_MAX_QCA6390 1
961c2498839Sstsp
962c2498839Sstsp #define DP_IDLE_SCATTER_BUFS_MAX 16
963c2498839Sstsp
964c2498839Sstsp #define DP_WBM_RELEASE_RING_SIZE 64
965c2498839Sstsp #define DP_TCL_DATA_RING_SIZE 512
966c2498839Sstsp #define DP_TCL_DATA_RING_SIZE_WCN6750 2048
967c2498839Sstsp #define DP_TX_COMP_RING_SIZE 32768
968c2498839Sstsp #define DP_TX_IDR_SIZE DP_TX_COMP_RING_SIZE
969c2498839Sstsp #define DP_TCL_CMD_RING_SIZE 32
970c2498839Sstsp #define DP_TCL_STATUS_RING_SIZE 32
971c2498839Sstsp #define DP_REO_DST_RING_MAX 4
972c2498839Sstsp #define DP_REO_DST_RING_SIZE 2048
973c2498839Sstsp #define DP_REO_REINJECT_RING_SIZE 32
974c2498839Sstsp #define DP_RX_RELEASE_RING_SIZE 1024
975c2498839Sstsp #define DP_REO_EXCEPTION_RING_SIZE 128
976c2498839Sstsp #define DP_REO_CMD_RING_SIZE 256
977c2498839Sstsp #define DP_REO_STATUS_RING_SIZE 2048
978c2498839Sstsp #define DP_RXDMA_BUF_RING_SIZE 4096
979c2498839Sstsp #define DP_RXDMA_REFILL_RING_SIZE 2048
980c2498839Sstsp #define DP_RXDMA_ERR_DST_RING_SIZE 1024
981c2498839Sstsp #define DP_RXDMA_MON_STATUS_RING_SIZE 1024
982c2498839Sstsp #define DP_RXDMA_MONITOR_BUF_RING_SIZE 4096
983c2498839Sstsp #define DP_RXDMA_MONITOR_DST_RING_SIZE 2048
984c2498839Sstsp #define DP_RXDMA_MONITOR_DESC_RING_SIZE 4096
985c2498839Sstsp
986c2498839Sstsp #define DP_RX_RELEASE_RING_NUM 3
987c2498839Sstsp
988c2498839Sstsp #define DP_RX_BUFFER_SIZE 2048
989c2498839Sstsp #define DP_RX_BUFFER_SIZE_LITE 1024
990c2498839Sstsp #define DP_RX_BUFFER_ALIGN_SIZE 128
991c2498839Sstsp
992c2498839Sstsp #define DP_RXDMA_BUF_COOKIE_BUF_ID GENMASK(17, 0)
993c2498839Sstsp #define DP_RXDMA_BUF_COOKIE_PDEV_ID GENMASK(20, 18)
994c2498839Sstsp
995c2498839Sstsp #define DP_HW2SW_MACID(mac_id) ((mac_id) ? ((mac_id) - 1) : 0)
996c2498839Sstsp #define DP_SW2HW_MACID(mac_id) ((mac_id) + 1)
997c2498839Sstsp
998c2498839Sstsp #define DP_TX_DESC_ID_MAC_ID GENMASK(1, 0)
999c2498839Sstsp #define DP_TX_DESC_ID_MSDU_ID GENMASK(18, 2)
1000c2498839Sstsp #define DP_TX_DESC_ID_POOL_ID GENMASK(20, 19)
1001c2498839Sstsp
1002c2498839Sstsp struct qwx_hp_update_timer {
1003c2498839Sstsp struct timeout timer;
1004c2498839Sstsp int started;
1005c2498839Sstsp int init;
1006c2498839Sstsp uint32_t tx_num;
1007c2498839Sstsp uint32_t timer_tx_num;
1008c2498839Sstsp uint32_t ring_id;
1009c2498839Sstsp uint32_t interval;
1010c2498839Sstsp struct qwx_softc *sc;
1011c2498839Sstsp };
1012c2498839Sstsp
1013c2498839Sstsp struct dp_rx_tid {
1014c2498839Sstsp uint8_t tid;
1015bb5c86a2Sstsp struct qwx_dmamem *mem;
1016c2498839Sstsp uint32_t *vaddr;
1017bb5c86a2Sstsp uint64_t paddr;
1018c2498839Sstsp uint32_t size;
1019c2498839Sstsp uint32_t ba_win_sz;
1020c2498839Sstsp int active;
1021c2498839Sstsp
1022c2498839Sstsp /* Info related to rx fragments */
1023c2498839Sstsp uint32_t cur_sn;
1024c2498839Sstsp uint16_t last_frag_no;
1025c2498839Sstsp uint16_t rx_frag_bitmap;
1026c2498839Sstsp #if 0
1027c2498839Sstsp struct sk_buff_head rx_frags;
1028c2498839Sstsp struct hal_reo_dest_ring *dst_ring_desc;
1029c2498839Sstsp
1030c2498839Sstsp /* Timer info related to fragments */
1031c2498839Sstsp struct timer_list frag_timer;
1032c2498839Sstsp struct ath11k_base *ab;
1033c2498839Sstsp #endif
1034c2498839Sstsp };
1035c2498839Sstsp
1036c2498839Sstsp #define DP_REO_DESC_FREE_THRESHOLD 64
1037c2498839Sstsp #define DP_REO_DESC_FREE_TIMEOUT_MS 1000
1038c2498839Sstsp #define DP_MON_PURGE_TIMEOUT_MS 100
1039c2498839Sstsp #define DP_MON_SERVICE_BUDGET 128
1040c2498839Sstsp
1041c2498839Sstsp struct dp_reo_cache_flush_elem {
1042c2498839Sstsp TAILQ_ENTRY(dp_reo_cache_flush_elem) entry;
1043c2498839Sstsp struct dp_rx_tid data;
104481fa3e72Scheloha uint64_t ts;
1045c2498839Sstsp };
1046c2498839Sstsp
1047c2498839Sstsp TAILQ_HEAD(dp_reo_cmd_cache_flush_head, dp_reo_cache_flush_elem);
1048c2498839Sstsp
1049c2498839Sstsp struct dp_reo_cmd {
1050c2498839Sstsp TAILQ_ENTRY(dp_reo_cmd) entry;
1051c2498839Sstsp struct dp_rx_tid data;
1052c2498839Sstsp int cmd_num;
1053c2498839Sstsp void (*handler)(struct qwx_dp *, void *,
1054c2498839Sstsp enum hal_reo_cmd_status status);
1055c2498839Sstsp };
1056c2498839Sstsp
1057c2498839Sstsp TAILQ_HEAD(dp_reo_cmd_head, dp_reo_cmd);
1058c2498839Sstsp
1059c2498839Sstsp struct dp_srng {
1060c2498839Sstsp struct qwx_dmamem *mem;
1061c2498839Sstsp uint32_t *vaddr;
1062c2498839Sstsp bus_addr_t paddr;
1063c2498839Sstsp int size;
1064c2498839Sstsp uint32_t ring_id;
1065c2498839Sstsp uint8_t cached;
1066c2498839Sstsp };
1067c2498839Sstsp
1068c2498839Sstsp struct dp_tx_ring {
1069c2498839Sstsp uint8_t tcl_data_ring_id;
1070c2498839Sstsp struct dp_srng tcl_data_ring;
1071c2498839Sstsp struct dp_srng tcl_comp_ring;
1072d2c51456Sstsp int cur;
1073d2c51456Sstsp int queued;
1074d2c51456Sstsp struct qwx_tx_data *data;
1075c2498839Sstsp struct hal_wbm_release_ring *tx_status;
1076c2498839Sstsp int tx_status_head;
1077c2498839Sstsp int tx_status_tail;
1078c2498839Sstsp };
1079c2498839Sstsp
1080c2498839Sstsp
1081c2498839Sstsp struct dp_link_desc_bank {
1082c2498839Sstsp struct qwx_dmamem *mem;
1083c2498839Sstsp caddr_t *vaddr;
1084c2498839Sstsp bus_addr_t paddr;
1085c2498839Sstsp uint32_t size;
1086c2498839Sstsp };
1087c2498839Sstsp
1088c2498839Sstsp /* Size to enforce scatter idle list mode */
1089c2498839Sstsp #define DP_LINK_DESC_ALLOC_SIZE_THRESH 0x200000
1090c2498839Sstsp #define DP_LINK_DESC_BANKS_MAX 8
1091c2498839Sstsp
1092c2498839Sstsp struct hal_wbm_idle_scatter_list {
1093c2498839Sstsp struct qwx_dmamem *mem;
1094c2498839Sstsp bus_addr_t paddr;
1095c2498839Sstsp struct hal_wbm_link_desc *vaddr;
1096c2498839Sstsp };
1097c2498839Sstsp
1098c2498839Sstsp struct qwx_dp {
1099c2498839Sstsp struct qwx_softc *sc;
1100c2498839Sstsp enum ath11k_htc_ep_id eid;
1101c2498839Sstsp int htt_tgt_version_received;
1102c2498839Sstsp uint8_t htt_tgt_ver_major;
1103c2498839Sstsp uint8_t htt_tgt_ver_minor;
1104c2498839Sstsp struct dp_link_desc_bank link_desc_banks[DP_LINK_DESC_BANKS_MAX];
1105c2498839Sstsp struct dp_srng wbm_idle_ring;
1106c2498839Sstsp struct dp_srng wbm_desc_rel_ring;
1107c2498839Sstsp struct dp_srng tcl_cmd_ring;
1108c2498839Sstsp struct dp_srng tcl_status_ring;
1109c2498839Sstsp struct dp_srng reo_reinject_ring;
1110c2498839Sstsp struct dp_srng rx_rel_ring;
1111c2498839Sstsp struct dp_srng reo_except_ring;
1112c2498839Sstsp struct dp_srng reo_cmd_ring;
1113c2498839Sstsp struct dp_srng reo_status_ring;
1114c2498839Sstsp struct dp_srng reo_dst_ring[DP_REO_DST_RING_MAX];
1115c2498839Sstsp struct dp_tx_ring tx_ring[DP_TCL_NUM_RING_MAX];
1116c2498839Sstsp struct hal_wbm_idle_scatter_list scatter_list[DP_IDLE_SCATTER_BUFS_MAX];
1117c2498839Sstsp struct dp_reo_cmd_head reo_cmd_list;
1118c2498839Sstsp struct dp_reo_cmd_cache_flush_head reo_cmd_cache_flush_list;
1119c2498839Sstsp #if 0
1120c2498839Sstsp struct list_head dp_full_mon_mpdu_list;
1121c2498839Sstsp #endif
1122c2498839Sstsp uint32_t reo_cmd_cache_flush_count;
1123c2498839Sstsp #if 0
1124c2498839Sstsp /**
1125c2498839Sstsp * protects access to below fields,
1126c2498839Sstsp * - reo_cmd_list
1127c2498839Sstsp * - reo_cmd_cache_flush_list
1128c2498839Sstsp * - reo_cmd_cache_flush_count
1129c2498839Sstsp */
1130c2498839Sstsp spinlock_t reo_cmd_lock;
1131c2498839Sstsp #endif
1132c2498839Sstsp struct qwx_hp_update_timer reo_cmd_timer;
1133c2498839Sstsp struct qwx_hp_update_timer tx_ring_timer[DP_TCL_NUM_RING_MAX];
1134c2498839Sstsp };
1135c2498839Sstsp
1136c2498839Sstsp #define ATH11K_SHADOW_DP_TIMER_INTERVAL 20
1137c2498839Sstsp #define ATH11K_SHADOW_CTRL_TIMER_INTERVAL 10
1138c2498839Sstsp
1139c2498839Sstsp struct qwx_ce_pipe {
1140c2498839Sstsp struct qwx_softc *sc;
1141c2498839Sstsp uint16_t pipe_num;
1142c2498839Sstsp unsigned int attr_flags;
1143c2498839Sstsp unsigned int buf_sz;
1144c2498839Sstsp unsigned int rx_buf_needed;
1145c2498839Sstsp
1146c2498839Sstsp void (*send_cb)(struct qwx_softc *, struct mbuf *);
1147c2498839Sstsp void (*recv_cb)(struct qwx_softc *, struct mbuf *);
1148c2498839Sstsp
1149c2498839Sstsp #ifdef notyet
1150c2498839Sstsp struct tasklet_struct intr_tq;
1151c2498839Sstsp #endif
1152c2498839Sstsp struct qwx_ce_ring *src_ring;
1153c2498839Sstsp struct qwx_ce_ring *dest_ring;
1154c2498839Sstsp struct qwx_ce_ring *status_ring;
1155c2498839Sstsp uint64_t timestamp;
1156c2498839Sstsp };
1157c2498839Sstsp
1158c2498839Sstsp struct qwx_ce {
1159c2498839Sstsp struct qwx_ce_pipe ce_pipe[CE_COUNT_MAX];
1160c2498839Sstsp #ifdef notyet
1161c2498839Sstsp /* Protects rings of all ce pipes */
1162c2498839Sstsp spinlock_t ce_lock;
1163c2498839Sstsp #endif
1164c2498839Sstsp struct qwx_hp_update_timer hp_timer[CE_COUNT_MAX];
1165c2498839Sstsp };
1166c2498839Sstsp
1167c2498839Sstsp
1168c2498839Sstsp /* XXX This may be non-zero on AHB but is always zero on PCI. */
1169c2498839Sstsp #define ATH11K_CE_OFFSET(sc) (0)
1170c2498839Sstsp
1171c2498839Sstsp struct qwx_qmi_ce_cfg {
1172c2498839Sstsp const uint8_t *shadow_reg;
1173c2498839Sstsp int shadow_reg_len;
1174c2498839Sstsp uint32_t *shadow_reg_v2;
1175c2498839Sstsp uint32_t shadow_reg_v2_len;
1176c2498839Sstsp };
1177c2498839Sstsp
1178c2498839Sstsp struct qwx_qmi_target_info {
1179c2498839Sstsp uint32_t chip_id;
1180c2498839Sstsp uint32_t chip_family;
1181c2498839Sstsp uint32_t board_id;
1182c2498839Sstsp uint32_t soc_id;
1183c2498839Sstsp uint32_t fw_version;
1184c2498839Sstsp uint32_t eeprom_caldata;
1185c2498839Sstsp char fw_build_timestamp[ATH11K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 + 1];
1186c2498839Sstsp char fw_build_id[ATH11K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01 + 1];
1187c2498839Sstsp char bdf_ext[ATH11K_QMI_BDF_EXT_STR_LENGTH];
1188c2498839Sstsp };
1189c2498839Sstsp
1190c2498839Sstsp enum ath11k_bdf_search {
1191c2498839Sstsp ATH11K_BDF_SEARCH_DEFAULT,
1192c2498839Sstsp ATH11K_BDF_SEARCH_BUS_AND_BOARD,
1193c2498839Sstsp };
1194c2498839Sstsp
1195c2498839Sstsp struct qwx_device_id {
1196c2498839Sstsp enum ath11k_bdf_search bdf_search;
1197c2498839Sstsp uint32_t vendor;
1198c2498839Sstsp uint32_t device;
1199c2498839Sstsp uint32_t subsystem_vendor;
1200c2498839Sstsp uint32_t subsystem_device;
1201c2498839Sstsp };
1202c2498839Sstsp
1203c2498839Sstsp struct qwx_wmi_base;
1204c2498839Sstsp
1205c2498839Sstsp struct qwx_pdev_wmi {
1206c2498839Sstsp struct qwx_wmi_base *wmi;
1207c2498839Sstsp enum ath11k_htc_ep_id eid;
1208c2498839Sstsp const struct wmi_peer_flags_map *peer_flags;
1209c2498839Sstsp uint32_t rx_decap_mode;
1210c2498839Sstsp int tx_ce_desc;
1211c2498839Sstsp };
1212c2498839Sstsp
1213c2498839Sstsp #define QWX_MAX_RADIOS 3
1214c2498839Sstsp
1215c2498839Sstsp struct qwx_wmi_base {
1216c2498839Sstsp struct qwx_softc *sc;
1217c2498839Sstsp struct qwx_pdev_wmi wmi[QWX_MAX_RADIOS];
1218c2498839Sstsp enum ath11k_htc_ep_id wmi_endpoint_id[QWX_MAX_RADIOS];
1219c2498839Sstsp uint32_t max_msg_len[QWX_MAX_RADIOS];
1220c2498839Sstsp int service_ready;
1221c2498839Sstsp int unified_ready;
1222c2498839Sstsp uint8_t svc_map[howmany(WMI_MAX_EXT2_SERVICE, 8)];
1223c2498839Sstsp int tx_credits;
1224c2498839Sstsp const struct wmi_peer_flags_map *peer_flags;
1225c2498839Sstsp uint32_t num_mem_chunks;
1226c2498839Sstsp uint32_t rx_decap_mode;
1227c2498839Sstsp struct wmi_host_mem_chunk mem_chunks[WMI_MAX_MEM_REQS];
1228c2498839Sstsp enum wmi_host_hw_mode_config_type preferred_hw_mode;
1229c2498839Sstsp struct target_resource_config wlan_resource_config;
1230c2498839Sstsp struct ath11k_targ_cap *targ_cap;
1231c2498839Sstsp };
1232c2498839Sstsp
1233c2498839Sstsp struct wmi_tlv_policy {
1234c2498839Sstsp size_t min_len;
1235c2498839Sstsp };
1236c2498839Sstsp
1237c2498839Sstsp struct wmi_tlv_svc_ready_parse {
1238c2498839Sstsp int wmi_svc_bitmap_done;
1239c2498839Sstsp };
1240c2498839Sstsp
1241c2498839Sstsp struct wmi_tlv_dma_ring_caps_parse {
1242c2498839Sstsp struct wmi_dma_ring_capabilities *dma_ring_caps;
1243c2498839Sstsp uint32_t n_dma_ring_caps;
1244c2498839Sstsp };
1245c2498839Sstsp
1246c2498839Sstsp struct wmi_tlv_svc_rdy_ext_parse {
1247c2498839Sstsp struct ath11k_service_ext_param param;
1248c2498839Sstsp struct wmi_soc_mac_phy_hw_mode_caps *hw_caps;
1249c2498839Sstsp struct wmi_hw_mode_capabilities *hw_mode_caps;
1250c2498839Sstsp uint32_t n_hw_mode_caps;
1251c2498839Sstsp uint32_t tot_phy_id;
1252c2498839Sstsp struct wmi_hw_mode_capabilities pref_hw_mode_caps;
1253c2498839Sstsp struct wmi_mac_phy_capabilities *mac_phy_caps;
1254c2498839Sstsp size_t mac_phy_caps_size;
1255c2498839Sstsp uint32_t n_mac_phy_caps;
1256c2498839Sstsp struct wmi_soc_hal_reg_capabilities *soc_hal_reg_caps;
1257c2498839Sstsp struct wmi_hal_reg_capabilities_ext *ext_hal_reg_caps;
1258c2498839Sstsp uint32_t n_ext_hal_reg_caps;
1259c2498839Sstsp struct wmi_tlv_dma_ring_caps_parse dma_caps_parse;
1260c2498839Sstsp int hw_mode_done;
1261c2498839Sstsp int mac_phy_done;
1262c2498839Sstsp int ext_hal_reg_done;
1263c2498839Sstsp int mac_phy_chainmask_combo_done;
1264c2498839Sstsp int mac_phy_chainmask_cap_done;
1265c2498839Sstsp int oem_dma_ring_cap_done;
1266c2498839Sstsp int dma_ring_cap_done;
1267c2498839Sstsp };
1268c2498839Sstsp
1269c2498839Sstsp struct wmi_tlv_svc_rdy_ext2_parse {
1270c2498839Sstsp struct wmi_tlv_dma_ring_caps_parse dma_caps_parse;
1271c2498839Sstsp bool dma_ring_cap_done;
1272c2498839Sstsp };
1273c2498839Sstsp
1274c2498839Sstsp struct wmi_tlv_rdy_parse {
1275c2498839Sstsp uint32_t num_extra_mac_addr;
1276c2498839Sstsp };
1277c2498839Sstsp
1278c2498839Sstsp struct wmi_tlv_dma_buf_release_parse {
1279c2498839Sstsp struct ath11k_wmi_dma_buf_release_fixed_param fixed;
1280c2498839Sstsp struct wmi_dma_buf_release_entry *buf_entry;
1281c2498839Sstsp struct wmi_dma_buf_release_meta_data *meta_data;
1282c2498839Sstsp uint32_t num_buf_entry;
1283c2498839Sstsp uint32_t num_meta;
1284c2498839Sstsp bool buf_entry_done;
1285c2498839Sstsp bool meta_data_done;
1286c2498839Sstsp };
1287c2498839Sstsp
1288c2498839Sstsp struct wmi_tlv_fw_stats_parse {
1289c2498839Sstsp const struct wmi_stats_event *ev;
1290c2498839Sstsp const struct wmi_per_chain_rssi_stats *rssi;
1291c2498839Sstsp struct ath11k_fw_stats *stats;
1292c2498839Sstsp int rssi_num;
1293c2498839Sstsp bool chain_rssi_done;
1294c2498839Sstsp };
1295c2498839Sstsp
1296c2498839Sstsp struct wmi_tlv_mgmt_rx_parse {
1297c2498839Sstsp const struct wmi_mgmt_rx_hdr *fixed;
1298c2498839Sstsp const uint8_t *frame_buf;
1299c2498839Sstsp bool frame_buf_done;
1300c2498839Sstsp };
1301c2498839Sstsp
1302c2498839Sstsp struct qwx_htc;
1303c2498839Sstsp
1304c2498839Sstsp struct qwx_htc_ep_ops {
1305c2498839Sstsp void (*ep_tx_complete)(struct qwx_softc *, struct mbuf *);
1306c2498839Sstsp void (*ep_rx_complete)(struct qwx_softc *, struct mbuf *);
1307c2498839Sstsp void (*ep_tx_credits)(struct qwx_softc *);
1308c2498839Sstsp };
1309c2498839Sstsp
1310c2498839Sstsp /* service connection information */
1311c2498839Sstsp struct qwx_htc_svc_conn_req {
1312c2498839Sstsp uint16_t service_id;
1313c2498839Sstsp struct qwx_htc_ep_ops ep_ops;
1314c2498839Sstsp int max_send_queue_depth;
1315c2498839Sstsp };
1316c2498839Sstsp
1317c2498839Sstsp /* service connection response information */
1318c2498839Sstsp struct qwx_htc_svc_conn_resp {
1319c2498839Sstsp uint8_t buffer_len;
1320c2498839Sstsp uint8_t actual_len;
1321c2498839Sstsp enum ath11k_htc_ep_id eid;
1322c2498839Sstsp unsigned int max_msg_len;
1323c2498839Sstsp uint8_t connect_resp_code;
1324c2498839Sstsp };
1325c2498839Sstsp
1326c2498839Sstsp #define ATH11K_NUM_CONTROL_TX_BUFFERS 2
1327c2498839Sstsp #define ATH11K_HTC_MAX_LEN 4096
1328c2498839Sstsp #define ATH11K_HTC_MAX_CTRL_MSG_LEN 256
1329c2498839Sstsp #define ATH11K_HTC_WAIT_TIMEOUT_HZ (1 * HZ)
1330c2498839Sstsp #define ATH11K_HTC_CONTROL_BUFFER_SIZE (ATH11K_HTC_MAX_CTRL_MSG_LEN + \
1331c2498839Sstsp sizeof(struct ath11k_htc_hdr))
1332c2498839Sstsp #define ATH11K_HTC_CONN_SVC_TIMEOUT_HZ (1 * HZ)
1333c2498839Sstsp #define ATH11K_HTC_MAX_SERVICE_ALLOC_ENTRIES 8
1334c2498839Sstsp
1335c2498839Sstsp struct qwx_htc_ep {
1336c2498839Sstsp struct qwx_htc *htc;
1337c2498839Sstsp enum ath11k_htc_ep_id eid;
1338c2498839Sstsp enum ath11k_htc_svc_id service_id;
1339c2498839Sstsp struct qwx_htc_ep_ops ep_ops;
1340c2498839Sstsp
1341c2498839Sstsp int max_tx_queue_depth;
1342c2498839Sstsp int max_ep_message_len;
1343c2498839Sstsp uint8_t ul_pipe_id;
1344c2498839Sstsp uint8_t dl_pipe_id;
1345c2498839Sstsp
1346c2498839Sstsp uint8_t seq_no; /* for debugging */
1347c2498839Sstsp int tx_credits;
1348c2498839Sstsp bool tx_credit_flow_enabled;
1349c2498839Sstsp };
1350c2498839Sstsp
1351c2498839Sstsp struct qwx_htc_svc_tx_credits {
1352c2498839Sstsp uint16_t service_id;
1353c2498839Sstsp uint8_t credit_allocation;
1354c2498839Sstsp };
1355c2498839Sstsp
1356c2498839Sstsp struct qwx_htc {
1357c2498839Sstsp struct qwx_softc *sc;
1358c2498839Sstsp struct qwx_htc_ep endpoint[ATH11K_HTC_EP_COUNT];
1359c2498839Sstsp #ifdef notyet
1360c2498839Sstsp /* protects endpoints */
1361c2498839Sstsp spinlock_t tx_lock;
1362c2498839Sstsp #endif
1363c2498839Sstsp uint8_t control_resp_buffer[ATH11K_HTC_MAX_CTRL_MSG_LEN];
1364c2498839Sstsp int control_resp_len;
1365c2498839Sstsp
1366c2498839Sstsp int ctl_resp;
1367c2498839Sstsp
1368c2498839Sstsp int total_transmit_credits;
1369c2498839Sstsp struct qwx_htc_svc_tx_credits
1370c2498839Sstsp service_alloc_table[ATH11K_HTC_MAX_SERVICE_ALLOC_ENTRIES];
1371c2498839Sstsp int target_credit_size;
1372c2498839Sstsp uint8_t wmi_ep_count;
1373c2498839Sstsp };
1374c2498839Sstsp
1375c2498839Sstsp struct qwx_msi_user {
1376c2498839Sstsp char *name;
1377c2498839Sstsp int num_vectors;
1378c2498839Sstsp uint32_t base_vector;
1379c2498839Sstsp };
1380c2498839Sstsp
1381c2498839Sstsp struct qwx_msi_config {
1382c2498839Sstsp int total_vectors;
1383c2498839Sstsp int total_users;
1384c2498839Sstsp struct qwx_msi_user *users;
1385c2498839Sstsp uint16_t hw_rev;
1386c2498839Sstsp };
1387c2498839Sstsp
1388c2498839Sstsp struct ath11k_band_cap {
1389c2498839Sstsp uint32_t phy_id;
1390c2498839Sstsp uint32_t max_bw_supported;
1391c2498839Sstsp uint32_t ht_cap_info;
1392c2498839Sstsp uint32_t he_cap_info[2];
1393c2498839Sstsp uint32_t he_mcs;
1394c2498839Sstsp uint32_t he_cap_phy_info[PSOC_HOST_MAX_PHY_SIZE];
1395c2498839Sstsp struct ath11k_ppe_threshold he_ppet;
1396c2498839Sstsp uint16_t he_6ghz_capa;
1397c2498839Sstsp };
1398c2498839Sstsp
1399c2498839Sstsp struct ath11k_pdev_cap {
1400c2498839Sstsp uint32_t supported_bands;
1401c2498839Sstsp uint32_t ampdu_density;
1402c2498839Sstsp uint32_t vht_cap;
1403c2498839Sstsp uint32_t vht_mcs;
1404c2498839Sstsp uint32_t he_mcs;
1405c2498839Sstsp uint32_t tx_chain_mask;
1406c2498839Sstsp uint32_t rx_chain_mask;
1407c2498839Sstsp uint32_t tx_chain_mask_shift;
1408c2498839Sstsp uint32_t rx_chain_mask_shift;
1409c2498839Sstsp struct ath11k_band_cap band[WMI_NUM_SUPPORTED_BAND_MAX];
1410c2498839Sstsp int nss_ratio_enabled;
1411c2498839Sstsp uint8_t nss_ratio_info;
1412c2498839Sstsp };
1413c2498839Sstsp
1414c2498839Sstsp struct qwx_pdev {
1415c2498839Sstsp struct qwx_softc *sc;
1416c2498839Sstsp uint32_t pdev_id;
1417c2498839Sstsp struct ath11k_pdev_cap cap;
1418c2498839Sstsp uint8_t mac_addr[IEEE80211_ADDR_LEN];
1419c2498839Sstsp };
1420c2498839Sstsp
1421c2498839Sstsp struct qwx_dbring_cap {
1422c2498839Sstsp uint32_t pdev_id;
1423c2498839Sstsp enum wmi_direct_buffer_module id;
1424c2498839Sstsp uint32_t min_elem;
1425c2498839Sstsp uint32_t min_buf_sz;
1426c2498839Sstsp uint32_t min_buf_align;
1427c2498839Sstsp };
1428c2498839Sstsp
1429c2498839Sstsp struct dp_rxdma_ring {
1430c2498839Sstsp struct dp_srng refill_buf_ring;
1431c2498839Sstsp #if 0
1432c2498839Sstsp struct idr bufs_idr;
1433c2498839Sstsp /* Protects bufs_idr */
1434c2498839Sstsp spinlock_t idr_lock;
1435c2498839Sstsp #else
1436c2498839Sstsp struct qwx_rx_data *rx_data;
1437c2498839Sstsp #endif
1438c2498839Sstsp int bufs_max;
14399ab07a2dSstsp uint8_t freemap[howmany(DP_RXDMA_BUF_RING_SIZE, 8)];
1440c2498839Sstsp };
1441c2498839Sstsp
144240c12381Sstsp enum hal_rx_mon_status {
144340c12381Sstsp HAL_RX_MON_STATUS_PPDU_NOT_DONE,
144440c12381Sstsp HAL_RX_MON_STATUS_PPDU_DONE,
144540c12381Sstsp HAL_RX_MON_STATUS_BUF_DONE,
144640c12381Sstsp };
144740c12381Sstsp
144840c12381Sstsp struct hal_rx_user_status {
144940c12381Sstsp uint32_t mcs:4,
145040c12381Sstsp nss:3,
145140c12381Sstsp ofdma_info_valid:1,
145240c12381Sstsp dl_ofdma_ru_start_index:7,
145340c12381Sstsp dl_ofdma_ru_width:7,
145440c12381Sstsp dl_ofdma_ru_size:8;
145540c12381Sstsp uint32_t ul_ofdma_user_v0_word0;
145640c12381Sstsp uint32_t ul_ofdma_user_v0_word1;
145740c12381Sstsp uint32_t ast_index;
145840c12381Sstsp uint32_t tid;
145940c12381Sstsp uint16_t tcp_msdu_count;
146040c12381Sstsp uint16_t udp_msdu_count;
146140c12381Sstsp uint16_t other_msdu_count;
146240c12381Sstsp uint16_t frame_control;
146340c12381Sstsp uint8_t frame_control_info_valid;
146440c12381Sstsp uint8_t data_sequence_control_info_valid;
146540c12381Sstsp uint16_t first_data_seq_ctrl;
146640c12381Sstsp uint32_t preamble_type;
146740c12381Sstsp uint16_t ht_flags;
146840c12381Sstsp uint16_t vht_flags;
146940c12381Sstsp uint16_t he_flags;
147040c12381Sstsp uint8_t rs_flags;
147140c12381Sstsp uint32_t mpdu_cnt_fcs_ok;
147240c12381Sstsp uint32_t mpdu_cnt_fcs_err;
147340c12381Sstsp uint32_t mpdu_fcs_ok_bitmap[8];
147440c12381Sstsp uint32_t mpdu_ok_byte_count;
147540c12381Sstsp uint32_t mpdu_err_byte_count;
147640c12381Sstsp };
147740c12381Sstsp
1478006236c7Sstsp struct hal_rx_wbm_rel_info {
1479006236c7Sstsp uint32_t cookie;
1480006236c7Sstsp enum hal_wbm_rel_src_module err_rel_src;
1481006236c7Sstsp enum hal_reo_dest_ring_push_reason push_reason;
1482006236c7Sstsp uint32_t err_code;
1483006236c7Sstsp int first_msdu;
1484006236c7Sstsp int last_msdu;
1485006236c7Sstsp };
1486006236c7Sstsp
148740c12381Sstsp #define HAL_INVALID_PEERID 0xffff
148840c12381Sstsp #define VHT_SIG_SU_NSS_MASK 0x7
148940c12381Sstsp
149040c12381Sstsp #define HAL_RX_MAX_MCS 12
149140c12381Sstsp #define HAL_RX_MAX_NSS 8
149240c12381Sstsp
149340c12381Sstsp #define HAL_TLV_STATUS_PPDU_NOT_DONE HAL_RX_MON_STATUS_PPDU_NOT_DONE
149440c12381Sstsp #define HAL_TLV_STATUS_PPDU_DONE HAL_RX_MON_STATUS_PPDU_DONE
149540c12381Sstsp #define HAL_TLV_STATUS_BUF_DONE HAL_RX_MON_STATUS_BUF_DONE
149640c12381Sstsp
149740c12381Sstsp struct hal_rx_mon_ppdu_info {
149840c12381Sstsp uint32_t ppdu_id;
149940c12381Sstsp uint32_t ppdu_ts;
150040c12381Sstsp uint32_t num_mpdu_fcs_ok;
150140c12381Sstsp uint32_t num_mpdu_fcs_err;
150240c12381Sstsp uint32_t preamble_type;
150340c12381Sstsp uint16_t chan_num;
150440c12381Sstsp uint16_t tcp_msdu_count;
150540c12381Sstsp uint16_t tcp_ack_msdu_count;
150640c12381Sstsp uint16_t udp_msdu_count;
150740c12381Sstsp uint16_t other_msdu_count;
150840c12381Sstsp uint16_t peer_id;
150940c12381Sstsp uint8_t rate;
151040c12381Sstsp uint8_t mcs;
151140c12381Sstsp uint8_t nss;
151240c12381Sstsp uint8_t bw;
151340c12381Sstsp uint8_t vht_flag_values1;
151440c12381Sstsp uint8_t vht_flag_values2;
151540c12381Sstsp uint8_t vht_flag_values3[4];
151640c12381Sstsp uint8_t vht_flag_values4;
151740c12381Sstsp uint8_t vht_flag_values5;
151840c12381Sstsp uint16_t vht_flag_values6;
151940c12381Sstsp uint8_t is_stbc;
152040c12381Sstsp uint8_t gi;
152140c12381Sstsp uint8_t ldpc;
152240c12381Sstsp uint8_t beamformed;
152340c12381Sstsp uint8_t rssi_comb;
152440c12381Sstsp uint8_t rssi_chain_pri20[HAL_RX_MAX_NSS];
152540c12381Sstsp uint8_t tid;
152640c12381Sstsp uint16_t ht_flags;
152740c12381Sstsp uint16_t vht_flags;
152840c12381Sstsp uint16_t he_flags;
152940c12381Sstsp uint16_t he_mu_flags;
153040c12381Sstsp uint8_t dcm;
153140c12381Sstsp uint8_t ru_alloc;
153240c12381Sstsp uint8_t reception_type;
153340c12381Sstsp uint64_t tsft;
153440c12381Sstsp uint64_t rx_duration;
153540c12381Sstsp uint16_t frame_control;
153640c12381Sstsp uint32_t ast_index;
153740c12381Sstsp uint8_t rs_fcs_err;
153840c12381Sstsp uint8_t rs_flags;
153940c12381Sstsp uint8_t cck_flag;
154040c12381Sstsp uint8_t ofdm_flag;
154140c12381Sstsp uint8_t ulofdma_flag;
154240c12381Sstsp uint8_t frame_control_info_valid;
154340c12381Sstsp uint16_t he_per_user_1;
154440c12381Sstsp uint16_t he_per_user_2;
154540c12381Sstsp uint8_t he_per_user_position;
154640c12381Sstsp uint8_t he_per_user_known;
154740c12381Sstsp uint16_t he_flags1;
154840c12381Sstsp uint16_t he_flags2;
154940c12381Sstsp uint8_t he_RU[4];
155040c12381Sstsp uint16_t he_data1;
155140c12381Sstsp uint16_t he_data2;
155240c12381Sstsp uint16_t he_data3;
155340c12381Sstsp uint16_t he_data4;
155440c12381Sstsp uint16_t he_data5;
155540c12381Sstsp uint16_t he_data6;
155640c12381Sstsp uint32_t ppdu_len;
155740c12381Sstsp uint32_t prev_ppdu_id;
155840c12381Sstsp uint32_t device_id;
155940c12381Sstsp uint16_t first_data_seq_ctrl;
156040c12381Sstsp uint8_t monitor_direct_used;
156140c12381Sstsp uint8_t data_sequence_control_info_valid;
156240c12381Sstsp uint8_t ltf_size;
156340c12381Sstsp uint8_t rxpcu_filter_pass;
156440c12381Sstsp char rssi_chain[8][8];
156540c12381Sstsp struct hal_rx_user_status userstats;
156640c12381Sstsp };
156740c12381Sstsp
156840c12381Sstsp enum dp_mon_status_buf_state {
156940c12381Sstsp /* PPDU id matches in dst ring and status ring */
157040c12381Sstsp DP_MON_STATUS_MATCH,
157140c12381Sstsp /* status ring dma is not done */
157240c12381Sstsp DP_MON_STATUS_NO_DMA,
157340c12381Sstsp /* status ring is lagging, reap status ring */
157440c12381Sstsp DP_MON_STATUS_LAG,
157540c12381Sstsp /* status ring is leading, reap dst ring and drop */
157640c12381Sstsp DP_MON_STATUS_LEAD,
157740c12381Sstsp /* replinish monitor status ring */
157840c12381Sstsp DP_MON_STATUS_REPLINISH,
157940c12381Sstsp };
158040c12381Sstsp
158140c12381Sstsp struct qwx_pdev_mon_stats {
158240c12381Sstsp uint32_t status_ppdu_state;
158340c12381Sstsp uint32_t status_ppdu_start;
158440c12381Sstsp uint32_t status_ppdu_end;
158540c12381Sstsp uint32_t status_ppdu_compl;
158640c12381Sstsp uint32_t status_ppdu_start_mis;
158740c12381Sstsp uint32_t status_ppdu_end_mis;
158840c12381Sstsp uint32_t status_ppdu_done;
158940c12381Sstsp uint32_t dest_ppdu_done;
159040c12381Sstsp uint32_t dest_mpdu_done;
159140c12381Sstsp uint32_t dest_mpdu_drop;
159240c12381Sstsp uint32_t dup_mon_linkdesc_cnt;
159340c12381Sstsp uint32_t dup_mon_buf_cnt;
159440c12381Sstsp uint32_t dest_mon_stuck;
159540c12381Sstsp uint32_t dest_mon_not_reaped;
159640c12381Sstsp };
159740c12381Sstsp
159840c12381Sstsp struct qwx_mon_data {
159940c12381Sstsp struct dp_link_desc_bank link_desc_banks[DP_LINK_DESC_BANKS_MAX];
160040c12381Sstsp struct hal_rx_mon_ppdu_info mon_ppdu_info;
160140c12381Sstsp
160240c12381Sstsp uint32_t mon_ppdu_status;
160340c12381Sstsp uint32_t mon_last_buf_cookie;
160440c12381Sstsp uint64_t mon_last_linkdesc_paddr;
160540c12381Sstsp uint16_t chan_noise_floor;
160640c12381Sstsp bool hold_mon_dst_ring;
160740c12381Sstsp enum dp_mon_status_buf_state buf_state;
160840c12381Sstsp bus_addr_t mon_status_paddr;
160940c12381Sstsp struct dp_full_mon_mpdu *mon_mpdu;
161040c12381Sstsp #ifdef notyet
161140c12381Sstsp struct hal_sw_mon_ring_entries sw_mon_entries;
161240c12381Sstsp #endif
161340c12381Sstsp struct qwx_pdev_mon_stats rx_mon_stats;
161440c12381Sstsp #ifdef notyet
161540c12381Sstsp /* lock for monitor data */
161640c12381Sstsp spinlock_t mon_lock;
161740c12381Sstsp struct sk_buff_head rx_status_q;
161840c12381Sstsp #endif
161940c12381Sstsp };
162040c12381Sstsp
162140c12381Sstsp
1622c2498839Sstsp #define MAX_RXDMA_PER_PDEV 2
1623c2498839Sstsp
1624c2498839Sstsp struct qwx_pdev_dp {
1625c2498839Sstsp uint32_t mac_id;
1626c2498839Sstsp uint32_t mon_dest_ring_stuck_cnt;
1627c2498839Sstsp #if 0
1628c2498839Sstsp atomic_t num_tx_pending;
1629c2498839Sstsp wait_queue_head_t tx_empty_waitq;
1630c2498839Sstsp #endif
1631c2498839Sstsp struct dp_rxdma_ring rx_refill_buf_ring;
1632c2498839Sstsp struct dp_srng rx_mac_buf_ring[MAX_RXDMA_PER_PDEV];
1633c2498839Sstsp struct dp_srng rxdma_err_dst_ring[MAX_RXDMA_PER_PDEV];
1634c2498839Sstsp struct dp_srng rxdma_mon_dst_ring;
1635c2498839Sstsp struct dp_srng rxdma_mon_desc_ring;
1636c2498839Sstsp struct dp_rxdma_ring rxdma_mon_buf_ring;
1637c2498839Sstsp struct dp_rxdma_ring rx_mon_status_refill_ring[MAX_RXDMA_PER_PDEV];
1638c2498839Sstsp #if 0
1639c2498839Sstsp struct ieee80211_rx_status rx_status;
1640c2498839Sstsp #endif
164140c12381Sstsp struct qwx_mon_data mon_data;
1642c2498839Sstsp };
1643c2498839Sstsp
164488b28198Sstsp struct qwx_txmgmt_queue {
164588b28198Sstsp struct qwx_tx_data data[8];
164688b28198Sstsp int cur;
164788b28198Sstsp int queued;
164888b28198Sstsp };
164988b28198Sstsp
1650c2498839Sstsp struct qwx_vif {
1651c2498839Sstsp uint32_t vdev_id;
1652c2498839Sstsp enum wmi_vdev_type vdev_type;
1653c2498839Sstsp enum wmi_vdev_subtype vdev_subtype;
1654c2498839Sstsp uint32_t beacon_interval;
1655c2498839Sstsp uint32_t dtim_period;
1656c2498839Sstsp uint16_t ast_hash;
1657c2498839Sstsp uint16_t ast_idx;
1658c2498839Sstsp uint16_t tcl_metadata;
1659c2498839Sstsp uint8_t hal_addr_search_flags;
1660c2498839Sstsp uint8_t search_type;
1661c2498839Sstsp
1662c2498839Sstsp struct qwx_softc *sc;
1663c2498839Sstsp
1664c2498839Sstsp uint16_t tx_seq_no;
1665c2498839Sstsp struct wmi_wmm_params_all_arg wmm_params;
1666c2498839Sstsp TAILQ_ENTRY(qwx_vif) entry;
1667c2498839Sstsp union {
1668c2498839Sstsp struct {
1669c2498839Sstsp uint32_t uapsd;
1670c2498839Sstsp } sta;
1671c2498839Sstsp struct {
1672c2498839Sstsp /* 127 stations; wmi limit */
1673c2498839Sstsp uint8_t tim_bitmap[16];
1674c2498839Sstsp uint8_t tim_len;
1675c2498839Sstsp uint32_t ssid_len;
1676c2498839Sstsp uint8_t ssid[IEEE80211_NWID_LEN];
1677c2498839Sstsp bool hidden_ssid;
1678c2498839Sstsp /* P2P_IE with NoA attribute for P2P_GO case */
1679c2498839Sstsp uint32_t noa_len;
1680c2498839Sstsp uint8_t *noa_data;
1681c2498839Sstsp } ap;
1682c2498839Sstsp } u;
1683c2498839Sstsp
1684c2498839Sstsp bool is_started;
1685c2498839Sstsp bool is_up;
1686c2498839Sstsp bool ftm_responder;
1687c2498839Sstsp bool spectral_enabled;
1688c2498839Sstsp bool ps;
1689c2498839Sstsp uint32_t aid;
1690c2498839Sstsp uint8_t bssid[IEEE80211_ADDR_LEN];
1691c2498839Sstsp #if 0
1692c2498839Sstsp struct cfg80211_bitrate_mask bitrate_mask;
1693c2498839Sstsp struct delayed_work connection_loss_work;
1694c2498839Sstsp #endif
1695c2498839Sstsp int num_legacy_stations;
1696c2498839Sstsp int rtscts_prot_mode;
1697c2498839Sstsp int txpower;
1698c2498839Sstsp bool rsnie_present;
1699c2498839Sstsp bool wpaie_present;
1700c2498839Sstsp bool bcca_zero_sent;
1701c2498839Sstsp bool do_not_send_tmpl;
1702bb5c86a2Sstsp struct ieee80211_channel *chan;
1703c2498839Sstsp #if 0
1704c2498839Sstsp struct ath11k_arp_ns_offload arp_ns_offload;
1705c2498839Sstsp struct ath11k_rekey_data rekey_data;
1706c2498839Sstsp #endif
1707c2498839Sstsp #ifdef CONFIG_ATH11K_DEBUGFS
1708c2498839Sstsp struct dentry *debugfs_twt;
1709c2498839Sstsp #endif /* CONFIG_ATH11K_DEBUGFS */
171088b28198Sstsp
171188b28198Sstsp struct qwx_txmgmt_queue txmgmt;
1712c2498839Sstsp };
1713c2498839Sstsp
1714c2498839Sstsp TAILQ_HEAD(qwx_vif_list, qwx_vif);
1715c2498839Sstsp
1716c2498839Sstsp struct qwx_survey_info {
1717c2498839Sstsp int8_t noise;
1718c2498839Sstsp uint64_t time;
1719c2498839Sstsp uint64_t time_busy;
1720c2498839Sstsp };
1721c2498839Sstsp
17225b068355Sstsp #define ATH11K_IRQ_NUM_MAX 52
17235b068355Sstsp #define ATH11K_EXT_IRQ_NUM_MAX 16
17245b068355Sstsp
17255b068355Sstsp struct qwx_ext_irq_grp {
17265b068355Sstsp struct qwx_softc *sc;
17275b068355Sstsp uint32_t irqs[ATH11K_EXT_IRQ_NUM_MAX];
17285b068355Sstsp uint32_t num_irq;
17295b068355Sstsp uint32_t grp_id;
17305b068355Sstsp uint64_t timestamp;
17315b068355Sstsp #if 0
17325b068355Sstsp bool napi_enabled;
17335b068355Sstsp struct napi_struct napi;
17345b068355Sstsp struct net_device napi_ndev;
17355b068355Sstsp #endif
17365b068355Sstsp };
17375b068355Sstsp
17387748e020Sstsp struct qwx_rx_radiotap_header {
17397748e020Sstsp struct ieee80211_radiotap_header wr_ihdr;
17407748e020Sstsp } __packed;
17417748e020Sstsp
17427748e020Sstsp #define IWX_RX_RADIOTAP_PRESENT 0 /* TODO add more information */
17437748e020Sstsp
17447748e020Sstsp struct qwx_tx_radiotap_header {
17457748e020Sstsp struct ieee80211_radiotap_header wt_ihdr;
17467748e020Sstsp } __packed;
17477748e020Sstsp
17487748e020Sstsp #define IWX_TX_RADIOTAP_PRESENT 0 /* TODO add more information */
17497748e020Sstsp
1750*fc05d6c1Sstsp struct qwx_setkey_task_arg {
1751*fc05d6c1Sstsp struct ieee80211_node *ni;
1752*fc05d6c1Sstsp struct ieee80211_key *k;
1753*fc05d6c1Sstsp int cmd;
1754*fc05d6c1Sstsp #define QWX_ADD_KEY 1
1755*fc05d6c1Sstsp #define QWX_DEL_KEY 2
1756*fc05d6c1Sstsp };
1757*fc05d6c1Sstsp
1758c2498839Sstsp struct qwx_softc {
1759c2498839Sstsp struct device sc_dev;
1760c2498839Sstsp struct ieee80211com sc_ic;
1761c2498839Sstsp uint32_t sc_flags;
176251dce3f8Skettenis int sc_node;
1763c2498839Sstsp
1764c2498839Sstsp int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int);
1765c2498839Sstsp
1766c2498839Sstsp struct rwlock ioctl_rwl;
1767c2498839Sstsp
1768c2498839Sstsp struct task init_task; /* NB: not reference-counted */
1769c2498839Sstsp struct refcnt task_refs;
1770c2498839Sstsp struct taskq *sc_nswq;
1771c2498839Sstsp struct task newstate_task;
1772c2498839Sstsp enum ieee80211_state ns_nstate;
1773c2498839Sstsp int ns_arg;
1774c2498839Sstsp
1775*fc05d6c1Sstsp /* Task for setting encryption keys and its arguments. */
1776*fc05d6c1Sstsp struct task setkey_task;
1777*fc05d6c1Sstsp /*
1778*fc05d6c1Sstsp * At present we need to process at most two keys at once:
1779*fc05d6c1Sstsp * Our pairwise key and a group key.
1780*fc05d6c1Sstsp * When hostap mode is implemented this array needs to grow or
1781*fc05d6c1Sstsp * it might become a bottleneck for associations that occur at
1782*fc05d6c1Sstsp * roughly the same time.
1783*fc05d6c1Sstsp */
1784*fc05d6c1Sstsp struct qwx_setkey_task_arg setkey_arg[2];
1785*fc05d6c1Sstsp int setkey_cur;
1786*fc05d6c1Sstsp int setkey_tail;
1787*fc05d6c1Sstsp int setkey_nkeys;
1788*fc05d6c1Sstsp
1789*fc05d6c1Sstsp int install_key_done;
1790*fc05d6c1Sstsp int install_key_status;
1791*fc05d6c1Sstsp
1792c2498839Sstsp enum ath11k_11d_state state_11d;
1793c2498839Sstsp int completed_11d_scan;
1794c2498839Sstsp uint32_t vdev_id_11d_scan;
1795c2498839Sstsp struct {
1796c2498839Sstsp int started;
1797c2498839Sstsp int completed;
1798c2498839Sstsp int on_channel;
1799c2498839Sstsp struct timeout timeout;
1800c2498839Sstsp enum ath11k_scan_state state;
1801c2498839Sstsp int vdev_id;
1802c2498839Sstsp int is_roc;
1803c2498839Sstsp int roc_freq;
1804c2498839Sstsp int roc_notify;
1805c2498839Sstsp } scan;
1806c2498839Sstsp u_int scan_channel;
1807c2498839Sstsp struct qwx_survey_info survey[IEEE80211_CHAN_MAX];
1808c2498839Sstsp
1809c2498839Sstsp int attached;
18109132454eSstsp struct {
18119132454eSstsp u_char *data;
18129132454eSstsp size_t size;
18139132454eSstsp } fw_img[4];
18149132454eSstsp #define QWX_FW_AMSS 0
18159132454eSstsp #define QWX_FW_BOARD 1
18169132454eSstsp #define QWX_FW_M3 2
18179132454eSstsp #define QWX_FW_REGDB 3
1818c2498839Sstsp
1819c2498839Sstsp int sc_tx_timer;
182088b28198Sstsp uint32_t qfullmsk;
1821ac51647dSstsp #define QWX_MGMT_QUEUE_ID 31
1822c2498839Sstsp
1823c2498839Sstsp bus_addr_t mem;
1824c2498839Sstsp struct ath11k_hw_params hw_params;
1825c2498839Sstsp struct ath11k_hal hal;
1826c2498839Sstsp struct qwx_ce ce;
1827c2498839Sstsp struct qwx_dp dp;
1828c2498839Sstsp struct qwx_pdev_dp pdev_dp;
1829c2498839Sstsp struct qwx_wmi_base wmi;
1830c2498839Sstsp struct qwx_htc htc;
1831c2498839Sstsp
1832c2498839Sstsp enum ath11k_firmware_mode fw_mode;
1833c2498839Sstsp enum ath11k_crypt_mode crypto_mode;
1834c2498839Sstsp enum ath11k_hw_txrx_mode frame_mode;
1835c2498839Sstsp
18365b068355Sstsp struct qwx_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX];
18375b068355Sstsp
1838c2498839Sstsp uint16_t qmi_txn_id;
1839c2498839Sstsp int qmi_cal_done;
1840c2498839Sstsp struct qwx_qmi_ce_cfg qmi_ce_cfg;
1841c2498839Sstsp struct qwx_qmi_target_info qmi_target;
1842c2498839Sstsp struct ath11k_targ_cap target_caps;
1843c2498839Sstsp int num_radios;
1844c2498839Sstsp uint32_t cc_freq_hz;
1845c2498839Sstsp uint32_t cfg_tx_chainmask;
1846c2498839Sstsp uint32_t cfg_rx_chainmask;
1847c2498839Sstsp int num_tx_chains;
1848c2498839Sstsp int num_rx_chains;
1849c2498839Sstsp int num_created_vdevs;
1850c2498839Sstsp int num_started_vdevs;
1851c2498839Sstsp uint32_t allocated_vdev_map;
1852c2498839Sstsp uint32_t free_vdev_map;
1853c2498839Sstsp int num_peers;
1854bb5c86a2Sstsp int peer_mapped;
1855bb5c86a2Sstsp int peer_delete_done;
1856bb5c86a2Sstsp int vdev_setup_done;
185760465fd7Sstsp int peer_assoc_done;
1858c2498839Sstsp
1859c2498839Sstsp struct qwx_dbring_cap *db_caps;
1860c2498839Sstsp uint32_t num_db_cap;
1861c2498839Sstsp
1862c2498839Sstsp uint8_t mac_addr[IEEE80211_ADDR_LEN];
1863c2498839Sstsp int wmi_ready;
1864c2498839Sstsp uint32_t wlan_init_status;
1865c2498839Sstsp
1866c2498839Sstsp uint32_t pktlog_defs_checksum;
1867c2498839Sstsp
1868c2498839Sstsp struct qwx_vif_list vif_list;
1869c2498839Sstsp struct qwx_pdev pdevs[MAX_RADIOS];
1870c2498839Sstsp struct {
1871c2498839Sstsp enum WMI_HOST_WLAN_BAND supported_bands;
1872c2498839Sstsp uint32_t pdev_id;
1873c2498839Sstsp } target_pdev_ids[MAX_RADIOS];
1874c2498839Sstsp uint8_t target_pdev_count;
1875bb5c86a2Sstsp uint32_t pdevs_active;
1876c2498839Sstsp int pdevs_macaddr_valid;
1877c2498839Sstsp struct ath11k_hal_reg_capabilities_ext hal_reg_cap[MAX_RADIOS];
1878c2498839Sstsp
1879c2498839Sstsp struct {
1880c2498839Sstsp uint32_t service;
1881c2498839Sstsp uint32_t instance;
1882c2498839Sstsp uint32_t node;
1883c2498839Sstsp uint32_t port;
1884c2498839Sstsp } qrtr_server;
1885c2498839Sstsp
1886c2498839Sstsp struct qmi_response_type_v01 qmi_resp;
1887c2498839Sstsp
1888c2498839Sstsp struct qwx_dmamem *fwmem;
188933cf7d2bSstsp int expect_fwmem_req;
1890c2498839Sstsp int fwmem_ready;
1891c2498839Sstsp int fw_init_done;
1892c2498839Sstsp
1893c2498839Sstsp int ctl_resp;
1894c2498839Sstsp
1895c2498839Sstsp struct qwx_dmamem *m3_mem;
1896c2498839Sstsp
189759a2c127Sstsp struct timeout mon_reap_timer;
189859a2c127Sstsp #define ATH11K_MON_TIMER_INTERVAL 10
189959a2c127Sstsp
1900c2498839Sstsp /* Provided by attachment driver: */
1901c2498839Sstsp struct qwx_ops ops;
1902c2498839Sstsp bus_dma_tag_t sc_dmat;
1903c2498839Sstsp enum ath11k_hw_rev sc_hw_rev;
1904c2498839Sstsp struct qwx_device_id id;
1905c2498839Sstsp char sc_bus_str[4]; /* "pci" or "ahb" */
19065b068355Sstsp int num_msivec;
1907c2498839Sstsp uint32_t msi_addr_lo;
1908c2498839Sstsp uint32_t msi_addr_hi;
1909c2498839Sstsp uint32_t msi_data_start;
1910c2498839Sstsp const struct qwx_msi_config *msi_cfg;
19115b068355Sstsp uint32_t msi_ce_irqmask;
1912c2498839Sstsp
1913c2498839Sstsp struct qmi_wlanfw_request_mem_ind_msg_v01 *sc_req_mem_ind;
19147748e020Sstsp
19157748e020Sstsp caddr_t sc_drvbpf;
19167748e020Sstsp
19177748e020Sstsp union {
19187748e020Sstsp struct qwx_rx_radiotap_header th;
19197748e020Sstsp uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
19207748e020Sstsp } sc_rxtapu;
19217748e020Sstsp #define sc_rxtap sc_rxtapu.th
19227748e020Sstsp int sc_rxtap_len;
19237748e020Sstsp
19247748e020Sstsp union {
19257748e020Sstsp struct qwx_tx_radiotap_header th;
19267748e020Sstsp uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
19277748e020Sstsp } sc_txtapu;
19287748e020Sstsp #define sc_txtap sc_txtapu.th
19297748e020Sstsp int sc_txtap_len;
1930c2498839Sstsp };
1931c2498839Sstsp
19325b068355Sstsp int qwx_ce_intr(void *);
19335b068355Sstsp int qwx_ext_intr(void *);
19345b068355Sstsp int qwx_dp_service_srng(struct qwx_softc *, int);
1935c2498839Sstsp
1936c2498839Sstsp int qwx_init_hw_params(struct qwx_softc *);
1937c2498839Sstsp int qwx_attach(struct qwx_softc *);
1938c2498839Sstsp void qwx_detach(struct qwx_softc *);
1939de21b57dSstsp int qwx_activate(struct device *, int);
1940c2498839Sstsp
1941c2498839Sstsp void qwx_core_deinit(struct qwx_softc *);
1942c2498839Sstsp void qwx_ce_cleanup_pipes(struct qwx_softc *);
1943c2498839Sstsp
1944c2498839Sstsp int qwx_ioctl(struct ifnet *, u_long, caddr_t);
1945c2498839Sstsp void qwx_start(struct ifnet *);
1946c2498839Sstsp void qwx_watchdog(struct ifnet *);
1947c2498839Sstsp int qwx_media_change(struct ifnet *);
1948c2498839Sstsp void qwx_init_task(void *);
1949c2498839Sstsp int qwx_newstate(struct ieee80211com *, enum ieee80211_state, int);
1950c2498839Sstsp void qwx_newstate_task(void *);
1951c2498839Sstsp
1952bb5c86a2Sstsp struct ath11k_peer {
1953bb5c86a2Sstsp #if 0
1954bb5c86a2Sstsp struct list_head list;
1955bb5c86a2Sstsp struct ieee80211_sta *sta;
1956bb5c86a2Sstsp #endif
1957bb5c86a2Sstsp int vdev_id;
1958bb5c86a2Sstsp #if 0
1959bb5c86a2Sstsp u8 addr[ETH_ALEN];
1960bb5c86a2Sstsp #endif
1961bb5c86a2Sstsp int peer_id;
1962bb5c86a2Sstsp uint16_t ast_hash;
1963bb5c86a2Sstsp uint8_t pdev_id;
1964bb5c86a2Sstsp uint16_t hw_peer_id;
1965bb5c86a2Sstsp #if 0
1966bb5c86a2Sstsp /* protected by ab->data_lock */
1967bb5c86a2Sstsp struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
1968bb5c86a2Sstsp #endif
1969bb5c86a2Sstsp struct dp_rx_tid rx_tid[IEEE80211_NUM_TID + 1];
1970bb5c86a2Sstsp #if 0
1971bb5c86a2Sstsp /* peer id based rhashtable list pointer */
1972bb5c86a2Sstsp struct rhash_head rhash_id;
1973bb5c86a2Sstsp /* peer addr based rhashtable list pointer */
1974bb5c86a2Sstsp struct rhash_head rhash_addr;
1975bb5c86a2Sstsp
1976bb5c86a2Sstsp /* Info used in MMIC verification of
1977bb5c86a2Sstsp * RX fragments
1978bb5c86a2Sstsp */
1979bb5c86a2Sstsp struct crypto_shash *tfm_mmic;
1980bb5c86a2Sstsp u8 mcast_keyidx;
1981bb5c86a2Sstsp u8 ucast_keyidx;
1982bb5c86a2Sstsp u16 sec_type;
1983bb5c86a2Sstsp u16 sec_type_grp;
1984bb5c86a2Sstsp bool is_authorized;
1985bb5c86a2Sstsp bool dp_setup_done;
1986bb5c86a2Sstsp #endif
1987bb5c86a2Sstsp };
1988bb5c86a2Sstsp
1989c2498839Sstsp struct qwx_node {
1990c2498839Sstsp struct ieee80211_node ni;
1991bb5c86a2Sstsp struct ath11k_peer peer;
1992*fc05d6c1Sstsp unsigned int flags;
1993*fc05d6c1Sstsp #define QWX_NODE_FLAG_HAVE_PAIRWISE_KEY 0x01
1994*fc05d6c1Sstsp #define QWX_NODE_FLAG_HAVE_GROUP_KEY 0x02
1995c2498839Sstsp };
1996c2498839Sstsp
1997c2498839Sstsp struct ieee80211_node *qwx_node_alloc(struct ieee80211com *);
1998*fc05d6c1Sstsp int qwx_set_key(struct ieee80211com *, struct ieee80211_node *,
1999*fc05d6c1Sstsp struct ieee80211_key *);
2000*fc05d6c1Sstsp void qwx_delete_key(struct ieee80211com *, struct ieee80211_node *,
2001*fc05d6c1Sstsp struct ieee80211_key *);
2002c2498839Sstsp
2003c2498839Sstsp void qwx_qrtr_recv_msg(struct qwx_softc *, struct mbuf *);
2004c2498839Sstsp
2005c2498839Sstsp int qwx_hal_srng_init(struct qwx_softc *);
2006c2498839Sstsp
2007c2498839Sstsp int qwx_ce_alloc_pipes(struct qwx_softc *);
20085b068355Sstsp void qwx_ce_free_pipes(struct qwx_softc *);
2009c2498839Sstsp void qwx_ce_rx_post_buf(struct qwx_softc *);
2010c2498839Sstsp void qwx_ce_get_shadow_config(struct qwx_softc *, uint32_t **, uint32_t *);
2011c2498839Sstsp
2012c2498839Sstsp static inline unsigned int
qwx_roundup_pow_of_two(unsigned int i)2013c2498839Sstsp qwx_roundup_pow_of_two(unsigned int i)
2014c2498839Sstsp {
2015c2498839Sstsp return (powerof2(i) ? i : (1 << (fls(i) - 1)));
2016c2498839Sstsp }
2017c2498839Sstsp
2018c2498839Sstsp static inline unsigned int
qwx_ce_get_attr_flags(struct qwx_softc * sc,int ce_id)2019c2498839Sstsp qwx_ce_get_attr_flags(struct qwx_softc *sc, int ce_id)
2020c2498839Sstsp {
2021c2498839Sstsp KASSERT(ce_id < sc->hw_params.ce_count);
2022c2498839Sstsp return sc->hw_params.host_ce_config[ce_id].flags;
2023c2498839Sstsp }
2024bb5c86a2Sstsp
qwx_tid_to_ac(uint32_t tid)2025bb5c86a2Sstsp static inline enum ieee80211_edca_ac qwx_tid_to_ac(uint32_t tid)
2026bb5c86a2Sstsp {
2027bb5c86a2Sstsp return (((tid == 0) || (tid == 3)) ? EDCA_AC_BE :
2028bb5c86a2Sstsp ((tid == 1) || (tid == 2)) ? EDCA_AC_BK :
2029bb5c86a2Sstsp ((tid == 4) || (tid == 5)) ? EDCA_AC_VI :
2030bb5c86a2Sstsp EDCA_AC_VO);
2031bb5c86a2Sstsp }
2032