xref: /wlan-driver/qca-wifi-host-cmn/hif/inc/hif.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name #ifndef _HIF_H_
21*5113495bSYour Name #define _HIF_H_
22*5113495bSYour Name 
23*5113495bSYour Name #ifdef __cplusplus
24*5113495bSYour Name extern "C" {
25*5113495bSYour Name #endif /* __cplusplus */
26*5113495bSYour Name 
27*5113495bSYour Name /* Header files */
28*5113495bSYour Name #include <qdf_status.h>
29*5113495bSYour Name #include "qdf_ipa.h"
30*5113495bSYour Name #include "qdf_nbuf.h"
31*5113495bSYour Name #include "qdf_lro.h"
32*5113495bSYour Name #include "ol_if_athvar.h"
33*5113495bSYour Name #include <linux/platform_device.h>
34*5113495bSYour Name #ifdef HIF_PCI
35*5113495bSYour Name #include <linux/pci.h>
36*5113495bSYour Name #endif /* HIF_PCI */
37*5113495bSYour Name #ifdef HIF_USB
38*5113495bSYour Name #include <linux/usb.h>
39*5113495bSYour Name #endif /* HIF_USB */
40*5113495bSYour Name #ifdef IPA_OFFLOAD
41*5113495bSYour Name #include <linux/ipa.h>
42*5113495bSYour Name #endif
43*5113495bSYour Name #include "cfg_ucfg_api.h"
44*5113495bSYour Name #include "qdf_dev.h"
45*5113495bSYour Name #include <wlan_init_cfg.h>
46*5113495bSYour Name 
47*5113495bSYour Name #define ENABLE_MBOX_DUMMY_SPACE_FEATURE 1
48*5113495bSYour Name 
49*5113495bSYour Name typedef void __iomem *A_target_id_t;
50*5113495bSYour Name typedef void *hif_handle_t;
51*5113495bSYour Name 
52*5113495bSYour Name #if defined(HIF_IPCI) && defined(FEATURE_HAL_DELAYED_REG_WRITE)
53*5113495bSYour Name #define HIF_WORK_DRAIN_WAIT_CNT 50
54*5113495bSYour Name 
55*5113495bSYour Name #define HIF_EP_WAKE_RESET_WAIT_CNT 10
56*5113495bSYour Name #endif
57*5113495bSYour Name 
58*5113495bSYour Name #define HIF_TYPE_AR6002   2
59*5113495bSYour Name #define HIF_TYPE_AR6003   3
60*5113495bSYour Name #define HIF_TYPE_AR6004   5
61*5113495bSYour Name #define HIF_TYPE_AR9888   6
62*5113495bSYour Name #define HIF_TYPE_AR6320   7
63*5113495bSYour Name #define HIF_TYPE_AR6320V2 8
64*5113495bSYour Name /* For attaching Peregrine 2.0 board host_reg_tbl only */
65*5113495bSYour Name #define HIF_TYPE_AR9888V2 9
66*5113495bSYour Name #define HIF_TYPE_ADRASTEA 10
67*5113495bSYour Name #define HIF_TYPE_AR900B 11
68*5113495bSYour Name #define HIF_TYPE_QCA9984 12
69*5113495bSYour Name #define HIF_TYPE_QCA9888 14
70*5113495bSYour Name #define HIF_TYPE_QCA8074 15
71*5113495bSYour Name #define HIF_TYPE_QCA6290 16
72*5113495bSYour Name #define HIF_TYPE_QCN7605 17
73*5113495bSYour Name #define HIF_TYPE_QCA6390 18
74*5113495bSYour Name #define HIF_TYPE_QCA8074V2 19
75*5113495bSYour Name #define HIF_TYPE_QCA6018  20
76*5113495bSYour Name #define HIF_TYPE_QCN9000 21
77*5113495bSYour Name #define HIF_TYPE_QCA6490 22
78*5113495bSYour Name #define HIF_TYPE_QCA6750 23
79*5113495bSYour Name #define HIF_TYPE_QCA5018 24
80*5113495bSYour Name #define HIF_TYPE_QCN6122 25
81*5113495bSYour Name #define HIF_TYPE_KIWI 26
82*5113495bSYour Name #define HIF_TYPE_QCN9224 27
83*5113495bSYour Name #define HIF_TYPE_QCA9574 28
84*5113495bSYour Name #define HIF_TYPE_MANGO 29
85*5113495bSYour Name #define HIF_TYPE_QCA5332 30
86*5113495bSYour Name #define HIF_TYPE_QCN9160 31
87*5113495bSYour Name #define HIF_TYPE_PEACH 32
88*5113495bSYour Name #define HIF_TYPE_WCN6450 33
89*5113495bSYour Name #define HIF_TYPE_QCN6432 34
90*5113495bSYour Name 
91*5113495bSYour Name #define DMA_COHERENT_MASK_DEFAULT   37
92*5113495bSYour Name 
93*5113495bSYour Name #ifdef IPA_OFFLOAD
94*5113495bSYour Name #define DMA_COHERENT_MASK_BELOW_IPA_VER_3       32
95*5113495bSYour Name #endif
96*5113495bSYour Name 
97*5113495bSYour Name /* enum hif_ic_irq - enum defining integrated chip irq numbers
98*5113495bSYour Name  * defining irq nubers that can be used by external modules like datapath
99*5113495bSYour Name  */
100*5113495bSYour Name enum hif_ic_irq {
101*5113495bSYour Name 	host2wbm_desc_feed = 16,
102*5113495bSYour Name 	host2reo_re_injection,
103*5113495bSYour Name 	host2reo_command,
104*5113495bSYour Name 	host2rxdma_monitor_ring3,
105*5113495bSYour Name 	host2rxdma_monitor_ring2,
106*5113495bSYour Name 	host2rxdma_monitor_ring1,
107*5113495bSYour Name 	reo2host_exception,
108*5113495bSYour Name 	wbm2host_rx_release,
109*5113495bSYour Name 	reo2host_status,
110*5113495bSYour Name 	reo2host_destination_ring4,
111*5113495bSYour Name 	reo2host_destination_ring3,
112*5113495bSYour Name 	reo2host_destination_ring2,
113*5113495bSYour Name 	reo2host_destination_ring1,
114*5113495bSYour Name 	rxdma2host_monitor_destination_mac3,
115*5113495bSYour Name 	rxdma2host_monitor_destination_mac2,
116*5113495bSYour Name 	rxdma2host_monitor_destination_mac1,
117*5113495bSYour Name 	ppdu_end_interrupts_mac3,
118*5113495bSYour Name 	ppdu_end_interrupts_mac2,
119*5113495bSYour Name 	ppdu_end_interrupts_mac1,
120*5113495bSYour Name 	rxdma2host_monitor_status_ring_mac3,
121*5113495bSYour Name 	rxdma2host_monitor_status_ring_mac2,
122*5113495bSYour Name 	rxdma2host_monitor_status_ring_mac1,
123*5113495bSYour Name 	host2rxdma_host_buf_ring_mac3,
124*5113495bSYour Name 	host2rxdma_host_buf_ring_mac2,
125*5113495bSYour Name 	host2rxdma_host_buf_ring_mac1,
126*5113495bSYour Name 	rxdma2host_destination_ring_mac3,
127*5113495bSYour Name 	rxdma2host_destination_ring_mac2,
128*5113495bSYour Name 	rxdma2host_destination_ring_mac1,
129*5113495bSYour Name 	host2tcl_input_ring4,
130*5113495bSYour Name 	host2tcl_input_ring3,
131*5113495bSYour Name 	host2tcl_input_ring2,
132*5113495bSYour Name 	host2tcl_input_ring1,
133*5113495bSYour Name 	wbm2host_tx_completions_ring4,
134*5113495bSYour Name 	wbm2host_tx_completions_ring3,
135*5113495bSYour Name 	wbm2host_tx_completions_ring2,
136*5113495bSYour Name 	wbm2host_tx_completions_ring1,
137*5113495bSYour Name 	tcl2host_status_ring,
138*5113495bSYour Name 	txmon2host_monitor_destination_mac3,
139*5113495bSYour Name 	txmon2host_monitor_destination_mac2,
140*5113495bSYour Name 	txmon2host_monitor_destination_mac1,
141*5113495bSYour Name 	host2tx_monitor_ring1,
142*5113495bSYour Name };
143*5113495bSYour Name 
144*5113495bSYour Name #ifdef QCA_SUPPORT_LEGACY_INTERRUPTS
145*5113495bSYour Name enum hif_legacy_pci_irq {
146*5113495bSYour Name 	ce0,
147*5113495bSYour Name 	ce1,
148*5113495bSYour Name 	ce2,
149*5113495bSYour Name 	ce3,
150*5113495bSYour Name 	ce4,
151*5113495bSYour Name 	ce5,
152*5113495bSYour Name 	ce6,
153*5113495bSYour Name 	ce7,
154*5113495bSYour Name 	ce8,
155*5113495bSYour Name 	ce9,
156*5113495bSYour Name 	ce10,
157*5113495bSYour Name 	ce11,
158*5113495bSYour Name 	ce12,
159*5113495bSYour Name 	ce13,
160*5113495bSYour Name 	ce14,
161*5113495bSYour Name 	ce15,
162*5113495bSYour Name 	reo2sw8_intr2,
163*5113495bSYour Name 	reo2sw7_intr2,
164*5113495bSYour Name 	reo2sw6_intr2,
165*5113495bSYour Name 	reo2sw5_intr2,
166*5113495bSYour Name 	reo2sw4_intr2,
167*5113495bSYour Name 	reo2sw3_intr2,
168*5113495bSYour Name 	reo2sw2_intr2,
169*5113495bSYour Name 	reo2sw1_intr2,
170*5113495bSYour Name 	reo2sw0_intr2,
171*5113495bSYour Name 	reo2sw8_intr,
172*5113495bSYour Name 	reo2sw7_intr,
173*5113495bSYour Name 	reo2sw6_inrr,
174*5113495bSYour Name 	reo2sw5_intr,
175*5113495bSYour Name 	reo2sw4_intr,
176*5113495bSYour Name 	reo2sw3_intr,
177*5113495bSYour Name 	reo2sw2_intr,
178*5113495bSYour Name 	reo2sw1_intr,
179*5113495bSYour Name 	reo2sw0_intr,
180*5113495bSYour Name 	reo2status_intr2,
181*5113495bSYour Name 	reo_status,
182*5113495bSYour Name 	reo2rxdma_out_2,
183*5113495bSYour Name 	reo2rxdma_out_1,
184*5113495bSYour Name 	reo_cmd,
185*5113495bSYour Name 	sw2reo6,
186*5113495bSYour Name 	sw2reo5,
187*5113495bSYour Name 	sw2reo1,
188*5113495bSYour Name 	sw2reo,
189*5113495bSYour Name 	rxdma2reo_mlo_0_dst_ring1,
190*5113495bSYour Name 	rxdma2reo_mlo_0_dst_ring0,
191*5113495bSYour Name 	rxdma2reo_mlo_1_dst_ring1,
192*5113495bSYour Name 	rxdma2reo_mlo_1_dst_ring0,
193*5113495bSYour Name 	rxdma2reo_dst_ring1,
194*5113495bSYour Name 	rxdma2reo_dst_ring0,
195*5113495bSYour Name 	rxdma2sw_dst_ring1,
196*5113495bSYour Name 	rxdma2sw_dst_ring0,
197*5113495bSYour Name 	rxdma2release_dst_ring1,
198*5113495bSYour Name 	rxdma2release_dst_ring0,
199*5113495bSYour Name 	sw2rxdma_2_src_ring,
200*5113495bSYour Name 	sw2rxdma_1_src_ring,
201*5113495bSYour Name 	sw2rxdma_0,
202*5113495bSYour Name 	wbm2sw6_release2,
203*5113495bSYour Name 	wbm2sw5_release2,
204*5113495bSYour Name 	wbm2sw4_release2,
205*5113495bSYour Name 	wbm2sw3_release2,
206*5113495bSYour Name 	wbm2sw2_release2,
207*5113495bSYour Name 	wbm2sw1_release2,
208*5113495bSYour Name 	wbm2sw0_release2,
209*5113495bSYour Name 	wbm2sw6_release,
210*5113495bSYour Name 	wbm2sw5_release,
211*5113495bSYour Name 	wbm2sw4_release,
212*5113495bSYour Name 	wbm2sw3_release,
213*5113495bSYour Name 	wbm2sw2_release,
214*5113495bSYour Name 	wbm2sw1_release,
215*5113495bSYour Name 	wbm2sw0_release,
216*5113495bSYour Name 	wbm2sw_link,
217*5113495bSYour Name 	wbm_error_release,
218*5113495bSYour Name 	sw2txmon_src_ring,
219*5113495bSYour Name 	sw2rxmon_src_ring,
220*5113495bSYour Name 	txmon2sw_p1_intr1,
221*5113495bSYour Name 	txmon2sw_p1_intr0,
222*5113495bSYour Name 	txmon2sw_p0_dest1,
223*5113495bSYour Name 	txmon2sw_p0_dest0,
224*5113495bSYour Name 	rxmon2sw_p1_intr1,
225*5113495bSYour Name 	rxmon2sw_p1_intr0,
226*5113495bSYour Name 	rxmon2sw_p0_dest1,
227*5113495bSYour Name 	rxmon2sw_p0_dest0,
228*5113495bSYour Name 	sw_release,
229*5113495bSYour Name 	sw2tcl_credit2,
230*5113495bSYour Name 	sw2tcl_credit,
231*5113495bSYour Name 	sw2tcl4,
232*5113495bSYour Name 	sw2tcl5,
233*5113495bSYour Name 	sw2tcl3,
234*5113495bSYour Name 	sw2tcl2,
235*5113495bSYour Name 	sw2tcl1,
236*5113495bSYour Name 	sw2wbm1,
237*5113495bSYour Name 	misc_8,
238*5113495bSYour Name 	misc_7,
239*5113495bSYour Name 	misc_6,
240*5113495bSYour Name 	misc_5,
241*5113495bSYour Name 	misc_4,
242*5113495bSYour Name 	misc_3,
243*5113495bSYour Name 	misc_2,
244*5113495bSYour Name 	misc_1,
245*5113495bSYour Name 	misc_0,
246*5113495bSYour Name };
247*5113495bSYour Name #endif
248*5113495bSYour Name 
249*5113495bSYour Name struct CE_state;
250*5113495bSYour Name #ifdef QCA_WIFI_QCN9224
251*5113495bSYour Name #define CE_COUNT_MAX 16
252*5113495bSYour Name #else
253*5113495bSYour Name #define CE_COUNT_MAX 12
254*5113495bSYour Name #endif
255*5113495bSYour Name 
256*5113495bSYour Name #ifndef HIF_MAX_GROUP
257*5113495bSYour Name #define HIF_MAX_GROUP WLAN_CFG_INT_NUM_CONTEXTS
258*5113495bSYour Name #endif
259*5113495bSYour Name 
260*5113495bSYour Name #ifdef CONFIG_BERYLLIUM
261*5113495bSYour Name #define HIF_MAX_GRP_IRQ 25
262*5113495bSYour Name #else
263*5113495bSYour Name #define HIF_MAX_GRP_IRQ 16
264*5113495bSYour Name #endif
265*5113495bSYour Name 
266*5113495bSYour Name #ifndef NAPI_YIELD_BUDGET_BASED
267*5113495bSYour Name #ifndef QCA_NAPI_DEF_SCALE_BIN_SHIFT
268*5113495bSYour Name #define QCA_NAPI_DEF_SCALE_BIN_SHIFT   4
269*5113495bSYour Name #endif
270*5113495bSYour Name #else  /* NAPI_YIELD_BUDGET_BASED */
271*5113495bSYour Name #define QCA_NAPI_DEF_SCALE_BIN_SHIFT 2
272*5113495bSYour Name #endif /* NAPI_YIELD_BUDGET_BASED */
273*5113495bSYour Name 
274*5113495bSYour Name #define QCA_NAPI_BUDGET    64
275*5113495bSYour Name #define QCA_NAPI_DEF_SCALE  \
276*5113495bSYour Name 	(1 << QCA_NAPI_DEF_SCALE_BIN_SHIFT)
277*5113495bSYour Name 
278*5113495bSYour Name #define HIF_NAPI_MAX_RECEIVES (QCA_NAPI_BUDGET * QCA_NAPI_DEF_SCALE)
279*5113495bSYour Name /* NOTE: "napi->scale" can be changed,
280*5113495bSYour Name  * but this does not change the number of buckets
281*5113495bSYour Name  */
282*5113495bSYour Name #define QCA_NAPI_NUM_BUCKETS 4
283*5113495bSYour Name 
284*5113495bSYour Name /**
285*5113495bSYour Name  * struct qca_napi_stat - stats structure for execution contexts
286*5113495bSYour Name  * @napi_schedules: number of times the schedule function is called
287*5113495bSYour Name  * @napi_polls: number of times the execution context runs
288*5113495bSYour Name  * @napi_completes: number of times that the generating interrupt is re-enabled
289*5113495bSYour Name  * @napi_workdone: cumulative of all work done reported by handler
290*5113495bSYour Name  * @cpu_corrected: incremented when execution context runs on a different core
291*5113495bSYour Name  *			than the one that its irq is affined to.
292*5113495bSYour Name  * @napi_budget_uses: histogram of work done per execution run
293*5113495bSYour Name  * @time_limit_reached: count of yields due to time limit thresholds
294*5113495bSYour Name  * @rxpkt_thresh_reached: count of yields due to a work limit
295*5113495bSYour Name  * @napi_max_poll_time:
296*5113495bSYour Name  * @poll_time_buckets: histogram of poll times for the napi
297*5113495bSYour Name  *
298*5113495bSYour Name  */
299*5113495bSYour Name struct qca_napi_stat {
300*5113495bSYour Name 	uint32_t napi_schedules;
301*5113495bSYour Name 	uint32_t napi_polls;
302*5113495bSYour Name 	uint32_t napi_completes;
303*5113495bSYour Name 	uint32_t napi_workdone;
304*5113495bSYour Name 	uint32_t cpu_corrected;
305*5113495bSYour Name 	uint32_t napi_budget_uses[QCA_NAPI_NUM_BUCKETS];
306*5113495bSYour Name 	uint32_t time_limit_reached;
307*5113495bSYour Name 	uint32_t rxpkt_thresh_reached;
308*5113495bSYour Name 	unsigned long long napi_max_poll_time;
309*5113495bSYour Name #ifdef WLAN_FEATURE_RX_SOFTIRQ_TIME_LIMIT
310*5113495bSYour Name 	uint32_t poll_time_buckets[QCA_NAPI_NUM_BUCKETS];
311*5113495bSYour Name #endif
312*5113495bSYour Name };
313*5113495bSYour Name 
314*5113495bSYour Name /*Number of buckets for latency*/
315*5113495bSYour Name #define HIF_SCHED_LATENCY_BUCKETS 8
316*5113495bSYour Name 
317*5113495bSYour Name /*Buckets for latency between 0 to 2 ms*/
318*5113495bSYour Name #define HIF_SCHED_LATENCY_BUCKET_0_2 2
319*5113495bSYour Name /*Buckets for latency between 3 to 10 ms*/
320*5113495bSYour Name #define HIF_SCHED_LATENCY_BUCKET_3_10 10
321*5113495bSYour Name /*Buckets for latency between 11 to 20 ms*/
322*5113495bSYour Name #define HIF_SCHED_LATENCY_BUCKET_11_20 20
323*5113495bSYour Name /*Buckets for latency between 21 to 50 ms*/
324*5113495bSYour Name #define HIF_SCHED_LATENCY_BUCKET_21_50 50
325*5113495bSYour Name /*Buckets for latency between 50 to 100 ms*/
326*5113495bSYour Name #define HIF_SCHED_LATENCY_BUCKET_51_100 100
327*5113495bSYour Name /*Buckets for latency between 100 to 250 ms*/
328*5113495bSYour Name #define HIF_SCHED_LATENCY_BUCKET_101_250 250
329*5113495bSYour Name /*Buckets for latency between 250 to 500 ms*/
330*5113495bSYour Name #define HIF_SCHED_LATENCY_BUCKET_251_500 500
331*5113495bSYour Name 
332*5113495bSYour Name /**
333*5113495bSYour Name  * struct qca_napi_info - per NAPI instance data structure
334*5113495bSYour Name  * @netdev: dummy net_dev
335*5113495bSYour Name  * @hif_ctx:
336*5113495bSYour Name  * @napi:
337*5113495bSYour Name  * @scale:
338*5113495bSYour Name  * @id:
339*5113495bSYour Name  * @cpu:
340*5113495bSYour Name  * @irq:
341*5113495bSYour Name  * @cpumask:
342*5113495bSYour Name  * @stats:
343*5113495bSYour Name  * @offld_flush_cb:
344*5113495bSYour Name  * @rx_thread_napi:
345*5113495bSYour Name  * @rx_thread_netdev:
346*5113495bSYour Name  * @lro_ctx:
347*5113495bSYour Name  * @poll_start_time: napi poll service start time
348*5113495bSYour Name  * @sched_latency_stats: napi schedule latency stats
349*5113495bSYour Name  * @tstamp: napi schedule start timestamp
350*5113495bSYour Name  *
351*5113495bSYour Name  * This data structure holds stuff per NAPI instance.
352*5113495bSYour Name  * Note that, in the current implementation, though scale is
353*5113495bSYour Name  * an instance variable, it is set to the same value for all
354*5113495bSYour Name  * instances.
355*5113495bSYour Name  */
356*5113495bSYour Name struct qca_napi_info {
357*5113495bSYour Name 	struct net_device    netdev; /* dummy net_dev */
358*5113495bSYour Name 	void                 *hif_ctx;
359*5113495bSYour Name 	struct napi_struct   napi;
360*5113495bSYour Name 	uint8_t              scale;   /* currently same on all instances */
361*5113495bSYour Name 	uint8_t              id;
362*5113495bSYour Name 	uint8_t              cpu;
363*5113495bSYour Name 	int                  irq;
364*5113495bSYour Name 	cpumask_t            cpumask;
365*5113495bSYour Name 	struct qca_napi_stat stats[NR_CPUS];
366*5113495bSYour Name #ifdef RECEIVE_OFFLOAD
367*5113495bSYour Name 	/* will only be present for data rx CE's */
368*5113495bSYour Name 	void (*offld_flush_cb)(void *);
369*5113495bSYour Name 	struct napi_struct   rx_thread_napi;
370*5113495bSYour Name 	struct net_device    rx_thread_netdev;
371*5113495bSYour Name #endif /* RECEIVE_OFFLOAD */
372*5113495bSYour Name 	qdf_lro_ctx_t        lro_ctx;
373*5113495bSYour Name #ifdef WLAN_FEATURE_RX_SOFTIRQ_TIME_LIMIT
374*5113495bSYour Name 	unsigned long long poll_start_time;
375*5113495bSYour Name #endif
376*5113495bSYour Name #ifdef HIF_LATENCY_PROFILE_ENABLE
377*5113495bSYour Name 	uint64_t sched_latency_stats[HIF_SCHED_LATENCY_BUCKETS];
378*5113495bSYour Name 	uint64_t tstamp;
379*5113495bSYour Name #endif
380*5113495bSYour Name };
381*5113495bSYour Name 
382*5113495bSYour Name enum qca_napi_tput_state {
383*5113495bSYour Name 	QCA_NAPI_TPUT_UNINITIALIZED,
384*5113495bSYour Name 	QCA_NAPI_TPUT_LO,
385*5113495bSYour Name 	QCA_NAPI_TPUT_HI
386*5113495bSYour Name };
387*5113495bSYour Name enum qca_napi_cpu_state {
388*5113495bSYour Name 	QCA_NAPI_CPU_UNINITIALIZED,
389*5113495bSYour Name 	QCA_NAPI_CPU_DOWN,
390*5113495bSYour Name 	QCA_NAPI_CPU_UP };
391*5113495bSYour Name 
392*5113495bSYour Name /**
393*5113495bSYour Name  * struct qca_napi_cpu - an entry of the napi cpu table
394*5113495bSYour Name  * @state:
395*5113495bSYour Name  * @core_id:     physical core id of the core
396*5113495bSYour Name  * @cluster_id:  cluster this core belongs to
397*5113495bSYour Name  * @core_mask:   mask to match all core of this cluster
398*5113495bSYour Name  * @thread_mask: mask for this core within the cluster
399*5113495bSYour Name  * @max_freq:    maximum clock this core can be clocked at
400*5113495bSYour Name  *               same for all cpus of the same core.
401*5113495bSYour Name  * @napis:       bitmap of napi instances on this core
402*5113495bSYour Name  * @execs:       bitmap of execution contexts on this core
403*5113495bSYour Name  * @cluster_nxt: chain to link cores within the same cluster
404*5113495bSYour Name  *
405*5113495bSYour Name  * This structure represents a single entry in the napi cpu
406*5113495bSYour Name  * table. The table is part of struct qca_napi_data.
407*5113495bSYour Name  * This table is initialized by the init function, called while
408*5113495bSYour Name  * the first napi instance is being created, updated by hotplug
409*5113495bSYour Name  * notifier and when cpu affinity decisions are made (by throughput
410*5113495bSYour Name  * detection), and deleted when the last napi instance is removed.
411*5113495bSYour Name  */
412*5113495bSYour Name struct qca_napi_cpu {
413*5113495bSYour Name 	enum qca_napi_cpu_state state;
414*5113495bSYour Name 	int			core_id;
415*5113495bSYour Name 	int			cluster_id;
416*5113495bSYour Name 	cpumask_t		core_mask;
417*5113495bSYour Name 	cpumask_t		thread_mask;
418*5113495bSYour Name 	unsigned int		max_freq;
419*5113495bSYour Name 	uint32_t		napis;
420*5113495bSYour Name 	uint32_t		execs;
421*5113495bSYour Name 	int			cluster_nxt;  /* index, not pointer */
422*5113495bSYour Name };
423*5113495bSYour Name 
424*5113495bSYour Name /**
425*5113495bSYour Name  * struct qca_napi_data - collection of napi data for a single hif context
426*5113495bSYour Name  * @hif_softc: pointer to the hif context
427*5113495bSYour Name  * @lock: spinlock used in the event state machine
428*5113495bSYour Name  * @state: state variable used in the napi stat machine
429*5113495bSYour Name  * @ce_map: bit map indicating which ce's have napis running
430*5113495bSYour Name  * @exec_map: bit map of instantiated exec contexts
431*5113495bSYour Name  * @user_cpu_affin_mask: CPU affinity mask from INI config.
432*5113495bSYour Name  * @napis:
433*5113495bSYour Name  * @napi_cpu: cpu info for irq affinity
434*5113495bSYour Name  * @lilcl_head:
435*5113495bSYour Name  * @bigcl_head:
436*5113495bSYour Name  * @napi_mode: irq affinity & clock voting mode
437*5113495bSYour Name  * @cpuhp_handler: CPU hotplug event registration handle
438*5113495bSYour Name  * @flags:
439*5113495bSYour Name  */
440*5113495bSYour Name struct qca_napi_data {
441*5113495bSYour Name 	struct               hif_softc *hif_softc;
442*5113495bSYour Name 	qdf_spinlock_t       lock;
443*5113495bSYour Name 	uint32_t             state;
444*5113495bSYour Name 
445*5113495bSYour Name 	/* bitmap of created/registered NAPI instances, indexed by pipe_id,
446*5113495bSYour Name 	 * not used by clients (clients use an id returned by create)
447*5113495bSYour Name 	 */
448*5113495bSYour Name 	uint32_t             ce_map;
449*5113495bSYour Name 	uint32_t             exec_map;
450*5113495bSYour Name 	uint32_t             user_cpu_affin_mask;
451*5113495bSYour Name 	struct qca_napi_info *napis[CE_COUNT_MAX];
452*5113495bSYour Name 	struct qca_napi_cpu  napi_cpu[NR_CPUS];
453*5113495bSYour Name 	int                  lilcl_head, bigcl_head;
454*5113495bSYour Name 	enum qca_napi_tput_state napi_mode;
455*5113495bSYour Name 	struct qdf_cpuhp_handler *cpuhp_handler;
456*5113495bSYour Name 	uint8_t              flags;
457*5113495bSYour Name };
458*5113495bSYour Name 
459*5113495bSYour Name /**
460*5113495bSYour Name  * struct hif_config_info - Place Holder for HIF configuration
461*5113495bSYour Name  * @enable_self_recovery: Self Recovery
462*5113495bSYour Name  * @enable_runtime_pm: Enable Runtime PM
463*5113495bSYour Name  * @runtime_pm_delay: Runtime PM Delay
464*5113495bSYour Name  * @rx_softirq_max_yield_duration_ns: Max Yield time duration for RX Softirq
465*5113495bSYour Name  * @enable_ce_dp_irq_affine: Enable affinity for CE DP IRQs
466*5113495bSYour Name  *
467*5113495bSYour Name  * Structure for holding HIF ini parameters.
468*5113495bSYour Name  */
469*5113495bSYour Name struct hif_config_info {
470*5113495bSYour Name 	bool enable_self_recovery;
471*5113495bSYour Name #ifdef FEATURE_RUNTIME_PM
472*5113495bSYour Name 	uint8_t enable_runtime_pm;
473*5113495bSYour Name 	u_int32_t runtime_pm_delay;
474*5113495bSYour Name #endif
475*5113495bSYour Name 	uint64_t rx_softirq_max_yield_duration_ns;
476*5113495bSYour Name #ifdef FEATURE_ENABLE_CE_DP_IRQ_AFFINE
477*5113495bSYour Name 	bool enable_ce_dp_irq_affine;
478*5113495bSYour Name #endif
479*5113495bSYour Name };
480*5113495bSYour Name 
481*5113495bSYour Name /**
482*5113495bSYour Name  * struct hif_target_info - Target Information
483*5113495bSYour Name  * @target_version: Target Version
484*5113495bSYour Name  * @target_type: Target Type
485*5113495bSYour Name  * @target_revision: Target Revision
486*5113495bSYour Name  * @soc_version: SOC Version
487*5113495bSYour Name  * @hw_name: pointer to hardware name
488*5113495bSYour Name  *
489*5113495bSYour Name  * Structure to hold target information.
490*5113495bSYour Name  */
491*5113495bSYour Name struct hif_target_info {
492*5113495bSYour Name 	uint32_t target_version;
493*5113495bSYour Name 	uint32_t target_type;
494*5113495bSYour Name 	uint32_t target_revision;
495*5113495bSYour Name 	uint32_t soc_version;
496*5113495bSYour Name 	char *hw_name;
497*5113495bSYour Name };
498*5113495bSYour Name 
499*5113495bSYour Name struct hif_opaque_softc {
500*5113495bSYour Name };
501*5113495bSYour Name 
502*5113495bSYour Name /**
503*5113495bSYour Name  * struct hif_ce_ring_info - CE ring information
504*5113495bSYour Name  * @ring_id: ring id
505*5113495bSYour Name  * @ring_dir: ring direction
506*5113495bSYour Name  * @num_entries: number of entries in ring
507*5113495bSYour Name  * @entry_size: ring entry size
508*5113495bSYour Name  * @ring_base_paddr: srng base physical address
509*5113495bSYour Name  * @hp_paddr: head pointer physical address
510*5113495bSYour Name  * @tp_paddr: tail pointer physical address
511*5113495bSYour Name  */
512*5113495bSYour Name struct hif_ce_ring_info {
513*5113495bSYour Name 	uint8_t ring_id;
514*5113495bSYour Name 	uint8_t ring_dir;
515*5113495bSYour Name 	uint32_t num_entries;
516*5113495bSYour Name 	uint32_t entry_size;
517*5113495bSYour Name 	uint64_t ring_base_paddr;
518*5113495bSYour Name 	uint64_t hp_paddr;
519*5113495bSYour Name 	uint64_t tp_paddr;
520*5113495bSYour Name };
521*5113495bSYour Name 
522*5113495bSYour Name /**
523*5113495bSYour Name  * struct hif_direct_link_ce_info - Direct Link CE information
524*5113495bSYour Name  * @ce_id: CE ide
525*5113495bSYour Name  * @pipe_dir: Pipe direction
526*5113495bSYour Name  * @ring_info: ring information
527*5113495bSYour Name  */
528*5113495bSYour Name struct hif_direct_link_ce_info {
529*5113495bSYour Name 	uint8_t ce_id;
530*5113495bSYour Name 	uint8_t pipe_dir;
531*5113495bSYour Name 	struct hif_ce_ring_info ring_info;
532*5113495bSYour Name };
533*5113495bSYour Name 
534*5113495bSYour Name /**
535*5113495bSYour Name  * enum hif_event_type - Type of DP events to be recorded
536*5113495bSYour Name  * @HIF_EVENT_IRQ_TRIGGER: IRQ trigger event
537*5113495bSYour Name  * @HIF_EVENT_TIMER_ENTRY: Monitor Timer entry event
538*5113495bSYour Name  * @HIF_EVENT_TIMER_EXIT: Monitor Timer exit event
539*5113495bSYour Name  * @HIF_EVENT_BH_SCHED: NAPI POLL scheduled event
540*5113495bSYour Name  * @HIF_EVENT_SRNG_ACCESS_START: hal ring access start event
541*5113495bSYour Name  * @HIF_EVENT_SRNG_ACCESS_END: hal ring access end event
542*5113495bSYour Name  * @HIF_EVENT_BH_COMPLETE: NAPI POLL completion event
543*5113495bSYour Name  * @HIF_EVENT_BH_FORCE_BREAK: NAPI POLL force break event
544*5113495bSYour Name  * @HIF_EVENT_IRQ_DISABLE_EXPIRED: IRQ disable expired event
545*5113495bSYour Name  */
546*5113495bSYour Name enum hif_event_type {
547*5113495bSYour Name 	HIF_EVENT_IRQ_TRIGGER,
548*5113495bSYour Name 	HIF_EVENT_TIMER_ENTRY,
549*5113495bSYour Name 	HIF_EVENT_TIMER_EXIT,
550*5113495bSYour Name 	HIF_EVENT_BH_SCHED,
551*5113495bSYour Name 	HIF_EVENT_SRNG_ACCESS_START,
552*5113495bSYour Name 	HIF_EVENT_SRNG_ACCESS_END,
553*5113495bSYour Name 	HIF_EVENT_BH_COMPLETE,
554*5113495bSYour Name 	HIF_EVENT_BH_FORCE_BREAK,
555*5113495bSYour Name 	HIF_EVENT_IRQ_DISABLE_EXPIRED,
556*5113495bSYour Name 	/* Do check hif_hist_skip_event_record when adding new events */
557*5113495bSYour Name };
558*5113495bSYour Name 
559*5113495bSYour Name /**
560*5113495bSYour Name  * enum hif_system_pm_state - System PM state
561*5113495bSYour Name  * @HIF_SYSTEM_PM_STATE_ON: System in active state
562*5113495bSYour Name  * @HIF_SYSTEM_PM_STATE_BUS_RESUMING: bus resume in progress as part of
563*5113495bSYour Name  *  system resume
564*5113495bSYour Name  * @HIF_SYSTEM_PM_STATE_BUS_SUSPENDING: bus suspend in progress as part of
565*5113495bSYour Name  *  system suspend
566*5113495bSYour Name  * @HIF_SYSTEM_PM_STATE_BUS_SUSPENDED: bus suspended as part of system suspend
567*5113495bSYour Name  */
568*5113495bSYour Name enum hif_system_pm_state {
569*5113495bSYour Name 	HIF_SYSTEM_PM_STATE_ON,
570*5113495bSYour Name 	HIF_SYSTEM_PM_STATE_BUS_RESUMING,
571*5113495bSYour Name 	HIF_SYSTEM_PM_STATE_BUS_SUSPENDING,
572*5113495bSYour Name 	HIF_SYSTEM_PM_STATE_BUS_SUSPENDED,
573*5113495bSYour Name };
574*5113495bSYour Name 
575*5113495bSYour Name #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
576*5113495bSYour Name #define HIF_NUM_INT_CONTEXTS		HIF_MAX_GROUP
577*5113495bSYour Name 
578*5113495bSYour Name #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
579*5113495bSYour Name /* HIF_EVENT_HIST_MAX should always be power of 2 */
580*5113495bSYour Name #define HIF_EVENT_HIST_MAX		512
581*5113495bSYour Name 
582*5113495bSYour Name #define HIF_EVENT_HIST_ENABLE_MASK	0xFF
583*5113495bSYour Name 
hif_get_log_timestamp(void)584*5113495bSYour Name static inline uint64_t hif_get_log_timestamp(void)
585*5113495bSYour Name {
586*5113495bSYour Name 	return qdf_get_log_timestamp();
587*5113495bSYour Name }
588*5113495bSYour Name 
589*5113495bSYour Name #else
590*5113495bSYour Name 
591*5113495bSYour Name #define HIF_EVENT_HIST_MAX		32
592*5113495bSYour Name /* Enable IRQ TRIGGER, NAPI SCHEDULE, SRNG ACCESS START */
593*5113495bSYour Name #define HIF_EVENT_HIST_ENABLE_MASK	0x19
594*5113495bSYour Name 
hif_get_log_timestamp(void)595*5113495bSYour Name static inline uint64_t hif_get_log_timestamp(void)
596*5113495bSYour Name {
597*5113495bSYour Name 	return qdf_sched_clock();
598*5113495bSYour Name }
599*5113495bSYour Name 
600*5113495bSYour Name #endif
601*5113495bSYour Name 
602*5113495bSYour Name /**
603*5113495bSYour Name  * struct hif_event_record - an entry of the DP event history
604*5113495bSYour Name  * @hal_ring_id: ring id for which event is recorded
605*5113495bSYour Name  * @hp: head pointer of the ring (may not be applicable for all events)
606*5113495bSYour Name  * @tp: tail pointer of the ring (may not be applicable for all events)
607*5113495bSYour Name  * @cpu_id: cpu id on which the event occurred
608*5113495bSYour Name  * @timestamp: timestamp when event occurred
609*5113495bSYour Name  * @type: type of the event
610*5113495bSYour Name  *
611*5113495bSYour Name  * This structure represents the information stored for every datapath
612*5113495bSYour Name  * event which is logged in the history.
613*5113495bSYour Name  */
614*5113495bSYour Name struct hif_event_record {
615*5113495bSYour Name 	uint8_t hal_ring_id;
616*5113495bSYour Name 	uint32_t hp;
617*5113495bSYour Name 	uint32_t tp;
618*5113495bSYour Name 	int cpu_id;
619*5113495bSYour Name 	uint64_t timestamp;
620*5113495bSYour Name 	enum hif_event_type type;
621*5113495bSYour Name };
622*5113495bSYour Name 
623*5113495bSYour Name /**
624*5113495bSYour Name  * struct hif_event_misc - history related misc info
625*5113495bSYour Name  * @last_irq_index: last irq event index in history
626*5113495bSYour Name  * @last_irq_ts: last irq timestamp
627*5113495bSYour Name  */
628*5113495bSYour Name struct hif_event_misc {
629*5113495bSYour Name 	int32_t last_irq_index;
630*5113495bSYour Name 	uint64_t last_irq_ts;
631*5113495bSYour Name };
632*5113495bSYour Name 
633*5113495bSYour Name #ifdef WLAN_FEATURE_AFFINITY_MGR
634*5113495bSYour Name /**
635*5113495bSYour Name  * struct hif_cpu_affinity - CPU affinity mask info for IRQ
636*5113495bSYour Name  *
637*5113495bSYour Name  * @current_irq_mask: Current CPU mask set for IRQ
638*5113495bSYour Name  * @wlan_requested_mask: CPU mask requested by WLAN
639*5113495bSYour Name  * @walt_taken_mask: Current CPU taken by Audio
640*5113495bSYour Name  * @last_updated: Last time IRQ CPU affinity was updated
641*5113495bSYour Name  * @last_affined_away: Last time when IRQ was affined away
642*5113495bSYour Name  * @update_requested: IRQ affinity hint set requested by WLAN
643*5113495bSYour Name  * @irq: IRQ number
644*5113495bSYour Name  */
645*5113495bSYour Name struct hif_cpu_affinity {
646*5113495bSYour Name 	qdf_cpu_mask current_irq_mask;
647*5113495bSYour Name 	qdf_cpu_mask wlan_requested_mask;
648*5113495bSYour Name 	qdf_cpu_mask walt_taken_mask;
649*5113495bSYour Name 	uint64_t last_updated;
650*5113495bSYour Name 	uint64_t last_affined_away;
651*5113495bSYour Name 	bool update_requested;
652*5113495bSYour Name 	int irq;
653*5113495bSYour Name };
654*5113495bSYour Name #endif
655*5113495bSYour Name 
656*5113495bSYour Name /**
657*5113495bSYour Name  * struct hif_event_history - history for one interrupt group
658*5113495bSYour Name  * @index: index to store new event
659*5113495bSYour Name  * @misc: event misc information
660*5113495bSYour Name  * @event: event entry
661*5113495bSYour Name  *
662*5113495bSYour Name  * This structure represents the datapath history for one
663*5113495bSYour Name  * interrupt group.
664*5113495bSYour Name  */
665*5113495bSYour Name struct hif_event_history {
666*5113495bSYour Name 	qdf_atomic_t index;
667*5113495bSYour Name 	struct hif_event_misc misc;
668*5113495bSYour Name 	struct hif_event_record event[HIF_EVENT_HIST_MAX];
669*5113495bSYour Name };
670*5113495bSYour Name 
671*5113495bSYour Name /**
672*5113495bSYour Name  * hif_desc_history_log_register() - Register hif_event_desc_history buffers
673*5113495bSYour Name  *
674*5113495bSYour Name  * Return: None
675*5113495bSYour Name  */
676*5113495bSYour Name void hif_desc_history_log_register(void);
677*5113495bSYour Name 
678*5113495bSYour Name /**
679*5113495bSYour Name  * hif_desc_history_log_unregister() - Unregister hif_event_desc_history
680*5113495bSYour Name  *
681*5113495bSYour Name  * Return: None
682*5113495bSYour Name  */
683*5113495bSYour Name void hif_desc_history_log_unregister(void);
684*5113495bSYour Name 
685*5113495bSYour Name /**
686*5113495bSYour Name  * hif_hist_record_event() - Record one datapath event in history
687*5113495bSYour Name  * @hif_ctx: HIF opaque context
688*5113495bSYour Name  * @event: DP event entry
689*5113495bSYour Name  * @intr_grp_id: interrupt group ID registered with hif
690*5113495bSYour Name  *
691*5113495bSYour Name  * Return: None
692*5113495bSYour Name  */
693*5113495bSYour Name void hif_hist_record_event(struct hif_opaque_softc *hif_ctx,
694*5113495bSYour Name 			   struct hif_event_record *event,
695*5113495bSYour Name 			   uint8_t intr_grp_id);
696*5113495bSYour Name 
697*5113495bSYour Name /**
698*5113495bSYour Name  * hif_event_history_init() - Initialize SRNG event history buffers
699*5113495bSYour Name  * @hif_ctx: HIF opaque context
700*5113495bSYour Name  * @id: context group ID for which history is recorded
701*5113495bSYour Name  *
702*5113495bSYour Name  * Returns: None
703*5113495bSYour Name  */
704*5113495bSYour Name void hif_event_history_init(struct hif_opaque_softc *hif_ctx, uint8_t id);
705*5113495bSYour Name 
706*5113495bSYour Name /**
707*5113495bSYour Name  * hif_event_history_deinit() - De-initialize SRNG event history buffers
708*5113495bSYour Name  * @hif_ctx: HIF opaque context
709*5113495bSYour Name  * @id: context group ID for which history is recorded
710*5113495bSYour Name  *
711*5113495bSYour Name  * Returns: None
712*5113495bSYour Name  */
713*5113495bSYour Name void hif_event_history_deinit(struct hif_opaque_softc *hif_ctx, uint8_t id);
714*5113495bSYour Name 
715*5113495bSYour Name /**
716*5113495bSYour Name  * hif_record_event() - Wrapper function to form and record DP event
717*5113495bSYour Name  * @hif_ctx: HIF opaque context
718*5113495bSYour Name  * @intr_grp_id: interrupt group ID registered with hif
719*5113495bSYour Name  * @hal_ring_id: ring id for which event is recorded
720*5113495bSYour Name  * @hp: head pointer index of the srng
721*5113495bSYour Name  * @tp: tail pointer index of the srng
722*5113495bSYour Name  * @type: type of the event to be logged in history
723*5113495bSYour Name  *
724*5113495bSYour Name  * Return: None
725*5113495bSYour Name  */
hif_record_event(struct hif_opaque_softc * hif_ctx,uint8_t intr_grp_id,uint8_t hal_ring_id,uint32_t hp,uint32_t tp,enum hif_event_type type)726*5113495bSYour Name static inline void hif_record_event(struct hif_opaque_softc *hif_ctx,
727*5113495bSYour Name 				    uint8_t intr_grp_id,
728*5113495bSYour Name 				    uint8_t hal_ring_id,
729*5113495bSYour Name 				    uint32_t hp,
730*5113495bSYour Name 				    uint32_t tp,
731*5113495bSYour Name 				    enum hif_event_type type)
732*5113495bSYour Name {
733*5113495bSYour Name 	struct hif_event_record event;
734*5113495bSYour Name 
735*5113495bSYour Name 	event.hal_ring_id = hal_ring_id;
736*5113495bSYour Name 	event.hp = hp;
737*5113495bSYour Name 	event.tp = tp;
738*5113495bSYour Name 	event.type = type;
739*5113495bSYour Name 
740*5113495bSYour Name 	hif_hist_record_event(hif_ctx, &event, intr_grp_id);
741*5113495bSYour Name 
742*5113495bSYour Name 	return;
743*5113495bSYour Name }
744*5113495bSYour Name 
745*5113495bSYour Name #else
hif_desc_history_log_register(void)746*5113495bSYour Name static inline void hif_desc_history_log_register(void)
747*5113495bSYour Name {
748*5113495bSYour Name }
749*5113495bSYour Name 
hif_desc_history_log_unregister(void)750*5113495bSYour Name static inline void hif_desc_history_log_unregister(void)
751*5113495bSYour Name {
752*5113495bSYour Name }
753*5113495bSYour Name 
hif_record_event(struct hif_opaque_softc * hif_ctx,uint8_t intr_grp_id,uint8_t hal_ring_id,uint32_t hp,uint32_t tp,enum hif_event_type type)754*5113495bSYour Name static inline void hif_record_event(struct hif_opaque_softc *hif_ctx,
755*5113495bSYour Name 				    uint8_t intr_grp_id,
756*5113495bSYour Name 				    uint8_t hal_ring_id,
757*5113495bSYour Name 				    uint32_t hp,
758*5113495bSYour Name 				    uint32_t tp,
759*5113495bSYour Name 				    enum hif_event_type type)
760*5113495bSYour Name {
761*5113495bSYour Name }
762*5113495bSYour Name 
hif_event_history_init(struct hif_opaque_softc * hif_ctx,uint8_t id)763*5113495bSYour Name static inline void hif_event_history_init(struct hif_opaque_softc *hif_ctx,
764*5113495bSYour Name 					  uint8_t id)
765*5113495bSYour Name {
766*5113495bSYour Name }
767*5113495bSYour Name 
hif_event_history_deinit(struct hif_opaque_softc * hif_ctx,uint8_t id)768*5113495bSYour Name static inline void hif_event_history_deinit(struct hif_opaque_softc *hif_ctx,
769*5113495bSYour Name 					    uint8_t id)
770*5113495bSYour Name {
771*5113495bSYour Name }
772*5113495bSYour Name #endif /* WLAN_FEATURE_DP_EVENT_HISTORY */
773*5113495bSYour Name 
774*5113495bSYour Name void hif_display_ctrl_traffic_pipes_state(struct hif_opaque_softc *hif_ctx);
775*5113495bSYour Name 
776*5113495bSYour Name #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
777*5113495bSYour Name void hif_display_latest_desc_hist(struct hif_opaque_softc *hif_ctx);
778*5113495bSYour Name #else
779*5113495bSYour Name static
hif_display_latest_desc_hist(struct hif_opaque_softc * hif_ctx)780*5113495bSYour Name inline void hif_display_latest_desc_hist(struct hif_opaque_softc *hif_ctx) {}
781*5113495bSYour Name #endif
782*5113495bSYour Name 
783*5113495bSYour Name /**
784*5113495bSYour Name  * enum HIF_DEVICE_POWER_CHANGE_TYPE: Device Power change type
785*5113495bSYour Name  *
786*5113495bSYour Name  * @HIF_DEVICE_POWER_UP:   HIF layer should power up interface and/or module
787*5113495bSYour Name  * @HIF_DEVICE_POWER_DOWN: HIF layer should initiate bus-specific measures to
788*5113495bSYour Name  *                         minimize power
789*5113495bSYour Name  * @HIF_DEVICE_POWER_CUT:  HIF layer should initiate bus-specific AND/OR
790*5113495bSYour Name  *                         platform-specific measures to completely power-off
791*5113495bSYour Name  *                         the module and associated hardware (i.e. cut power
792*5113495bSYour Name  *                         supplies)
793*5113495bSYour Name  */
794*5113495bSYour Name enum HIF_DEVICE_POWER_CHANGE_TYPE {
795*5113495bSYour Name 	HIF_DEVICE_POWER_UP,
796*5113495bSYour Name 	HIF_DEVICE_POWER_DOWN,
797*5113495bSYour Name 	HIF_DEVICE_POWER_CUT
798*5113495bSYour Name };
799*5113495bSYour Name 
800*5113495bSYour Name /**
801*5113495bSYour Name  * enum hif_enable_type: what triggered the enabling of hif
802*5113495bSYour Name  *
803*5113495bSYour Name  * @HIF_ENABLE_TYPE_PROBE: probe triggered enable
804*5113495bSYour Name  * @HIF_ENABLE_TYPE_REINIT: reinit triggered enable
805*5113495bSYour Name  * @HIF_ENABLE_TYPE_MAX: Max value
806*5113495bSYour Name  */
807*5113495bSYour Name enum hif_enable_type {
808*5113495bSYour Name 	HIF_ENABLE_TYPE_PROBE,
809*5113495bSYour Name 	HIF_ENABLE_TYPE_REINIT,
810*5113495bSYour Name 	HIF_ENABLE_TYPE_MAX
811*5113495bSYour Name };
812*5113495bSYour Name 
813*5113495bSYour Name /**
814*5113495bSYour Name  * enum hif_disable_type: what triggered the disabling of hif
815*5113495bSYour Name  *
816*5113495bSYour Name  * @HIF_DISABLE_TYPE_PROBE_ERROR: probe error triggered disable
817*5113495bSYour Name  * @HIF_DISABLE_TYPE_REINIT_ERROR: reinit error triggered disable
818*5113495bSYour Name  * @HIF_DISABLE_TYPE_REMOVE: remove triggered disable
819*5113495bSYour Name  * @HIF_DISABLE_TYPE_SHUTDOWN: shutdown triggered disable
820*5113495bSYour Name  * @HIF_DISABLE_TYPE_MAX: Max value
821*5113495bSYour Name  */
822*5113495bSYour Name enum hif_disable_type {
823*5113495bSYour Name 	HIF_DISABLE_TYPE_PROBE_ERROR,
824*5113495bSYour Name 	HIF_DISABLE_TYPE_REINIT_ERROR,
825*5113495bSYour Name 	HIF_DISABLE_TYPE_REMOVE,
826*5113495bSYour Name 	HIF_DISABLE_TYPE_SHUTDOWN,
827*5113495bSYour Name 	HIF_DISABLE_TYPE_MAX
828*5113495bSYour Name };
829*5113495bSYour Name 
830*5113495bSYour Name /**
831*5113495bSYour Name  * enum hif_device_config_opcode: configure mode
832*5113495bSYour Name  *
833*5113495bSYour Name  * @HIF_DEVICE_POWER_STATE: device power state
834*5113495bSYour Name  * @HIF_DEVICE_GET_BLOCK_SIZE: get block size
835*5113495bSYour Name  * @HIF_DEVICE_GET_FIFO_ADDR: get block address
836*5113495bSYour Name  * @HIF_DEVICE_GET_PENDING_EVENTS_FUNC: get pending events functions
837*5113495bSYour Name  * @HIF_DEVICE_GET_IRQ_PROC_MODE: get irq proc mode
838*5113495bSYour Name  * @HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC: receive event function
839*5113495bSYour Name  * @HIF_DEVICE_POWER_STATE_CHANGE: change power state
840*5113495bSYour Name  * @HIF_DEVICE_GET_IRQ_YIELD_PARAMS: get yield params
841*5113495bSYour Name  * @HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT: configure scatter request
842*5113495bSYour Name  * @HIF_DEVICE_GET_OS_DEVICE: get OS device
843*5113495bSYour Name  * @HIF_DEVICE_DEBUG_BUS_STATE: debug bus state
844*5113495bSYour Name  * @HIF_BMI_DONE: bmi done
845*5113495bSYour Name  * @HIF_DEVICE_SET_TARGET_TYPE: set target type
846*5113495bSYour Name  * @HIF_DEVICE_SET_HTC_CONTEXT: set htc context
847*5113495bSYour Name  * @HIF_DEVICE_GET_HTC_CONTEXT: get htc context
848*5113495bSYour Name  */
849*5113495bSYour Name enum hif_device_config_opcode {
850*5113495bSYour Name 	HIF_DEVICE_POWER_STATE = 0,
851*5113495bSYour Name 	HIF_DEVICE_GET_BLOCK_SIZE,
852*5113495bSYour Name 	HIF_DEVICE_GET_FIFO_ADDR,
853*5113495bSYour Name 	HIF_DEVICE_GET_PENDING_EVENTS_FUNC,
854*5113495bSYour Name 	HIF_DEVICE_GET_IRQ_PROC_MODE,
855*5113495bSYour Name 	HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC,
856*5113495bSYour Name 	HIF_DEVICE_POWER_STATE_CHANGE,
857*5113495bSYour Name 	HIF_DEVICE_GET_IRQ_YIELD_PARAMS,
858*5113495bSYour Name 	HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT,
859*5113495bSYour Name 	HIF_DEVICE_GET_OS_DEVICE,
860*5113495bSYour Name 	HIF_DEVICE_DEBUG_BUS_STATE,
861*5113495bSYour Name 	HIF_BMI_DONE,
862*5113495bSYour Name 	HIF_DEVICE_SET_TARGET_TYPE,
863*5113495bSYour Name 	HIF_DEVICE_SET_HTC_CONTEXT,
864*5113495bSYour Name 	HIF_DEVICE_GET_HTC_CONTEXT,
865*5113495bSYour Name };
866*5113495bSYour Name 
867*5113495bSYour Name #ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG
868*5113495bSYour Name struct HID_ACCESS_LOG {
869*5113495bSYour Name 	uint32_t seqnum;
870*5113495bSYour Name 	bool is_write;
871*5113495bSYour Name 	void *addr;
872*5113495bSYour Name 	uint32_t value;
873*5113495bSYour Name };
874*5113495bSYour Name #endif
875*5113495bSYour Name 
876*5113495bSYour Name void hif_reg_write(struct hif_opaque_softc *hif_ctx, uint32_t offset,
877*5113495bSYour Name 		uint32_t value);
878*5113495bSYour Name uint32_t hif_reg_read(struct hif_opaque_softc *hif_ctx, uint32_t offset);
879*5113495bSYour Name 
880*5113495bSYour Name #define HIF_MAX_DEVICES                 1
881*5113495bSYour Name /**
882*5113495bSYour Name  * struct htc_callbacks - Structure for HTC Callbacks methods
883*5113495bSYour Name  * @context:             context to pass to the @dsr_handler
884*5113495bSYour Name  *                       note : @rw_compl_handler is provided the context
885*5113495bSYour Name  *                       passed to hif_read_write
886*5113495bSYour Name  * @rw_compl_handler:    Read / write completion handler
887*5113495bSYour Name  * @dsr_handler:         DSR Handler
888*5113495bSYour Name  */
889*5113495bSYour Name struct htc_callbacks {
890*5113495bSYour Name 	void *context;
891*5113495bSYour Name 	QDF_STATUS(*rw_compl_handler)(void *rw_ctx, QDF_STATUS status);
892*5113495bSYour Name 	QDF_STATUS(*dsr_handler)(void *context);
893*5113495bSYour Name };
894*5113495bSYour Name 
895*5113495bSYour Name /**
896*5113495bSYour Name  * struct hif_driver_state_callbacks - Callbacks for HIF to query Driver state
897*5113495bSYour Name  * @context: Private data context
898*5113495bSYour Name  * @set_recovery_in_progress: To Set Driver state for recovery in progress
899*5113495bSYour Name  * @is_recovery_in_progress: Query if driver state is recovery in progress
900*5113495bSYour Name  * @is_load_unload_in_progress: Query if driver state Load/Unload in Progress
901*5113495bSYour Name  * @is_driver_unloading: Query if driver is unloading.
902*5113495bSYour Name  * @is_target_ready:
903*5113495bSYour Name  * @get_bandwidth_level: Query current bandwidth level for the driver
904*5113495bSYour Name  * @prealloc_get_consistent_mem_unaligned: get prealloc unaligned consistent mem
905*5113495bSYour Name  * @prealloc_put_consistent_mem_unaligned: put unaligned consistent mem to pool
906*5113495bSYour Name  * @prealloc_get_multi_pages: get prealloc multi pages memory
907*5113495bSYour Name  * @prealloc_put_multi_pages: put prealloc multi pages memory back to pool
908*5113495bSYour Name  * This Structure provides callback pointer for HIF to query hdd for driver
909*5113495bSYour Name  * states.
910*5113495bSYour Name  */
911*5113495bSYour Name struct hif_driver_state_callbacks {
912*5113495bSYour Name 	void *context;
913*5113495bSYour Name 	void (*set_recovery_in_progress)(void *context, uint8_t val);
914*5113495bSYour Name 	bool (*is_recovery_in_progress)(void *context);
915*5113495bSYour Name 	bool (*is_load_unload_in_progress)(void *context);
916*5113495bSYour Name 	bool (*is_driver_unloading)(void *context);
917*5113495bSYour Name 	bool (*is_target_ready)(void *context);
918*5113495bSYour Name 	int (*get_bandwidth_level)(void *context);
919*5113495bSYour Name 	void *(*prealloc_get_consistent_mem_unaligned)(qdf_size_t size,
920*5113495bSYour Name 						       qdf_dma_addr_t *paddr,
921*5113495bSYour Name 						       uint32_t ring_type);
922*5113495bSYour Name 	void (*prealloc_put_consistent_mem_unaligned)(void *vaddr);
923*5113495bSYour Name 	void (*prealloc_get_multi_pages)(uint32_t desc_type,
924*5113495bSYour Name 					 qdf_size_t elem_size,
925*5113495bSYour Name 					 uint16_t elem_num,
926*5113495bSYour Name 					 struct qdf_mem_multi_page_t *pages,
927*5113495bSYour Name 					 bool cacheable);
928*5113495bSYour Name 	void (*prealloc_put_multi_pages)(uint32_t desc_type,
929*5113495bSYour Name 					 struct qdf_mem_multi_page_t *pages);
930*5113495bSYour Name };
931*5113495bSYour Name 
932*5113495bSYour Name /* This API detaches the HTC layer from the HIF device */
933*5113495bSYour Name void hif_detach_htc(struct hif_opaque_softc *hif_ctx);
934*5113495bSYour Name 
935*5113495bSYour Name /****************************************************************/
936*5113495bSYour Name /* BMI and Diag window abstraction                              */
937*5113495bSYour Name /****************************************************************/
938*5113495bSYour Name 
939*5113495bSYour Name #define HIF_BMI_EXCHANGE_NO_TIMEOUT  ((uint32_t)(0))
940*5113495bSYour Name 
941*5113495bSYour Name #define DIAG_TRANSFER_LIMIT 2048U   /* maximum number of bytes that can be
942*5113495bSYour Name 				     * handled atomically by
943*5113495bSYour Name 				     * DiagRead/DiagWrite
944*5113495bSYour Name 				     */
945*5113495bSYour Name 
946*5113495bSYour Name #ifdef WLAN_FEATURE_BMI
947*5113495bSYour Name /*
948*5113495bSYour Name  * API to handle HIF-specific BMI message exchanges, this API is synchronous
949*5113495bSYour Name  * and only allowed to be called from a context that can block (sleep)
950*5113495bSYour Name  */
951*5113495bSYour Name QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *hif_ctx,
952*5113495bSYour Name 				qdf_dma_addr_t cmd, qdf_dma_addr_t rsp,
953*5113495bSYour Name 				uint8_t *pSendMessage, uint32_t Length,
954*5113495bSYour Name 				uint8_t *pResponseMessage,
955*5113495bSYour Name 				uint32_t *pResponseLength, uint32_t TimeoutMS);
956*5113495bSYour Name void hif_register_bmi_callbacks(struct hif_opaque_softc *hif_ctx);
957*5113495bSYour Name bool hif_needs_bmi(struct hif_opaque_softc *hif_ctx);
958*5113495bSYour Name #else /* WLAN_FEATURE_BMI */
959*5113495bSYour Name static inline void
hif_register_bmi_callbacks(struct hif_opaque_softc * hif_ctx)960*5113495bSYour Name hif_register_bmi_callbacks(struct hif_opaque_softc *hif_ctx)
961*5113495bSYour Name {
962*5113495bSYour Name }
963*5113495bSYour Name 
964*5113495bSYour Name static inline bool
hif_needs_bmi(struct hif_opaque_softc * hif_ctx)965*5113495bSYour Name hif_needs_bmi(struct hif_opaque_softc *hif_ctx)
966*5113495bSYour Name {
967*5113495bSYour Name 	return false;
968*5113495bSYour Name }
969*5113495bSYour Name #endif /* WLAN_FEATURE_BMI */
970*5113495bSYour Name 
971*5113495bSYour Name #ifdef HIF_CPU_CLEAR_AFFINITY
972*5113495bSYour Name /**
973*5113495bSYour Name  * hif_config_irq_clear_cpu_affinity() - Remove cpu affinity of IRQ
974*5113495bSYour Name  * @scn: HIF handle
975*5113495bSYour Name  * @intr_ctxt_id: interrupt group index
976*5113495bSYour Name  * @cpu: CPU core to clear
977*5113495bSYour Name  *
978*5113495bSYour Name  * Return: None
979*5113495bSYour Name  */
980*5113495bSYour Name void hif_config_irq_clear_cpu_affinity(struct hif_opaque_softc *scn,
981*5113495bSYour Name 				       int intr_ctxt_id, int cpu);
982*5113495bSYour Name #else
983*5113495bSYour Name static inline
hif_config_irq_clear_cpu_affinity(struct hif_opaque_softc * scn,int intr_ctxt_id,int cpu)984*5113495bSYour Name void hif_config_irq_clear_cpu_affinity(struct hif_opaque_softc *scn,
985*5113495bSYour Name 				       int intr_ctxt_id, int cpu)
986*5113495bSYour Name {
987*5113495bSYour Name }
988*5113495bSYour Name #endif
989*5113495bSYour Name 
990*5113495bSYour Name /*
991*5113495bSYour Name  * APIs to handle HIF specific diagnostic read accesses. These APIs are
992*5113495bSYour Name  * synchronous and only allowed to be called from a context that
993*5113495bSYour Name  * can block (sleep). They are not high performance APIs.
994*5113495bSYour Name  *
995*5113495bSYour Name  * hif_diag_read_access reads a 4 Byte aligned/length value from a
996*5113495bSYour Name  * Target register or memory word.
997*5113495bSYour Name  *
998*5113495bSYour Name  * hif_diag_read_mem reads an arbitrary length of arbitrarily aligned memory.
999*5113495bSYour Name  */
1000*5113495bSYour Name QDF_STATUS hif_diag_read_access(struct hif_opaque_softc *hif_ctx,
1001*5113495bSYour Name 				uint32_t address, uint32_t *data);
1002*5113495bSYour Name QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *hif_ctx, uint32_t address,
1003*5113495bSYour Name 		      uint8_t *data, int nbytes);
1004*5113495bSYour Name void hif_dump_target_memory(struct hif_opaque_softc *hif_ctx,
1005*5113495bSYour Name 			void *ramdump_base, uint32_t address, uint32_t size);
1006*5113495bSYour Name /*
1007*5113495bSYour Name  * APIs to handle HIF specific diagnostic write accesses. These APIs are
1008*5113495bSYour Name  * synchronous and only allowed to be called from a context that
1009*5113495bSYour Name  * can block (sleep).
1010*5113495bSYour Name  * They are not high performance APIs.
1011*5113495bSYour Name  *
1012*5113495bSYour Name  * hif_diag_write_access writes a 4 Byte aligned/length value to a
1013*5113495bSYour Name  * Target register or memory word.
1014*5113495bSYour Name  *
1015*5113495bSYour Name  * hif_diag_write_mem writes an arbitrary length of arbitrarily aligned memory.
1016*5113495bSYour Name  */
1017*5113495bSYour Name QDF_STATUS hif_diag_write_access(struct hif_opaque_softc *hif_ctx,
1018*5113495bSYour Name 				 uint32_t address, uint32_t data);
1019*5113495bSYour Name QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *hif_ctx,
1020*5113495bSYour Name 			uint32_t address, uint8_t *data, int nbytes);
1021*5113495bSYour Name 
1022*5113495bSYour Name typedef void (*fastpath_msg_handler)(void *, qdf_nbuf_t *, uint32_t);
1023*5113495bSYour Name 
1024*5113495bSYour Name void hif_enable_polled_mode(struct hif_opaque_softc *hif_ctx);
1025*5113495bSYour Name bool hif_is_polled_mode_enabled(struct hif_opaque_softc *hif_ctx);
1026*5113495bSYour Name 
1027*5113495bSYour Name /*
1028*5113495bSYour Name  * Set the FASTPATH_mode_on flag in sc, for use by data path
1029*5113495bSYour Name  */
1030*5113495bSYour Name #ifdef WLAN_FEATURE_FASTPATH
1031*5113495bSYour Name void hif_enable_fastpath(struct hif_opaque_softc *hif_ctx);
1032*5113495bSYour Name bool hif_is_fastpath_mode_enabled(struct hif_opaque_softc *hif_ctx);
1033*5113495bSYour Name void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret);
1034*5113495bSYour Name 
1035*5113495bSYour Name /**
1036*5113495bSYour Name  * hif_ce_fastpath_cb_register() - Register callback for fastpath msg handler
1037*5113495bSYour Name  * @hif_ctx: HIF opaque context
1038*5113495bSYour Name  * @handler: Callback function
1039*5113495bSYour Name  * @context: handle for callback function
1040*5113495bSYour Name  *
1041*5113495bSYour Name  * Return: QDF_STATUS_SUCCESS on success or QDF_STATUS_E_FAILURE
1042*5113495bSYour Name  */
1043*5113495bSYour Name QDF_STATUS hif_ce_fastpath_cb_register(
1044*5113495bSYour Name 		struct hif_opaque_softc *hif_ctx,
1045*5113495bSYour Name 		fastpath_msg_handler handler, void *context);
1046*5113495bSYour Name #else
hif_ce_fastpath_cb_register(struct hif_opaque_softc * hif_ctx,fastpath_msg_handler handler,void * context)1047*5113495bSYour Name static inline QDF_STATUS hif_ce_fastpath_cb_register(
1048*5113495bSYour Name 		struct hif_opaque_softc *hif_ctx,
1049*5113495bSYour Name 		fastpath_msg_handler handler, void *context)
1050*5113495bSYour Name {
1051*5113495bSYour Name 	return QDF_STATUS_E_FAILURE;
1052*5113495bSYour Name }
1053*5113495bSYour Name 
hif_get_ce_handle(struct hif_opaque_softc * hif_ctx,int ret)1054*5113495bSYour Name static inline void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret)
1055*5113495bSYour Name {
1056*5113495bSYour Name 	return NULL;
1057*5113495bSYour Name }
1058*5113495bSYour Name 
1059*5113495bSYour Name #endif
1060*5113495bSYour Name 
1061*5113495bSYour Name /*
1062*5113495bSYour Name  * Enable/disable CDC max performance workaround
1063*5113495bSYour Name  * For max-performance set this to 0
1064*5113495bSYour Name  * To allow SoC to enter sleep set this to 1
1065*5113495bSYour Name  */
1066*5113495bSYour Name #define CONFIG_DISABLE_CDC_MAX_PERF_WAR 0
1067*5113495bSYour Name 
1068*5113495bSYour Name void hif_ipa_get_ce_resource(struct hif_opaque_softc *hif_ctx,
1069*5113495bSYour Name 			     qdf_shared_mem_t **ce_sr,
1070*5113495bSYour Name 			     uint32_t *ce_sr_ring_size,
1071*5113495bSYour Name 			     qdf_dma_addr_t *ce_reg_paddr);
1072*5113495bSYour Name 
1073*5113495bSYour Name /**
1074*5113495bSYour Name  * struct hif_msg_callbacks - List of callbacks - filled in by HTC.
1075*5113495bSYour Name  * @Context: context meaningful to HTC
1076*5113495bSYour Name  * @txCompletionHandler:
1077*5113495bSYour Name  * @rxCompletionHandler:
1078*5113495bSYour Name  * @txResourceAvailHandler:
1079*5113495bSYour Name  * @fwEventHandler:
1080*5113495bSYour Name  * @update_bundle_stats:
1081*5113495bSYour Name  */
1082*5113495bSYour Name struct hif_msg_callbacks {
1083*5113495bSYour Name 	void *Context;
1084*5113495bSYour Name 	/**< context meaningful to HTC */
1085*5113495bSYour Name 	QDF_STATUS (*txCompletionHandler)(void *Context, qdf_nbuf_t wbuf,
1086*5113495bSYour Name 					uint32_t transferID,
1087*5113495bSYour Name 					uint32_t toeplitz_hash_result);
1088*5113495bSYour Name 	QDF_STATUS (*rxCompletionHandler)(void *Context, qdf_nbuf_t wbuf,
1089*5113495bSYour Name 					uint8_t pipeID);
1090*5113495bSYour Name 	void (*txResourceAvailHandler)(void *context, uint8_t pipe);
1091*5113495bSYour Name 	void (*fwEventHandler)(void *context, QDF_STATUS status);
1092*5113495bSYour Name 	void (*update_bundle_stats)(void *context, uint8_t no_of_pkt_in_bundle);
1093*5113495bSYour Name };
1094*5113495bSYour Name 
1095*5113495bSYour Name enum hif_target_status {
1096*5113495bSYour Name 	TARGET_STATUS_CONNECTED = 0,  /* target connected */
1097*5113495bSYour Name 	TARGET_STATUS_RESET,  /* target got reset */
1098*5113495bSYour Name 	TARGET_STATUS_EJECT,  /* target got ejected */
1099*5113495bSYour Name 	TARGET_STATUS_SUSPEND /*target got suspend */
1100*5113495bSYour Name };
1101*5113495bSYour Name 
1102*5113495bSYour Name /**
1103*5113495bSYour Name  * enum hif_attribute_flags: configure hif
1104*5113495bSYour Name  *
1105*5113495bSYour Name  * @HIF_LOWDESC_CE_CFG: Configure HIF with Low descriptor CE
1106*5113495bSYour Name  * @HIF_LOWDESC_CE_NO_PKTLOG_CFG: Configure HIF with Low descriptor
1107*5113495bSYour Name  *  							+ No pktlog CE
1108*5113495bSYour Name  */
1109*5113495bSYour Name enum hif_attribute_flags {
1110*5113495bSYour Name 	HIF_LOWDESC_CE_CFG = 1,
1111*5113495bSYour Name 	HIF_LOWDESC_CE_NO_PKTLOG_CFG
1112*5113495bSYour Name };
1113*5113495bSYour Name 
1114*5113495bSYour Name #define HIF_DATA_ATTR_SET_TX_CLASSIFY(attr, v) \
1115*5113495bSYour Name 	(attr |= (v & 0x01) << 5)
1116*5113495bSYour Name #define HIF_DATA_ATTR_SET_ENCAPSULATION_TYPE(attr, v) \
1117*5113495bSYour Name 	(attr |= (v & 0x03) << 6)
1118*5113495bSYour Name #define HIF_DATA_ATTR_SET_ADDR_X_SEARCH_DISABLE(attr, v) \
1119*5113495bSYour Name 	(attr |= (v & 0x01) << 13)
1120*5113495bSYour Name #define HIF_DATA_ATTR_SET_ADDR_Y_SEARCH_DISABLE(attr, v) \
1121*5113495bSYour Name 	(attr |= (v & 0x01) << 14)
1122*5113495bSYour Name #define HIF_DATA_ATTR_SET_TOEPLITZ_HASH_ENABLE(attr, v) \
1123*5113495bSYour Name 	(attr |= (v & 0x01) << 15)
1124*5113495bSYour Name #define HIF_DATA_ATTR_SET_PACKET_OR_RESULT_OFFSET(attr, v) \
1125*5113495bSYour Name 	(attr |= (v & 0x0FFF) << 16)
1126*5113495bSYour Name #define HIF_DATA_ATTR_SET_ENABLE_11H(attr, v) \
1127*5113495bSYour Name 	(attr |= (v & 0x01) << 30)
1128*5113495bSYour Name 
1129*5113495bSYour Name struct hif_ul_pipe_info {
1130*5113495bSYour Name 	unsigned int nentries;
1131*5113495bSYour Name 	unsigned int nentries_mask;
1132*5113495bSYour Name 	unsigned int sw_index;
1133*5113495bSYour Name 	unsigned int write_index; /* cached copy */
1134*5113495bSYour Name 	unsigned int hw_index;    /* cached copy */
1135*5113495bSYour Name 	void *base_addr_owner_space; /* Host address space */
1136*5113495bSYour Name 	qdf_dma_addr_t base_addr_CE_space; /* CE address space */
1137*5113495bSYour Name };
1138*5113495bSYour Name 
1139*5113495bSYour Name struct hif_dl_pipe_info {
1140*5113495bSYour Name 	unsigned int nentries;
1141*5113495bSYour Name 	unsigned int nentries_mask;
1142*5113495bSYour Name 	unsigned int sw_index;
1143*5113495bSYour Name 	unsigned int write_index; /* cached copy */
1144*5113495bSYour Name 	unsigned int hw_index;    /* cached copy */
1145*5113495bSYour Name 	void *base_addr_owner_space; /* Host address space */
1146*5113495bSYour Name 	qdf_dma_addr_t base_addr_CE_space; /* CE address space */
1147*5113495bSYour Name };
1148*5113495bSYour Name 
1149*5113495bSYour Name struct hif_pipe_addl_info {
1150*5113495bSYour Name 	uint32_t pci_mem;
1151*5113495bSYour Name 	uint32_t ctrl_addr;
1152*5113495bSYour Name 	struct hif_ul_pipe_info ul_pipe;
1153*5113495bSYour Name 	struct hif_dl_pipe_info dl_pipe;
1154*5113495bSYour Name };
1155*5113495bSYour Name 
1156*5113495bSYour Name #ifdef CONFIG_SLUB_DEBUG_ON
1157*5113495bSYour Name #define MSG_FLUSH_NUM 16
1158*5113495bSYour Name #else /* PERF build */
1159*5113495bSYour Name #define MSG_FLUSH_NUM 32
1160*5113495bSYour Name #endif /* SLUB_DEBUG_ON */
1161*5113495bSYour Name 
1162*5113495bSYour Name struct hif_bus_id;
1163*5113495bSYour Name 
1164*5113495bSYour Name #ifdef CUSTOM_CB_SCHEDULER_SUPPORT
1165*5113495bSYour Name /**
1166*5113495bSYour Name  * hif_register_ce_custom_cb() - Helper API to register the custom callback
1167*5113495bSYour Name  * @hif_ctx: HIF opaque context
1168*5113495bSYour Name  * @pipe: Pipe number
1169*5113495bSYour Name  * @custom_cb: Custom call back function pointer
1170*5113495bSYour Name  * @custom_cb_context: Custom callback context
1171*5113495bSYour Name  *
1172*5113495bSYour Name  * return: QDF_STATUS
1173*5113495bSYour Name  */
1174*5113495bSYour Name QDF_STATUS
1175*5113495bSYour Name hif_register_ce_custom_cb(struct hif_opaque_softc *hif_ctx, uint8_t pipe,
1176*5113495bSYour Name 			  void (*custom_cb)(void *), void *custom_cb_context);
1177*5113495bSYour Name 
1178*5113495bSYour Name /**
1179*5113495bSYour Name  * hif_unregister_ce_custom_cb() - Helper API to unregister the custom callback
1180*5113495bSYour Name  * @hif_ctx: HIF opaque context
1181*5113495bSYour Name  * @pipe: Pipe number
1182*5113495bSYour Name  *
1183*5113495bSYour Name  * return: QDF_STATUS
1184*5113495bSYour Name  */
1185*5113495bSYour Name QDF_STATUS
1186*5113495bSYour Name hif_unregister_ce_custom_cb(struct hif_opaque_softc *hif_ctx, uint8_t pipe);
1187*5113495bSYour Name 
1188*5113495bSYour Name /**
1189*5113495bSYour Name  * hif_enable_ce_custom_cb() - Helper API to enable the custom callback
1190*5113495bSYour Name  * @hif_ctx: HIF opaque context
1191*5113495bSYour Name  * @pipe: Pipe number
1192*5113495bSYour Name  *
1193*5113495bSYour Name  * return: QDF_STATUS
1194*5113495bSYour Name  */
1195*5113495bSYour Name QDF_STATUS
1196*5113495bSYour Name hif_enable_ce_custom_cb(struct hif_opaque_softc *hif_ctx, uint8_t pipe);
1197*5113495bSYour Name 
1198*5113495bSYour Name /**
1199*5113495bSYour Name  * hif_disable_ce_custom_cb() - Helper API to disable the custom callback
1200*5113495bSYour Name  * @hif_ctx: HIF opaque context
1201*5113495bSYour Name  * @pipe: Pipe number
1202*5113495bSYour Name  *
1203*5113495bSYour Name  * return: QDF_STATUS
1204*5113495bSYour Name  */
1205*5113495bSYour Name QDF_STATUS
1206*5113495bSYour Name hif_disable_ce_custom_cb(struct hif_opaque_softc *hif_ctx, uint8_t pipe);
1207*5113495bSYour Name #endif /* CUSTOM_CB_SCHEDULER_SUPPORT */
1208*5113495bSYour Name 
1209*5113495bSYour Name void hif_claim_device(struct hif_opaque_softc *hif_ctx);
1210*5113495bSYour Name QDF_STATUS hif_get_config_item(struct hif_opaque_softc *hif_ctx,
1211*5113495bSYour Name 		     int opcode, void *config, uint32_t config_len);
1212*5113495bSYour Name void hif_set_mailbox_swap(struct hif_opaque_softc *hif_ctx);
1213*5113495bSYour Name void hif_mask_interrupt_call(struct hif_opaque_softc *hif_ctx);
1214*5113495bSYour Name void hif_post_init(struct hif_opaque_softc *hif_ctx, void *hHTC,
1215*5113495bSYour Name 		   struct hif_msg_callbacks *callbacks);
1216*5113495bSYour Name QDF_STATUS hif_start(struct hif_opaque_softc *hif_ctx);
1217*5113495bSYour Name void hif_stop(struct hif_opaque_softc *hif_ctx);
1218*5113495bSYour Name void hif_flush_surprise_remove(struct hif_opaque_softc *hif_ctx);
1219*5113495bSYour Name void hif_dump(struct hif_opaque_softc *hif_ctx, uint8_t CmdId, bool start);
1220*5113495bSYour Name void hif_trigger_dump(struct hif_opaque_softc *hif_ctx,
1221*5113495bSYour Name 		      uint8_t cmd_id, bool start);
1222*5113495bSYour Name 
1223*5113495bSYour Name QDF_STATUS hif_send_head(struct hif_opaque_softc *hif_ctx, uint8_t PipeID,
1224*5113495bSYour Name 				  uint32_t transferID, uint32_t nbytes,
1225*5113495bSYour Name 				  qdf_nbuf_t wbuf, uint32_t data_attr);
1226*5113495bSYour Name void hif_send_complete_check(struct hif_opaque_softc *hif_ctx, uint8_t PipeID,
1227*5113495bSYour Name 			     int force);
1228*5113495bSYour Name void hif_schedule_ce_tasklet(struct hif_opaque_softc *hif_ctx, uint8_t PipeID);
1229*5113495bSYour Name void hif_shut_down_device(struct hif_opaque_softc *hif_ctx);
1230*5113495bSYour Name void hif_get_default_pipe(struct hif_opaque_softc *hif_ctx, uint8_t *ULPipe,
1231*5113495bSYour Name 			  uint8_t *DLPipe);
1232*5113495bSYour Name int hif_map_service_to_pipe(struct hif_opaque_softc *hif_ctx, uint16_t svc_id,
1233*5113495bSYour Name 			uint8_t *ul_pipe, uint8_t *dl_pipe, int *ul_is_polled,
1234*5113495bSYour Name 			int *dl_is_polled);
1235*5113495bSYour Name uint16_t
1236*5113495bSYour Name hif_get_free_queue_number(struct hif_opaque_softc *hif_ctx, uint8_t PipeID);
1237*5113495bSYour Name void *hif_get_targetdef(struct hif_opaque_softc *hif_ctx);
1238*5113495bSYour Name uint32_t hif_hia_item_address(uint32_t target_type, uint32_t item_offset);
1239*5113495bSYour Name void hif_set_target_sleep(struct hif_opaque_softc *hif_ctx, bool sleep_ok,
1240*5113495bSYour Name 		     bool wait_for_it);
1241*5113495bSYour Name int hif_check_fw_reg(struct hif_opaque_softc *hif_ctx);
1242*5113495bSYour Name #ifndef HIF_PCI
hif_check_soc_status(struct hif_opaque_softc * hif_ctx)1243*5113495bSYour Name static inline int hif_check_soc_status(struct hif_opaque_softc *hif_ctx)
1244*5113495bSYour Name {
1245*5113495bSYour Name 	return 0;
1246*5113495bSYour Name }
1247*5113495bSYour Name #else
1248*5113495bSYour Name int hif_check_soc_status(struct hif_opaque_softc *hif_ctx);
1249*5113495bSYour Name #endif
1250*5113495bSYour Name void hif_get_hw_info(struct hif_opaque_softc *hif_ctx, u32 *version,
1251*5113495bSYour Name 			u32 *revision, const char **target_name);
1252*5113495bSYour Name 
1253*5113495bSYour Name #ifdef RECEIVE_OFFLOAD
1254*5113495bSYour Name /**
1255*5113495bSYour Name  * hif_offld_flush_cb_register() - Register the offld flush callback
1256*5113495bSYour Name  * @scn: HIF opaque context
1257*5113495bSYour Name  * @offld_flush_handler: Flush callback is either ol_flush, incase of rx_thread
1258*5113495bSYour Name  *			 Or GRO/LRO flush when RxThread is not enabled. Called
1259*5113495bSYour Name  *			 with corresponding context for flush.
1260*5113495bSYour Name  * Return: None
1261*5113495bSYour Name  */
1262*5113495bSYour Name void hif_offld_flush_cb_register(struct hif_opaque_softc *scn,
1263*5113495bSYour Name 				 void (offld_flush_handler)(void *ol_ctx));
1264*5113495bSYour Name 
1265*5113495bSYour Name /**
1266*5113495bSYour Name  * hif_offld_flush_cb_deregister() - deRegister the offld flush callback
1267*5113495bSYour Name  * @scn: HIF opaque context
1268*5113495bSYour Name  *
1269*5113495bSYour Name  * Return: None
1270*5113495bSYour Name  */
1271*5113495bSYour Name void hif_offld_flush_cb_deregister(struct hif_opaque_softc *scn);
1272*5113495bSYour Name #endif
1273*5113495bSYour Name 
1274*5113495bSYour Name #ifdef WLAN_FEATURE_RX_SOFTIRQ_TIME_LIMIT
1275*5113495bSYour Name /**
1276*5113495bSYour Name  * hif_exec_should_yield() - Check if hif napi context should yield
1277*5113495bSYour Name  * @hif_ctx: HIF opaque context
1278*5113495bSYour Name  * @grp_id: grp_id of the napi for which check needs to be done
1279*5113495bSYour Name  *
1280*5113495bSYour Name  * The function uses grp_id to look for NAPI and checks if NAPI needs to
1281*5113495bSYour Name  * yield. HIF_EXT_GROUP_MAX_YIELD_DURATION_NS is the duration used for
1282*5113495bSYour Name  * yield decision.
1283*5113495bSYour Name  *
1284*5113495bSYour Name  * Return: true if NAPI needs to yield, else false
1285*5113495bSYour Name  */
1286*5113495bSYour Name bool hif_exec_should_yield(struct hif_opaque_softc *hif_ctx, uint grp_id);
1287*5113495bSYour Name #else
hif_exec_should_yield(struct hif_opaque_softc * hif_ctx,uint grp_id)1288*5113495bSYour Name static inline bool hif_exec_should_yield(struct hif_opaque_softc *hif_ctx,
1289*5113495bSYour Name 					 uint grp_id)
1290*5113495bSYour Name {
1291*5113495bSYour Name 	return false;
1292*5113495bSYour Name }
1293*5113495bSYour Name #endif
1294*5113495bSYour Name 
1295*5113495bSYour Name void hif_disable_isr(struct hif_opaque_softc *hif_ctx);
1296*5113495bSYour Name void hif_reset_soc(struct hif_opaque_softc *hif_ctx);
1297*5113495bSYour Name void hif_save_htc_htt_config_endpoint(struct hif_opaque_softc *hif_ctx,
1298*5113495bSYour Name 				      int htc_htt_tx_endpoint);
1299*5113495bSYour Name 
1300*5113495bSYour Name /**
1301*5113495bSYour Name  * hif_open() - Create hif handle
1302*5113495bSYour Name  * @qdf_ctx: qdf context
1303*5113495bSYour Name  * @mode: Driver Mode
1304*5113495bSYour Name  * @bus_type: Bus Type
1305*5113495bSYour Name  * @cbk: CDS Callbacks
1306*5113495bSYour Name  * @psoc: psoc object manager
1307*5113495bSYour Name  *
1308*5113495bSYour Name  * API to open HIF Context
1309*5113495bSYour Name  *
1310*5113495bSYour Name  * Return: HIF Opaque Pointer
1311*5113495bSYour Name  */
1312*5113495bSYour Name struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx,
1313*5113495bSYour Name 				  uint32_t mode,
1314*5113495bSYour Name 				  enum qdf_bus_type bus_type,
1315*5113495bSYour Name 				  struct hif_driver_state_callbacks *cbk,
1316*5113495bSYour Name 				  struct wlan_objmgr_psoc *psoc);
1317*5113495bSYour Name 
1318*5113495bSYour Name /**
1319*5113495bSYour Name  * hif_init_dma_mask() - Set dma mask for the dev
1320*5113495bSYour Name  * @dev: dev for which DMA mask is to be set
1321*5113495bSYour Name  * @bus_type: bus type for the target
1322*5113495bSYour Name  *
1323*5113495bSYour Name  * This API sets the DMA mask for the device. before the datapath
1324*5113495bSYour Name  * memory pre-allocation is done. If the DMA mask is not set before
1325*5113495bSYour Name  * requesting the DMA memory, kernel defaults to a 32-bit DMA mask,
1326*5113495bSYour Name  * and does not utilize the full device capability.
1327*5113495bSYour Name  *
1328*5113495bSYour Name  * Return: 0 - success, non-zero on failure.
1329*5113495bSYour Name  */
1330*5113495bSYour Name int hif_init_dma_mask(struct device *dev, enum qdf_bus_type bus_type);
1331*5113495bSYour Name void hif_close(struct hif_opaque_softc *hif_ctx);
1332*5113495bSYour Name QDF_STATUS hif_enable(struct hif_opaque_softc *hif_ctx, struct device *dev,
1333*5113495bSYour Name 		      void *bdev, const struct hif_bus_id *bid,
1334*5113495bSYour Name 		      enum qdf_bus_type bus_type,
1335*5113495bSYour Name 		      enum hif_enable_type type);
1336*5113495bSYour Name void hif_disable(struct hif_opaque_softc *hif_ctx, enum hif_disable_type type);
1337*5113495bSYour Name #ifdef CE_TASKLET_DEBUG_ENABLE
1338*5113495bSYour Name void hif_enable_ce_latency_stats(struct hif_opaque_softc *hif_ctx,
1339*5113495bSYour Name 				 uint8_t value);
1340*5113495bSYour Name #endif
1341*5113495bSYour Name void hif_display_stats(struct hif_opaque_softc *hif_ctx);
1342*5113495bSYour Name void hif_clear_stats(struct hif_opaque_softc *hif_ctx);
1343*5113495bSYour Name 
1344*5113495bSYour Name /**
1345*5113495bSYour Name  * enum hif_pm_wake_irq_type - Wake interrupt type for Power Management
1346*5113495bSYour Name  * @HIF_PM_INVALID_WAKE: Wake irq is invalid or not configured
1347*5113495bSYour Name  * @HIF_PM_MSI_WAKE: Wake irq is MSI interrupt
1348*5113495bSYour Name  * @HIF_PM_CE_WAKE: Wake irq is CE interrupt
1349*5113495bSYour Name  */
1350*5113495bSYour Name typedef enum {
1351*5113495bSYour Name 	HIF_PM_INVALID_WAKE,
1352*5113495bSYour Name 	HIF_PM_MSI_WAKE,
1353*5113495bSYour Name 	HIF_PM_CE_WAKE,
1354*5113495bSYour Name } hif_pm_wake_irq_type;
1355*5113495bSYour Name 
1356*5113495bSYour Name /**
1357*5113495bSYour Name  * hif_pm_get_wake_irq_type - Get wake irq type for Power Management
1358*5113495bSYour Name  * @hif_ctx: HIF context
1359*5113495bSYour Name  *
1360*5113495bSYour Name  * Return: enum hif_pm_wake_irq_type
1361*5113495bSYour Name  */
1362*5113495bSYour Name hif_pm_wake_irq_type hif_pm_get_wake_irq_type(struct hif_opaque_softc *hif_ctx);
1363*5113495bSYour Name 
1364*5113495bSYour Name /**
1365*5113495bSYour Name  * enum hif_ep_vote_type - hif ep vote type
1366*5113495bSYour Name  * @HIF_EP_VOTE_DP_ACCESS: vote type is specific DP
1367*5113495bSYour Name  * @HIF_EP_VOTE_NONDP_ACCESS: ep vote for over all access
1368*5113495bSYour Name  */
1369*5113495bSYour Name enum hif_ep_vote_type {
1370*5113495bSYour Name 	HIF_EP_VOTE_DP_ACCESS,
1371*5113495bSYour Name 	HIF_EP_VOTE_NONDP_ACCESS
1372*5113495bSYour Name };
1373*5113495bSYour Name 
1374*5113495bSYour Name /**
1375*5113495bSYour Name  * enum hif_ep_vote_access - hif ep vote access
1376*5113495bSYour Name  * @HIF_EP_VOTE_ACCESS_ENABLE: Enable ep voting
1377*5113495bSYour Name  * @HIF_EP_VOTE_INTERMEDIATE_ACCESS: allow during transition
1378*5113495bSYour Name  * @HIF_EP_VOTE_ACCESS_DISABLE: disable ep voting
1379*5113495bSYour Name  */
1380*5113495bSYour Name enum hif_ep_vote_access {
1381*5113495bSYour Name 	HIF_EP_VOTE_ACCESS_ENABLE,
1382*5113495bSYour Name 	HIF_EP_VOTE_INTERMEDIATE_ACCESS,
1383*5113495bSYour Name 	HIF_EP_VOTE_ACCESS_DISABLE
1384*5113495bSYour Name };
1385*5113495bSYour Name 
1386*5113495bSYour Name /**
1387*5113495bSYour Name  * enum hif_rtpm_client_id - modules registered with runtime pm module
1388*5113495bSYour Name  * @HIF_RTPM_ID_RESERVED: Reserved ID
1389*5113495bSYour Name  * @HIF_RTPM_ID_HAL_REO_CMD: HAL REO commands
1390*5113495bSYour Name  * @HIF_RTPM_ID_WMI: WMI commands Tx
1391*5113495bSYour Name  * @HIF_RTPM_ID_HTT: HTT commands Tx
1392*5113495bSYour Name  * @HIF_RTPM_ID_DP: Datapath Tx path
1393*5113495bSYour Name  * @HIF_RTPM_ID_DP_RING_STATS: Datapath ring stats
1394*5113495bSYour Name  * @HIF_RTPM_ID_CE: CE Tx buffer posting
1395*5113495bSYour Name  * @HIF_RTPM_ID_FORCE_WAKE: Force wake request
1396*5113495bSYour Name  * @HIF_RTPM_ID_PM_QOS_NOTIFY:
1397*5113495bSYour Name  * @HIF_RTPM_ID_WIPHY_SUSPEND:
1398*5113495bSYour Name  * @HIF_RTPM_ID_MAX: Max id
1399*5113495bSYour Name  */
1400*5113495bSYour Name enum  hif_rtpm_client_id {
1401*5113495bSYour Name 	HIF_RTPM_ID_RESERVED,
1402*5113495bSYour Name 	HIF_RTPM_ID_HAL_REO_CMD,
1403*5113495bSYour Name 	HIF_RTPM_ID_WMI,
1404*5113495bSYour Name 	HIF_RTPM_ID_HTT,
1405*5113495bSYour Name 	HIF_RTPM_ID_DP,
1406*5113495bSYour Name 	HIF_RTPM_ID_DP_RING_STATS,
1407*5113495bSYour Name 	HIF_RTPM_ID_CE,
1408*5113495bSYour Name 	HIF_RTPM_ID_FORCE_WAKE,
1409*5113495bSYour Name 	HIF_RTPM_ID_PM_QOS_NOTIFY,
1410*5113495bSYour Name 	HIF_RTPM_ID_WIPHY_SUSPEND,
1411*5113495bSYour Name 	HIF_RTPM_ID_MAX
1412*5113495bSYour Name };
1413*5113495bSYour Name 
1414*5113495bSYour Name /**
1415*5113495bSYour Name  * enum rpm_type - Get and Put calls types
1416*5113495bSYour Name  * @HIF_RTPM_GET_ASYNC: Increment usage count and when system is suspended
1417*5113495bSYour Name  *		      schedule resume process, return depends on pm state.
1418*5113495bSYour Name  * @HIF_RTPM_GET_FORCE: Increment usage count and when system is suspended
1419*5113495bSYour Name  *		      schedule resume process, returns success irrespective of
1420*5113495bSYour Name  *		      pm_state.
1421*5113495bSYour Name  * @HIF_RTPM_GET_SYNC: Increment usage count and when system is suspended,
1422*5113495bSYour Name  *		     wait till process is resumed.
1423*5113495bSYour Name  * @HIF_RTPM_GET_NORESUME: Only increments usage count.
1424*5113495bSYour Name  * @HIF_RTPM_PUT_ASYNC: Decrements usage count and puts system in idle state.
1425*5113495bSYour Name  * @HIF_RTPM_PUT_SYNC_SUSPEND: Decrements usage count and puts system in
1426*5113495bSYour Name  *			     suspended state.
1427*5113495bSYour Name  * @HIF_RTPM_PUT_NOIDLE: Decrements usage count.
1428*5113495bSYour Name  */
1429*5113495bSYour Name enum rpm_type {
1430*5113495bSYour Name 	HIF_RTPM_GET_ASYNC,
1431*5113495bSYour Name 	HIF_RTPM_GET_FORCE,
1432*5113495bSYour Name 	HIF_RTPM_GET_SYNC,
1433*5113495bSYour Name 	HIF_RTPM_GET_NORESUME,
1434*5113495bSYour Name 	HIF_RTPM_PUT_ASYNC,
1435*5113495bSYour Name 	HIF_RTPM_PUT_SYNC_SUSPEND,
1436*5113495bSYour Name 	HIF_RTPM_PUT_NOIDLE,
1437*5113495bSYour Name };
1438*5113495bSYour Name 
1439*5113495bSYour Name /**
1440*5113495bSYour Name  * struct hif_pm_runtime_lock - data structure for preventing runtime suspend
1441*5113495bSYour Name  * @list: global list of runtime locks
1442*5113495bSYour Name  * @active: true if this lock is preventing suspend
1443*5113495bSYour Name  * @name: character string for tracking this lock
1444*5113495bSYour Name  */
1445*5113495bSYour Name struct hif_pm_runtime_lock {
1446*5113495bSYour Name 	struct list_head list;
1447*5113495bSYour Name 	bool active;
1448*5113495bSYour Name 	const char *name;
1449*5113495bSYour Name };
1450*5113495bSYour Name 
1451*5113495bSYour Name #ifdef FEATURE_RUNTIME_PM
1452*5113495bSYour Name /**
1453*5113495bSYour Name  * hif_rtpm_register() - Register a module with runtime PM.
1454*5113495bSYour Name  * @id: ID of the module which needs to be registered
1455*5113495bSYour Name  * @hif_rpm_cbk: callback to be called when get was called in suspended state.
1456*5113495bSYour Name  *
1457*5113495bSYour Name  * Return: success status if successfully registered
1458*5113495bSYour Name  */
1459*5113495bSYour Name QDF_STATUS hif_rtpm_register(uint32_t id, void (*hif_rpm_cbk)(void));
1460*5113495bSYour Name 
1461*5113495bSYour Name /**
1462*5113495bSYour Name  * hif_rtpm_deregister() - Deregister the module
1463*5113495bSYour Name  * @id: ID of the module which needs to be de-registered
1464*5113495bSYour Name  */
1465*5113495bSYour Name QDF_STATUS hif_rtpm_deregister(uint32_t id);
1466*5113495bSYour Name 
1467*5113495bSYour Name /**
1468*5113495bSYour Name  * hif_rtpm_set_autosuspend_delay() - Set delay to trigger RTPM suspend
1469*5113495bSYour Name  * @delay: delay in ms to be set
1470*5113495bSYour Name  *
1471*5113495bSYour Name  * Return: Success if delay is set successfully
1472*5113495bSYour Name  */
1473*5113495bSYour Name QDF_STATUS hif_rtpm_set_autosuspend_delay(int delay);
1474*5113495bSYour Name 
1475*5113495bSYour Name /**
1476*5113495bSYour Name  * hif_rtpm_restore_autosuspend_delay() - Restore delay value to default value
1477*5113495bSYour Name  *
1478*5113495bSYour Name  * Return: Success if reset done. E_ALREADY if delay same as config value
1479*5113495bSYour Name  */
1480*5113495bSYour Name QDF_STATUS hif_rtpm_restore_autosuspend_delay(void);
1481*5113495bSYour Name 
1482*5113495bSYour Name /**
1483*5113495bSYour Name  * hif_rtpm_get_autosuspend_delay() -Get delay to trigger RTPM suspend
1484*5113495bSYour Name  *
1485*5113495bSYour Name  * Return: Delay in ms
1486*5113495bSYour Name  */
1487*5113495bSYour Name int hif_rtpm_get_autosuspend_delay(void);
1488*5113495bSYour Name 
1489*5113495bSYour Name /**
1490*5113495bSYour Name  * hif_runtime_lock_init() - API to initialize Runtime PM context
1491*5113495bSYour Name  * @lock: QDF lock context
1492*5113495bSYour Name  * @name: Context name
1493*5113495bSYour Name  *
1494*5113495bSYour Name  * This API initializes the Runtime PM context of the caller and
1495*5113495bSYour Name  * return the pointer.
1496*5113495bSYour Name  *
1497*5113495bSYour Name  * Return: None
1498*5113495bSYour Name  */
1499*5113495bSYour Name int hif_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name);
1500*5113495bSYour Name 
1501*5113495bSYour Name /**
1502*5113495bSYour Name  * hif_runtime_lock_deinit() - This API frees the runtime pm context
1503*5113495bSYour Name  * @data: Runtime PM context
1504*5113495bSYour Name  *
1505*5113495bSYour Name  * Return: void
1506*5113495bSYour Name  */
1507*5113495bSYour Name void hif_runtime_lock_deinit(struct hif_pm_runtime_lock *data);
1508*5113495bSYour Name 
1509*5113495bSYour Name /**
1510*5113495bSYour Name  * hif_rtpm_get() - Increment usage_count on the device to avoid suspend.
1511*5113495bSYour Name  * @type: get call types from hif_rpm_type
1512*5113495bSYour Name  * @id: ID of the module calling get()
1513*5113495bSYour Name  *
1514*5113495bSYour Name  * A get operation will prevent a runtime suspend until a
1515*5113495bSYour Name  * corresponding put is done.  This api should be used when accessing bus.
1516*5113495bSYour Name  *
1517*5113495bSYour Name  * CONTRARY TO THE REGULAR RUNTIME PM, WHEN THE BUS IS SUSPENDED,
1518*5113495bSYour Name  * THIS API WILL ONLY REQUEST THE RESUME AND NOT DO A GET!!!
1519*5113495bSYour Name  *
1520*5113495bSYour Name  * return: success if a get has been issued, else error code.
1521*5113495bSYour Name  */
1522*5113495bSYour Name QDF_STATUS hif_rtpm_get(uint8_t type, uint32_t id);
1523*5113495bSYour Name 
1524*5113495bSYour Name /**
1525*5113495bSYour Name  * hif_rtpm_put() - do a put operation on the device
1526*5113495bSYour Name  * @type: put call types from hif_rpm_type
1527*5113495bSYour Name  * @id: ID of the module calling put()
1528*5113495bSYour Name  *
1529*5113495bSYour Name  * A put operation will allow a runtime suspend after a corresponding
1530*5113495bSYour Name  * get was done.  This api should be used when finished accessing bus.
1531*5113495bSYour Name  *
1532*5113495bSYour Name  * This api will return a failure if runtime pm is stopped
1533*5113495bSYour Name  * This api will return failure if it would decrement the usage count below 0.
1534*5113495bSYour Name  *
1535*5113495bSYour Name  * return: QDF_STATUS_SUCCESS if the put is performed
1536*5113495bSYour Name  */
1537*5113495bSYour Name QDF_STATUS hif_rtpm_put(uint8_t type, uint32_t id);
1538*5113495bSYour Name 
1539*5113495bSYour Name /**
1540*5113495bSYour Name  * hif_pm_runtime_prevent_suspend() - Prevent Runtime suspend
1541*5113495bSYour Name  * @data: runtime PM lock
1542*5113495bSYour Name  *
1543*5113495bSYour Name  * This function will prevent runtime suspend, by incrementing
1544*5113495bSYour Name  * device's usage count.
1545*5113495bSYour Name  *
1546*5113495bSYour Name  * Return: status
1547*5113495bSYour Name  */
1548*5113495bSYour Name int hif_pm_runtime_prevent_suspend(struct hif_pm_runtime_lock *data);
1549*5113495bSYour Name 
1550*5113495bSYour Name /**
1551*5113495bSYour Name  * hif_pm_runtime_prevent_suspend_sync() - Synchronized prevent Runtime suspend
1552*5113495bSYour Name  * @data: runtime PM lock
1553*5113495bSYour Name  *
1554*5113495bSYour Name  * This function will prevent runtime suspend, by incrementing
1555*5113495bSYour Name  * device's usage count.
1556*5113495bSYour Name  *
1557*5113495bSYour Name  * Return: status
1558*5113495bSYour Name  */
1559*5113495bSYour Name int hif_pm_runtime_prevent_suspend_sync(struct hif_pm_runtime_lock *data);
1560*5113495bSYour Name 
1561*5113495bSYour Name /**
1562*5113495bSYour Name  * hif_pm_runtime_allow_suspend() - Allow Runtime suspend
1563*5113495bSYour Name  * @data: runtime PM lock
1564*5113495bSYour Name  *
1565*5113495bSYour Name  * This function will allow runtime suspend, by decrementing
1566*5113495bSYour Name  * device's usage count.
1567*5113495bSYour Name  *
1568*5113495bSYour Name  * Return: status
1569*5113495bSYour Name  */
1570*5113495bSYour Name int hif_pm_runtime_allow_suspend(struct hif_pm_runtime_lock *data);
1571*5113495bSYour Name 
1572*5113495bSYour Name /**
1573*5113495bSYour Name  * hif_rtpm_request_resume() - Request resume if bus is suspended
1574*5113495bSYour Name  *
1575*5113495bSYour Name  * Return: None
1576*5113495bSYour Name  */
1577*5113495bSYour Name void hif_rtpm_request_resume(void);
1578*5113495bSYour Name 
1579*5113495bSYour Name /**
1580*5113495bSYour Name  * hif_rtpm_sync_resume() - Invoke synchronous runtime resume.
1581*5113495bSYour Name  *
1582*5113495bSYour Name  * This function will invoke synchronous runtime resume.
1583*5113495bSYour Name  *
1584*5113495bSYour Name  * Return: status
1585*5113495bSYour Name  */
1586*5113495bSYour Name QDF_STATUS hif_rtpm_sync_resume(void);
1587*5113495bSYour Name 
1588*5113495bSYour Name /**
1589*5113495bSYour Name  * hif_rtpm_check_and_request_resume() - check if bus is suspended and
1590*5113495bSYour Name  *                                       request resume.
1591*5113495bSYour Name  * @suspend_in_progress: Request resume if suspend is in progress
1592*5113495bSYour Name  *
1593*5113495bSYour Name  * Return: void
1594*5113495bSYour Name  */
1595*5113495bSYour Name void hif_rtpm_check_and_request_resume(bool suspend_in_progress);
1596*5113495bSYour Name 
1597*5113495bSYour Name /**
1598*5113495bSYour Name  * hif_rtpm_set_client_job() - Set job for the client.
1599*5113495bSYour Name  * @client_id: Client id for which job needs to be set
1600*5113495bSYour Name  *
1601*5113495bSYour Name  * If get failed due to system being in suspended state, set the client job so
1602*5113495bSYour Name  * when system resumes the client's job is called.
1603*5113495bSYour Name  *
1604*5113495bSYour Name  * Return: None
1605*5113495bSYour Name  */
1606*5113495bSYour Name void hif_rtpm_set_client_job(uint32_t client_id);
1607*5113495bSYour Name 
1608*5113495bSYour Name /**
1609*5113495bSYour Name  * hif_rtpm_mark_last_busy() - Mark last busy to delay retry to suspend
1610*5113495bSYour Name  * @id: ID marking last busy
1611*5113495bSYour Name  *
1612*5113495bSYour Name  * Return: None
1613*5113495bSYour Name  */
1614*5113495bSYour Name void hif_rtpm_mark_last_busy(uint32_t id);
1615*5113495bSYour Name 
1616*5113495bSYour Name /**
1617*5113495bSYour Name  * hif_rtpm_get_monitor_wake_intr() - API to get monitor_wake_intr
1618*5113495bSYour Name  *
1619*5113495bSYour Name  * monitor_wake_intr variable can be used to indicate if driver expects wake
1620*5113495bSYour Name  * MSI for runtime PM
1621*5113495bSYour Name  *
1622*5113495bSYour Name  * Return: monitor_wake_intr variable
1623*5113495bSYour Name  */
1624*5113495bSYour Name int hif_rtpm_get_monitor_wake_intr(void);
1625*5113495bSYour Name 
1626*5113495bSYour Name /**
1627*5113495bSYour Name  * hif_rtpm_set_monitor_wake_intr() - API to set monitor_wake_intr
1628*5113495bSYour Name  * @val: value to set
1629*5113495bSYour Name  *
1630*5113495bSYour Name  * monitor_wake_intr variable can be used to indicate if driver expects wake
1631*5113495bSYour Name  * MSI for runtime PM
1632*5113495bSYour Name  *
1633*5113495bSYour Name  * Return: void
1634*5113495bSYour Name  */
1635*5113495bSYour Name void hif_rtpm_set_monitor_wake_intr(int val);
1636*5113495bSYour Name 
1637*5113495bSYour Name /**
1638*5113495bSYour Name  * hif_pre_runtime_suspend() - book keeping before beginning runtime suspend.
1639*5113495bSYour Name  * @hif_ctx: HIF context
1640*5113495bSYour Name  *
1641*5113495bSYour Name  * Makes sure that the pci link will be taken down by the suspend operation.
1642*5113495bSYour Name  * If the hif layer is configured to leave the bus on, runtime suspend will
1643*5113495bSYour Name  * not save any power.
1644*5113495bSYour Name  *
1645*5113495bSYour Name  * Set the runtime suspend state to SUSPENDING.
1646*5113495bSYour Name  *
1647*5113495bSYour Name  * return -EINVAL if the bus won't go down.  otherwise return 0
1648*5113495bSYour Name  */
1649*5113495bSYour Name int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx);
1650*5113495bSYour Name 
1651*5113495bSYour Name /**
1652*5113495bSYour Name  * hif_pre_runtime_resume() - bookkeeping before beginning runtime resume
1653*5113495bSYour Name  *
1654*5113495bSYour Name  * update the runtime pm state to RESUMING.
1655*5113495bSYour Name  * Return: void
1656*5113495bSYour Name  */
1657*5113495bSYour Name void hif_pre_runtime_resume(void);
1658*5113495bSYour Name 
1659*5113495bSYour Name /**
1660*5113495bSYour Name  * hif_process_runtime_suspend_success() - bookkeeping of suspend success
1661*5113495bSYour Name  *
1662*5113495bSYour Name  * Record the success.
1663*5113495bSYour Name  * update the runtime_pm state to SUSPENDED
1664*5113495bSYour Name  * Return: void
1665*5113495bSYour Name  */
1666*5113495bSYour Name void hif_process_runtime_suspend_success(void);
1667*5113495bSYour Name 
1668*5113495bSYour Name /**
1669*5113495bSYour Name  * hif_process_runtime_suspend_failure() - bookkeeping of suspend failure
1670*5113495bSYour Name  *
1671*5113495bSYour Name  * Record the failure.
1672*5113495bSYour Name  * mark last busy to delay a retry.
1673*5113495bSYour Name  * update the runtime_pm state back to ON
1674*5113495bSYour Name  *
1675*5113495bSYour Name  * Return: void
1676*5113495bSYour Name  */
1677*5113495bSYour Name void hif_process_runtime_suspend_failure(void);
1678*5113495bSYour Name 
1679*5113495bSYour Name /**
1680*5113495bSYour Name  * hif_process_runtime_resume_linkup() - bookkeeping of resuming link up
1681*5113495bSYour Name  *
1682*5113495bSYour Name  * update the runtime_pm state to RESUMING_LINKUP
1683*5113495bSYour Name  * Return: void
1684*5113495bSYour Name  */
1685*5113495bSYour Name void hif_process_runtime_resume_linkup(void);
1686*5113495bSYour Name 
1687*5113495bSYour Name /**
1688*5113495bSYour Name  * hif_process_runtime_resume_success() - bookkeeping after a runtime resume
1689*5113495bSYour Name  *
1690*5113495bSYour Name  * record the success.
1691*5113495bSYour Name  * update the runtime_pm state to SUSPENDED
1692*5113495bSYour Name  * Return: void
1693*5113495bSYour Name  */
1694*5113495bSYour Name void hif_process_runtime_resume_success(void);
1695*5113495bSYour Name 
1696*5113495bSYour Name /**
1697*5113495bSYour Name  * hif_rtpm_print_prevent_list() - list the clients preventing suspend.
1698*5113495bSYour Name  *
1699*5113495bSYour Name  * Return: None
1700*5113495bSYour Name  */
1701*5113495bSYour Name void hif_rtpm_print_prevent_list(void);
1702*5113495bSYour Name 
1703*5113495bSYour Name /**
1704*5113495bSYour Name  * hif_rtpm_suspend_lock() - spin_lock on marking runtime suspend
1705*5113495bSYour Name  *
1706*5113495bSYour Name  * Return: void
1707*5113495bSYour Name  */
1708*5113495bSYour Name void hif_rtpm_suspend_lock(void);
1709*5113495bSYour Name 
1710*5113495bSYour Name /**
1711*5113495bSYour Name  * hif_rtpm_suspend_unlock() - spin_unlock on marking runtime suspend
1712*5113495bSYour Name  *
1713*5113495bSYour Name  * Return: void
1714*5113495bSYour Name  */
1715*5113495bSYour Name void hif_rtpm_suspend_unlock(void);
1716*5113495bSYour Name 
1717*5113495bSYour Name /**
1718*5113495bSYour Name  * hif_runtime_suspend() - do the bus suspend part of a runtime suspend
1719*5113495bSYour Name  * @hif_ctx: HIF context
1720*5113495bSYour Name  *
1721*5113495bSYour Name  * Return: 0 for success and non-zero error code for failure
1722*5113495bSYour Name  */
1723*5113495bSYour Name int hif_runtime_suspend(struct hif_opaque_softc *hif_ctx);
1724*5113495bSYour Name 
1725*5113495bSYour Name /**
1726*5113495bSYour Name  * hif_runtime_resume() - do the bus resume part of a runtime resume
1727*5113495bSYour Name  * @hif_ctx: HIF context
1728*5113495bSYour Name  *
1729*5113495bSYour Name  * Return: 0 for success and non-zero error code for failure
1730*5113495bSYour Name  */
1731*5113495bSYour Name int hif_runtime_resume(struct hif_opaque_softc *hif_ctx);
1732*5113495bSYour Name 
1733*5113495bSYour Name /**
1734*5113495bSYour Name  * hif_fastpath_resume() - resume fastpath for runtimepm
1735*5113495bSYour Name  * @hif_ctx: HIF context
1736*5113495bSYour Name  *
1737*5113495bSYour Name  * ensure that the fastpath write index register is up to date
1738*5113495bSYour Name  * since runtime pm may cause ce_send_fast to skip the register
1739*5113495bSYour Name  * write.
1740*5113495bSYour Name  *
1741*5113495bSYour Name  * fastpath only applicable to legacy copy engine
1742*5113495bSYour Name  */
1743*5113495bSYour Name void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx);
1744*5113495bSYour Name 
1745*5113495bSYour Name /**
1746*5113495bSYour Name  * hif_rtpm_get_state(): get rtpm link state
1747*5113495bSYour Name  *
1748*5113495bSYour Name  * Return: state
1749*5113495bSYour Name  */
1750*5113495bSYour Name int hif_rtpm_get_state(void);
1751*5113495bSYour Name 
1752*5113495bSYour Name /**
1753*5113495bSYour Name  * hif_rtpm_display_last_busy_hist() - Display runtimepm last busy history
1754*5113495bSYour Name  * @hif_ctx: HIF context
1755*5113495bSYour Name  *
1756*5113495bSYour Name  * Return: None
1757*5113495bSYour Name  */
1758*5113495bSYour Name void hif_rtpm_display_last_busy_hist(struct hif_opaque_softc *hif_ctx);
1759*5113495bSYour Name 
1760*5113495bSYour Name /**
1761*5113495bSYour Name  * hif_rtpm_record_ce_last_busy_evt() - Record CE runtimepm last busy event
1762*5113495bSYour Name  * @scn: HIF context
1763*5113495bSYour Name  * @ce_id: CE id
1764*5113495bSYour Name  *
1765*5113495bSYour Name  * Return: None
1766*5113495bSYour Name  */
1767*5113495bSYour Name void hif_rtpm_record_ce_last_busy_evt(struct hif_softc *scn,
1768*5113495bSYour Name 				      unsigned long ce_id);
1769*5113495bSYour Name 
1770*5113495bSYour Name /**
1771*5113495bSYour Name  * hif_set_enable_rpm() - Set enable_rpm value
1772*5113495bSYour Name  * @hif_hdl: hif opaque handle
1773*5113495bSYour Name  *
1774*5113495bSYour Name  *  Return: None
1775*5113495bSYour Name  */
1776*5113495bSYour Name void hif_set_enable_rpm(struct hif_opaque_softc *hif_hdl);
1777*5113495bSYour Name 
1778*5113495bSYour Name #else
1779*5113495bSYour Name 
1780*5113495bSYour Name /**
1781*5113495bSYour Name  * hif_rtpm_display_last_busy_hist() - Display runtimepm last busy history
1782*5113495bSYour Name  * @hif_ctx: HIF context
1783*5113495bSYour Name  *
1784*5113495bSYour Name  * Return: None
1785*5113495bSYour Name  */
1786*5113495bSYour Name static inline
hif_rtpm_display_last_busy_hist(struct hif_opaque_softc * hif_ctx)1787*5113495bSYour Name void hif_rtpm_display_last_busy_hist(struct hif_opaque_softc *hif_ctx) { }
1788*5113495bSYour Name 
1789*5113495bSYour Name /**
1790*5113495bSYour Name  * hif_rtpm_record_ce_last_busy_evt() - Record CE runtimepm last busy event
1791*5113495bSYour Name  * @scn: HIF context
1792*5113495bSYour Name  * @ce_id: CE id
1793*5113495bSYour Name  *
1794*5113495bSYour Name  * Return: None
1795*5113495bSYour Name  */
1796*5113495bSYour Name static inline
hif_rtpm_record_ce_last_busy_evt(struct hif_softc * scn,unsigned long ce_id)1797*5113495bSYour Name void hif_rtpm_record_ce_last_busy_evt(struct hif_softc *scn,
1798*5113495bSYour Name 				      unsigned long ce_id)
1799*5113495bSYour Name { }
1800*5113495bSYour Name 
1801*5113495bSYour Name static inline
hif_rtpm_register(uint32_t id,void (* hif_rpm_cbk)(void))1802*5113495bSYour Name QDF_STATUS hif_rtpm_register(uint32_t id, void (*hif_rpm_cbk)(void))
1803*5113495bSYour Name { return QDF_STATUS_SUCCESS; }
1804*5113495bSYour Name 
1805*5113495bSYour Name static inline
hif_rtpm_deregister(uint32_t id)1806*5113495bSYour Name QDF_STATUS hif_rtpm_deregister(uint32_t id)
1807*5113495bSYour Name { return QDF_STATUS_SUCCESS; }
1808*5113495bSYour Name 
1809*5113495bSYour Name static inline
hif_rtpm_set_autosuspend_delay(int delay)1810*5113495bSYour Name QDF_STATUS hif_rtpm_set_autosuspend_delay(int delay)
1811*5113495bSYour Name { return QDF_STATUS_SUCCESS; }
1812*5113495bSYour Name 
hif_rtpm_restore_autosuspend_delay(void)1813*5113495bSYour Name static inline QDF_STATUS hif_rtpm_restore_autosuspend_delay(void)
1814*5113495bSYour Name { return QDF_STATUS_SUCCESS; }
1815*5113495bSYour Name 
hif_rtpm_get_autosuspend_delay(void)1816*5113495bSYour Name static inline int hif_rtpm_get_autosuspend_delay(void)
1817*5113495bSYour Name { return 0; }
1818*5113495bSYour Name 
1819*5113495bSYour Name static inline
hif_runtime_lock_init(qdf_runtime_lock_t * lock,const char * name)1820*5113495bSYour Name int hif_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name)
1821*5113495bSYour Name { return 0; }
1822*5113495bSYour Name 
1823*5113495bSYour Name static inline
hif_runtime_lock_deinit(struct hif_pm_runtime_lock * data)1824*5113495bSYour Name void hif_runtime_lock_deinit(struct hif_pm_runtime_lock *data)
1825*5113495bSYour Name {}
1826*5113495bSYour Name 
1827*5113495bSYour Name static inline
hif_rtpm_get(uint8_t type,uint32_t id)1828*5113495bSYour Name int hif_rtpm_get(uint8_t type, uint32_t id)
1829*5113495bSYour Name { return QDF_STATUS_SUCCESS; }
1830*5113495bSYour Name 
1831*5113495bSYour Name static inline
hif_rtpm_put(uint8_t type,uint32_t id)1832*5113495bSYour Name QDF_STATUS hif_rtpm_put(uint8_t type, uint32_t id)
1833*5113495bSYour Name { return QDF_STATUS_SUCCESS; }
1834*5113495bSYour Name 
1835*5113495bSYour Name static inline
hif_pm_runtime_allow_suspend(struct hif_pm_runtime_lock * data)1836*5113495bSYour Name int hif_pm_runtime_allow_suspend(struct hif_pm_runtime_lock *data)
1837*5113495bSYour Name { return 0; }
1838*5113495bSYour Name 
1839*5113495bSYour Name static inline
hif_pm_runtime_prevent_suspend(struct hif_pm_runtime_lock * data)1840*5113495bSYour Name int hif_pm_runtime_prevent_suspend(struct hif_pm_runtime_lock *data)
1841*5113495bSYour Name { return 0; }
1842*5113495bSYour Name 
1843*5113495bSYour Name static inline
hif_pm_runtime_prevent_suspend_sync(struct hif_pm_runtime_lock * data)1844*5113495bSYour Name int hif_pm_runtime_prevent_suspend_sync(struct hif_pm_runtime_lock *data)
1845*5113495bSYour Name { return 0; }
1846*5113495bSYour Name 
1847*5113495bSYour Name static inline
hif_rtpm_sync_resume(void)1848*5113495bSYour Name QDF_STATUS hif_rtpm_sync_resume(void)
1849*5113495bSYour Name { return QDF_STATUS_SUCCESS; }
1850*5113495bSYour Name 
1851*5113495bSYour Name static inline
hif_rtpm_request_resume(void)1852*5113495bSYour Name void hif_rtpm_request_resume(void)
1853*5113495bSYour Name {}
1854*5113495bSYour Name 
1855*5113495bSYour Name static inline
hif_rtpm_check_and_request_resume(bool suspend_in_progress)1856*5113495bSYour Name void hif_rtpm_check_and_request_resume(bool suspend_in_progress)
1857*5113495bSYour Name {}
1858*5113495bSYour Name 
1859*5113495bSYour Name static inline
hif_rtpm_set_client_job(uint32_t client_id)1860*5113495bSYour Name void hif_rtpm_set_client_job(uint32_t client_id)
1861*5113495bSYour Name {}
1862*5113495bSYour Name 
1863*5113495bSYour Name static inline
hif_rtpm_print_prevent_list(void)1864*5113495bSYour Name void hif_rtpm_print_prevent_list(void)
1865*5113495bSYour Name {}
1866*5113495bSYour Name 
1867*5113495bSYour Name static inline
hif_rtpm_suspend_unlock(void)1868*5113495bSYour Name void hif_rtpm_suspend_unlock(void)
1869*5113495bSYour Name {}
1870*5113495bSYour Name 
1871*5113495bSYour Name static inline
hif_rtpm_suspend_lock(void)1872*5113495bSYour Name void hif_rtpm_suspend_lock(void)
1873*5113495bSYour Name {}
1874*5113495bSYour Name 
1875*5113495bSYour Name static inline
hif_rtpm_get_monitor_wake_intr(void)1876*5113495bSYour Name int hif_rtpm_get_monitor_wake_intr(void)
1877*5113495bSYour Name { return 0; }
1878*5113495bSYour Name 
1879*5113495bSYour Name static inline
hif_rtpm_set_monitor_wake_intr(int val)1880*5113495bSYour Name void hif_rtpm_set_monitor_wake_intr(int val)
1881*5113495bSYour Name {}
1882*5113495bSYour Name 
1883*5113495bSYour Name static inline
hif_rtpm_mark_last_busy(uint32_t id)1884*5113495bSYour Name void hif_rtpm_mark_last_busy(uint32_t id)
1885*5113495bSYour Name {}
1886*5113495bSYour Name 
1887*5113495bSYour Name static inline
hif_set_enable_rpm(struct hif_opaque_softc * hif_hdl)1888*5113495bSYour Name void hif_set_enable_rpm(struct hif_opaque_softc *hif_hdl)
1889*5113495bSYour Name {
1890*5113495bSYour Name }
1891*5113495bSYour Name #endif
1892*5113495bSYour Name 
1893*5113495bSYour Name void hif_enable_power_management(struct hif_opaque_softc *hif_ctx,
1894*5113495bSYour Name 				 bool is_packet_log_enabled);
1895*5113495bSYour Name void hif_disable_power_management(struct hif_opaque_softc *hif_ctx);
1896*5113495bSYour Name 
1897*5113495bSYour Name void hif_vote_link_up(struct hif_opaque_softc *hif_ctx);
1898*5113495bSYour Name void hif_vote_link_down(struct hif_opaque_softc *hif_ctx);
1899*5113495bSYour Name 
1900*5113495bSYour Name bool hif_can_suspend_link(struct hif_opaque_softc *hif_ctx);
1901*5113495bSYour Name 
1902*5113495bSYour Name #ifdef IPA_OFFLOAD
1903*5113495bSYour Name /**
1904*5113495bSYour Name  * hif_get_ipa_hw_type() - get IPA hw type
1905*5113495bSYour Name  *
1906*5113495bSYour Name  * This API return the IPA hw type.
1907*5113495bSYour Name  *
1908*5113495bSYour Name  * Return: IPA hw type
1909*5113495bSYour Name  */
1910*5113495bSYour Name static inline
hif_get_ipa_hw_type(void)1911*5113495bSYour Name enum ipa_hw_type hif_get_ipa_hw_type(void)
1912*5113495bSYour Name {
1913*5113495bSYour Name 	return ipa_get_hw_type();
1914*5113495bSYour Name }
1915*5113495bSYour Name 
1916*5113495bSYour Name /**
1917*5113495bSYour Name  * hif_get_ipa_present() - get IPA hw status
1918*5113495bSYour Name  *
1919*5113495bSYour Name  * This API return the IPA hw status.
1920*5113495bSYour Name  *
1921*5113495bSYour Name  * Return: true if IPA is present or false otherwise
1922*5113495bSYour Name  */
1923*5113495bSYour Name static inline
hif_get_ipa_present(void)1924*5113495bSYour Name bool hif_get_ipa_present(void)
1925*5113495bSYour Name {
1926*5113495bSYour Name 	if (qdf_ipa_uc_reg_rdyCB(NULL) != -EPERM)
1927*5113495bSYour Name 		return true;
1928*5113495bSYour Name 	else
1929*5113495bSYour Name 		return false;
1930*5113495bSYour Name }
1931*5113495bSYour Name #endif
1932*5113495bSYour Name int hif_bus_resume(struct hif_opaque_softc *hif_ctx);
1933*5113495bSYour Name 
1934*5113495bSYour Name /**
1935*5113495bSYour Name  * hif_bus_early_suspend() - stop non wmi tx traffic
1936*5113495bSYour Name  * @hif_ctx: hif context
1937*5113495bSYour Name  */
1938*5113495bSYour Name int hif_bus_early_suspend(struct hif_opaque_softc *hif_ctx);
1939*5113495bSYour Name 
1940*5113495bSYour Name /**
1941*5113495bSYour Name  * hif_bus_late_resume() - resume non wmi traffic
1942*5113495bSYour Name  * @hif_ctx: hif context
1943*5113495bSYour Name  */
1944*5113495bSYour Name int hif_bus_late_resume(struct hif_opaque_softc *hif_ctx);
1945*5113495bSYour Name int hif_bus_suspend(struct hif_opaque_softc *hif_ctx);
1946*5113495bSYour Name int hif_bus_resume_noirq(struct hif_opaque_softc *hif_ctx);
1947*5113495bSYour Name int hif_bus_suspend_noirq(struct hif_opaque_softc *hif_ctx);
1948*5113495bSYour Name 
1949*5113495bSYour Name /**
1950*5113495bSYour Name  * hif_apps_irqs_enable() - Enables all irqs from the APPS side
1951*5113495bSYour Name  * @hif_ctx: an opaque HIF handle to use
1952*5113495bSYour Name  *
1953*5113495bSYour Name  * As opposed to the standard hif_irq_enable, this function always applies to
1954*5113495bSYour Name  * the APPS side kernel interrupt handling.
1955*5113495bSYour Name  *
1956*5113495bSYour Name  * Return: errno
1957*5113495bSYour Name  */
1958*5113495bSYour Name int hif_apps_irqs_enable(struct hif_opaque_softc *hif_ctx);
1959*5113495bSYour Name 
1960*5113495bSYour Name /**
1961*5113495bSYour Name  * hif_apps_irqs_disable() - Disables all irqs from the APPS side
1962*5113495bSYour Name  * @hif_ctx: an opaque HIF handle to use
1963*5113495bSYour Name  *
1964*5113495bSYour Name  * As opposed to the standard hif_irq_disable, this function always applies to
1965*5113495bSYour Name  * the APPS side kernel interrupt handling.
1966*5113495bSYour Name  *
1967*5113495bSYour Name  * Return: errno
1968*5113495bSYour Name  */
1969*5113495bSYour Name int hif_apps_irqs_disable(struct hif_opaque_softc *hif_ctx);
1970*5113495bSYour Name 
1971*5113495bSYour Name /**
1972*5113495bSYour Name  * hif_apps_wake_irq_enable() - Enables the wake irq from the APPS side
1973*5113495bSYour Name  * @hif_ctx: an opaque HIF handle to use
1974*5113495bSYour Name  *
1975*5113495bSYour Name  * As opposed to the standard hif_irq_enable, this function always applies to
1976*5113495bSYour Name  * the APPS side kernel interrupt handling.
1977*5113495bSYour Name  *
1978*5113495bSYour Name  * Return: errno
1979*5113495bSYour Name  */
1980*5113495bSYour Name int hif_apps_wake_irq_enable(struct hif_opaque_softc *hif_ctx);
1981*5113495bSYour Name 
1982*5113495bSYour Name /**
1983*5113495bSYour Name  * hif_apps_wake_irq_disable() - Disables the wake irq from the APPS side
1984*5113495bSYour Name  * @hif_ctx: an opaque HIF handle to use
1985*5113495bSYour Name  *
1986*5113495bSYour Name  * As opposed to the standard hif_irq_disable, this function always applies to
1987*5113495bSYour Name  * the APPS side kernel interrupt handling.
1988*5113495bSYour Name  *
1989*5113495bSYour Name  * Return: errno
1990*5113495bSYour Name  */
1991*5113495bSYour Name int hif_apps_wake_irq_disable(struct hif_opaque_softc *hif_ctx);
1992*5113495bSYour Name 
1993*5113495bSYour Name /**
1994*5113495bSYour Name  * hif_apps_enable_irq_wake() - Enables the irq wake from the APPS side
1995*5113495bSYour Name  * @hif_ctx: an opaque HIF handle to use
1996*5113495bSYour Name  *
1997*5113495bSYour Name  * This function always applies to the APPS side kernel interrupt handling
1998*5113495bSYour Name  * to wake the system from suspend.
1999*5113495bSYour Name  *
2000*5113495bSYour Name  * Return: errno
2001*5113495bSYour Name  */
2002*5113495bSYour Name int hif_apps_enable_irq_wake(struct hif_opaque_softc *hif_ctx);
2003*5113495bSYour Name 
2004*5113495bSYour Name /**
2005*5113495bSYour Name  * hif_apps_disable_irq_wake() - Disables the wake irq from the APPS side
2006*5113495bSYour Name  * @hif_ctx: an opaque HIF handle to use
2007*5113495bSYour Name  *
2008*5113495bSYour Name  * This function always applies to the APPS side kernel interrupt handling
2009*5113495bSYour Name  * to disable the wake irq.
2010*5113495bSYour Name  *
2011*5113495bSYour Name  * Return: errno
2012*5113495bSYour Name  */
2013*5113495bSYour Name int hif_apps_disable_irq_wake(struct hif_opaque_softc *hif_ctx);
2014*5113495bSYour Name 
2015*5113495bSYour Name /**
2016*5113495bSYour Name  * hif_apps_enable_irqs_except_wake_irq() - Enables all irqs except wake_irq
2017*5113495bSYour Name  * @hif_ctx: an opaque HIF handle to use
2018*5113495bSYour Name  *
2019*5113495bSYour Name  * As opposed to the standard hif_irq_enable, this function always applies to
2020*5113495bSYour Name  * the APPS side kernel interrupt handling.
2021*5113495bSYour Name  *
2022*5113495bSYour Name  * Return: errno
2023*5113495bSYour Name  */
2024*5113495bSYour Name int hif_apps_enable_irqs_except_wake_irq(struct hif_opaque_softc *hif_ctx);
2025*5113495bSYour Name 
2026*5113495bSYour Name /**
2027*5113495bSYour Name  * hif_apps_disable_irqs_except_wake_irq() - Disables all irqs except wake_irq
2028*5113495bSYour Name  * @hif_ctx: an opaque HIF handle to use
2029*5113495bSYour Name  *
2030*5113495bSYour Name  * As opposed to the standard hif_irq_disable, this function always applies to
2031*5113495bSYour Name  * the APPS side kernel interrupt handling.
2032*5113495bSYour Name  *
2033*5113495bSYour Name  * Return: errno
2034*5113495bSYour Name  */
2035*5113495bSYour Name int hif_apps_disable_irqs_except_wake_irq(struct hif_opaque_softc *hif_ctx);
2036*5113495bSYour Name 
2037*5113495bSYour Name int hif_get_irq_num(struct hif_opaque_softc *scn, int *irq, uint32_t size);
2038*5113495bSYour Name int hif_dump_registers(struct hif_opaque_softc *scn);
2039*5113495bSYour Name int ol_copy_ramdump(struct hif_opaque_softc *scn);
2040*5113495bSYour Name void hif_crash_shutdown(struct hif_opaque_softc *hif_ctx);
2041*5113495bSYour Name void hif_get_hw_info(struct hif_opaque_softc *hif_ctx, u32 *version,
2042*5113495bSYour Name 		     u32 *revision, const char **target_name);
2043*5113495bSYour Name enum qdf_bus_type hif_get_bus_type(struct hif_opaque_softc *hif_hdl);
2044*5113495bSYour Name struct hif_target_info *hif_get_target_info_handle(struct hif_opaque_softc *
2045*5113495bSYour Name 						   scn);
2046*5113495bSYour Name struct hif_config_info *hif_get_ini_handle(struct hif_opaque_softc *hif_ctx);
2047*5113495bSYour Name struct ramdump_info *hif_get_ramdump_ctx(struct hif_opaque_softc *hif_ctx);
2048*5113495bSYour Name enum hif_target_status hif_get_target_status(struct hif_opaque_softc *hif_ctx);
2049*5113495bSYour Name void hif_set_target_status(struct hif_opaque_softc *hif_ctx, enum
2050*5113495bSYour Name 			   hif_target_status);
2051*5113495bSYour Name void hif_init_ini_config(struct hif_opaque_softc *hif_ctx,
2052*5113495bSYour Name 			 struct hif_config_info *cfg);
2053*5113495bSYour Name void hif_update_tx_ring(struct hif_opaque_softc *osc, u_int32_t num_htt_cmpls);
2054*5113495bSYour Name qdf_nbuf_t hif_batch_send(struct hif_opaque_softc *osc, qdf_nbuf_t msdu,
2055*5113495bSYour Name 		uint32_t transfer_id, u_int32_t len, uint32_t sendhead);
2056*5113495bSYour Name QDF_STATUS hif_send_single(struct hif_opaque_softc *osc, qdf_nbuf_t msdu,
2057*5113495bSYour Name 			   uint32_t transfer_id, u_int32_t len);
2058*5113495bSYour Name int hif_send_fast(struct hif_opaque_softc *osc, qdf_nbuf_t nbuf,
2059*5113495bSYour Name 	uint32_t transfer_id, uint32_t download_len);
2060*5113495bSYour Name void hif_pkt_dl_len_set(void *hif_sc, unsigned int pkt_download_len);
2061*5113495bSYour Name void hif_ce_war_disable(void);
2062*5113495bSYour Name void hif_ce_war_enable(void);
2063*5113495bSYour Name void hif_disable_interrupt(struct hif_opaque_softc *osc, uint32_t pipe_num);
2064*5113495bSYour Name #ifdef QCA_NSS_WIFI_OFFLOAD_SUPPORT
2065*5113495bSYour Name struct hif_pipe_addl_info *hif_get_addl_pipe_info(struct hif_opaque_softc *osc,
2066*5113495bSYour Name 		struct hif_pipe_addl_info *hif_info, uint32_t pipe_number);
2067*5113495bSYour Name uint32_t hif_set_nss_wifiol_mode(struct hif_opaque_softc *osc,
2068*5113495bSYour Name 		uint32_t pipe_num);
2069*5113495bSYour Name int32_t hif_get_nss_wifiol_bypass_nw_process(struct hif_opaque_softc *osc);
2070*5113495bSYour Name #endif /* QCA_NSS_WIFI_OFFLOAD_SUPPORT */
2071*5113495bSYour Name 
2072*5113495bSYour Name void hif_set_bundle_mode(struct hif_opaque_softc *hif_ctx, bool enabled,
2073*5113495bSYour Name 				int rx_bundle_cnt);
2074*5113495bSYour Name int hif_bus_reset_resume(struct hif_opaque_softc *hif_ctx);
2075*5113495bSYour Name 
2076*5113495bSYour Name void hif_set_attribute(struct hif_opaque_softc *osc, uint8_t hif_attrib);
2077*5113495bSYour Name 
2078*5113495bSYour Name void *hif_get_lro_info(int ctx_id, struct hif_opaque_softc *hif_hdl);
2079*5113495bSYour Name 
2080*5113495bSYour Name enum hif_exec_type {
2081*5113495bSYour Name 	HIF_EXEC_NAPI_TYPE,
2082*5113495bSYour Name 	HIF_EXEC_TASKLET_TYPE,
2083*5113495bSYour Name };
2084*5113495bSYour Name 
2085*5113495bSYour Name typedef uint32_t (*ext_intr_handler)(void *, uint32_t, int);
2086*5113495bSYour Name 
2087*5113495bSYour Name /**
2088*5113495bSYour Name  * hif_get_int_ctx_irq_num() - retrieve an irq num for an interrupt context id
2089*5113495bSYour Name  * @softc: hif opaque context owning the exec context
2090*5113495bSYour Name  * @id: the id of the interrupt context
2091*5113495bSYour Name  *
2092*5113495bSYour Name  * Return: IRQ number of the first (zero'th) IRQ within the interrupt context ID
2093*5113495bSYour Name  *         'id' registered with the OS
2094*5113495bSYour Name  */
2095*5113495bSYour Name int32_t hif_get_int_ctx_irq_num(struct hif_opaque_softc *softc,
2096*5113495bSYour Name 				uint8_t id);
2097*5113495bSYour Name 
2098*5113495bSYour Name /**
2099*5113495bSYour Name  * hif_configure_ext_group_interrupts() - Configure ext group interrupts
2100*5113495bSYour Name  * @hif_ctx: hif opaque context
2101*5113495bSYour Name  *
2102*5113495bSYour Name  * Return: QDF_STATUS
2103*5113495bSYour Name  */
2104*5113495bSYour Name QDF_STATUS hif_configure_ext_group_interrupts(struct hif_opaque_softc *hif_ctx);
2105*5113495bSYour Name 
2106*5113495bSYour Name /**
2107*5113495bSYour Name  * hif_deconfigure_ext_group_interrupts() - Deconfigure ext group interrupts
2108*5113495bSYour Name  * @hif_ctx: hif opaque context
2109*5113495bSYour Name  *
2110*5113495bSYour Name  * Return: None
2111*5113495bSYour Name  */
2112*5113495bSYour Name void hif_deconfigure_ext_group_interrupts(struct hif_opaque_softc *hif_ctx);
2113*5113495bSYour Name 
2114*5113495bSYour Name /**
2115*5113495bSYour Name  * hif_register_ext_group() - API to register external group
2116*5113495bSYour Name  * interrupt handler.
2117*5113495bSYour Name  * @hif_ctx : HIF Context
2118*5113495bSYour Name  * @numirq: number of irq's in the group
2119*5113495bSYour Name  * @irq: array of irq values
2120*5113495bSYour Name  * @handler: callback interrupt handler function
2121*5113495bSYour Name  * @cb_ctx: context to passed in callback
2122*5113495bSYour Name  * @context_name: text name of the context
2123*5113495bSYour Name  * @type: napi vs tasklet
2124*5113495bSYour Name  * @scale:
2125*5113495bSYour Name  *
2126*5113495bSYour Name  * Return: QDF_STATUS
2127*5113495bSYour Name  */
2128*5113495bSYour Name QDF_STATUS hif_register_ext_group(struct hif_opaque_softc *hif_ctx,
2129*5113495bSYour Name 				  uint32_t numirq, uint32_t irq[],
2130*5113495bSYour Name 				  ext_intr_handler handler,
2131*5113495bSYour Name 				  void *cb_ctx, const char *context_name,
2132*5113495bSYour Name 				  enum hif_exec_type type, uint32_t scale);
2133*5113495bSYour Name 
2134*5113495bSYour Name void hif_deregister_exec_group(struct hif_opaque_softc *hif_ctx,
2135*5113495bSYour Name 				const char *context_name);
2136*5113495bSYour Name 
2137*5113495bSYour Name void hif_update_pipe_callback(struct hif_opaque_softc *osc,
2138*5113495bSYour Name 				u_int8_t pipeid,
2139*5113495bSYour Name 				struct hif_msg_callbacks *callbacks);
2140*5113495bSYour Name 
2141*5113495bSYour Name /**
2142*5113495bSYour Name  * hif_print_napi_stats() - Display HIF NAPI stats
2143*5113495bSYour Name  * @hif_ctx: HIF opaque context
2144*5113495bSYour Name  *
2145*5113495bSYour Name  * Return: None
2146*5113495bSYour Name  */
2147*5113495bSYour Name void hif_print_napi_stats(struct hif_opaque_softc *hif_ctx);
2148*5113495bSYour Name 
2149*5113495bSYour Name /**
2150*5113495bSYour Name  * hif_clear_napi_stats() - function clears the stats of the
2151*5113495bSYour Name  * latency when called.
2152*5113495bSYour Name  * @hif_ctx: the HIF context to assign the callback to
2153*5113495bSYour Name  *
2154*5113495bSYour Name  * Return: None
2155*5113495bSYour Name  */
2156*5113495bSYour Name void hif_clear_napi_stats(struct hif_opaque_softc *hif_ctx);
2157*5113495bSYour Name 
2158*5113495bSYour Name #ifdef __cplusplus
2159*5113495bSYour Name }
2160*5113495bSYour Name #endif
2161*5113495bSYour Name 
2162*5113495bSYour Name #ifdef FORCE_WAKE
2163*5113495bSYour Name /**
2164*5113495bSYour Name  * hif_force_wake_request() - Function to wake from power collapse
2165*5113495bSYour Name  * @handle: HIF opaque handle
2166*5113495bSYour Name  *
2167*5113495bSYour Name  * Description: API to check if the device is awake or not before
2168*5113495bSYour Name  * read/write to BAR + 4K registers. If device is awake return
2169*5113495bSYour Name  * success otherwise write '1' to
2170*5113495bSYour Name  * PCIE_PCIE_LOCAL_REG_PCIE_SOC_WAKE_PCIE_LOCAL_REG which will interrupt
2171*5113495bSYour Name  * the device and does wakeup the PCI and MHI within 50ms
2172*5113495bSYour Name  * and then the device writes a value to
2173*5113495bSYour Name  * PCIE_SOC_PCIE_REG_PCIE_SCRATCH_0_SOC_PCIE_REG to complete the
2174*5113495bSYour Name  * handshake process to let the host know the device is awake.
2175*5113495bSYour Name  *
2176*5113495bSYour Name  * Return: zero - success/non-zero - failure
2177*5113495bSYour Name  */
2178*5113495bSYour Name int hif_force_wake_request(struct hif_opaque_softc *handle);
2179*5113495bSYour Name 
2180*5113495bSYour Name /**
2181*5113495bSYour Name  * hif_force_wake_release() - API to release/reset the SOC wake register
2182*5113495bSYour Name  * from interrupting the device.
2183*5113495bSYour Name  * @handle: HIF opaque handle
2184*5113495bSYour Name  *
2185*5113495bSYour Name  * Description: API to set the
2186*5113495bSYour Name  * PCIE_PCIE_LOCAL_REG_PCIE_SOC_WAKE_PCIE_LOCAL_REG to '0'
2187*5113495bSYour Name  * to release the interrupt line.
2188*5113495bSYour Name  *
2189*5113495bSYour Name  * Return: zero - success/non-zero - failure
2190*5113495bSYour Name  */
2191*5113495bSYour Name int hif_force_wake_release(struct hif_opaque_softc *handle);
2192*5113495bSYour Name #else
2193*5113495bSYour Name static inline
hif_force_wake_request(struct hif_opaque_softc * handle)2194*5113495bSYour Name int hif_force_wake_request(struct hif_opaque_softc *handle)
2195*5113495bSYour Name {
2196*5113495bSYour Name 	return 0;
2197*5113495bSYour Name }
2198*5113495bSYour Name 
2199*5113495bSYour Name static inline
hif_force_wake_release(struct hif_opaque_softc * handle)2200*5113495bSYour Name int hif_force_wake_release(struct hif_opaque_softc *handle)
2201*5113495bSYour Name {
2202*5113495bSYour Name 	return 0;
2203*5113495bSYour Name }
2204*5113495bSYour Name #endif /* FORCE_WAKE */
2205*5113495bSYour Name 
2206*5113495bSYour Name #if defined(FEATURE_HAL_DELAYED_REG_WRITE) || \
2207*5113495bSYour Name 	defined(FEATURE_HIF_DELAYED_REG_WRITE)
2208*5113495bSYour Name /**
2209*5113495bSYour Name  * hif_prevent_link_low_power_states() - Prevent from going to low power states
2210*5113495bSYour Name  * @hif: HIF opaque context
2211*5113495bSYour Name  *
2212*5113495bSYour Name  * Return: 0 on success. Error code on failure.
2213*5113495bSYour Name  */
2214*5113495bSYour Name int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif);
2215*5113495bSYour Name 
2216*5113495bSYour Name /**
2217*5113495bSYour Name  * hif_allow_link_low_power_states() - Allow link to go to low power states
2218*5113495bSYour Name  * @hif: HIF opaque context
2219*5113495bSYour Name  *
2220*5113495bSYour Name  * Return: None
2221*5113495bSYour Name  */
2222*5113495bSYour Name void hif_allow_link_low_power_states(struct hif_opaque_softc *hif);
2223*5113495bSYour Name 
2224*5113495bSYour Name #else
2225*5113495bSYour Name 
2226*5113495bSYour Name static inline
hif_prevent_link_low_power_states(struct hif_opaque_softc * hif)2227*5113495bSYour Name int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif)
2228*5113495bSYour Name {
2229*5113495bSYour Name 	return 0;
2230*5113495bSYour Name }
2231*5113495bSYour Name 
2232*5113495bSYour Name static inline
hif_allow_link_low_power_states(struct hif_opaque_softc * hif)2233*5113495bSYour Name void hif_allow_link_low_power_states(struct hif_opaque_softc *hif)
2234*5113495bSYour Name {
2235*5113495bSYour Name }
2236*5113495bSYour Name #endif
2237*5113495bSYour Name 
2238*5113495bSYour Name #ifdef IPA_OPT_WIFI_DP
2239*5113495bSYour Name /**
2240*5113495bSYour Name  * hif_prevent_l1() - Prevent from going to low power states
2241*5113495bSYour Name  * @hif: HIF opaque context
2242*5113495bSYour Name  *
2243*5113495bSYour Name  * Return: 0 on success. Error code on failure.
2244*5113495bSYour Name  */
2245*5113495bSYour Name int hif_prevent_l1(struct hif_opaque_softc *hif);
2246*5113495bSYour Name 
2247*5113495bSYour Name /**
2248*5113495bSYour Name  * hif_allow_l1() - Allow link to go to low power states
2249*5113495bSYour Name  * @hif: HIF opaque context
2250*5113495bSYour Name  *
2251*5113495bSYour Name  * Return: None
2252*5113495bSYour Name  */
2253*5113495bSYour Name void hif_allow_l1(struct hif_opaque_softc *hif);
2254*5113495bSYour Name 
2255*5113495bSYour Name #else
2256*5113495bSYour Name 
2257*5113495bSYour Name static inline
hif_prevent_l1(struct hif_opaque_softc * hif)2258*5113495bSYour Name int hif_prevent_l1(struct hif_opaque_softc *hif)
2259*5113495bSYour Name {
2260*5113495bSYour Name 	return 0;
2261*5113495bSYour Name }
2262*5113495bSYour Name 
2263*5113495bSYour Name static inline
hif_allow_l1(struct hif_opaque_softc * hif)2264*5113495bSYour Name void hif_allow_l1(struct hif_opaque_softc *hif)
2265*5113495bSYour Name {
2266*5113495bSYour Name }
2267*5113495bSYour Name #endif
2268*5113495bSYour Name 
2269*5113495bSYour Name void *hif_get_dev_ba(struct hif_opaque_softc *hif_handle);
2270*5113495bSYour Name void *hif_get_dev_ba_ce(struct hif_opaque_softc *hif_handle);
2271*5113495bSYour Name void *hif_get_dev_ba_pmm(struct hif_opaque_softc *hif_handle);
2272*5113495bSYour Name 
2273*5113495bSYour Name /**
2274*5113495bSYour Name  * hif_get_dev_ba_cmem() - get base address of CMEM
2275*5113495bSYour Name  * @hif_handle: the HIF context
2276*5113495bSYour Name  *
2277*5113495bSYour Name  */
2278*5113495bSYour Name void *hif_get_dev_ba_cmem(struct hif_opaque_softc *hif_handle);
2279*5113495bSYour Name 
2280*5113495bSYour Name /**
2281*5113495bSYour Name  * hif_get_soc_version() - get soc major version from target info
2282*5113495bSYour Name  * @hif_handle: the HIF context
2283*5113495bSYour Name  *
2284*5113495bSYour Name  * Return: version number
2285*5113495bSYour Name  */
2286*5113495bSYour Name uint32_t hif_get_soc_version(struct hif_opaque_softc *hif_handle);
2287*5113495bSYour Name 
2288*5113495bSYour Name /**
2289*5113495bSYour Name  * hif_set_initial_wakeup_cb() - set the initial wakeup event handler function
2290*5113495bSYour Name  * @hif_ctx: the HIF context to assign the callback to
2291*5113495bSYour Name  * @callback: the callback to assign
2292*5113495bSYour Name  * @priv: the private data to pass to the callback when invoked
2293*5113495bSYour Name  *
2294*5113495bSYour Name  * Return: None
2295*5113495bSYour Name  */
2296*5113495bSYour Name void hif_set_initial_wakeup_cb(struct hif_opaque_softc *hif_ctx,
2297*5113495bSYour Name 			       void (*callback)(void *),
2298*5113495bSYour Name 			       void *priv);
2299*5113495bSYour Name /*
2300*5113495bSYour Name  * Note: For MCL, #if defined (HIF_CONFIG_SLUB_DEBUG_ON) needs to be checked
2301*5113495bSYour Name  * for defined here
2302*5113495bSYour Name  */
2303*5113495bSYour Name #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
2304*5113495bSYour Name ssize_t hif_dump_desc_trace_buf(struct device *dev,
2305*5113495bSYour Name 				struct device_attribute *attr, char *buf);
2306*5113495bSYour Name ssize_t hif_input_desc_trace_buf_index(struct hif_softc *scn,
2307*5113495bSYour Name 					const char *buf, size_t size);
2308*5113495bSYour Name ssize_t hif_ce_en_desc_hist(struct hif_softc *scn,
2309*5113495bSYour Name 				const char *buf, size_t size);
2310*5113495bSYour Name ssize_t hif_disp_ce_enable_desc_data_hist(struct hif_softc *scn, char *buf);
2311*5113495bSYour Name ssize_t hif_dump_desc_event(struct hif_softc *scn, char *buf);
2312*5113495bSYour Name #endif/*#if defined(HIF_CONFIG_SLUB_DEBUG_ON)||defined(HIF_CE_DEBUG_DATA_BUF)*/
2313*5113495bSYour Name 
2314*5113495bSYour Name /**
2315*5113495bSYour Name  * hif_set_ce_service_max_yield_time() - sets CE service max yield time
2316*5113495bSYour Name  * @hif: hif context
2317*5113495bSYour Name  * @ce_service_max_yield_time: CE service max yield time to set
2318*5113495bSYour Name  *
2319*5113495bSYour Name  * This API storess CE service max yield time in hif context based
2320*5113495bSYour Name  * on ini value.
2321*5113495bSYour Name  *
2322*5113495bSYour Name  * Return: void
2323*5113495bSYour Name  */
2324*5113495bSYour Name void hif_set_ce_service_max_yield_time(struct hif_opaque_softc *hif,
2325*5113495bSYour Name 				       uint32_t ce_service_max_yield_time);
2326*5113495bSYour Name 
2327*5113495bSYour Name /**
2328*5113495bSYour Name  * hif_get_ce_service_max_yield_time() - get CE service max yield time
2329*5113495bSYour Name  * @hif: hif context
2330*5113495bSYour Name  *
2331*5113495bSYour Name  * This API returns CE service max yield time.
2332*5113495bSYour Name  *
2333*5113495bSYour Name  * Return: CE service max yield time
2334*5113495bSYour Name  */
2335*5113495bSYour Name unsigned long long
2336*5113495bSYour Name hif_get_ce_service_max_yield_time(struct hif_opaque_softc *hif);
2337*5113495bSYour Name 
2338*5113495bSYour Name /**
2339*5113495bSYour Name  * hif_set_ce_service_max_rx_ind_flush() - sets CE service max rx ind flush
2340*5113495bSYour Name  * @hif: hif context
2341*5113495bSYour Name  * @ce_service_max_rx_ind_flush: CE service max rx ind flush to set
2342*5113495bSYour Name  *
2343*5113495bSYour Name  * This API stores CE service max rx ind flush in hif context based
2344*5113495bSYour Name  * on ini value.
2345*5113495bSYour Name  *
2346*5113495bSYour Name  * Return: void
2347*5113495bSYour Name  */
2348*5113495bSYour Name void hif_set_ce_service_max_rx_ind_flush(struct hif_opaque_softc *hif,
2349*5113495bSYour Name 					 uint8_t ce_service_max_rx_ind_flush);
2350*5113495bSYour Name 
2351*5113495bSYour Name #ifdef OL_ATH_SMART_LOGGING
2352*5113495bSYour Name /**
2353*5113495bSYour Name  * hif_log_dump_ce() - Copy all the CE DEST ring to buf
2354*5113495bSYour Name  * @scn: HIF handler
2355*5113495bSYour Name  * @buf_cur: Current pointer in ring buffer
2356*5113495bSYour Name  * @buf_init:Start of the ring buffer
2357*5113495bSYour Name  * @buf_sz: Size of the ring buffer
2358*5113495bSYour Name  * @ce: Copy Engine id
2359*5113495bSYour Name  * @skb_sz: Max size of the SKB buffer to be copied
2360*5113495bSYour Name  *
2361*5113495bSYour Name  * Calls the respective function to dump all the CE SRC/DEST ring descriptors
2362*5113495bSYour Name  * and buffers pointed by them in to the given buf
2363*5113495bSYour Name  *
2364*5113495bSYour Name  * Return: Current pointer in ring buffer
2365*5113495bSYour Name  */
2366*5113495bSYour Name uint8_t *hif_log_dump_ce(struct hif_softc *scn, uint8_t *buf_cur,
2367*5113495bSYour Name 			 uint8_t *buf_init, uint32_t buf_sz,
2368*5113495bSYour Name 			 uint32_t ce, uint32_t skb_sz);
2369*5113495bSYour Name #endif /* OL_ATH_SMART_LOGGING */
2370*5113495bSYour Name 
2371*5113495bSYour Name /**
2372*5113495bSYour Name  * hif_softc_to_hif_opaque_softc() - API to convert hif_softc handle
2373*5113495bSYour Name  * to hif_opaque_softc handle
2374*5113495bSYour Name  * @hif_handle: hif_softc type
2375*5113495bSYour Name  *
2376*5113495bSYour Name  * Return: hif_opaque_softc type
2377*5113495bSYour Name  */
2378*5113495bSYour Name static inline struct hif_opaque_softc *
hif_softc_to_hif_opaque_softc(struct hif_softc * hif_handle)2379*5113495bSYour Name hif_softc_to_hif_opaque_softc(struct hif_softc *hif_handle)
2380*5113495bSYour Name {
2381*5113495bSYour Name 	return (struct hif_opaque_softc *)hif_handle;
2382*5113495bSYour Name }
2383*5113495bSYour Name 
2384*5113495bSYour Name /**
2385*5113495bSYour Name  * hif_try_complete_dp_tasks() - Try to complete all DP related tasks
2386*5113495bSYour Name  * @hif_ctx: opaque softc handle
2387*5113495bSYour Name  *
2388*5113495bSYour Name  * Return: QDF_STATUS of operation
2389*5113495bSYour Name  */
2390*5113495bSYour Name QDF_STATUS hif_try_complete_dp_tasks(struct hif_opaque_softc *hif_ctx);
2391*5113495bSYour Name 
2392*5113495bSYour Name #if defined(HIF_IPCI) && defined(FEATURE_HAL_DELAYED_REG_WRITE)
2393*5113495bSYour Name QDF_STATUS hif_try_prevent_ep_vote_access(struct hif_opaque_softc *hif_ctx);
2394*5113495bSYour Name void hif_set_ep_intermediate_vote_access(struct hif_opaque_softc *hif_ctx);
2395*5113495bSYour Name void hif_allow_ep_vote_access(struct hif_opaque_softc *hif_ctx);
2396*5113495bSYour Name void hif_set_ep_vote_access(struct hif_opaque_softc *hif_ctx,
2397*5113495bSYour Name 			    uint8_t type, uint8_t access);
2398*5113495bSYour Name uint8_t hif_get_ep_vote_access(struct hif_opaque_softc *hif_ctx,
2399*5113495bSYour Name 			       uint8_t type);
2400*5113495bSYour Name #else
2401*5113495bSYour Name static inline QDF_STATUS
hif_try_prevent_ep_vote_access(struct hif_opaque_softc * hif_ctx)2402*5113495bSYour Name hif_try_prevent_ep_vote_access(struct hif_opaque_softc *hif_ctx)
2403*5113495bSYour Name {
2404*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
2405*5113495bSYour Name }
2406*5113495bSYour Name 
2407*5113495bSYour Name static inline void
hif_set_ep_intermediate_vote_access(struct hif_opaque_softc * hif_ctx)2408*5113495bSYour Name hif_set_ep_intermediate_vote_access(struct hif_opaque_softc *hif_ctx)
2409*5113495bSYour Name {
2410*5113495bSYour Name }
2411*5113495bSYour Name 
2412*5113495bSYour Name static inline void
hif_allow_ep_vote_access(struct hif_opaque_softc * hif_ctx)2413*5113495bSYour Name hif_allow_ep_vote_access(struct hif_opaque_softc *hif_ctx)
2414*5113495bSYour Name {
2415*5113495bSYour Name }
2416*5113495bSYour Name 
2417*5113495bSYour Name static inline void
hif_set_ep_vote_access(struct hif_opaque_softc * hif_ctx,uint8_t type,uint8_t access)2418*5113495bSYour Name hif_set_ep_vote_access(struct hif_opaque_softc *hif_ctx,
2419*5113495bSYour Name 		       uint8_t type, uint8_t access)
2420*5113495bSYour Name {
2421*5113495bSYour Name }
2422*5113495bSYour Name 
2423*5113495bSYour Name static inline uint8_t
hif_get_ep_vote_access(struct hif_opaque_softc * hif_ctx,uint8_t type)2424*5113495bSYour Name hif_get_ep_vote_access(struct hif_opaque_softc *hif_ctx,
2425*5113495bSYour Name 		       uint8_t type)
2426*5113495bSYour Name {
2427*5113495bSYour Name 	return HIF_EP_VOTE_ACCESS_ENABLE;
2428*5113495bSYour Name }
2429*5113495bSYour Name #endif
2430*5113495bSYour Name 
2431*5113495bSYour Name #ifdef FORCE_WAKE
2432*5113495bSYour Name /**
2433*5113495bSYour Name  * hif_srng_init_phase(): Indicate srng initialization phase
2434*5113495bSYour Name  * to avoid force wake as UMAC power collapse is not yet
2435*5113495bSYour Name  * enabled
2436*5113495bSYour Name  * @hif_ctx: hif opaque handle
2437*5113495bSYour Name  * @init_phase: initialization phase
2438*5113495bSYour Name  *
2439*5113495bSYour Name  * Return:  None
2440*5113495bSYour Name  */
2441*5113495bSYour Name void hif_srng_init_phase(struct hif_opaque_softc *hif_ctx,
2442*5113495bSYour Name 			 bool init_phase);
2443*5113495bSYour Name #else
2444*5113495bSYour Name static inline
hif_srng_init_phase(struct hif_opaque_softc * hif_ctx,bool init_phase)2445*5113495bSYour Name void hif_srng_init_phase(struct hif_opaque_softc *hif_ctx,
2446*5113495bSYour Name 			 bool init_phase)
2447*5113495bSYour Name {
2448*5113495bSYour Name }
2449*5113495bSYour Name #endif /* FORCE_WAKE */
2450*5113495bSYour Name 
2451*5113495bSYour Name #ifdef HIF_IPCI
2452*5113495bSYour Name /**
2453*5113495bSYour Name  * hif_shutdown_notifier_cb - Call back for shutdown notifier
2454*5113495bSYour Name  * @ctx: hif handle
2455*5113495bSYour Name  *
2456*5113495bSYour Name  * Return:  None
2457*5113495bSYour Name  */
2458*5113495bSYour Name void hif_shutdown_notifier_cb(void *ctx);
2459*5113495bSYour Name #else
2460*5113495bSYour Name static inline
hif_shutdown_notifier_cb(void * ctx)2461*5113495bSYour Name void hif_shutdown_notifier_cb(void *ctx)
2462*5113495bSYour Name {
2463*5113495bSYour Name }
2464*5113495bSYour Name #endif /* HIF_IPCI */
2465*5113495bSYour Name 
2466*5113495bSYour Name #ifdef HIF_CE_LOG_INFO
2467*5113495bSYour Name /**
2468*5113495bSYour Name  * hif_log_ce_info() - API to log ce info
2469*5113495bSYour Name  * @scn: hif handle
2470*5113495bSYour Name  * @data: hang event data buffer
2471*5113495bSYour Name  * @offset: offset at which data needs to be written
2472*5113495bSYour Name  *
2473*5113495bSYour Name  * Return:  None
2474*5113495bSYour Name  */
2475*5113495bSYour Name void hif_log_ce_info(struct hif_softc *scn, uint8_t *data,
2476*5113495bSYour Name 		     unsigned int *offset);
2477*5113495bSYour Name #else
2478*5113495bSYour Name static inline
hif_log_ce_info(struct hif_softc * scn,uint8_t * data,unsigned int * offset)2479*5113495bSYour Name void hif_log_ce_info(struct hif_softc *scn, uint8_t *data,
2480*5113495bSYour Name 		     unsigned int *offset)
2481*5113495bSYour Name {
2482*5113495bSYour Name }
2483*5113495bSYour Name #endif
2484*5113495bSYour Name 
2485*5113495bSYour Name #if defined(HIF_CPU_PERF_AFFINE_MASK) || \
2486*5113495bSYour Name 	defined(FEATURE_ENABLE_CE_DP_IRQ_AFFINE)
2487*5113495bSYour Name /**
2488*5113495bSYour Name  * hif_config_irq_set_perf_affinity_hint() - API to set affinity
2489*5113495bSYour Name  * @hif_ctx: hif opaque handle
2490*5113495bSYour Name  *
2491*5113495bSYour Name  * This function is used to move the WLAN IRQs to perf cores in
2492*5113495bSYour Name  * case of defconfig builds.
2493*5113495bSYour Name  *
2494*5113495bSYour Name  * Return:  None
2495*5113495bSYour Name  */
2496*5113495bSYour Name void hif_config_irq_set_perf_affinity_hint(
2497*5113495bSYour Name 	struct hif_opaque_softc *hif_ctx);
2498*5113495bSYour Name 
2499*5113495bSYour Name #else
hif_config_irq_set_perf_affinity_hint(struct hif_opaque_softc * hif_ctx)2500*5113495bSYour Name static inline void hif_config_irq_set_perf_affinity_hint(
2501*5113495bSYour Name 	struct hif_opaque_softc *hif_ctx)
2502*5113495bSYour Name {
2503*5113495bSYour Name }
2504*5113495bSYour Name #endif
2505*5113495bSYour Name 
2506*5113495bSYour Name /**
2507*5113495bSYour Name  * hif_apps_grp_irqs_enable() - enable ext grp irqs
2508*5113495bSYour Name  * @hif_ctx: HIF opaque context
2509*5113495bSYour Name  *
2510*5113495bSYour Name  * Return: 0 on success. Error code on failure.
2511*5113495bSYour Name  */
2512*5113495bSYour Name int hif_apps_grp_irqs_enable(struct hif_opaque_softc *hif_ctx);
2513*5113495bSYour Name 
2514*5113495bSYour Name /**
2515*5113495bSYour Name  * hif_apps_grp_irqs_disable() - disable ext grp irqs
2516*5113495bSYour Name  * @hif_ctx: HIF opaque context
2517*5113495bSYour Name  *
2518*5113495bSYour Name  * Return: 0 on success. Error code on failure.
2519*5113495bSYour Name  */
2520*5113495bSYour Name int hif_apps_grp_irqs_disable(struct hif_opaque_softc *hif_ctx);
2521*5113495bSYour Name 
2522*5113495bSYour Name /**
2523*5113495bSYour Name  * hif_disable_grp_irqs() - disable ext grp irqs
2524*5113495bSYour Name  * @scn: HIF opaque context
2525*5113495bSYour Name  *
2526*5113495bSYour Name  * Return: 0 on success. Error code on failure.
2527*5113495bSYour Name  */
2528*5113495bSYour Name int hif_disable_grp_irqs(struct hif_opaque_softc *scn);
2529*5113495bSYour Name 
2530*5113495bSYour Name /**
2531*5113495bSYour Name  * hif_enable_grp_irqs() - enable ext grp irqs
2532*5113495bSYour Name  * @scn: HIF opaque context
2533*5113495bSYour Name  *
2534*5113495bSYour Name  * Return: 0 on success. Error code on failure.
2535*5113495bSYour Name  */
2536*5113495bSYour Name int hif_enable_grp_irqs(struct hif_opaque_softc *scn);
2537*5113495bSYour Name 
2538*5113495bSYour Name enum hif_credit_exchange_type {
2539*5113495bSYour Name 	HIF_REQUEST_CREDIT,
2540*5113495bSYour Name 	HIF_PROCESS_CREDIT_REPORT,
2541*5113495bSYour Name };
2542*5113495bSYour Name 
2543*5113495bSYour Name enum hif_detect_latency_type {
2544*5113495bSYour Name 	HIF_DETECT_TASKLET,
2545*5113495bSYour Name 	HIF_DETECT_CREDIT,
2546*5113495bSYour Name 	HIF_DETECT_UNKNOWN
2547*5113495bSYour Name };
2548*5113495bSYour Name 
2549*5113495bSYour Name #ifdef HIF_DETECTION_LATENCY_ENABLE
2550*5113495bSYour Name void hif_latency_detect_credit_record_time(
2551*5113495bSYour Name 	enum hif_credit_exchange_type type,
2552*5113495bSYour Name 	struct hif_opaque_softc *hif_ctx);
2553*5113495bSYour Name 
2554*5113495bSYour Name void hif_latency_detect_timer_start(struct hif_opaque_softc *hif_ctx);
2555*5113495bSYour Name void hif_latency_detect_timer_stop(struct hif_opaque_softc *hif_ctx);
2556*5113495bSYour Name void hif_check_detection_latency(struct hif_softc *scn,
2557*5113495bSYour Name 				 bool from_timer,
2558*5113495bSYour Name 				 uint32_t bitmap_type);
2559*5113495bSYour Name void hif_set_enable_detection(struct hif_opaque_softc *hif_ctx, bool value);
2560*5113495bSYour Name 
2561*5113495bSYour Name /**
2562*5113495bSYour Name  * hif_tasklet_latency_record_exec() - record execute time and
2563*5113495bSYour Name  * check the latency
2564*5113495bSYour Name  * @scn: HIF opaque context
2565*5113495bSYour Name  * @idx: CE id
2566*5113495bSYour Name  *
2567*5113495bSYour Name  * Return: None
2568*5113495bSYour Name  */
2569*5113495bSYour Name void hif_tasklet_latency_record_exec(struct hif_softc *scn, int idx);
2570*5113495bSYour Name 
2571*5113495bSYour Name /**
2572*5113495bSYour Name  * hif_tasklet_latency_record_sched() - record schedule time of a tasklet
2573*5113495bSYour Name  * @scn: HIF opaque context
2574*5113495bSYour Name  * @idx: CE id
2575*5113495bSYour Name  *
2576*5113495bSYour Name  * Return: None
2577*5113495bSYour Name  */
2578*5113495bSYour Name void hif_tasklet_latency_record_sched(struct hif_softc *scn, int idx);
2579*5113495bSYour Name #else
2580*5113495bSYour Name static inline
hif_latency_detect_timer_start(struct hif_opaque_softc * hif_ctx)2581*5113495bSYour Name void hif_latency_detect_timer_start(struct hif_opaque_softc *hif_ctx)
2582*5113495bSYour Name {}
2583*5113495bSYour Name 
2584*5113495bSYour Name static inline
hif_latency_detect_timer_stop(struct hif_opaque_softc * hif_ctx)2585*5113495bSYour Name void hif_latency_detect_timer_stop(struct hif_opaque_softc *hif_ctx)
2586*5113495bSYour Name {}
2587*5113495bSYour Name 
2588*5113495bSYour Name static inline
hif_latency_detect_credit_record_time(enum hif_credit_exchange_type type,struct hif_opaque_softc * hif_ctx)2589*5113495bSYour Name void hif_latency_detect_credit_record_time(
2590*5113495bSYour Name 	enum hif_credit_exchange_type type,
2591*5113495bSYour Name 	struct hif_opaque_softc *hif_ctx)
2592*5113495bSYour Name {}
2593*5113495bSYour Name static inline
hif_check_detection_latency(struct hif_softc * scn,bool from_timer,uint32_t bitmap_type)2594*5113495bSYour Name void hif_check_detection_latency(struct hif_softc *scn,
2595*5113495bSYour Name 				 bool from_timer,
2596*5113495bSYour Name 				 uint32_t bitmap_type)
2597*5113495bSYour Name {}
2598*5113495bSYour Name 
2599*5113495bSYour Name static inline
hif_set_enable_detection(struct hif_opaque_softc * hif_ctx,bool value)2600*5113495bSYour Name void hif_set_enable_detection(struct hif_opaque_softc *hif_ctx, bool value)
2601*5113495bSYour Name {}
2602*5113495bSYour Name 
2603*5113495bSYour Name static inline
hif_tasklet_latency_record_exec(struct hif_softc * scn,int idx)2604*5113495bSYour Name void hif_tasklet_latency_record_exec(struct hif_softc *scn, int idx)
2605*5113495bSYour Name {}
2606*5113495bSYour Name 
2607*5113495bSYour Name static inline
hif_tasklet_latency_record_sched(struct hif_softc * scn,int idx)2608*5113495bSYour Name void hif_tasklet_latency_record_sched(struct hif_softc *scn, int idx)
2609*5113495bSYour Name {}
2610*5113495bSYour Name #endif
2611*5113495bSYour Name 
2612*5113495bSYour Name #ifdef SYSTEM_PM_CHECK
2613*5113495bSYour Name /**
2614*5113495bSYour Name  * __hif_system_pm_set_state() - Set system pm state
2615*5113495bSYour Name  * @hif: hif opaque handle
2616*5113495bSYour Name  * @state: system state
2617*5113495bSYour Name  *
2618*5113495bSYour Name  * Return:  None
2619*5113495bSYour Name  */
2620*5113495bSYour Name void __hif_system_pm_set_state(struct hif_opaque_softc *hif,
2621*5113495bSYour Name 			       enum hif_system_pm_state state);
2622*5113495bSYour Name 
2623*5113495bSYour Name /**
2624*5113495bSYour Name  * hif_system_pm_set_state_on() - Set system pm state to ON
2625*5113495bSYour Name  * @hif: hif opaque handle
2626*5113495bSYour Name  *
2627*5113495bSYour Name  * Return:  None
2628*5113495bSYour Name  */
2629*5113495bSYour Name static inline
hif_system_pm_set_state_on(struct hif_opaque_softc * hif)2630*5113495bSYour Name void hif_system_pm_set_state_on(struct hif_opaque_softc *hif)
2631*5113495bSYour Name {
2632*5113495bSYour Name 	__hif_system_pm_set_state(hif, HIF_SYSTEM_PM_STATE_ON);
2633*5113495bSYour Name }
2634*5113495bSYour Name 
2635*5113495bSYour Name /**
2636*5113495bSYour Name  * hif_system_pm_set_state_resuming() - Set system pm state to resuming
2637*5113495bSYour Name  * @hif: hif opaque handle
2638*5113495bSYour Name  *
2639*5113495bSYour Name  * Return:  None
2640*5113495bSYour Name  */
2641*5113495bSYour Name static inline
hif_system_pm_set_state_resuming(struct hif_opaque_softc * hif)2642*5113495bSYour Name void hif_system_pm_set_state_resuming(struct hif_opaque_softc *hif)
2643*5113495bSYour Name {
2644*5113495bSYour Name 	__hif_system_pm_set_state(hif, HIF_SYSTEM_PM_STATE_BUS_RESUMING);
2645*5113495bSYour Name }
2646*5113495bSYour Name 
2647*5113495bSYour Name /**
2648*5113495bSYour Name  * hif_system_pm_set_state_suspending() - Set system pm state to suspending
2649*5113495bSYour Name  * @hif: hif opaque handle
2650*5113495bSYour Name  *
2651*5113495bSYour Name  * Return:  None
2652*5113495bSYour Name  */
2653*5113495bSYour Name static inline
hif_system_pm_set_state_suspending(struct hif_opaque_softc * hif)2654*5113495bSYour Name void hif_system_pm_set_state_suspending(struct hif_opaque_softc *hif)
2655*5113495bSYour Name {
2656*5113495bSYour Name 	__hif_system_pm_set_state(hif, HIF_SYSTEM_PM_STATE_BUS_SUSPENDING);
2657*5113495bSYour Name }
2658*5113495bSYour Name 
2659*5113495bSYour Name /**
2660*5113495bSYour Name  * hif_system_pm_set_state_suspended() - Set system pm state to suspended
2661*5113495bSYour Name  * @hif: hif opaque handle
2662*5113495bSYour Name  *
2663*5113495bSYour Name  * Return:  None
2664*5113495bSYour Name  */
2665*5113495bSYour Name static inline
hif_system_pm_set_state_suspended(struct hif_opaque_softc * hif)2666*5113495bSYour Name void hif_system_pm_set_state_suspended(struct hif_opaque_softc *hif)
2667*5113495bSYour Name {
2668*5113495bSYour Name 	__hif_system_pm_set_state(hif, HIF_SYSTEM_PM_STATE_BUS_SUSPENDED);
2669*5113495bSYour Name }
2670*5113495bSYour Name 
2671*5113495bSYour Name /**
2672*5113495bSYour Name  * hif_system_pm_get_state() - Get system pm state
2673*5113495bSYour Name  * @hif: hif opaque handle
2674*5113495bSYour Name  *
2675*5113495bSYour Name  * Return:  system state
2676*5113495bSYour Name  */
2677*5113495bSYour Name int32_t hif_system_pm_get_state(struct hif_opaque_softc *hif);
2678*5113495bSYour Name 
2679*5113495bSYour Name /**
2680*5113495bSYour Name  * hif_system_pm_state_check() - Check system state and trigger resume
2681*5113495bSYour Name  *  if required
2682*5113495bSYour Name  * @hif: hif opaque handle
2683*5113495bSYour Name  *
2684*5113495bSYour Name  * Return: 0 if system is in on state else error code
2685*5113495bSYour Name  */
2686*5113495bSYour Name int hif_system_pm_state_check(struct hif_opaque_softc *hif);
2687*5113495bSYour Name #else
2688*5113495bSYour Name static inline
__hif_system_pm_set_state(struct hif_opaque_softc * hif,enum hif_system_pm_state state)2689*5113495bSYour Name void __hif_system_pm_set_state(struct hif_opaque_softc *hif,
2690*5113495bSYour Name 			       enum hif_system_pm_state state)
2691*5113495bSYour Name {
2692*5113495bSYour Name }
2693*5113495bSYour Name 
2694*5113495bSYour Name static inline
hif_system_pm_set_state_on(struct hif_opaque_softc * hif)2695*5113495bSYour Name void hif_system_pm_set_state_on(struct hif_opaque_softc *hif)
2696*5113495bSYour Name {
2697*5113495bSYour Name }
2698*5113495bSYour Name 
2699*5113495bSYour Name static inline
hif_system_pm_set_state_resuming(struct hif_opaque_softc * hif)2700*5113495bSYour Name void hif_system_pm_set_state_resuming(struct hif_opaque_softc *hif)
2701*5113495bSYour Name {
2702*5113495bSYour Name }
2703*5113495bSYour Name 
2704*5113495bSYour Name static inline
hif_system_pm_set_state_suspending(struct hif_opaque_softc * hif)2705*5113495bSYour Name void hif_system_pm_set_state_suspending(struct hif_opaque_softc *hif)
2706*5113495bSYour Name {
2707*5113495bSYour Name }
2708*5113495bSYour Name 
2709*5113495bSYour Name static inline
hif_system_pm_set_state_suspended(struct hif_opaque_softc * hif)2710*5113495bSYour Name void hif_system_pm_set_state_suspended(struct hif_opaque_softc *hif)
2711*5113495bSYour Name {
2712*5113495bSYour Name }
2713*5113495bSYour Name 
2714*5113495bSYour Name static inline
hif_system_pm_get_state(struct hif_opaque_softc * hif)2715*5113495bSYour Name int32_t hif_system_pm_get_state(struct hif_opaque_softc *hif)
2716*5113495bSYour Name {
2717*5113495bSYour Name 	return 0;
2718*5113495bSYour Name }
2719*5113495bSYour Name 
hif_system_pm_state_check(struct hif_opaque_softc * hif)2720*5113495bSYour Name static inline int hif_system_pm_state_check(struct hif_opaque_softc *hif)
2721*5113495bSYour Name {
2722*5113495bSYour Name 	return 0;
2723*5113495bSYour Name }
2724*5113495bSYour Name #endif
2725*5113495bSYour Name 
2726*5113495bSYour Name #ifdef FEATURE_IRQ_AFFINITY
2727*5113495bSYour Name /**
2728*5113495bSYour Name  * hif_set_grp_intr_affinity() - API to set affinity for grp
2729*5113495bSYour Name  *  intrs set in the bitmap
2730*5113495bSYour Name  * @scn: hif handle
2731*5113495bSYour Name  * @grp_intr_bitmask: grp intrs for which perf affinity should be
2732*5113495bSYour Name  *  applied
2733*5113495bSYour Name  * @perf: affine to perf or non-perf cluster
2734*5113495bSYour Name  *
2735*5113495bSYour Name  * Return: None
2736*5113495bSYour Name  */
2737*5113495bSYour Name void hif_set_grp_intr_affinity(struct hif_opaque_softc *scn,
2738*5113495bSYour Name 			       uint32_t grp_intr_bitmask, bool perf);
2739*5113495bSYour Name #else
2740*5113495bSYour Name static inline
hif_set_grp_intr_affinity(struct hif_opaque_softc * scn,uint32_t grp_intr_bitmask,bool perf)2741*5113495bSYour Name void hif_set_grp_intr_affinity(struct hif_opaque_softc *scn,
2742*5113495bSYour Name 			       uint32_t grp_intr_bitmask, bool perf)
2743*5113495bSYour Name {
2744*5113495bSYour Name }
2745*5113495bSYour Name #endif
2746*5113495bSYour Name /**
2747*5113495bSYour Name  * hif_get_max_wmi_ep() - Get max WMI EPs configured in target svc map
2748*5113495bSYour Name  * @scn: hif opaque handle
2749*5113495bSYour Name  *
2750*5113495bSYour Name  * Description:
2751*5113495bSYour Name  *   Gets number of WMI EPs configured in target svc map. Since EP map
2752*5113495bSYour Name  *   include IN and OUT direction pipes, count only OUT pipes to get EPs
2753*5113495bSYour Name  *   configured for WMI service.
2754*5113495bSYour Name  *
2755*5113495bSYour Name  * Return:
2756*5113495bSYour Name  *  uint8_t: count for WMI eps in target svc map
2757*5113495bSYour Name  */
2758*5113495bSYour Name uint8_t hif_get_max_wmi_ep(struct hif_opaque_softc *scn);
2759*5113495bSYour Name 
2760*5113495bSYour Name #ifdef DP_UMAC_HW_RESET_SUPPORT
2761*5113495bSYour Name /**
2762*5113495bSYour Name  * hif_register_umac_reset_handler() - Register UMAC HW reset handler
2763*5113495bSYour Name  * @hif_scn: hif opaque handle
2764*5113495bSYour Name  * @irq_handler: irq callback handler function
2765*5113495bSYour Name  * @tl_handler: tasklet callback handler function
2766*5113495bSYour Name  * @cb_ctx: context to passed to @handler
2767*5113495bSYour Name  * @irq: irq number to be used for UMAC HW reset interrupt
2768*5113495bSYour Name  *
2769*5113495bSYour Name  * Return: QDF_STATUS of operation
2770*5113495bSYour Name  */
2771*5113495bSYour Name QDF_STATUS hif_register_umac_reset_handler(struct hif_opaque_softc *hif_scn,
2772*5113495bSYour Name 					   bool (*irq_handler)(void *cb_ctx),
2773*5113495bSYour Name 					   int (*tl_handler)(void *cb_ctx),
2774*5113495bSYour Name 					   void *cb_ctx, int irq);
2775*5113495bSYour Name 
2776*5113495bSYour Name /**
2777*5113495bSYour Name  * hif_unregister_umac_reset_handler() - Unregister UMAC HW reset handler
2778*5113495bSYour Name  * @hif_scn: hif opaque handle
2779*5113495bSYour Name  *
2780*5113495bSYour Name  * Return: QDF_STATUS of operation
2781*5113495bSYour Name  */
2782*5113495bSYour Name QDF_STATUS hif_unregister_umac_reset_handler(struct hif_opaque_softc *hif_scn);
2783*5113495bSYour Name QDF_STATUS hif_get_umac_reset_irq(struct hif_opaque_softc *hif_scn,
2784*5113495bSYour Name 				  int *umac_reset_irq);
2785*5113495bSYour Name #else
2786*5113495bSYour Name static inline
hif_register_umac_reset_handler(struct hif_opaque_softc * hif_scn,bool (* irq_handler)(void * cb_ctx),int (* tl_handler)(void * cb_ctx),void * cb_ctx,int irq)2787*5113495bSYour Name QDF_STATUS hif_register_umac_reset_handler(struct hif_opaque_softc *hif_scn,
2788*5113495bSYour Name 					   bool (*irq_handler)(void *cb_ctx),
2789*5113495bSYour Name 					   int (*tl_handler)(void *cb_ctx),
2790*5113495bSYour Name 					   void *cb_ctx, int irq)
2791*5113495bSYour Name {
2792*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
2793*5113495bSYour Name }
2794*5113495bSYour Name 
2795*5113495bSYour Name static inline
hif_unregister_umac_reset_handler(struct hif_opaque_softc * hif_scn)2796*5113495bSYour Name QDF_STATUS hif_unregister_umac_reset_handler(struct hif_opaque_softc *hif_scn)
2797*5113495bSYour Name {
2798*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
2799*5113495bSYour Name }
2800*5113495bSYour Name 
2801*5113495bSYour Name static inline
hif_get_umac_reset_irq(struct hif_opaque_softc * hif_scn,int * umac_reset_irq)2802*5113495bSYour Name QDF_STATUS hif_get_umac_reset_irq(struct hif_opaque_softc *hif_scn,
2803*5113495bSYour Name 				  int *umac_reset_irq)
2804*5113495bSYour Name {
2805*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
2806*5113495bSYour Name }
2807*5113495bSYour Name 
2808*5113495bSYour Name #endif /* DP_UMAC_HW_RESET_SUPPORT */
2809*5113495bSYour Name 
2810*5113495bSYour Name #ifdef FEATURE_DIRECT_LINK
2811*5113495bSYour Name /**
2812*5113495bSYour Name  * hif_set_irq_config_by_ceid() - Set irq configuration for CE given by id
2813*5113495bSYour Name  * @scn: hif opaque handle
2814*5113495bSYour Name  * @ce_id: CE id
2815*5113495bSYour Name  * @addr: irq trigger address
2816*5113495bSYour Name  * @data: irq trigger data
2817*5113495bSYour Name  *
2818*5113495bSYour Name  * Return: QDF status
2819*5113495bSYour Name  */
2820*5113495bSYour Name QDF_STATUS
2821*5113495bSYour Name hif_set_irq_config_by_ceid(struct hif_opaque_softc *scn, uint8_t ce_id,
2822*5113495bSYour Name 			   uint64_t addr, uint32_t data);
2823*5113495bSYour Name 
2824*5113495bSYour Name /**
2825*5113495bSYour Name  * hif_get_direct_link_ce_dest_srng_buffers() - Get Direct Link ce dest srng
2826*5113495bSYour Name  *  buffer information
2827*5113495bSYour Name  * @scn: hif opaque handle
2828*5113495bSYour Name  * @dma_addr: pointer to array of dma addresses
2829*5113495bSYour Name  * @buf_size: ce dest ring buffer size
2830*5113495bSYour Name  *
2831*5113495bSYour Name  * Return: Number of buffers attached to the dest srng.
2832*5113495bSYour Name  */
2833*5113495bSYour Name uint16_t hif_get_direct_link_ce_dest_srng_buffers(struct hif_opaque_softc *scn,
2834*5113495bSYour Name 						  uint64_t **dma_addr,
2835*5113495bSYour Name 						  uint32_t *buf_size);
2836*5113495bSYour Name 
2837*5113495bSYour Name /**
2838*5113495bSYour Name  * hif_get_direct_link_ce_srng_info() - Get Direct Link CE srng information
2839*5113495bSYour Name  * @scn: hif opaque handle
2840*5113495bSYour Name  * @info: Direct Link CEs information
2841*5113495bSYour Name  * @max_ce_info_len: max array size of ce info
2842*5113495bSYour Name  *
2843*5113495bSYour Name  * Return: QDF status
2844*5113495bSYour Name  */
2845*5113495bSYour Name QDF_STATUS
2846*5113495bSYour Name hif_get_direct_link_ce_srng_info(struct hif_opaque_softc *scn,
2847*5113495bSYour Name 				 struct hif_direct_link_ce_info *info,
2848*5113495bSYour Name 				 uint8_t max_ce_info_len);
2849*5113495bSYour Name #else
2850*5113495bSYour Name static inline QDF_STATUS
hif_set_irq_config_by_ceid(struct hif_opaque_softc * scn,uint8_t ce_id,uint64_t addr,uint32_t data)2851*5113495bSYour Name hif_set_irq_config_by_ceid(struct hif_opaque_softc *scn, uint8_t ce_id,
2852*5113495bSYour Name 			   uint64_t addr, uint32_t data)
2853*5113495bSYour Name {
2854*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
2855*5113495bSYour Name }
2856*5113495bSYour Name 
2857*5113495bSYour Name static inline
hif_get_direct_link_ce_dest_srng_buffers(struct hif_opaque_softc * scn,uint64_t ** dma_addr,uint32_t * buf_size)2858*5113495bSYour Name uint16_t hif_get_direct_link_ce_dest_srng_buffers(struct hif_opaque_softc *scn,
2859*5113495bSYour Name 						  uint64_t **dma_addr,
2860*5113495bSYour Name 						  uint32_t *buf_size)
2861*5113495bSYour Name {
2862*5113495bSYour Name 	return 0;
2863*5113495bSYour Name }
2864*5113495bSYour Name 
2865*5113495bSYour Name static inline QDF_STATUS
hif_get_direct_link_ce_srng_info(struct hif_opaque_softc * scn,struct hif_direct_link_ce_info * info,uint8_t max_ce_info_len)2866*5113495bSYour Name hif_get_direct_link_ce_srng_info(struct hif_opaque_softc *scn,
2867*5113495bSYour Name 				 struct hif_direct_link_ce_info *info,
2868*5113495bSYour Name 				 uint8_t max_ce_info_len)
2869*5113495bSYour Name {
2870*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
2871*5113495bSYour Name }
2872*5113495bSYour Name #endif
2873*5113495bSYour Name 
2874*5113495bSYour Name static inline QDF_STATUS
hif_irq_set_affinity_hint(int irq_num,qdf_cpu_mask * cpu_mask)2875*5113495bSYour Name hif_irq_set_affinity_hint(int irq_num, qdf_cpu_mask *cpu_mask)
2876*5113495bSYour Name {
2877*5113495bSYour Name 	QDF_STATUS status;
2878*5113495bSYour Name 
2879*5113495bSYour Name 	qdf_dev_modify_irq_status(irq_num, IRQ_NO_BALANCING, 0);
2880*5113495bSYour Name 	status = qdf_dev_set_irq_affinity(irq_num,
2881*5113495bSYour Name 					  (struct qdf_cpu_mask *)cpu_mask);
2882*5113495bSYour Name 	qdf_dev_modify_irq_status(irq_num, 0, IRQ_NO_BALANCING);
2883*5113495bSYour Name 
2884*5113495bSYour Name 	return status;
2885*5113495bSYour Name }
2886*5113495bSYour Name 
2887*5113495bSYour Name #ifdef WLAN_FEATURE_AFFINITY_MGR
2888*5113495bSYour Name /**
2889*5113495bSYour Name  * hif_affinity_mgr_init_ce_irq() - Init for CE IRQ
2890*5113495bSYour Name  * @scn: hif opaque handle
2891*5113495bSYour Name  * @id: CE ID
2892*5113495bSYour Name  * @irq: IRQ assigned
2893*5113495bSYour Name  *
2894*5113495bSYour Name  * Return: None
2895*5113495bSYour Name  */
2896*5113495bSYour Name void
2897*5113495bSYour Name hif_affinity_mgr_init_ce_irq(struct hif_softc *scn, int id, int irq);
2898*5113495bSYour Name 
2899*5113495bSYour Name /**
2900*5113495bSYour Name  * hif_affinity_mgr_init_grp_irq() - Init for group IRQ
2901*5113495bSYour Name  * @scn: hif opaque handle
2902*5113495bSYour Name  * @grp_id: GRP ID
2903*5113495bSYour Name  * @irq_num: IRQ number of hif ext group
2904*5113495bSYour Name  * @irq: IRQ number assigned
2905*5113495bSYour Name  *
2906*5113495bSYour Name  * Return: None
2907*5113495bSYour Name  */
2908*5113495bSYour Name void
2909*5113495bSYour Name hif_affinity_mgr_init_grp_irq(struct hif_softc *scn, int grp_id,
2910*5113495bSYour Name 			      int irq_num, int irq);
2911*5113495bSYour Name 
2912*5113495bSYour Name /**
2913*5113495bSYour Name  * hif_affinity_mgr_set_qrg_irq_affinity() - Set affinity for group IRQ
2914*5113495bSYour Name  * @scn: hif opaque handle
2915*5113495bSYour Name  * @irq: IRQ assigned
2916*5113495bSYour Name  * @grp_id: GRP ID
2917*5113495bSYour Name  * @irq_index: IRQ number of hif ext group
2918*5113495bSYour Name  * @cpu_mask: reuquested cpu_mask for IRQ
2919*5113495bSYour Name  *
2920*5113495bSYour Name  * Return: status
2921*5113495bSYour Name  */
2922*5113495bSYour Name QDF_STATUS
2923*5113495bSYour Name hif_affinity_mgr_set_qrg_irq_affinity(struct hif_softc *scn, uint32_t irq,
2924*5113495bSYour Name 				      uint32_t grp_id, uint32_t irq_index,
2925*5113495bSYour Name 				      qdf_cpu_mask *cpu_mask);
2926*5113495bSYour Name 
2927*5113495bSYour Name /**
2928*5113495bSYour Name  * hif_affinity_mgr_set_ce_irq_affinity() - Set affinity for CE IRQ
2929*5113495bSYour Name  * @scn: hif opaque handle
2930*5113495bSYour Name  * @irq: IRQ assigned
2931*5113495bSYour Name  * @ce_id: CE ID
2932*5113495bSYour Name  * @cpu_mask: reuquested cpu_mask for IRQ
2933*5113495bSYour Name  *
2934*5113495bSYour Name  * Return: status
2935*5113495bSYour Name  */
2936*5113495bSYour Name QDF_STATUS
2937*5113495bSYour Name hif_affinity_mgr_set_ce_irq_affinity(struct hif_softc *scn, uint32_t irq,
2938*5113495bSYour Name 				     uint32_t ce_id, qdf_cpu_mask *cpu_mask);
2939*5113495bSYour Name 
2940*5113495bSYour Name /**
2941*5113495bSYour Name  * hif_affinity_mgr_affine_irq() - Affine CE and GRP IRQs
2942*5113495bSYour Name  * @scn: hif opaque handle
2943*5113495bSYour Name  *
2944*5113495bSYour Name  * Return: None
2945*5113495bSYour Name  */
2946*5113495bSYour Name void hif_affinity_mgr_affine_irq(struct hif_softc *scn);
2947*5113495bSYour Name #else
2948*5113495bSYour Name static inline void
hif_affinity_mgr_init_ce_irq(struct hif_softc * scn,int id,int irq)2949*5113495bSYour Name hif_affinity_mgr_init_ce_irq(struct hif_softc *scn, int id, int irq)
2950*5113495bSYour Name {
2951*5113495bSYour Name }
2952*5113495bSYour Name 
2953*5113495bSYour Name static inline void
hif_affinity_mgr_init_grp_irq(struct hif_softc * scn,int grp_id,int irq_num,int irq)2954*5113495bSYour Name hif_affinity_mgr_init_grp_irq(struct hif_softc *scn, int grp_id, int irq_num,
2955*5113495bSYour Name 			      int irq)
2956*5113495bSYour Name {
2957*5113495bSYour Name }
2958*5113495bSYour Name 
2959*5113495bSYour Name static inline QDF_STATUS
hif_affinity_mgr_set_qrg_irq_affinity(struct hif_softc * scn,uint32_t irq,uint32_t grp_id,uint32_t irq_index,qdf_cpu_mask * cpu_mask)2960*5113495bSYour Name hif_affinity_mgr_set_qrg_irq_affinity(struct hif_softc *scn, uint32_t irq,
2961*5113495bSYour Name 				      uint32_t grp_id, uint32_t irq_index,
2962*5113495bSYour Name 				      qdf_cpu_mask *cpu_mask)
2963*5113495bSYour Name {
2964*5113495bSYour Name 	return hif_irq_set_affinity_hint(irq, cpu_mask);
2965*5113495bSYour Name }
2966*5113495bSYour Name 
2967*5113495bSYour Name static inline QDF_STATUS
hif_affinity_mgr_set_ce_irq_affinity(struct hif_softc * scn,uint32_t irq,uint32_t ce_id,qdf_cpu_mask * cpu_mask)2968*5113495bSYour Name hif_affinity_mgr_set_ce_irq_affinity(struct hif_softc *scn, uint32_t irq,
2969*5113495bSYour Name 				     uint32_t ce_id, qdf_cpu_mask *cpu_mask)
2970*5113495bSYour Name {
2971*5113495bSYour Name 	return hif_irq_set_affinity_hint(irq, cpu_mask);
2972*5113495bSYour Name }
2973*5113495bSYour Name 
2974*5113495bSYour Name static inline
hif_affinity_mgr_affine_irq(struct hif_softc * scn)2975*5113495bSYour Name void hif_affinity_mgr_affine_irq(struct hif_softc *scn)
2976*5113495bSYour Name {
2977*5113495bSYour Name }
2978*5113495bSYour Name #endif
2979*5113495bSYour Name 
2980*5113495bSYour Name /**
2981*5113495bSYour Name  * hif_affinity_mgr_set_affinity() - Affine CE and GRP IRQs
2982*5113495bSYour Name  * @scn: hif opaque handle
2983*5113495bSYour Name  *
2984*5113495bSYour Name  * Return: None
2985*5113495bSYour Name  */
2986*5113495bSYour Name void hif_affinity_mgr_set_affinity(struct hif_opaque_softc *scn);
2987*5113495bSYour Name 
2988*5113495bSYour Name #ifdef FEATURE_HIF_DELAYED_REG_WRITE
2989*5113495bSYour Name /**
2990*5113495bSYour Name  * hif_print_reg_write_stats() - Print hif delayed reg write stats
2991*5113495bSYour Name  * @hif_ctx: hif opaque handle
2992*5113495bSYour Name  *
2993*5113495bSYour Name  * Return: None
2994*5113495bSYour Name  */
2995*5113495bSYour Name void hif_print_reg_write_stats(struct hif_opaque_softc *hif_ctx);
2996*5113495bSYour Name #else
hif_print_reg_write_stats(struct hif_opaque_softc * hif_ctx)2997*5113495bSYour Name static inline void hif_print_reg_write_stats(struct hif_opaque_softc *hif_ctx)
2998*5113495bSYour Name {
2999*5113495bSYour Name }
3000*5113495bSYour Name #endif
3001*5113495bSYour Name void hif_ce_print_ring_stats(struct hif_opaque_softc *hif_ctx);
3002*5113495bSYour Name #endif /* _HIF_H_ */
3003