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