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