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