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