xref: /wlan-dirver/qca-wifi-host-cmn/target_if/core/inc/target_if.h (revision 97f44cd39e4ff816eaa1710279d28cf6b9e65ad9)
1 /*
2  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: This target interface shall be used
21  *      to communicate with target using WMI.
22  */
23 #ifndef _WLAN_TARGET_IF_H_
24 #define _WLAN_TARGET_IF_H_
25 
26 #include "qdf_types.h"
27 #include "qdf_util.h"
28 #include "wlan_objmgr_psoc_obj.h"
29 #include "wmi_unified_api.h"
30 #include "wmi_unified_priv.h"
31 #include "wmi_unified_param.h"
32 
33 #define TGT_WMI_PDEV_ID_SOC	0	/* WMI SOC ID */
34 
35 /* ASCII "TGT\0" */
36 #define TGT_MAGIC 0x54575400
37 
38 #define target_if_fatal(params...) \
39 	QDF_TRACE_FATAL(QDF_MODULE_ID_TARGET_IF, params)
40 #define target_if_err(params...) \
41 	QDF_TRACE_ERROR(QDF_MODULE_ID_TARGET_IF, params)
42 #define target_if_warn(params...) \
43 	QDF_TRACE_WARN(QDF_MODULE_ID_TARGET_IF, params)
44 #define target_if_info(params...) \
45 	QDF_TRACE_INFO(QDF_MODULE_ID_TARGET_IF, params)
46 #define target_if_debug(params...) \
47 	QDF_TRACE_DEBUG(QDF_MODULE_ID_TARGET_IF, params)
48 #define TARGET_IF_ENTER() \
49 	QDF_TRACE_ENTER(QDF_MODULE_ID_TARGET_IF, "enter")
50 #define TARGET_IF_EXIT() \
51 	QDF_TRACE_EXIT(QDF_MODULE_ID_TARGET_IF, "exit")
52 #define target_if_err_rl(params...) \
53 	QDF_TRACE_ERROR_RL(QDF_MODULE_ID_TARGET_IF, params)
54 
55 
56 #define targetif_nofl_fatal(params...) \
57 	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_TARGET_IF, params)
58 #define targetif_nofl_err(params...) \
59 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_TARGET_IF, params)
60 #define targetif_nofl_warn(params...) \
61 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_TARGET_IF, params)
62 #define targetif_nofl_info(params...) \
63 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_TARGET_IF, params)
64 #define targetif_nofl_debug(params...) \
65 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_TARGET_IF, params)
66 
67 typedef struct wlan_objmgr_psoc *(*get_psoc_handle_callback)(
68 			void *scn_handle);
69 
70 typedef struct wlan_objmgr_pdev *(*get_pdev_handle_callback)(
71 			void *scn_handle);
72 
73 typedef int (*wmi_legacy_service_ready_callback)(uint32_t event_id,
74 						void *handle,
75 						uint8_t *event_data,
76 						uint32_t length);
77 
78 /**
79  * struct target_if_ctx - target_interface context
80  * @magic: magic for target if ctx
81  * @get_psoc_hdl_cb:  function pointer to get psoc
82  * @get_pdev_hdl_cb:  function pointer to get pdev
83  * @lock: spin lock for protecting the ctx
84  */
85 struct target_if_ctx {
86 	uint32_t magic;
87 	get_psoc_handle_callback get_psoc_hdl_cb;
88 	get_pdev_handle_callback get_pdev_hdl_cb;
89 	wmi_legacy_service_ready_callback service_ready_cb;
90 	qdf_spinlock_t lock;
91 };
92 
93 struct target_psoc_info;
94 /**
95  * struct host_fw_ver - holds host fw version
96  * @host_ver: Host version
97  * @target_ver: Target version ID
98  * @target_rev: Target revision ID
99  * @wlan_ver: FW SW version
100  * @wlan_ver_1: FW SW version second dword
101  * @abi_ver: ABI version
102  */
103 struct host_fw_ver {
104 	uint32_t host_ver;
105 	uint32_t target_ver;
106 	uint32_t target_rev;
107 	uint32_t wlan_ver;
108 	uint32_t wlan_ver_1;
109 	uint32_t abi_ver;
110 };
111 
112 struct common_dbglog_handle;
113 struct common_accelerator_handle;
114 
115 /**
116  * struct comp_hdls - Non-umac/lower layer components handles, it is a sub
117  *                    structure of target psoc information
118  * @hif_hdl: HIF handle
119  * @htc_hdl: HTC handle
120  * @wmi_hdl: WMI handle
121  * @accelerator_hdl: NSS offload/IPA handle
122  * @dbglog_hdl: Debug log handle
123  */
124 struct comp_hdls {
125 	struct hif_opaque_softc *hif_hdl;
126 	HTC_HANDLE htc_hdl;
127 	struct wmi_unified *wmi_hdl;
128 	struct common_accelerator_handle *accelerator_hdl;
129 	struct common_dbglog_handle *dbglog_hdl;
130 };
131 
132 /**
133  * struct target_supported_modes - List of HW modes supported by target.
134  *
135  * @num_modes: Number of modes supported
136  * @hw_mode_ids: List of HW mode ids
137  * @phy_bit_map: List of Phy bit maps
138  */
139 struct target_supported_modes {
140 	uint8_t num_modes;
141 	uint32_t hw_mode_ids[WMI_HOST_HW_MODE_MAX];
142 	uint32_t phy_bit_map[WMI_HOST_HW_MODE_MAX];
143 };
144 
145 /**
146  * struct target_version_info - Target version information
147  *
148  * @reg_db_version_major: REG DB version major
149  * @reg_db_version_minor: REG DB version minor
150  * @bdf_reg_db_version_major: BDF REG DB version major
151  * @bdf_reg_db_version_minor: BDF REG DB version minor
152  */
153 struct target_version_info {
154 	uint8_t reg_db_version_major;
155 	uint8_t reg_db_version_minor;
156 	uint8_t bdf_reg_db_version_major;
157 	uint8_t bdf_reg_db_version_minor;
158 };
159 
160 /**
161  * struct tgt_info - FW or lower layer related info(required by target_if),
162  *                   it is a sub structure of taarget psoc information
163  * @version: Host FW version struct
164  * @wlan_res_cfg:  target_resource_config info
165  * @wlan_ext_res_cfg: wmi_host_ext_resource_config info
166  * @wmi_service_ready: is service ready received
167  * @wmi_ready: is ready event received
168  * @total_mac_phy_cnt: num of mac phys
169  * @num_radios: number of radios
170  * @wlan_init_status: Target init status
171  * @target_type: Target type
172  * @max_descs: Max descriptors
173  * @preferred_hw_mode: preferred hw mode
174  * @wmi_timeout: wait timeout for target events
175  * @event: qdf_event for target events
176  * @service_bitmap: WMI service bitmap
177  * @target_cap: target capabilities
178  * @service_ext2_param: service ready ext2 event params
179  * @service_ext_param: ext service params
180  * @mac_phy_cap: phy caps array
181  * @dbr_ring_cap: dbr_ring capability info
182  * @reg_cap: regulatory caps array
183  * @scaling_params: Spectral bin scaling parameters
184  * @num_mem_chunks: number of mem chunks allocated
185  * @hw_mode_caps: HW mode caps of preferred mode
186  * @mem_chunks: allocated memory blocks for FW
187  * @scan_radio_caps: scan radio capabilities
188  * @device_mode: Global Device mode
189  */
190 struct tgt_info {
191 	struct host_fw_ver version;
192 	target_resource_config wlan_res_cfg;
193 	wmi_host_ext_resource_config wlan_ext_res_cfg;
194 	bool wmi_service_ready;
195 	bool wmi_ready;
196 	uint8_t total_mac_phy_cnt;
197 	uint8_t num_radios;
198 	uint32_t wlan_init_status;
199 	uint32_t target_type;
200 	uint32_t max_descs;
201 	uint32_t preferred_hw_mode;
202 	uint32_t wmi_timeout;
203 	qdf_event_t event;
204 	uint32_t service_bitmap[PSOC_SERVICE_BM_SIZE];
205 	struct wlan_psoc_target_capability_info target_caps;
206 	struct wlan_psoc_host_service_ext_param service_ext_param;
207 	struct wlan_psoc_host_service_ext2_param service_ext2_param;
208 	struct wlan_psoc_host_mac_phy_caps
209 			mac_phy_cap[PSOC_MAX_MAC_PHY_CAP];
210 	struct wlan_psoc_host_dbr_ring_caps *dbr_ring_cap;
211 	struct wlan_psoc_host_spectral_scaling_params *scaling_params;
212 	uint32_t num_mem_chunks;
213 	struct wmi_host_mem_chunk mem_chunks[MAX_MEM_CHUNKS];
214 	struct wlan_psoc_host_hw_mode_caps hw_mode_cap;
215 	struct target_supported_modes hw_modes;
216 	uint8_t pdev_id_to_phy_id_map[WLAN_UMAC_MAX_PDEVS];
217 	bool is_pdevid_to_phyid_map;
218 	struct wlan_psoc_host_scan_radio_caps *scan_radio_caps;
219 	uint32_t device_mode;
220 };
221 
222 /**
223  * struct target_ops - Holds feature specific function pointers, which would be
224  *                     invoked as part of service ready or ext service ready
225  * @ext_resource_config_enable: Ext resource config
226  * @peer_config: Peer config enable
227  * @mesh_support_enable: Mesh support enable
228  * @smart_antenna_enable: Smart antenna enable
229  * @atf_config_enable: ATF config enable
230  * @qwrap_config_enable: QWRAP config enable
231  * @btcoex_config_enable: BTCOEX config enable
232  * @lteu_ext_support_enable: LTE-U Ext config enable
233  * @set_init_cmd_dev_based_params: Sets Init command params
234  * @alloc_pdevs: Allocates PDEVs
235  * @update_pdev_tgt_info: Updates PDEV target info
236  * @mem_mgr_alloc_chunk: Allocates memory through MEM manager
237  * @mem_mgr_free_chunks: Free memory chunks through MEM manager
238  * @print_svc_ready_ex_param: Print service ready ext params
239  * @add_11ax_modes: Adds 11ax modes to reg cap
240  * @set_default_tgt_config: Sets target config with default values
241  * @sw_version_check: Checks the SW version
242  * @smart_log_enable: Enable Smart Logs feature
243  * @cfr_support_enable: CFR support enable
244  * @set_pktlog_checksum: Set the pktlog checksum from FW ready event to pl_dev
245  * @csa_switch_count_status: CSA event handler
246  */
247 struct target_ops {
248 	QDF_STATUS (*ext_resource_config_enable)
249 		(struct wlan_objmgr_psoc *psoc,
250 		 struct target_psoc_info *tgt_info, uint8_t *event);
251 	void (*peer_config)
252 		(struct wlan_objmgr_psoc *psoc,
253 		 struct target_psoc_info *tgt_info, uint8_t *event);
254 	void (*mesh_support_enable)
255 		(struct wlan_objmgr_psoc *psoc,
256 		 struct target_psoc_info *tgt_info, uint8_t *event);
257 	void (*smart_antenna_enable)
258 		(struct wlan_objmgr_psoc *psoc,
259 		 struct target_psoc_info *tgt_info, uint8_t *event);
260 	void (*atf_config_enable)
261 		(struct wlan_objmgr_psoc *psoc,
262 		 struct target_psoc_info *tgt_info, uint8_t *event);
263 	void (*qwrap_config_enable)
264 		(struct wlan_objmgr_psoc *psoc,
265 		 struct target_psoc_info *tgt_info, uint8_t *event);
266 	void (*btcoex_config_enable)
267 		(struct wlan_objmgr_psoc *psoc,
268 		 struct target_psoc_info *tgt_info, uint8_t *event);
269 	void (*lteu_ext_support_enable)
270 		(struct wlan_objmgr_psoc *psoc,
271 		 struct target_psoc_info *tgt_info, uint8_t *event);
272 	void (*set_init_cmd_dev_based_params)
273 		(struct wlan_objmgr_psoc *psoc,
274 		 struct target_psoc_info *tgt_info);
275 	QDF_STATUS (*alloc_pdevs)
276 		(struct wlan_objmgr_psoc *psoc,
277 		 struct target_psoc_info *tgt_info);
278 	QDF_STATUS (*update_pdev_tgt_info)
279 		(struct wlan_objmgr_psoc *psoc,
280 		 struct target_psoc_info *tgt_info);
281 	uint32_t (*mem_mgr_alloc_chunk)(struct wlan_objmgr_psoc *psoc,
282 		struct target_psoc_info *tgt_info,
283 		u_int32_t req_id, u_int32_t idx, u_int32_t num_units,
284 		u_int32_t unit_len, u_int32_t num_unit_info);
285 	QDF_STATUS (*mem_mgr_free_chunks)(struct wlan_objmgr_psoc *psoc,
286 			struct target_psoc_info *tgt_hdl);
287 	void (*print_svc_ready_ex_param)(
288 		 struct wlan_objmgr_psoc *psoc,
289 		 struct target_psoc_info *tgt_info);
290 	void (*add_11ax_modes)(
291 		 struct wlan_objmgr_psoc *psoc,
292 		 struct target_psoc_info *tgt_info);
293 	void (*set_default_tgt_config)(
294 		 struct wlan_objmgr_psoc *psoc,
295 		 struct target_psoc_info *tgt_info);
296 	QDF_STATUS (*sw_version_check)(
297 		 struct wlan_objmgr_psoc *psoc,
298 		 struct target_psoc_info *tgt_hdl,
299 		 uint8_t *evt_buf);
300 	void (*eapol_minrate_enable)
301 		(struct wlan_objmgr_psoc *psoc,
302 		 struct target_psoc_info *tgt_info, uint8_t *event);
303 	void (*cfr_support_enable)
304 		(struct wlan_objmgr_psoc *psoc,
305 		 struct target_psoc_info *tgt_info, uint8_t *event);
306 	void (*set_pktlog_checksum)
307 		(struct wlan_objmgr_pdev *pdev, uint32_t checksum);
308 	int (*csa_switch_count_status)(
309 		struct wlan_objmgr_psoc *psoc,
310 		struct pdev_csa_switch_count_status csa_status);
311 };
312 
313 
314 
315 /**
316  * struct target_psoc_info - target psoc information
317  * @hdls: component handles (htc/htt/wmi) sub structure
318  * @info: target related info sub structure
319  * @feature_ptr: stores legacy pointer or few driver specific structures
320  * @tif_ops: holds driver specific function pointers
321  */
322 struct target_psoc_info {
323 	struct comp_hdls hdls;
324 	struct tgt_info info;
325 	void *feature_ptr;
326 	struct target_ops *tif_ops;
327 };
328 
329 /**
330  * struct target_pdev_info - target pdev information
331  * @wmi_handle: WMI handle
332  * @accelerator_hdl: NSS offload/IPA handles
333  * @pdev_idx: pdev id (of FW)
334  * @phy_idx: phy id (of FW)
335  * @feature_ptr: stores legacy pointer or few driver specific structures
336  */
337 struct target_pdev_info {
338 	struct wmi_unified *wmi_handle;
339 	struct common_accelerator_handle *accelerator_hdl;
340 	int32_t pdev_idx;
341 	int32_t phy_idx;
342 	void *feature_ptr;
343 };
344 
345 /**
346  * struct target_mu_caps - max number of users per-PPDU for OFDMA/MU-MIMO
347  * @ofdma_dl: max users for Downlink OFDMA transmissions
348  * @ofdma_ul: max users for Uplink OFDMA transmissions
349  * @mumimo_dl: max users for Downlink MU-MIMO transmissions
350  * @mumimo_ul: max users for Uplink MU-MIMO transmissions
351  */
352 struct target_mu_caps {
353 	uint16_t ofdma_dl;
354 	uint16_t ofdma_ul;
355 	uint16_t mumimo_dl;
356 	uint16_t mumimo_ul;
357 };
358 
359 
360 /**
361  * target_if_init() - target_if Initialization
362  * @get_wmi_handle: function pointer to get wmi handle
363  *
364  *
365  * Return: QDF_STATUS
366  */
367 QDF_STATUS target_if_init(get_psoc_handle_callback psoc_hdl_cb);
368 
369 /**
370  * target_if_deinit() - Close target_if
371  * @scn_handle: scn handle
372  *
373  * Return: QDF_STATUS_SUCCESS - in case of success
374  */
375 QDF_STATUS target_if_deinit(void);
376 
377 /**
378  * target_if_store_pdev_target_if_ctx() - stores objmgr pdev in target if ctx
379  * @pdev_hdl_cb: function pointer to get objmgr pdev
380  *
381  * Return: QDF_STATUS_SUCCESS - in case of success
382  */
383 QDF_STATUS target_if_store_pdev_target_if_ctx(
384 		get_pdev_handle_callback pdev_hdl_cb);
385 
386 /**
387  * wlan_get_tgt_if_ctx() -Get target if ctx
388  *
389  * Return: target if ctx
390  */
391 struct target_if_ctx *target_if_get_ctx(void);
392 
393 /**
394  * target_if_get_psoc_from_scn_hdl() - get psoc from scn handle
395  * @scn_handle: scn handle
396  *
397  * This API is generally used while processing wmi event.
398  * In wmi event SCN handle will be passed by wmi hence
399  * using this API we can get psoc from scn handle.
400  *
401  * Return: index for matching scn handle
402  */
403 struct wlan_objmgr_psoc *target_if_get_psoc_from_scn_hdl(void *scn_handle);
404 
405 /**
406  * target_if_get_pdev_from_scn_hdl() - get pdev from scn handle
407  * @scn_handle: scn handle
408  *
409  * This API is generally used while processing wmi event.
410  * In wmi event SCN handle will be passed by wmi hence
411  * using this API we can get pdev from scn handle.
412  *
413  * Return: pdev for matching scn handle
414  */
415 struct wlan_objmgr_pdev *target_if_get_pdev_from_scn_hdl(void *scn_handle);
416 
417 /** target_if_register_tx_ops() - register tx_ops
418  * @tx_ops: tx_ops structure
419  *
420  * This function is to be used by components to populate
421  * the OL function pointers (tx_ops) required by the component
422  * for UMAC-LMAC interaction, with the appropriate handler
423  *
424  * Return: QDF STATUS
425  */
426 QDF_STATUS target_if_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
427 
428 /**
429  * target_if_get_psoc_legacy_service_ready_cb() - get psoc from scn handle
430  *
431  * This API is generally used while processing wmi event.
432  * In wmi event SCN handle will be passed by wmi hence
433  * using this API we can get psoc from scn handle.
434  *
435  * Return: wmi_legacy_service_ready_callback
436  */
437 wmi_legacy_service_ready_callback
438 		target_if_get_psoc_legacy_service_ready_cb(void);
439 
440 /**
441  * target_if_register_legacy_service_ready_cb() - get legacy
442  *                                       service ready handler from scn handle
443  *
444  * @service_ready_cb: function pointer to service ready callback
445  *
446  * Return: QDF Status
447  */
448 QDF_STATUS target_if_register_legacy_service_ready_cb(
449 	wmi_legacy_service_ready_callback service_ready_cb);
450 
451 /**
452  * target_if_alloc_pdev_tgt_info() - alloc pdev tgt info
453  * @pdev: pointer to pdev
454  *
455  * API to allocate memory for target_pdev_info
456  *
457  * Return: SUCCESS on successful memory allocation or Failure
458  */
459 QDF_STATUS target_if_alloc_pdev_tgt_info(struct wlan_objmgr_pdev *pdev);
460 
461 /**
462  * target_if_free_pdev_tgt_info() - free pdev tgt info
463  * @pdev: pointer to pdev
464  *
465  * API to free allocated memory for target_pdev_info
466  *
467  * Return: SUCCESS on successful memory deallocation or Failure
468  */
469 QDF_STATUS target_if_free_pdev_tgt_info(struct wlan_objmgr_pdev *pdev);
470 
471 /**
472  * target_if_alloc_psoc_tgt_info() - alloc psoc tgt info
473  * @psoc: pointer to psoc
474  *
475  * API to allocate memory for target_psoc_info
476  *
477  * Return: SUCCESS on successful memory allocation or Failure
478  */
479 QDF_STATUS target_if_alloc_psoc_tgt_info(struct wlan_objmgr_psoc *psoc);
480 
481 /**
482  * target_if_free_psoc_tgt_info() - free psoc tgt info
483  * @psoc: pointer to psoc
484  *
485  * API to free allocated memory for target_psoc_info
486  *
487  * Return: SUCCESS on successful memory deallocation or Failure
488  */
489 QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc);
490 
491 /**
492  * target_is_tgt_type_ar900b() - Check if the target type is AR900B
493  * @target_type: target type to be checked.
494  *
495  * Return: true if the target_type is AR900B, else false.
496  */
497 bool target_is_tgt_type_ar900b(uint32_t target_type);
498 
499 /**
500  * target_is_tgt_type_ipq4019() - Check if the target type is IPQ4019
501  * @target_type: target type to be checked.
502  *
503  * Return: true if the target_type is IPQ4019, else false.
504  */
505 bool target_is_tgt_type_ipq4019(uint32_t target_type);
506 
507 /**
508  * target_is_tgt_type_qca9984() - Check if the target type is QCA9984
509  * @target_type: target type to be checked.
510  *
511  * Return: true if the target_type is QCA9984, else false.
512  */
513 bool target_is_tgt_type_qca9984(uint32_t target_type);
514 
515 /**
516  * target_is_tgt_type_qca9888() - Check if the target type is QCA9888
517  * @target_type: target type to be checked.
518  *
519  * Return: true if the target_type is QCA9888, else false.
520  */
521 bool target_is_tgt_type_qca9888(uint32_t target_type);
522 
523 /**
524  * target_is_tgt_type_adrastea() - Check if the target type is QCS40X
525  * @target_type: target type to be checked.
526  *
527  * Return: true if the target_type is QCS40X, else false.
528  */
529 bool target_is_tgt_type_adrastea(uint32_t target_type);
530 
531 /**
532  * target_is_tgt_type_qcn9000() - Check if the target type is QCN9000 (pine)
533  * @target_type: target type to be checked.
534  *
535  * Return: true if the target_type is QCN9000, else false.
536  */
537 bool target_is_tgt_type_qcn9000(uint32_t target_type);
538 
539 /**
540  * target_is_tgt_type_qcn9100() - Check if the target type is QCN9100 (Spruce)
541  * @target_type: target type to be checked.
542  *
543  * Return: true if the target_type is QCN9100, else false.
544  */
545 bool target_is_tgt_type_qcn9100(uint32_t target_type);
546 
547 /**
548  * target_psoc_set_wlan_init_status() - set info wlan_init_status
549  * @psoc_info:          pointer to structure target_psoc_info
550  * @wlan_init_status:   FW init status
551  *
552  * API to set wlan_init_status
553  *
554  * Return: void
555  */
556 static inline void target_psoc_set_wlan_init_status
557 		(struct target_psoc_info *psoc_info, uint32_t wlan_init_status)
558 {
559 	if (!psoc_info)
560 		return;
561 
562 	psoc_info->info.wlan_init_status = wlan_init_status;
563 }
564 
565 /**
566  * target_psoc_get_wlan_init_status() - get info wlan_init_status
567  * @psoc_info:  pointer to structure target_psoc_info
568  *
569  * API to get wlan_init_status
570  *
571  * Return: uint32_t
572  */
573 static inline uint32_t target_psoc_get_wlan_init_status
574 		(struct target_psoc_info *psoc_info)
575 {
576 	if (!psoc_info)
577 		return (uint32_t)-1;
578 
579 	return psoc_info->info.wlan_init_status;
580 }
581 
582 /**
583  * target_psoc_set_target_type() - set info target_type
584  * @psoc_info:  pointer to structure target_psoc_info
585  * @target_type: Target type
586  *
587  * API to set target_type
588  *
589  * Return: void
590  */
591 static inline void target_psoc_set_target_type
592 		(struct target_psoc_info *psoc_info, uint32_t target_type)
593 {
594 	if (!psoc_info)
595 		return;
596 
597 	psoc_info->info.target_type = target_type;
598 }
599 
600 /**
601  * target_psoc_get_target_type() - get info target_type
602  * @psoc_info:  pointer to structure target_psoc_info
603  *
604  * API to get target_type
605  *
606  * Return: unit32_t
607  */
608 static inline uint32_t target_psoc_get_target_type
609 		(struct target_psoc_info *psoc_info)
610 {
611 	if (!psoc_info)
612 		return (uint32_t)-1;
613 
614 	return psoc_info->info.target_type;
615 }
616 
617 /**
618  * target_psoc_set_max_descs() - set info max_descs
619  * @psoc_info:  pointer to structure target_psoc_info
620  * @max_descs:  Max descriptors
621  *
622  * API to set max_descs
623  *
624  * Return: void
625  */
626 static inline void target_psoc_set_max_descs
627 		(struct target_psoc_info *psoc_info, uint32_t max_descs)
628 {
629 	if (!psoc_info)
630 		return;
631 
632 	psoc_info->info.max_descs = max_descs;
633 }
634 
635 /**
636  * target_psoc_get_max_descs() - get info max_descs
637  * @psoc_info:  pointer to structure target_psoc_info
638  *
639  * API to get max_descs
640  *
641  * Return: unint32_t
642  */
643 static inline uint32_t target_psoc_get_max_descs
644 		(struct target_psoc_info *psoc_info)
645 {
646 	if (!psoc_info)
647 		return (uint32_t)-1;
648 
649 	return psoc_info->info.max_descs;
650 }
651 
652 /**
653  * target_psoc_set_wmi_service_ready() - set info wmi_service_ready
654  * @psoc_info:         pointer to structure target_psoc_info
655  * @wmi_service_ready: service ready flag
656  *
657  * API to set wmi_service_ready
658  *
659  * Return: void
660  */
661 static inline void target_psoc_set_wmi_service_ready
662 		(struct target_psoc_info *psoc_info, bool wmi_service_ready)
663 {
664 	if (!psoc_info)
665 		return;
666 
667 	psoc_info->info.wmi_service_ready = wmi_service_ready;
668 }
669 
670 /**
671  * target_psoc_get_wmi_service_ready() - get info wmi_service_ready
672  * @psoc_info:  pointer to structure target_psoc_info
673  *
674  * API to get wmi_service_ready
675  *
676  * Return: bool
677  */
678 static inline bool target_psoc_get_wmi_service_ready
679 		(struct target_psoc_info *psoc_info)
680 {
681 	return psoc_info->info.wmi_service_ready;
682 }
683 
684 /**
685  * target_psoc_set_wmi_ready() - set info wmi_ready
686  * @psoc_info:  pointer to structure target_psoc_info
687  * @wmi_ready:  Ready event flag
688  *
689  * API to set wmi_ready
690  *
691  * Return: void
692  */
693 static inline void target_psoc_set_wmi_ready
694 		(struct target_psoc_info *psoc_info, bool wmi_ready)
695 {
696 	if (!psoc_info)
697 		return;
698 
699 	psoc_info->info.wmi_ready = wmi_ready;
700 }
701 
702 /**
703  * target_psoc_get_wmi_ready() - get info wmi_ready
704  * @psoc_info:  pointer to structure target_psoc_info
705  *
706  * API to get wmi_ready
707  *
708  * Return: bool
709  */
710 static inline bool target_psoc_get_wmi_ready
711 		(struct target_psoc_info *psoc_info)
712 {
713 	return psoc_info->info.wmi_ready;
714 }
715 
716 /**
717  * target_psoc_set_preferred_hw_mode() - set preferred_hw_mode
718  * @psoc_info:  pointer to structure target_psoc_info
719  * @preferred_hw_mode: Preferred HW mode
720  *
721  * API to set preferred_hw_mode
722  *
723  * Return: void
724  */
725 static inline void target_psoc_set_preferred_hw_mode(
726 		struct target_psoc_info *psoc_info, uint32_t preferred_hw_mode)
727 {
728 	if (!psoc_info)
729 		return;
730 
731 	psoc_info->info.preferred_hw_mode = preferred_hw_mode;
732 }
733 
734 /**
735  * target_psoc_get_preferred_hw_mode() - get preferred_hw_mode
736  * @psoc_info:  pointer to structure target_psoc_info
737  *
738  * API to get preferred_hw_mode
739  *
740  * Return: unint32_t
741  */
742 static inline uint32_t target_psoc_get_preferred_hw_mode
743 		(struct target_psoc_info *psoc_info)
744 {
745 	if (!psoc_info)
746 		return WMI_HOST_HW_MODE_MAX;
747 
748 	return psoc_info->info.preferred_hw_mode;
749 }
750 
751 /**
752  * target_psoc_get_supported_hw_modes() - get supported_hw_mode in target
753  * @psoc_info:  pointer to structure target_psoc_info
754  *
755  * API to get list of supported HW modes
756  *
757  * Return: pointer to target_supported_modes
758  */
759 static inline struct target_supported_modes *target_psoc_get_supported_hw_modes
760 		(struct target_psoc_info *psoc_info)
761 {
762 	if (!psoc_info)
763 		return NULL;
764 
765 	return &psoc_info->info.hw_modes;
766 }
767 
768 /**
769  * target_psoc_set_wmi_timeout() - set wmi_timeout
770  * @psoc_info:  pointer to structure target_psoc_info
771  * @wmi_timeout: WMI timeout value in sec
772  *
773  * API to set wmi_timeout
774  *
775  * Return: void
776  */
777 static inline void target_psoc_set_wmi_timeout
778 		(struct target_psoc_info *psoc_info, uint32_t wmi_timeout)
779 {
780 	if (!psoc_info)
781 		return;
782 
783 	psoc_info->info.wmi_timeout = wmi_timeout;
784 }
785 
786 /**
787  * target_psoc_get_wmi_timeout() - get wmi_timeout
788  * @psoc_info:  pointer to structure target_psoc_info
789  *
790  * API to get wmi_timeout
791  *
792  * Return: unint32_t
793  */
794 static inline uint32_t target_psoc_get_wmi_timeout
795 		(struct target_psoc_info *psoc_info)
796 {
797 	if (!psoc_info)
798 		return (uint32_t)-1;
799 
800 	return psoc_info->info.wmi_timeout;
801 }
802 
803 /**
804  * target_psoc_set_total_mac_phy_cnt() - set total_mac_phy
805  * @psoc_info:  pointer to structure target_psoc_infoa
806  * @total_mac_phy_cnt: Total MAC PHY cnt
807  *
808  * API to set total_mac_phy
809  *
810  * Return: void
811  */
812 static inline void target_psoc_set_total_mac_phy_cnt
813 		(struct target_psoc_info *psoc_info, uint8_t total_mac_phy_cnt)
814 {
815 	if (!psoc_info)
816 		return;
817 
818 	psoc_info->info.total_mac_phy_cnt = total_mac_phy_cnt;
819 }
820 
821 /**
822  * target_psoc_get_total_mac_phy_cnt() - get total_mac_phy
823  * @psoc_info:  pointer to structure target_psoc_info
824  *
825  * API to get total_mac_phy
826  *
827  * Return: unint8_t
828  */
829 static inline uint8_t target_psoc_get_total_mac_phy_cnt(
830 		struct target_psoc_info *psoc_info)
831 {
832 	if (!psoc_info)
833 		return 0;
834 
835 	return psoc_info->info.total_mac_phy_cnt;
836 }
837 
838 /**
839  * target_psoc_set_num_radios() - set num of radios
840  * @psoc_info:  pointer to structure target_psoc_info
841  * @num_radios: Number of radios
842  *
843  * API to set number of radios
844  *
845  * Return: number of radios
846  */
847 static inline void target_psoc_set_num_radios(
848 		struct target_psoc_info *psoc_info, uint8_t num_radios)
849 {
850 	if (!psoc_info)
851 		return;
852 
853 	psoc_info->info.num_radios = num_radios;
854 }
855 
856 /**
857  * target_psoc_set_pdev_id_to_phy_id_map() - set pdev to phy id mapping
858  * @psoc_info:  pointer to structure target_psoc_info
859  * @pdev_id: pdev id
860  * @phy_id: phy_id
861  *
862  * API to set pdev id to phy id mapping
863  *
864  * Return: void
865  */
866 static inline void target_psoc_set_pdev_id_to_phy_id_map(
867 		struct target_psoc_info *psoc_info,
868 		uint8_t *phy_id_map)
869 {
870 	if (!psoc_info)
871 		return;
872 
873 	psoc_info->info.is_pdevid_to_phyid_map = true;
874 	qdf_mem_copy(psoc_info->info.pdev_id_to_phy_id_map, phy_id_map,
875 		     PSOC_MAX_PHY_REG_CAP);
876 }
877 
878 /**
879  * target_psoc_get_num_radios() - get number of radios
880  * @psoc_info:  pointer to structure target_psoc_info
881  *
882  * API to get number_of_radios
883  *
884  * Return: number of radios
885  */
886 static inline uint8_t target_psoc_get_num_radios
887 		(struct target_psoc_info *psoc_info)
888 {
889 	if (!psoc_info)
890 		return 0;
891 
892 	return psoc_info->info.num_radios;
893 }
894 
895 /**
896  * target_psoc_get_num_radios_for_mode() - get number of radios for a hw-mode
897  * @psoc_info:  pointer to structure target_psoc_info
898  *
899  * API to get number_of_radios for a HW mode
900  *
901  * Return: number of radios
902  */
903 
904 static inline uint8_t target_psoc_get_num_radios_for_mode
905 		(struct target_psoc_info *psoc_info, uint8_t mode)
906 {
907 	uint8_t mac_phy_count;
908 	uint8_t num_radios = 0;
909 	struct tgt_info *info = &psoc_info->info;
910 
911 	if (!psoc_info)
912 		return 0;
913 
914 	for (mac_phy_count = 0;
915 		mac_phy_count < target_psoc_get_total_mac_phy_cnt(psoc_info);
916 		mac_phy_count++) {
917 		num_radios +=
918 		(info->mac_phy_cap[mac_phy_count].hw_mode_id == mode);
919 	}
920 
921 	return num_radios;
922 }
923 
924 /**
925  * target_psoc_set_service_bitmap() - set service_bitmap
926  * @psoc_info:  pointer to structure target_psoc_info
927  * @service_bitmap: FW service bitmap
928  *
929  * API to set service_bitmap
930  *
931  * Return: void
932  */
933 static inline void target_psoc_set_service_bitmap
934 		(struct target_psoc_info *psoc_info, uint32_t *service_bitmap)
935 {
936 	qdf_mem_copy(psoc_info->info.service_bitmap, service_bitmap,
937 			sizeof(psoc_info->info.service_bitmap));
938 }
939 
940 /**
941  * target_psoc_get_service_bitmap() - get service_bitmap
942  * @psoc_info:  pointer to structure target_psoc_info
943  *
944  * API to get service_bitmap
945  *
946  * Return: unint32_t
947  */
948 static inline uint32_t *target_psoc_get_service_bitmap
949 		(struct target_psoc_info *psoc_info)
950 {
951 	return psoc_info->info.service_bitmap;
952 }
953 
954 /**
955  * target_psoc_set_num_mem_chunks - set num_mem_chunks
956  * @psoc_info:  pointer to structure target_psoc_info
957  & @num_mem_chunks: Num Memory chunks allocated for FW
958  *
959  * API to set num_mem_chunks
960  *
961  * Return: void
962  */
963 static inline void target_psoc_set_num_mem_chunks(
964 		struct target_psoc_info *psoc_info, uint32_t num_mem_chunks)
965 {
966 	if (!psoc_info)
967 		return;
968 	psoc_info->info.num_mem_chunks = num_mem_chunks;
969 }
970 
971 /**
972  * target_psoc_get_num_mem_chunks() - get num_mem_chunks
973  * @psoc_info:  pointer to structure target_psoc_info
974  *
975  * API to get total_mac_phy
976  *
977  * Return: unint8_t
978  */
979 static inline uint32_t target_psoc_get_num_mem_chunks
980 		(struct target_psoc_info *psoc_info)
981 {
982 	if (!psoc_info)
983 		return (uint32_t)-1;
984 
985 	return psoc_info->info.num_mem_chunks;
986 }
987 /**
988  * target_psoc_set_hif_hdl - set hif_hdl
989  * @psoc_info:  pointer to structure target_psoc_info
990  * @hif_hdl:    HIF handle
991  *
992  * API to set hif_hdl
993  *
994  * Return: void
995  */
996 static inline void target_psoc_set_hif_hdl
997 		(struct target_psoc_info *psoc_info,
998 		 struct hif_opaque_softc *hif_hdl)
999 {
1000 	if (!psoc_info)
1001 		return;
1002 
1003 	psoc_info->hdls.hif_hdl = hif_hdl;
1004 }
1005 
1006 /**
1007  * target_psoc_get_hif_hdl() - get hif_hdl
1008  * @psoc_info:  pointer to structure target_psoc_info
1009  *
1010  * API to get hif_hdl
1011  *
1012  * Return: hif_hdl
1013  */
1014 static inline struct hif_opaque_softc *target_psoc_get_hif_hdl
1015 		(struct target_psoc_info *psoc_info)
1016 {
1017 	if (!psoc_info)
1018 		return NULL;
1019 
1020 	return psoc_info->hdls.hif_hdl;
1021 }
1022 
1023 /**
1024  * target_psoc_set_hif_hdl - set htc_hdl
1025  * @psoc_info:  pointer to structure target_psoc_info
1026  * @htc_hdl:    HTC handle
1027  *
1028  * API to set htc_hdl
1029  *
1030  * Return: void
1031  */
1032 static inline void target_psoc_set_htc_hdl(
1033 		struct target_psoc_info *psoc_info,
1034 		HTC_HANDLE htc_hdl)
1035 {
1036 	if (!psoc_info)
1037 		return;
1038 
1039 	psoc_info->hdls.htc_hdl = htc_hdl;
1040 }
1041 
1042 /**
1043  * target_psoc_get_htc_hdl() - get htc_hdl
1044  * @psoc_info:  pointer to structure target_psoc_info
1045  *
1046  * API to get htc_hdl
1047  *
1048  * Return: htc_hdl
1049  */
1050 static inline HTC_HANDLE target_psoc_get_htc_hdl
1051 		(struct target_psoc_info *psoc_info)
1052 {
1053 	if (!psoc_info)
1054 		return NULL;
1055 
1056 	return psoc_info->hdls.htc_hdl;
1057 }
1058 /**
1059  * target_psoc_set_wmi_hdl - set wmi_hdl
1060  * @psoc_info:  pointer to structure target_psoc_info
1061  * @wmi_hdl:    WMI handle
1062  *
1063  * API to set wmi_hdl
1064  *
1065  * Return: void
1066  */
1067 static inline void target_psoc_set_wmi_hdl
1068 		(struct target_psoc_info *psoc_info,
1069 		 struct wmi_unified *wmi_hdl)
1070 {
1071 	if (!psoc_info)
1072 		return;
1073 
1074 	psoc_info->hdls.wmi_hdl = wmi_hdl;
1075 }
1076 
1077 /**
1078  * target_psoc_get_wmi_hdl() - get wmi_hdl
1079  * @psoc_info:  pointer to structure target_psoc_info
1080  *
1081  * API to get wmi_hdl
1082  *
1083  * Return: wmi_hdl
1084  */
1085 static inline struct wmi_unified *target_psoc_get_wmi_hdl
1086 		(struct target_psoc_info *psoc_info)
1087 {
1088 	if (!psoc_info)
1089 		return NULL;
1090 
1091 	return psoc_info->hdls.wmi_hdl;
1092 }
1093 
1094 /**
1095  * target_psoc_set_accelerator_hdl - set accelerator_hdl
1096  * @psoc_info:  pointer to structure target_psoc_info
1097  * @accelerator_hdl: Accelator handle
1098  *
1099  * API to set accelerator_hdl
1100  *
1101  * Return: void
1102  */
1103 static inline void target_psoc_set_accelerator_hdl
1104 		(struct target_psoc_info *psoc_info,
1105 		 struct common_accelerator_handle *accelerator_hdl)
1106 {
1107 	if (!psoc_info)
1108 		return;
1109 
1110 	psoc_info->hdls.accelerator_hdl = accelerator_hdl;
1111 }
1112 
1113 /**
1114  * target_psoc_get_accelerator_hdl() - get accelerator_hdl
1115  * @psoc_info:  pointer to structure target_psoc_info
1116  *
1117  * API to get accelerator_hdl
1118  *
1119  * Return: accelerator_hdl
1120  */
1121 static inline
1122 struct common_accelerator_handle *target_psoc_get_accelerator_hdl
1123 		(struct target_psoc_info *psoc_info)
1124 {
1125 	if (!psoc_info)
1126 		return NULL;
1127 
1128 	return psoc_info->hdls.accelerator_hdl;
1129 }
1130 
1131 /**
1132  * target_psoc_set_feature_ptr - set feature_ptr
1133  * @psoc_info:  pointer to structure target_psoc_info
1134  * @feature_ptr: set feature pointer
1135  *
1136  * API to set feature_ptr
1137  *
1138  * Return: void
1139  */
1140 static inline void target_psoc_set_feature_ptr
1141 		(struct target_psoc_info *psoc_info, void *feature_ptr)
1142 {
1143 	if (!psoc_info)
1144 		return;
1145 
1146 	psoc_info->feature_ptr = feature_ptr;
1147 }
1148 
1149 /**
1150  * target_psoc_get_feature_ptr() - get feature_ptr
1151  * @psoc_info:  pointer to structure target_psoc_info
1152  *
1153  * API to get feature_ptr
1154  *
1155  * Return: feature_ptr
1156  */
1157 static inline void *target_psoc_get_feature_ptr
1158 		(struct target_psoc_info *psoc_info)
1159 {
1160 	if (!psoc_info)
1161 		return NULL;
1162 
1163 	return psoc_info->feature_ptr;
1164 }
1165 
1166 /**
1167  * target_psoc_get_version()- get host_fw_ver version
1168  * @psoc_info:  pointer to structure target_psoc_info
1169  *
1170  * API to get host_fw_ver version
1171  *
1172  * Return: void
1173  */
1174 static inline struct host_fw_ver *target_psoc_get_version
1175 		(struct target_psoc_info *psoc_info)
1176 {
1177 	return &psoc_info->info.version;
1178 }
1179 
1180 /**
1181  * target_psoc_get_target_ver()- get target version
1182  * @psoc_info:  pointer to structure target_psoc_info
1183  *
1184  * API to get target version
1185  *
1186  * Return: target version
1187  */
1188 static inline uint32_t target_psoc_get_target_ver
1189 		(struct target_psoc_info *psoc_info)
1190 {
1191 	return psoc_info->info.version.target_ver;
1192 }
1193 
1194 /**
1195  * target_psoc_set_target_ver()- set target version
1196  * @psoc_info:  pointer to structure target_psoc_info
1197  * @target_ver: Target version
1198  *
1199  * API to set target version
1200  *
1201  * Return: void
1202  */
1203 static inline void target_psoc_set_target_ver
1204 		(struct target_psoc_info *psoc_info, uint32_t target_ver)
1205 {
1206 	if (!psoc_info)
1207 		return;
1208 
1209 	psoc_info->info.version.target_ver = target_ver;
1210 }
1211 
1212 /**
1213  * target_psoc_set_target_rev()- set target revision
1214  * @psoc_info:  pointer to structure target_psoc_info
1215  * @target_rev: Target revision
1216  *
1217  * API to get target version
1218  *
1219  * Return: void
1220  */
1221 static inline void target_psoc_set_target_rev
1222 		(struct target_psoc_info *psoc_info, uint32_t target_rev)
1223 {
1224 	if (!psoc_info)
1225 		return;
1226 
1227 	psoc_info->info.version.target_rev = target_rev;
1228 }
1229 
1230 /**
1231  * target_psoc_get_target_rev()- get target revision
1232  * @psoc_info:  pointer to structure target_psoc_info
1233  *
1234  * API to get target revision
1235  *
1236  * Return: target revision
1237  */
1238 static inline uint32_t target_psoc_get_target_rev
1239 		(struct target_psoc_info *psoc_info)
1240 {
1241 	return psoc_info->info.version.target_rev;
1242 }
1243 
1244 /**
1245  * target_psoc_set_dbglog_hdl - set dbglog_hdl
1246  * @psoc_info:  pointer to structure target_psoc_info
1247  * @dbglog_hdl:    dbglog handle
1248  *
1249  * API to set dbglog_hdl
1250  *
1251  * Return: void
1252  */
1253 static inline void target_psoc_set_dbglog_hdl
1254 		(struct target_psoc_info *psoc_info,
1255 		 struct common_dbglog_handle *dbglog_hdl)
1256 {
1257 	if (!psoc_info)
1258 		return;
1259 
1260 	psoc_info->hdls.dbglog_hdl = dbglog_hdl;
1261 }
1262 
1263 /**
1264  * target_psoc_get_dbglog_hdl() - get dbglog_hdl
1265  * @psoc_info:  pointer to structure target_psoc_info
1266  *
1267  * API to get dbglog_hdl
1268  *
1269  * Return: dbglog_hdl
1270  */
1271 static inline struct common_dbglog_handle *target_psoc_get_dbglog_hdl
1272 		(struct target_psoc_info *psoc_info)
1273 {
1274 	if (!psoc_info)
1275 		return NULL;
1276 
1277 	return psoc_info->hdls.dbglog_hdl;
1278 }
1279 
1280 /**
1281  * target_psoc_get_wlan_res_cfg() - get wlan_res_cfg
1282  * @psoc_info:  pointer to structure target_psoc_info
1283  *
1284  * API to get wlan_res_cfg
1285  *
1286  * Return: structure pointer to host_fw_ver
1287  */
1288 static inline target_resource_config *target_psoc_get_wlan_res_cfg
1289 		(struct target_psoc_info *psoc_info)
1290 {
1291 	if (!psoc_info)
1292 		return NULL;
1293 
1294 	return &psoc_info->info.wlan_res_cfg;
1295 }
1296 
1297 /**
1298  * target_psoc_get_wlan_ext_res_cfg() - get wlan_ext_res_cfg
1299  * @psoc_info:  pointer to structure target_psoc_info
1300  *
1301  * API to get wlan_ext_res_cfg
1302  *
1303  * Return: structure pointer to wmi_host_ext_resource_config
1304  */
1305 static inline wmi_host_ext_resource_config *target_psoc_get_wlan_ext_res_cfg
1306 		(struct target_psoc_info *psoc_info)
1307 {
1308 	if (!psoc_info)
1309 		return NULL;
1310 
1311 	return &psoc_info->info.wlan_ext_res_cfg;
1312 }
1313 
1314 /**
1315  * target_psoc_get_event_queue() - get event_queue
1316  * @psoc_info:  pointer to structure target_psoc_info
1317  *
1318  * API to get event_queue
1319  *
1320  * Return: structure pointer to qdf_wait_queue_head_t
1321  */
1322 static inline qdf_event_t *target_psoc_get_event
1323 		(struct target_psoc_info *psoc_info)
1324 {
1325 	if (!psoc_info)
1326 		return NULL;
1327 
1328 	return &psoc_info->info.event;
1329 }
1330 
1331 /**
1332  * target_psoc_get_target_caps() - get target_caps
1333  * @psoc_info:  pointer to structure target_psoc_info
1334  *
1335  * API to get target_caps
1336  *
1337  * Return: structure pointer to wlan_psoc_target_capability_info
1338  */
1339 static inline struct wlan_psoc_target_capability_info
1340 		*target_psoc_get_target_caps(struct target_psoc_info *psoc_info)
1341 {
1342 	if (!psoc_info)
1343 		return NULL;
1344 
1345 	return &psoc_info->info.target_caps;
1346 }
1347 
1348 /**
1349  * target_psoc_get_service_ext_param() - get service_ext_param
1350  * @psoc_info:  pointer to structure target_psoc_info
1351  *
1352  * API to get service_ext_param
1353  *
1354  * Return: structure pointer to wlan_psoc_host_service_ext_param
1355  */
1356 static inline struct wlan_psoc_host_service_ext_param
1357 		*target_psoc_get_service_ext_param
1358 		(struct target_psoc_info *psoc_info)
1359 {
1360 	if (!psoc_info)
1361 		return NULL;
1362 
1363 	return &psoc_info->info.service_ext_param;
1364 }
1365 
1366 /**
1367  * target_psoc_get_num_dbr_ring_caps() - get no of dbr_ring_caps
1368  * @psoc_info:  pointer to structure target_psoc_info
1369  *
1370  * API to get num_dbr_ring_caps
1371  *
1372  * Return: no of dbr_ring_caps
1373  */
1374 static inline uint32_t target_psoc_get_num_dbr_ring_caps
1375 		(struct target_psoc_info *psoc_info)
1376 {
1377 	if (!psoc_info)
1378 		return 0;
1379 
1380 	if (psoc_info->info.service_ext_param.num_dbr_ring_caps)
1381 		return psoc_info->info.service_ext_param.num_dbr_ring_caps;
1382 
1383 	return psoc_info->info.service_ext2_param.num_dbr_ring_caps;
1384 }
1385 
1386 /**
1387  * target_psoc_get_num_scan_radio_caps() - get no of scan_radio_caps
1388  * @psoc_info:  pointer to structure target_psoc_info
1389  *
1390  * API to get num_scan_radio_caps
1391  *
1392  * Return: no of scan_radio_caps
1393  */
1394 static inline uint32_t target_psoc_get_num_scan_radio_caps
1395 		(struct target_psoc_info *psoc_info)
1396 {
1397 	if (!psoc_info)
1398 		return 0;
1399 
1400 	return psoc_info->info.service_ext2_param.num_scan_radio_caps;
1401 }
1402 
1403 /**
1404  * target_psoc_get_mac_phy_cap_for_mode() - get mac_phy_cap for a hw-mode
1405  * @psoc_info:  pointer to structure target_psoc_info
1406  *
1407  * API to get mac_phy_cap for a specified hw-mode
1408  *
1409  * Return: structure pointer to wlan_psoc_host_mac_phy_caps
1410  */
1411 
1412 static inline struct wlan_psoc_host_mac_phy_caps
1413 		*target_psoc_get_mac_phy_cap_for_mode
1414 		(struct target_psoc_info *psoc_info, uint8_t mode)
1415 {
1416 	uint8_t mac_phy_idx;
1417 	struct tgt_info *info = &psoc_info->info;
1418 
1419 	if (!psoc_info)
1420 		return NULL;
1421 
1422 	for (mac_phy_idx = 0;
1423 		mac_phy_idx < PSOC_MAX_MAC_PHY_CAP;
1424 			mac_phy_idx++)
1425 		if (info->mac_phy_cap[mac_phy_idx].hw_mode_id == mode)
1426 			break;
1427 
1428 	if (mac_phy_idx == PSOC_MAX_MAC_PHY_CAP)
1429 		return NULL;
1430 
1431 	return &info->mac_phy_cap[mac_phy_idx];
1432 }
1433 
1434 /**
1435  * target_psoc_get_mac_phy_cap() - get mac_phy_cap
1436  * @psoc_info:  pointer to structure target_psoc_info
1437  *
1438  * API to get mac_phy_cap
1439  *
1440  * Return: structure pointer to wlan_psoc_host_mac_phy_caps
1441  */
1442 static inline struct wlan_psoc_host_mac_phy_caps *target_psoc_get_mac_phy_cap
1443 		(struct target_psoc_info *psoc_info)
1444 {
1445 	uint32_t preferred_hw_mode;
1446 	struct wlan_psoc_host_mac_phy_caps *mac_phy_cap;
1447 
1448 	if (!psoc_info)
1449 		return NULL;
1450 
1451 	preferred_hw_mode =
1452 		target_psoc_get_preferred_hw_mode(psoc_info);
1453 
1454 	if (preferred_hw_mode < WMI_HOST_HW_MODE_MAX) {
1455 		mac_phy_cap =
1456 			target_psoc_get_mac_phy_cap_for_mode
1457 			(psoc_info, preferred_hw_mode);
1458 	} else {
1459 		mac_phy_cap = psoc_info->info.mac_phy_cap;
1460 	}
1461 
1462 	return mac_phy_cap;
1463 }
1464 
1465 /**
1466  * target_psoc_get_dbr_ring_caps() - get dbr_ring_cap
1467  * @psoc_info:  pointer to structure target_psoc_info
1468  *
1469  * API to get dbr_ring_cap
1470  *
1471  * Return: structure pointer to wlan_psoc_host_dbr_ring_caps
1472  */
1473 static inline struct wlan_psoc_host_dbr_ring_caps
1474 	*target_psoc_get_dbr_ring_caps(struct target_psoc_info *psoc_info)
1475 {
1476 	if (!psoc_info)
1477 		return NULL;
1478 
1479 	return psoc_info->info.dbr_ring_cap;
1480 }
1481 
1482 /**
1483  * target_psoc_get_scan_radio_caps() - get scan_radio_cap
1484  * @psoc_info:  pointer to structure target_psoc_info
1485  *
1486  * API to get scan_radio_cap
1487  *
1488  * Return: structure pointer to wlan_psoc_host_scan_radio_caps
1489  */
1490 static inline struct wlan_psoc_host_scan_radio_caps
1491 	*target_psoc_get_scan_radio_caps(struct target_psoc_info *psoc_info)
1492 {
1493 	if (!psoc_info)
1494 		return NULL;
1495 
1496 	return psoc_info->info.scan_radio_caps;
1497 }
1498 
1499 /**
1500  * target_psoc_get_spectral_scaling_params() - get Spectral scaling params
1501  * @psoc_info:  pointer to structure target_psoc_info
1502  *
1503  * API to get Spectral scaling params
1504  *
1505  * Return: structure pointer to wlan_psoc_host_spectral_scaling_params
1506  */
1507 static inline struct wlan_psoc_host_spectral_scaling_params
1508 		*target_psoc_get_spectral_scaling_params(
1509 		struct target_psoc_info *psoc_info)
1510 {
1511 	if (!psoc_info)
1512 		return NULL;
1513 
1514 	return psoc_info->info.scaling_params;
1515 }
1516 
1517 /**
1518  * target_psoc_get_mem_chunks() - get mem_chunks
1519  * @psoc_info:  pointer to structure target_psoc_info
1520  *
1521  * API to get mem_chunks
1522  *
1523  * Return: structure pointer to wmi_host_mem_chunk
1524  */
1525 static inline struct wmi_host_mem_chunk *target_psoc_get_mem_chunks
1526 		(struct target_psoc_info *psoc_info)
1527 {
1528 	if (!psoc_info)
1529 		return NULL;
1530 
1531 	return psoc_info->info.mem_chunks;
1532 }
1533 
1534 /**
1535  * target_psoc_get_tif_ops() - get tif_ops
1536  * @psoc_info:  pointer to structure target_psoc_info
1537  *
1538  * API to get tif_ops
1539  *
1540  * Return: structure pointer to target_ops
1541  */
1542 static inline struct target_ops *target_psoc_get_tif_ops
1543 		(struct target_psoc_info *psoc_info)
1544 {
1545 	if (!psoc_info)
1546 		return NULL;
1547 
1548 	return psoc_info->tif_ops;
1549 }
1550 
1551 /**
1552  * target_pdev_set_feature_ptr - set feature_ptr
1553  * @pdev_info:  pointer to structure target_pdev_info
1554  * @feature_ptr: Feature pointer
1555  *
1556  * API to set feature_ptr
1557  *
1558  * Return: void
1559  */
1560 static inline void target_pdev_set_feature_ptr
1561 		(struct target_pdev_info *pdev_info, void *feature_ptr)
1562 {
1563 	if (!pdev_info)
1564 		return;
1565 
1566 	pdev_info->feature_ptr = feature_ptr;
1567 }
1568 
1569 /**
1570  * target_pdev_get_feature_ptr() - get feature_ptr
1571  * @pdev_info:  pointer to structure target_pdev_info
1572  *
1573  * API to get feature_ptr
1574  *
1575  * Return: feature_ptr
1576  */
1577 static inline void *target_pdev_get_feature_ptr
1578 		(struct target_pdev_info *pdev_info)
1579 {
1580 	if (!pdev_info)
1581 		return NULL;
1582 
1583 	return pdev_info->feature_ptr;
1584 }
1585 
1586 /**
1587  * target_pdev_set_wmi_handle - set wmi_handle
1588  * @pdev_info:  pointer to structure target_pdev_info
1589  * @wmi_handle: WMI handle
1590  *
1591  * API to set wmi_handle
1592  *
1593  * Return: void
1594  */
1595 static inline void target_pdev_set_wmi_handle
1596 		(struct target_pdev_info *pdev_info,
1597 		 struct wmi_unified *wmi_handle)
1598 {
1599 	if (!pdev_info)
1600 		return;
1601 
1602 	pdev_info->wmi_handle = wmi_handle;
1603 }
1604 
1605 /**
1606  * target_pdev_get_wmi_handle - get wmi_handle
1607  * @pdev_info:  pointer to structure target_dev_info
1608  *
1609  * API to get wmi_handle
1610  *
1611  * Return: wmi_handle
1612  */
1613 static inline struct wmi_unified *target_pdev_get_wmi_handle
1614 		(struct target_pdev_info *pdev_info)
1615 {
1616 	if (!pdev_info)
1617 		return NULL;
1618 
1619 	return pdev_info->wmi_handle;
1620 }
1621 
1622 /**
1623  * target_pdev_set_accelerator_hdl - set accelerator_hdl
1624  * @pdev_info:  pointer to structure target_pdev_info
1625  * @accelerator_hdl: Accelator handle
1626  *
1627  * API to set accelerator_hdl
1628  *
1629  * Return: void
1630  */
1631 static inline void target_pdev_set_accelerator_hdl
1632 		(struct target_pdev_info *pdev_info,
1633 		 struct common_accelerator_handle *accelerator_hdl)
1634 {
1635 	if (!pdev_info)
1636 		return;
1637 
1638 	pdev_info->accelerator_hdl = accelerator_hdl;
1639 }
1640 
1641 /**
1642  * target_pdev_get_accelerator_hdl - get accelerator_hdl
1643  * @pdev_info:  pointer to structure target_dev_info
1644  *
1645  * API to get accelerator_hdl
1646  *
1647  * Return: accelerator_hdl
1648  */
1649 static inline struct common_accelerator_handle *
1650 target_pdev_get_accelerator_hdl(struct target_pdev_info *pdev_info)
1651 {
1652 	if (!pdev_info)
1653 		return NULL;
1654 
1655 	return pdev_info->accelerator_hdl;
1656 }
1657 
1658 /**
1659  * target_pdev_set_pdev_idx - set pdev_idx
1660  * @pdev_info:  pointer to structure target_pdev_info
1661  * @pdev_idx:   PDEV id of FW
1662  *
1663  * API to set pdev_idx
1664  *
1665  * Return: void
1666  */
1667 static inline void target_pdev_set_pdev_idx
1668 		(struct target_pdev_info *pdev_info, int32_t pdev_idx)
1669 {
1670 	if (!pdev_info)
1671 		return;
1672 
1673 	pdev_info->pdev_idx = pdev_idx;
1674 }
1675 
1676 /**
1677  * target_pdev_get_pdev_idx  - get pdev_idx
1678  * @pdev_info:  pointer to structure target_dev_info
1679  *
1680  * API to get pdev_idx
1681  *
1682  * Return: int32_t
1683  */
1684 static inline int32_t  target_pdev_get_pdev_idx
1685 		(struct target_pdev_info *pdev_info)
1686 {
1687 	if (!pdev_info)
1688 		return -EINVAL;
1689 
1690 	return pdev_info->pdev_idx;
1691 }
1692 
1693 /**
1694  * target_pdev_set_phy_idx - set phy_idx
1695  * @pdev_info:  pointer to structure target_pdev_info
1696  * @phy_idx:    phy ID of FW
1697  *
1698  * API to set phy_idx
1699  *
1700  * Return: void
1701  */
1702 static inline void target_pdev_set_phy_idx
1703 		(struct target_pdev_info *pdev_info, int32_t phy_idx)
1704 {
1705 	if (!pdev_info)
1706 		return;
1707 
1708 	pdev_info->phy_idx  = phy_idx;
1709 }
1710 
1711 /**
1712  * target_pdev_get_phy_idx  - get phy_idx
1713  * @pdev_info:  pointer to structure target_dev_info
1714  *
1715  * API to get phy_idx
1716  *
1717  * Return: int32_t
1718  */
1719 static inline int32_t target_pdev_get_phy_idx
1720 		(struct target_pdev_info *pdev_info)
1721 {
1722 	if (!pdev_info)
1723 		return -EINVAL;
1724 
1725 	return pdev_info->phy_idx;
1726 }
1727 
1728 /**
1729  * GET_WMI_HDL_FROM_PSOC - get wmi handle from psoc
1730  * @psoc:  psoc object
1731  *
1732  * API to get wmi_handle from psoc
1733  *
1734  * Return: wmi_handle on success
1735  *         if tgt handle is not initialized, it returns NULL
1736  */
1737 static inline struct wmi_unified *GET_WMI_HDL_FROM_PSOC(
1738 		struct wlan_objmgr_psoc *psoc)
1739 {
1740 	struct target_psoc_info *tgt_if_handle;
1741 
1742 	if (psoc) {
1743 		tgt_if_handle = psoc->tgt_if_handle;
1744 
1745 		if (tgt_if_handle)
1746 			return target_psoc_get_wmi_hdl(tgt_if_handle);
1747 		else
1748 			return NULL;
1749 	}
1750 
1751 	return NULL;
1752 }
1753 
1754 /**
1755  * GET_WMI_HDL_FROM_PDEV - get wmi handle from pdev
1756  * @pdev:  pdev object
1757  *
1758  * API to get wmi_handle from pdev
1759  *
1760  * Return: wmi_handle on success
1761  *         if tgt handle is not initialized, it returns NULL
1762  */
1763 static inline struct wmi_unified *GET_WMI_HDL_FROM_PDEV(
1764 		struct wlan_objmgr_pdev *pdev)
1765 {
1766 	struct target_pdev_info *tgt_if_handle;
1767 
1768 	if (pdev) {
1769 		tgt_if_handle =  pdev->tgt_if_handle;
1770 
1771 		if (tgt_if_handle)
1772 			return target_pdev_get_wmi_handle(tgt_if_handle);
1773 		else
1774 			return NULL;
1775 	}
1776 
1777 	return NULL;
1778 }
1779 
1780 /**
1781  * get_wmi_unified_hdl_from_psoc - get wmi handle from psoc
1782  * @psoc:  psoc object
1783  *
1784  * API to get wmi_handle from psoc
1785  *
1786  * Return: wmi_handle on success
1787  *         if tgt handle is not initialized, it returns NULL
1788  */
1789 static inline wmi_unified_t
1790 get_wmi_unified_hdl_from_psoc(struct wlan_objmgr_psoc *psoc)
1791 {
1792 	return (wmi_unified_t)GET_WMI_HDL_FROM_PSOC(psoc);
1793 }
1794 
1795 /**
1796  * get_wmi_unified_hdl_from_pdev - get wmi handle from pdev
1797  * @pdev:  pdev object
1798  *
1799  * API to get wmi_handle from pdev
1800  *
1801  * Return: wmi_handle on success
1802  *         if tgt handle is not initialized, it returns NULL
1803  */
1804 static inline wmi_unified_t
1805 get_wmi_unified_hdl_from_pdev(struct wlan_objmgr_pdev *pdev)
1806 {
1807 	return (wmi_unified_t)GET_WMI_HDL_FROM_PDEV(pdev);
1808 }
1809 
1810 /**
1811  * target_if_ext_res_cfg_enable - Enable ext resource config
1812  * @psoc:  psoc object
1813  * @tgt_hdl: target_psoc_info pointer
1814  * @evt_buf: Event buffer received from FW
1815  *
1816  * API to enable Ext resource config
1817  *
1818  * Return: none
1819  */
1820 static inline void target_if_ext_res_cfg_enable(struct wlan_objmgr_psoc *psoc,
1821 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
1822 {
1823 	if ((tgt_hdl->tif_ops) &&
1824 		(tgt_hdl->tif_ops->ext_resource_config_enable))
1825 		tgt_hdl->tif_ops->ext_resource_config_enable(psoc,
1826 				tgt_hdl, evt_buf);
1827 }
1828 
1829 /**
1830  * target_if_peer_cfg_enable - Enable peer config
1831  * @psoc:  psoc object
1832  * @tgt_hdl: target_psoc_info pointer
1833  * @evt_buf: Event buffer received from FW
1834  *
1835  * API to enable peer config
1836  *
1837  * Return: none
1838  */
1839 static inline void target_if_peer_cfg_enable(struct wlan_objmgr_psoc *psoc,
1840 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
1841 {
1842 	if ((tgt_hdl->tif_ops) &&
1843 		(tgt_hdl->tif_ops->peer_config))
1844 		tgt_hdl->tif_ops->peer_config(psoc, tgt_hdl, evt_buf);
1845 }
1846 
1847 /**
1848  * target_if_mesh_support_enable - Enable MESH mode support
1849  * @psoc:  psoc object
1850  * @tgt_hdl: target_psoc_info pointer
1851  * @evt_buf: Event buffer received from FW
1852  *
1853  * API to enable Mesh mode
1854  *
1855  * Return: none
1856  */
1857 static inline void target_if_mesh_support_enable(struct wlan_objmgr_psoc *psoc,
1858 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
1859 {
1860 	if ((tgt_hdl->tif_ops) &&
1861 		(tgt_hdl->tif_ops->mesh_support_enable))
1862 		tgt_hdl->tif_ops->mesh_support_enable(psoc, tgt_hdl, evt_buf);
1863 }
1864 
1865 /**
1866  * target_if_eapol_minrate_enable - Enable EAPOL Minrate in Tunnel Mode
1867  * @psoc: psoc object
1868  * @tgt_hdl: target_psoc_info pointer
1869  * @evt_buf: Event buffer received from FW
1870  *
1871  * API to enable eapol minrate
1872  *
1873  * Return: none
1874  */
1875 static inline void target_if_eapol_minrate_enable(struct wlan_objmgr_psoc *psoc,
1876 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
1877 {
1878 	if ((tgt_hdl->tif_ops) &&
1879 	    (tgt_hdl->tif_ops->eapol_minrate_enable))
1880 		tgt_hdl->tif_ops->eapol_minrate_enable(psoc, tgt_hdl, evt_buf);
1881 }
1882 
1883 /**
1884  * target_if_smart_antenna_enable - Enable Smart antenna module
1885  * @psoc:  psoc object
1886  * @tgt_hdl: target_psoc_info pointer
1887  * @evt_buf: Event buffer received from FW
1888  *
1889  * API to enable Smart antenna
1890  *
1891  * Return: none
1892  */
1893 static inline void target_if_smart_antenna_enable(struct wlan_objmgr_psoc *psoc,
1894 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
1895 {
1896 	if ((tgt_hdl->tif_ops) &&
1897 		(tgt_hdl->tif_ops->smart_antenna_enable))
1898 		tgt_hdl->tif_ops->smart_antenna_enable(psoc, tgt_hdl, evt_buf);
1899 }
1900 
1901 /**
1902  * target_if_cfr_support_enable - Enable cfr support
1903  * @psoc:  psoc object
1904  * @tgt_hdl: target_psoc_info pointer
1905  * @evt_buf: Event buffer received from FW
1906  *
1907  * API to enable cfr support
1908  *
1909  * Return: none
1910  */
1911 static inline void target_if_cfr_support_enable(struct wlan_objmgr_psoc *psoc,
1912 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
1913 {
1914 	if ((tgt_hdl->tif_ops) &&
1915 	    (tgt_hdl->tif_ops->cfr_support_enable))
1916 		tgt_hdl->tif_ops->cfr_support_enable(psoc, tgt_hdl, evt_buf);
1917 }
1918 
1919 /**
1920  * target_if_set_pktlog_checksum - Set pktlog checksum
1921  * @pdev: pdev object
1922  * @tgt_hdl: target_psoc_info pointer
1923  * @checksum: checksum received from FW
1924  *
1925  * API to set pktlog checksum
1926  *
1927  * Return: none
1928  */
1929 static inline void target_if_set_pktlog_checksum(struct wlan_objmgr_pdev *pdev,
1930 			struct target_psoc_info *tgt_hdl, uint32_t checksum)
1931 {
1932 	if ((tgt_hdl->tif_ops) &&
1933 	    (tgt_hdl->tif_ops->set_pktlog_checksum))
1934 		tgt_hdl->tif_ops->set_pktlog_checksum(pdev, checksum);
1935 }
1936 
1937 /**
1938  * target_if_atf_cfg_enable - Enable ATF config
1939  * @psoc:  psoc object
1940  * @tgt_hdl: target_psoc_info pointer
1941  * @evt_buf: Event buffer received from FW
1942  *
1943  * API to enable ATF config
1944  *
1945  * Return: none
1946  */
1947 static inline void target_if_atf_cfg_enable(struct wlan_objmgr_psoc *psoc,
1948 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
1949 {
1950 	if ((tgt_hdl->tif_ops) &&
1951 		(tgt_hdl->tif_ops->atf_config_enable))
1952 		tgt_hdl->tif_ops->atf_config_enable(psoc, tgt_hdl, evt_buf);
1953 }
1954 
1955 /**
1956  * target_if_qwrap_cfg_enable - Enable QWRAP config
1957  * @psoc:  psoc object
1958  * @tgt_hdl: target_psoc_info pointer
1959  * @evt_buf: Event buffer received from FW
1960  *
1961  * API to enable QWRAP config
1962  *
1963  * Return: none
1964  */
1965 static inline void target_if_qwrap_cfg_enable(struct wlan_objmgr_psoc *psoc,
1966 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
1967 {
1968 	if ((tgt_hdl->tif_ops) &&
1969 		(tgt_hdl->tif_ops->qwrap_config_enable))
1970 		tgt_hdl->tif_ops->qwrap_config_enable(psoc, tgt_hdl, evt_buf);
1971 }
1972 
1973 /**
1974  * target_if_btcoex_cfg_enable - Enable BT coex config
1975  * @psoc:  psoc object
1976  * @tgt_hdl: target_psoc_info pointer
1977  * @evt_buf: Event buffer received from FW
1978  *
1979  * API to enable BT coex config
1980  *
1981  * Return: none
1982  */
1983 static inline void target_if_btcoex_cfg_enable(struct wlan_objmgr_psoc *psoc,
1984 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
1985 {
1986 	if ((tgt_hdl->tif_ops) &&
1987 		(tgt_hdl->tif_ops->btcoex_config_enable))
1988 		tgt_hdl->tif_ops->btcoex_config_enable(psoc, tgt_hdl, evt_buf);
1989 }
1990 
1991 /**
1992  * target_if_lteu_cfg_enable - Enable LTEU config
1993  * @psoc:  psoc object
1994  * @tgt_hdl: target_psoc_info pointer
1995  * @evt_buf: Event buffer received from FW
1996  *
1997  * API to enable LTEU coex config
1998  *
1999  * Return: none
2000  */
2001 static inline void target_if_lteu_cfg_enable(struct wlan_objmgr_psoc *psoc,
2002 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
2003 {
2004 	if ((tgt_hdl->tif_ops) &&
2005 		(tgt_hdl->tif_ops->lteu_ext_support_enable))
2006 		tgt_hdl->tif_ops->lteu_ext_support_enable(psoc,	tgt_hdl,
2007 								evt_buf);
2008 }
2009 
2010 /**
2011  * target_if_set_init_cmd_dev_param - Set init command params
2012  * @psoc:  psoc object
2013  * @tgt_hdl: target_psoc_info pointer
2014  *
2015  * API to set init command param based on config
2016  *
2017  * Return: none
2018  */
2019 static inline void target_if_set_init_cmd_dev_param(
2020 	struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_hdl)
2021 {
2022 	if ((tgt_hdl->tif_ops) &&
2023 		(tgt_hdl->tif_ops->set_init_cmd_dev_based_params)) {
2024 		tgt_hdl->tif_ops->set_init_cmd_dev_based_params(psoc,
2025 					tgt_hdl);
2026 	}
2027 }
2028 
2029 /**
2030  * target_if_alloc_pdevs - Allocate PDEVs
2031  * @psoc:  psoc object
2032  * @tgt_hdl: target_psoc_info pointer
2033  *
2034  * API allocates PDEVs based on ext service ready param
2035  *
2036  * Return: SUCCESS on pdev allocation or PDEV allocation is not needed
2037  *         FAILURE, if allocation fails
2038  */
2039 static inline QDF_STATUS target_if_alloc_pdevs(struct wlan_objmgr_psoc *psoc,
2040 					struct target_psoc_info *tgt_hdl)
2041 {
2042 	QDF_STATUS ret_val;
2043 
2044 	if ((tgt_hdl->tif_ops) &&
2045 		(tgt_hdl->tif_ops->alloc_pdevs))
2046 		ret_val = tgt_hdl->tif_ops->alloc_pdevs(psoc, tgt_hdl);
2047 	else
2048 		ret_val = QDF_STATUS_SUCCESS;
2049 
2050 	return ret_val;
2051 }
2052 
2053 /**
2054  * target_if_update_pdev_tgt_info - Update PDEVs info
2055  * @psoc:  psoc object
2056  * @tgt_hdl: target_psoc_info pointer
2057  *
2058  * API updates PDEVs info based on config
2059  *
2060  * Return: SUCCESS on pdev updation or PDEV updation is not needed
2061  *         FAILURE, if updation fails
2062  */
2063 static inline QDF_STATUS target_if_update_pdev_tgt_info(
2064 	struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_hdl)
2065 {
2066 	QDF_STATUS ret_val;
2067 
2068 	if ((tgt_hdl->tif_ops) &&
2069 		(tgt_hdl->tif_ops->update_pdev_tgt_info))
2070 		ret_val = tgt_hdl->tif_ops->update_pdev_tgt_info(psoc,
2071 							tgt_hdl);
2072 	else
2073 		ret_val = QDF_STATUS_SUCCESS;
2074 
2075 	return ret_val;
2076 }
2077 
2078 /**
2079  * target_if_print_service_ready_ext_param - Print Service ready ext param
2080  * @psoc:  psoc object
2081  * @tgt_hdl: target_psoc_info pointer
2082  *
2083  * API to print service ready ext param
2084  *
2085  * Return: none
2086  */
2087 static inline void target_if_print_service_ready_ext_param(
2088 	struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_hdl)
2089 {
2090 	if ((tgt_hdl->tif_ops) &&
2091 		(tgt_hdl->tif_ops->print_svc_ready_ex_param)) {
2092 		tgt_hdl->tif_ops->print_svc_ready_ex_param(psoc,
2093 			tgt_hdl);
2094 	}
2095 }
2096 
2097 /**
2098  * target_if_add_11ax_modes - Add 11ax modes explicitly
2099  * @psoc:  psoc object
2100  * @tgt_hdl: target_psoc_info pointer
2101  *
2102  * API to adds 11ax modes
2103  *
2104  * Return: none
2105  */
2106 #ifdef QCA_HOST_ADD_11AX_MODE_WAR
2107 static inline void target_if_add_11ax_modes(struct wlan_objmgr_psoc *psoc,
2108 					    struct target_psoc_info *tgt_hdl)
2109 {
2110 	if ((tgt_hdl->tif_ops) &&
2111 		(tgt_hdl->tif_ops->add_11ax_modes)) {
2112 		tgt_hdl->tif_ops->add_11ax_modes(psoc, tgt_hdl);
2113 	}
2114 }
2115 #else
2116 static inline void target_if_add_11ax_modes(struct wlan_objmgr_psoc *psoc,
2117 					    struct target_psoc_info *tgt_hdl)
2118 {
2119 }
2120 #endif
2121 
2122 /**
2123  * target_if_csa_switch_count_status - Calls a function to process CSA event
2124  * @psoc:  psoc object
2125  * @tgt_hdl: target_psoc_info pointer
2126  * @csa_status: CSA switch count status event param
2127  *
2128  * Return: 0 on success, -1 on failure
2129  */
2130 static inline int target_if_csa_switch_count_status(
2131 		struct wlan_objmgr_psoc *psoc,
2132 		struct target_psoc_info *tgt_hdl,
2133 		struct pdev_csa_switch_count_status csa_status)
2134 {
2135 	if (tgt_hdl->tif_ops && tgt_hdl->tif_ops->csa_switch_count_status)
2136 		return tgt_hdl->tif_ops->csa_switch_count_status(
2137 				psoc, csa_status);
2138 
2139 	return -1;
2140 }
2141 
2142 /**
2143  * target_if_set_default_config - Set default config in init command
2144  * @psoc:  psoc object
2145  * @tgt_hdl: target_psoc_info pointer
2146  *
2147  * API to set default config in init command
2148  *
2149  * Return: none
2150  */
2151 static inline void target_if_set_default_config(struct wlan_objmgr_psoc *psoc,
2152 					struct target_psoc_info *tgt_hdl)
2153 {
2154 	if ((tgt_hdl->tif_ops) &&
2155 		(tgt_hdl->tif_ops->set_default_tgt_config)) {
2156 		tgt_hdl->tif_ops->set_default_tgt_config(psoc, tgt_hdl);
2157 	}
2158 }
2159 
2160 /**
2161  * target_if_sw_version_check - SW version check
2162  * @psoc:  psoc object
2163  * @tgt_hdl: target_psoc_info pointer
2164  * @evt_buf: Event buffer received from FW
2165  *
2166  * API checks the SW version
2167  *
2168  * Return: SUCCESS on version matches or version check is not needed
2169  *         FAILURE, if check fails
2170  */
2171 static inline QDF_STATUS target_if_sw_version_check(
2172 			struct wlan_objmgr_psoc *psoc,
2173 			struct target_psoc_info *tgt_hdl, uint8_t *evt_buf)
2174 {
2175 	QDF_STATUS ret_val;
2176 
2177 	if ((tgt_hdl->tif_ops) &&
2178 		(tgt_hdl->tif_ops->sw_version_check))
2179 		ret_val = tgt_hdl->tif_ops->sw_version_check(psoc, tgt_hdl,
2180 								evt_buf);
2181 	else
2182 		ret_val = QDF_STATUS_SUCCESS;
2183 
2184 	return ret_val;
2185 }
2186 
2187 /**
2188  * target_if_get_phy_capability  - get phy capability
2189  * @target_psoc_info:  pointer to structure target_psoc_info
2190  *
2191  * API to get phy capability from the target caps
2192  *
2193  * Return: int32_t
2194  */
2195 static inline int32_t target_if_get_phy_capability
2196 			(struct target_psoc_info *target_psoc_info)
2197 {
2198 	if (!target_psoc_info)
2199 		return -EINVAL;
2200 
2201 	return target_psoc_info->info.target_caps.phy_capability;
2202 }
2203 
2204 /**
2205  * target_if_set_phy_capability  - set phy capability
2206  * @target_psoc_info:  pointer to structure target_psoc_info
2207  * @phy_capab: PHY capabilities
2208  *
2209  * API to set phy capability in the target caps
2210  *
2211  * Return: None
2212  */
2213 static inline void target_if_set_phy_capability
2214 		(struct target_psoc_info *target_psoc_info, int phy_capability)
2215 {
2216 	if (!target_psoc_info)
2217 		return;
2218 
2219 	target_psoc_info->info.target_caps.phy_capability = phy_capability;
2220 }
2221 
2222 /**
2223  * target_if_set_max_frag_entry  - set Maximum frag entries
2224  * @target_psoc_info:  pointer to structure target_psoc_info
2225  * @max_frag_entry: Maximum frag entries
2226  *
2227  * API to set Maximum frag entries from the target caps
2228  *
2229  * Return: None
2230  */
2231 static inline void target_if_set_max_frag_entry
2232 		(struct target_psoc_info *target_psoc_info, int max_frag_entry)
2233 {
2234 	if (!target_psoc_info)
2235 		return;
2236 
2237 	target_psoc_info->info.target_caps.max_frag_entry = max_frag_entry;
2238 }
2239 
2240 /**
2241  * target_if_get_max_frag_entry  - get Maximum frag entries
2242  * @target_psoc_info:  pointer to structure target_psoc_info
2243  *
2244  * API to get Maximum frag entries from the target caps
2245  *
2246  * Return: int32_t
2247  */
2248 static inline int32_t target_if_get_max_frag_entry
2249 		(struct target_psoc_info *target_psoc_info)
2250 {
2251 	if (!target_psoc_info)
2252 		return -EINVAL;
2253 
2254 	return target_psoc_info->info.target_caps.max_frag_entry;
2255 }
2256 
2257 /**
2258  * target_if_get_ht_cap_info  - get ht capabilities info
2259  * @target_psoc_info:  pointer to structure target_psoc_info
2260  *
2261  * API to get ht capabilities info from the target caps
2262  *
2263  * Return: int32_t
2264  */
2265 static inline int32_t target_if_get_ht_cap_info
2266 		(struct target_psoc_info *target_psoc_info)
2267 {
2268 	if (!target_psoc_info)
2269 		return -EINVAL;
2270 
2271 	return target_psoc_info->info.target_caps.ht_cap_info;
2272 }
2273 
2274 /**
2275  * target_if_get_vht_cap_info  - get vht capabilities info
2276  * @target_psoc_info:  pointer to structure target_psoc_info
2277  *
2278  * API to get vht capabilities info from the target caps
2279  *
2280  * Return: int32_t
2281  */
2282 static inline int32_t target_if_get_vht_cap_info
2283 		(struct target_psoc_info *target_psoc_info)
2284 {
2285 	if (!target_psoc_info)
2286 		return -EINVAL;
2287 
2288 	return target_psoc_info->info.target_caps.vht_cap_info;
2289 }
2290 
2291 /**
2292  * target_if_get_num_rf_chains  - get Number of RF chains supported
2293  * @target_psoc_info:  pointer to structure target_psoc_info
2294  *
2295  * API to get Number of RF chains supported from the target caps
2296  *
2297  * Return: int32_t
2298  */
2299 static inline int32_t target_if_get_num_rf_chains
2300 		(struct target_psoc_info *target_psoc_info)
2301 {
2302 	if (!target_psoc_info)
2303 		return -EINVAL;
2304 
2305 	return target_psoc_info->info.target_caps.num_rf_chains;
2306 }
2307 
2308 /**
2309  * target_if_get_fw_version  - get firmware version
2310  * @target_psoc_info:  pointer to structure target_psoc_info
2311  *
2312  * API to get firmware version from the target caps
2313  *
2314  * Return: int32_t
2315  */
2316 static inline int32_t target_if_get_fw_version
2317 		(struct target_psoc_info *target_psoc_info)
2318 {
2319 	if (!target_psoc_info)
2320 		return 0;
2321 
2322 	return target_psoc_info->info.target_caps.fw_version;
2323 }
2324 
2325 /**
2326  * target_if_get_wmi_fw_sub_feat_caps  - FW sub feature capabilities
2327  * @target_psoc_info:  pointer to structure target_psoc_info
2328  *
2329  * API to get FW sub feature capabilities from the target caps
2330  *
2331  * Return: int32_t
2332  */
2333 static inline int32_t target_if_get_wmi_fw_sub_feat_caps
2334 		(struct target_psoc_info *target_psoc_info)
2335 {
2336 	if (!target_psoc_info)
2337 		return -EINVAL;
2338 
2339 	return target_psoc_info->info.target_caps.wmi_fw_sub_feat_caps;
2340 }
2341 
2342 /**
2343  * target_if_get_conc_scan_config_bits  - Default concurrenct scan config
2344  * @tgt_hdl:  pointer to structure target_psoc_info
2345  *
2346  * API to get Default concurrenct scan config from the target caps
2347  *
2348  * Return: int32_t
2349  */
2350 static inline int32_t target_if_get_conc_scan_config_bits
2351 		(struct target_psoc_info *tgt_hdl)
2352 {
2353 	if (!tgt_hdl)
2354 		return -EINVAL;
2355 
2356 	return tgt_hdl->info.service_ext_param.default_conc_scan_config_bits;
2357 }
2358 
2359 /**
2360  * target_if_get_fw_config_bits  - Default HW config bits
2361  * @tgt_hdl:  pointer to structure target_psoc_info
2362  *
2363  * API to get Default HW config bits from the target caps
2364  *
2365  * Return: int32_t
2366  */
2367 static inline int32_t target_if_get_fw_config_bits
2368 		(struct target_psoc_info *tgt_hdl)
2369 {
2370 	if (!tgt_hdl)
2371 		return -EINVAL;
2372 
2373 	return tgt_hdl->info.service_ext_param.default_fw_config_bits;
2374 }
2375 
2376 /**
2377  * target_psoc_get_num_hw_modes  - get number of dbs hardware modes
2378  * @tgt_hdl:  pointer to structure target_psoc_info
2379  *
2380  * API to get Number of Dual Band Simultaneous (DBS) hardware modes
2381  *
2382  * Return: int32_t
2383  */
2384 static inline int32_t target_psoc_get_num_hw_modes
2385 		(struct target_psoc_info *tgt_hdl)
2386 {
2387 	if (!tgt_hdl)
2388 		return -EINVAL;
2389 
2390 	return tgt_hdl->info.service_ext_param.num_hw_modes;
2391 }
2392 
2393 #ifdef WLAN_SUPPORT_TWT
2394 #ifdef WLAN_TWT_AP_PDEV_COUNT_NUM_PHY
2395 static inline void target_if_set_twt_ap_pdev_count
2396 		(struct tgt_info *info, struct target_psoc_info *tgt_hdl)
2397 {
2398 	if (!tgt_hdl)
2399 		return;
2400 
2401 	info->wlan_res_cfg.twt_ap_pdev_count =
2402 					info->service_ext_param.num_phy;
2403 }
2404 #else
2405 static inline void target_if_set_twt_ap_pdev_count
2406 		(struct tgt_info *info, struct target_psoc_info *tgt_hdl)
2407 {
2408 	if (!tgt_hdl)
2409 		return;
2410 
2411 	info->wlan_res_cfg.twt_ap_pdev_count =
2412 					target_psoc_get_num_radios(tgt_hdl);
2413 }
2414 #endif /* WLAN_TWT_AP_PDEV_COUNT_NUM_PHY */
2415 #else
2416 static inline void target_if_set_twt_ap_pdev_count
2417 		(struct tgt_info *info, struct target_psoc_info *tgt_hdl)
2418 {
2419 }
2420 #endif /* WLAN_SUPPORT_TWT */
2421 
2422 /**
2423  * target_psoc_get_version_info() - Get version info from tgt info
2424  * @psoc_info: pointer to structure target_psoc_info
2425  * @reg_major: reg db version major
2426  * @reg_minor: reg db version minor
2427  * @bdf_major: bdf reg db version major
2428  * @bdf_minor: bdf reg db version minor
2429  *
2430  * API to get target version information.
2431  *
2432  * Return: void
2433  */
2434 static inline void target_psoc_get_version_info(
2435 					struct target_psoc_info *psoc_info,
2436 					uint8_t *reg_major, uint8_t *reg_minor,
2437 					uint8_t *bdf_major, uint8_t *bdf_minor)
2438 {
2439 	if (!psoc_info)
2440 		return;
2441 
2442 	*reg_major = psoc_info->info.service_ext2_param.reg_db_version_major;
2443 	*reg_minor = psoc_info->info.service_ext2_param.reg_db_version_minor;
2444 	*bdf_major =
2445 		psoc_info->info.service_ext2_param.bdf_reg_db_version_major;
2446 	*bdf_minor =
2447 		psoc_info->info.service_ext2_param.bdf_reg_db_version_minor;
2448 }
2449 
2450 /**
2451  * target_psoc_get_chan_width_switch_num_peers() - Get peer limit
2452  * @psoc_info: pointer to structure target_psoc_info
2453  *
2454  * API to get the number of peers supported per WMI command with the ID
2455  * WMI_PEER_CHAN_WIDTH_SWITCH_CMDID.
2456  *
2457  * Return: maximum peers allowed in a single WMI command with the given ID.
2458  */
2459 static inline uint32_t target_psoc_get_chan_width_switch_num_peers(
2460 					    struct target_psoc_info *psoc_info)
2461 {
2462 	if (!psoc_info)
2463 		return 0;
2464 
2465 	return psoc_info->info.service_ext2_param.chwidth_num_peer_caps;
2466 }
2467 
2468 /**
2469  * target_if_is_scan_radio_supported() - API to check scan radio
2470  * support for the given radio
2471  * @pdev: pointer to pdev
2472  * @is_scan_radio_supported: pointer to scan radio support flag
2473  *
2474  * API to check scan radio support for the given radio
2475  *
2476  * Return: QDF_STATUS
2477  */
2478 QDF_STATUS
2479 target_pdev_is_scan_radio_supported(struct wlan_objmgr_pdev *pdev,
2480 				    bool *is_scan_radio_supported);
2481 
2482 /**
2483  * target_pdev_scan_radio_is_dfs_enabled() - API to check
2484  * whether DFS needs to be enabled/disabled for scan radio.
2485  * @pdev:  pointer to pdev
2486  * @is_dfs_en: Pointer to DFS enable flag
2487  *
2488  * API to check whether DFS needs to be enabled/disabled for
2489  * scan radio. This API should be used only for a scan radio
2490  * pdev.
2491  *
2492  * Return: QDF_STATUS
2493  */
2494 QDF_STATUS
2495 target_pdev_scan_radio_is_dfs_enabled(struct wlan_objmgr_pdev *pdev,
2496 				      bool *is_dfs_en);
2497 
2498 /**
2499  * target_psoc_get_preamble_puncture_cap() - Get Preamble Puncturing capability
2500  * @psoc_info: pointer to structure target_psoc_info
2501  *
2502  * API to get the target capability for Preamble Punctured Tx
2503  *
2504  * Return: target capability for Preamble Punctured Tx.
2505  */
2506 static inline uint32_t target_psoc_get_preamble_puncture_cap(
2507 					    struct target_psoc_info *psoc_info)
2508 {
2509 	if (!psoc_info)
2510 		return 0;
2511 
2512 	return psoc_info->info.service_ext2_param.preamble_puncture_bw_cap;
2513 }
2514 
2515 /**
2516  * target_psoc_get_mu_max_users() - Get max users for MU transmissions
2517  * @psoc_info: pointer to structure target_psoc_info
2518  * @mu_caps: pointer to structure for max OFDMA/MU-MIMO users per-PPDU
2519  *
2520  * API to get the max number of users per-PPDU supported for Uplink/Downlink
2521  * MU transmissions.
2522  *
2523  * Return: void
2524  */
2525 static inline void target_psoc_get_mu_max_users(
2526 					struct target_psoc_info *psoc_info,
2527 					struct target_mu_caps *mu_caps)
2528 {
2529 	struct wlan_psoc_host_service_ext2_param *service_ext2_param;
2530 
2531 	if (!psoc_info || !mu_caps)
2532 		return;
2533 
2534 	service_ext2_param = &psoc_info->info.service_ext2_param;
2535 
2536 	mu_caps->ofdma_dl = service_ext2_param->max_users_dl_ofdma;
2537 	mu_caps->ofdma_ul = service_ext2_param->max_users_ul_ofdma;
2538 	mu_caps->mumimo_dl = service_ext2_param->max_users_dl_mumimo;
2539 	mu_caps->mumimo_ul = service_ext2_param->max_users_ul_mumimo;
2540 }
2541 
2542 /**
2543  * target_psoc_set_device_mode() - set global device_mode
2544  * @psoc_info: pointer to structure target_psoc_info
2545  * @device_mode: device mode mission monitor/ftm etc
2546  *
2547  * API to set global device mode
2548  *
2549  * Return: void
2550  */
2551 static inline void target_psoc_set_device_mode
2552 		(struct target_psoc_info *psoc_info, uint32_t device_mode)
2553 {
2554 	if (!psoc_info)
2555 		return;
2556 
2557 	psoc_info->info.device_mode = device_mode;
2558 }
2559 
2560 /**
2561  * target_psoc_get_device_mode() - get info device_mode
2562  * @psoc_info: pointer to structure target_psoc_info
2563  *
2564  * API to get device_mode
2565  *
2566  * Return: enum QDF_GLOBAL_MODE
2567  */
2568 static inline enum QDF_GLOBAL_MODE target_psoc_get_device_mode
2569 		(struct target_psoc_info *psoc_info)
2570 {
2571 	if (!psoc_info)
2572 		return QDF_GLOBAL_MAX_MODE;
2573 
2574 	return psoc_info->info.device_mode;
2575 }
2576 #endif
2577