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