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