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