1 /* 2 * Copyright (c) 2017-2018 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 #ifdef CONFIG_MCL 68 #define TARGET_TYPE_AR900B 9 /* Beeliner */ 69 #define TARGET_TYPE_QCA9984 15 /* cascade */ 70 #define TARGET_TYPE_IPQ4019 16 /* dakota */ 71 #define TARGET_TYPE_QCA9888 17 /* besra */ 72 #define TARGET_TYPE_AR9888 7 /* Peregrine */ 73 #endif 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 /** 87 * struct target_if_ctx - target_interface context 88 * @magic: magic for target if ctx 89 * @get_psoc_hdl_cb: function pointer to get psoc 90 * @get_pdev_hdl_cb: function pointer to get pdev 91 * @lock: spin lock for protecting the ctx 92 */ 93 struct target_if_ctx { 94 uint32_t magic; 95 get_psoc_handle_callback get_psoc_hdl_cb; 96 get_pdev_handle_callback get_pdev_hdl_cb; 97 wmi_legacy_service_ready_callback service_ready_cb; 98 qdf_spinlock_t lock; 99 }; 100 101 struct target_psoc_info; 102 /** 103 * struct host_fw_ver - holds host fw version 104 * @host_ver: Host version 105 * @target_ver: Target version ID 106 * @target_rev: Target revision ID 107 * @wlan_ver: FW SW version 108 * @wlan_ver_1: FW SW version second dword 109 * @abi_ver: ABI version 110 */ 111 struct host_fw_ver { 112 uint32_t host_ver; 113 uint32_t target_ver; 114 uint32_t target_rev; 115 uint32_t wlan_ver; 116 uint32_t wlan_ver_1; 117 uint32_t abi_ver; 118 }; 119 120 struct common_dbglog_handle; 121 struct common_hif_handle; 122 struct common_htc_handle; 123 struct common_wmi_handle; 124 struct common_accelerator_handle; 125 126 /** 127 * struct comp_hdls - Non-umac/lower layer components handles, it is a sub 128 * structure of target psoc information 129 * @hif_hdl: HIF handle 130 * @htc_hdl: HTC handle 131 * @wmi_hdl: WMI handle 132 * @accelerator_hdl: NSS offload/IPA handle 133 * @dbglog_hdl: Debug log handle 134 */ 135 struct comp_hdls { 136 struct common_hif_handle *hif_hdl; 137 struct common_htc_handle *htc_hdl; 138 struct common_wmi_handle *wmi_hdl; 139 struct common_accelerator_handle *accelerator_hdl; 140 struct common_dbglog_handle *dbglog_hdl; 141 }; 142 143 /** 144 * struct tgt_info - FW or lower layer related info(required by target_if), 145 * it is a sub structure of taarget psoc information 146 * @version: Host FW version struct 147 * @wlan_res_cfg: target_resource_config info 148 * @wlan_ext_res_cfg: wmi_host_ext_resource_config info 149 * @wmi_service_ready: is service ready received 150 * @wmi_ready: is ready event received 151 * @total_mac_phy_cnt: num of mac phys 152 * @num_radios: number of radios 153 * @wlan_init_status: Target init status 154 * @target_type: Target type 155 * @max_descs: Max descriptors 156 * @preferred_hw_mode: preferred hw mode 157 * @wmi_timeout: wait timeout for target events 158 * @event: qdf_event for target events 159 * @service_bitmap: WMI service bitmap 160 * @target_cap: target capabilities 161 * @service_ext_param: ext service params 162 * @mac_phy_cap: phy caps array 163 * @reg_cap: regulatory caps array 164 * @num_mem_chunks: number of mem chunks allocated 165 * @mem_chunks: allocated memory blocks for FW 166 */ 167 struct tgt_info { 168 struct host_fw_ver version; 169 target_resource_config wlan_res_cfg; 170 wmi_host_ext_resource_config wlan_ext_res_cfg; 171 bool wmi_service_ready; 172 bool wmi_ready; 173 uint8_t total_mac_phy_cnt; 174 uint8_t num_radios; 175 uint32_t wlan_init_status; 176 uint32_t target_type; 177 uint32_t max_descs; 178 uint32_t preferred_hw_mode; 179 uint32_t wmi_timeout; 180 qdf_event_t event; 181 uint32_t service_bitmap[PSOC_SERVICE_BM_SIZE]; 182 struct wlan_psoc_target_capability_info target_caps; 183 struct wlan_psoc_host_service_ext_param service_ext_param; 184 struct wlan_psoc_host_mac_phy_caps 185 mac_phy_cap[PSOC_MAX_MAC_PHY_CAP]; 186 struct wlan_psoc_host_dbr_ring_caps *dbr_ring_cap; 187 uint32_t num_mem_chunks; 188 struct wmi_host_mem_chunk mem_chunks[MAX_MEM_CHUNKS]; 189 }; 190 191 /** 192 * struct target_ops - Holds feature specific function pointers, which would be 193 * invoked as part of service ready or ext service ready 194 * @ext_resource_config_enable: Ext resource config 195 * @peer_config: Peer config enable 196 * @mesh_support_enable: Mesh support enable 197 * @smart_antenna_enable: Smart antenna enable 198 * @atf_config_enable: ATF config enable 199 * @qwrap_config_enable: QWRAP config enable 200 * @btcoex_config_enable: BTCOEX config enable 201 * @lteu_ext_support_enable: LTE-U Ext config enable 202 * @set_init_cmd_dev_based_params: Sets Init command params 203 * @alloc_pdevs: Allocates PDEVs 204 * @update_pdev_tgt_info: Updates PDEV target info 205 * @mem_mgr_alloc_chunk: Allocates memory through MEM manager 206 * @mem_mgr_free_chunks: Free memory chunks through MEM manager 207 * @print_svc_ready_ex_param: Print service ready ext params 208 * @add_11ax_modes: Adds 11ax modes to reg cap 209 * @set_default_tgt_config: Sets target config with default values 210 * @sw_version_check: Checks the SW version 211 * @smart_log_enable: Enable Smart Logs feature 212 */ 213 struct target_ops { 214 QDF_STATUS (*ext_resource_config_enable) 215 (struct wlan_objmgr_psoc *psoc, 216 struct target_psoc_info *tgt_info, uint8_t *event); 217 void (*peer_config) 218 (struct wlan_objmgr_psoc *psoc, 219 struct target_psoc_info *tgt_info, uint8_t *event); 220 void (*mesh_support_enable) 221 (struct wlan_objmgr_psoc *psoc, 222 struct target_psoc_info *tgt_info, uint8_t *event); 223 void (*smart_antenna_enable) 224 (struct wlan_objmgr_psoc *psoc, 225 struct target_psoc_info *tgt_info, uint8_t *event); 226 void (*atf_config_enable) 227 (struct wlan_objmgr_psoc *psoc, 228 struct target_psoc_info *tgt_info, uint8_t *event); 229 void (*qwrap_config_enable) 230 (struct wlan_objmgr_psoc *psoc, 231 struct target_psoc_info *tgt_info, uint8_t *event); 232 void (*btcoex_config_enable) 233 (struct wlan_objmgr_psoc *psoc, 234 struct target_psoc_info *tgt_info, uint8_t *event); 235 void (*lteu_ext_support_enable) 236 (struct wlan_objmgr_psoc *psoc, 237 struct target_psoc_info *tgt_info, uint8_t *event); 238 void (*set_init_cmd_dev_based_params) 239 (struct wlan_objmgr_psoc *psoc, 240 struct target_psoc_info *tgt_info); 241 QDF_STATUS (*alloc_pdevs) 242 (struct wlan_objmgr_psoc *psoc, 243 struct target_psoc_info *tgt_info); 244 QDF_STATUS (*update_pdev_tgt_info) 245 (struct wlan_objmgr_psoc *psoc, 246 struct target_psoc_info *tgt_info); 247 uint32_t (*mem_mgr_alloc_chunk)(struct wlan_objmgr_psoc *psoc, 248 struct target_psoc_info *tgt_info, 249 u_int32_t req_id, u_int32_t idx, u_int32_t num_units, 250 u_int32_t unit_len, u_int32_t num_unit_info); 251 QDF_STATUS (*mem_mgr_free_chunks)(struct wlan_objmgr_psoc *psoc, 252 struct target_psoc_info *tgt_hdl); 253 void (*print_svc_ready_ex_param)( 254 struct wlan_objmgr_psoc *psoc, 255 struct target_psoc_info *tgt_info); 256 void (*add_11ax_modes)( 257 struct wlan_objmgr_psoc *psoc, 258 struct target_psoc_info *tgt_info); 259 void (*set_default_tgt_config)( 260 struct wlan_objmgr_psoc *psoc, 261 struct target_psoc_info *tgt_info); 262 QDF_STATUS (*sw_version_check)( 263 struct wlan_objmgr_psoc *psoc, 264 struct target_psoc_info *tgt_hdl, 265 uint8_t *evt_buf); 266 void (*smart_log_enable) 267 (struct wlan_objmgr_psoc *psoc, 268 struct target_psoc_info *tgt_info, uint8_t *event); 269 void (*eapol_minrate_enable) 270 (struct wlan_objmgr_psoc *psoc, 271 struct target_psoc_info *tgt_info, uint8_t *event); 272 }; 273 274 275 276 /** 277 * struct target_psoc_info - target psoc information 278 * @hdls: component handles (htc/htt/wmi) sub structure 279 * @info: target related info sub structure 280 * @feature_ptr: stores legacy pointer or few driver specific structures 281 * @tif_ops: holds driver specific function pointers 282 */ 283 struct target_psoc_info { 284 struct comp_hdls hdls; 285 struct tgt_info info; 286 void *feature_ptr; 287 struct target_ops *tif_ops; 288 }; 289 290 /** 291 * struct target_pdev_info - target pdev information 292 * @wmi_handle: WMI handle 293 * @accelerator_hdl: NSS offload/IPA handles 294 * @pdev_idx: pdev id (of FW) 295 * @phy_idx: phy id (of FW) 296 * @feature_ptr: stores legacy pointer or few driver specific structures 297 */ 298 struct target_pdev_info { 299 struct common_wmi_handle *wmi_handle; 300 struct common_accelerator_handle *accelerator_hdl; 301 int32_t pdev_idx; 302 int32_t phy_idx; 303 void *feature_ptr; 304 }; 305 306 307 /** 308 * target_if_open() - target_if open 309 * @get_wmi_handle: function pointer to get wmi handle 310 * 311 * 312 * Return: QDF_STATUS 313 */ 314 QDF_STATUS target_if_open(get_psoc_handle_callback psoc_hdl_cb); 315 316 /** 317 * target_if_close() - Close target_if 318 * @scn_handle: scn handle 319 * 320 * Return: QDF_STATUS_SUCCESS - in case of success 321 */ 322 QDF_STATUS target_if_close(void); 323 324 /** 325 * target_if_store_pdev_target_if_ctx() - stores objmgr pdev in target if ctx 326 * @pdev_hdl_cb: function pointer to get objmgr pdev 327 * 328 * Return: QDF_STATUS_SUCCESS - in case of success 329 */ 330 QDF_STATUS target_if_store_pdev_target_if_ctx( 331 get_pdev_handle_callback pdev_hdl_cb); 332 333 /** 334 * wlan_get_tgt_if_ctx() -Get target if ctx 335 * 336 * Return: target if ctx 337 */ 338 struct target_if_ctx *target_if_get_ctx(void); 339 340 /** 341 * target_if_get_psoc_from_scn_hdl() - get psoc from scn handle 342 * @scn_handle: scn handle 343 * 344 * This API is generally used while processing wmi event. 345 * In wmi event SCN handle will be passed by wmi hence 346 * using this API we can get psoc from scn handle. 347 * 348 * Return: index for matching scn handle 349 */ 350 struct wlan_objmgr_psoc *target_if_get_psoc_from_scn_hdl(void *scn_handle); 351 352 /** 353 * target_if_get_pdev_from_scn_hdl() - get pdev from scn handle 354 * @scn_handle: scn handle 355 * 356 * This API is generally used while processing wmi event. 357 * In wmi event SCN handle will be passed by wmi hence 358 * using this API we can get pdev from scn handle. 359 * 360 * Return: pdev for matching scn handle 361 */ 362 struct wlan_objmgr_pdev *target_if_get_pdev_from_scn_hdl(void *scn_handle); 363 364 /** target_if_register_tx_ops() - register tx_ops 365 * @tx_ops: tx_ops structure 366 * 367 * This function is to be used by components to populate 368 * the OL function pointers (tx_ops) required by the component 369 * for UMAC-LMAC interaction, with the appropriate handler 370 * 371 * Return: QDF STATUS 372 */ 373 QDF_STATUS target_if_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); 374 375 /** 376 * target_if_get_psoc_legacy_service_ready_cb() - get psoc from scn handle 377 * 378 * This API is generally used while processing wmi event. 379 * In wmi event SCN handle will be passed by wmi hence 380 * using this API we can get psoc from scn handle. 381 * 382 * Return: wmi_legacy_service_ready_callback 383 */ 384 wmi_legacy_service_ready_callback 385 target_if_get_psoc_legacy_service_ready_cb(void); 386 387 /** 388 * target_if_register_legacy_service_ready_cb() - get legacy 389 * service ready handler from scn handle 390 * 391 * @service_ready_cb: function pointer to service ready callback 392 * 393 * Return: QDF Status 394 */ 395 QDF_STATUS target_if_register_legacy_service_ready_cb( 396 wmi_legacy_service_ready_callback service_ready_cb); 397 398 /** 399 * target_if_alloc_pdev_tgt_info() - alloc pdev tgt info 400 * @pdev: pointer to pdev 401 * 402 * API to allocate memory for target_pdev_info 403 * 404 * Return: SUCCESS on successful memory allocation or Failure 405 */ 406 QDF_STATUS target_if_alloc_pdev_tgt_info(struct wlan_objmgr_pdev *pdev); 407 408 /** 409 * target_if_free_pdev_tgt_info() - free pdev tgt info 410 * @pdev: pointer to pdev 411 * 412 * API to free allocated memory for target_pdev_info 413 * 414 * Return: SUCCESS on successful memory deallocation or Failure 415 */ 416 QDF_STATUS target_if_free_pdev_tgt_info(struct wlan_objmgr_pdev *pdev); 417 418 /** 419 * target_if_alloc_psoc_tgt_info() - alloc psoc tgt info 420 * @psoc: pointer to psoc 421 * 422 * API to allocate memory for target_psoc_info 423 * 424 * Return: SUCCESS on successful memory allocation or Failure 425 */ 426 QDF_STATUS target_if_alloc_psoc_tgt_info(struct wlan_objmgr_psoc *psoc); 427 428 /** 429 * target_if_free_psoc_tgt_info() - free psoc tgt info 430 * @psoc: pointer to psoc 431 * 432 * API to free allocated memory for target_psoc_info 433 * 434 * Return: SUCCESS on successful memory deallocation or Failure 435 */ 436 QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc); 437 438 /** 439 * target_is_tgt_type_ar900b() - Check if the target type is AR900B 440 * @target_type: target type to be checked. 441 * 442 * Return: true if the target_type is AR900B, else false. 443 */ 444 bool target_is_tgt_type_ar900b(uint32_t target_type); 445 446 /** 447 * target_is_tgt_type_ipq4019() - Check if the target type is IPQ4019 448 * @target_type: target type to be checked. 449 * 450 * Return: true if the target_type is IPQ4019, else false. 451 */ 452 bool target_is_tgt_type_ipq4019(uint32_t target_type); 453 454 /** 455 * target_is_tgt_type_qca9984() - Check if the target type is QCA9984 456 * @target_type: target type to be checked. 457 * 458 * Return: true if the target_type is QCA9984, else false. 459 */ 460 bool target_is_tgt_type_qca9984(uint32_t target_type); 461 462 /** 463 * target_is_tgt_type_qca9888() - Check if the target type is QCA9888 464 * @target_type: target type to be checked. 465 * 466 * Return: true if the target_type is QCA9888, else false. 467 */ 468 bool target_is_tgt_type_qca9888(uint32_t target_type); 469 470 471 /** 472 * target_psoc_set_wlan_init_status() - set info wlan_init_status 473 * @psoc_info: pointer to structure target_psoc_info 474 * @wlan_init_status: FW init status 475 * 476 * API to set wlan_init_status 477 * 478 * Return: void 479 */ 480 static inline void target_psoc_set_wlan_init_status 481 (struct target_psoc_info *psoc_info, uint32_t wlan_init_status) 482 { 483 if (psoc_info == NULL) 484 return; 485 486 psoc_info->info.wlan_init_status = wlan_init_status; 487 } 488 489 /** 490 * target_psoc_get_wlan_init_status() - get info wlan_init_status 491 * @psoc_info: pointer to structure target_psoc_info 492 * 493 * API to get wlan_init_status 494 * 495 * Return: uint32_t 496 */ 497 static inline uint32_t target_psoc_get_wlan_init_status 498 (struct target_psoc_info *psoc_info) 499 { 500 if (psoc_info == NULL) 501 return (uint32_t)-1; 502 503 return psoc_info->info.wlan_init_status; 504 } 505 506 /** 507 * target_psoc_set_target_type() - set info target_type 508 * @psoc_info: pointer to structure target_psoc_info 509 * @target_type: Target type 510 * 511 * API to set target_type 512 * 513 * Return: void 514 */ 515 static inline void target_psoc_set_target_type 516 (struct target_psoc_info *psoc_info, uint32_t target_type) 517 { 518 if (psoc_info == NULL) 519 return; 520 521 psoc_info->info.target_type = target_type; 522 } 523 524 /** 525 * target_psoc_get_target_type() - get info target_type 526 * @psoc_info: pointer to structure target_psoc_info 527 * 528 * API to get target_type 529 * 530 * Return: unit32_t 531 */ 532 static inline uint32_t target_psoc_get_target_type 533 (struct target_psoc_info *psoc_info) 534 { 535 if (psoc_info == NULL) 536 return (uint32_t)-1; 537 538 return psoc_info->info.target_type; 539 } 540 541 /** 542 * target_psoc_set_max_descs() - set info max_descs 543 * @psoc_info: pointer to structure target_psoc_info 544 * @max_descs: Max descriptors 545 * 546 * API to set max_descs 547 * 548 * Return: void 549 */ 550 static inline void target_psoc_set_max_descs 551 (struct target_psoc_info *psoc_info, uint32_t max_descs) 552 { 553 if (psoc_info == NULL) 554 return; 555 556 psoc_info->info.max_descs = max_descs; 557 } 558 559 /** 560 * target_psoc_get_max_descs() - get info max_descs 561 * @psoc_info: pointer to structure target_psoc_info 562 * 563 * API to get max_descs 564 * 565 * Return: unint32_t 566 */ 567 static inline uint32_t target_psoc_get_max_descs 568 (struct target_psoc_info *psoc_info) 569 { 570 if (psoc_info == NULL) 571 return (uint32_t)-1; 572 573 return psoc_info->info.max_descs; 574 } 575 576 /** 577 * target_psoc_set_wmi_service_ready() - set info wmi_service_ready 578 * @psoc_info: pointer to structure target_psoc_info 579 * @wmi_service_ready: service ready flag 580 * 581 * API to set wmi_service_ready 582 * 583 * Return: void 584 */ 585 static inline void target_psoc_set_wmi_service_ready 586 (struct target_psoc_info *psoc_info, bool wmi_service_ready) 587 { 588 if (psoc_info == NULL) 589 return; 590 591 psoc_info->info.wmi_service_ready = wmi_service_ready; 592 } 593 594 /** 595 * target_psoc_get_wmi_service_ready() - get info wmi_service_ready 596 * @psoc_info: pointer to structure target_psoc_info 597 * 598 * API to get wmi_service_ready 599 * 600 * Return: bool 601 */ 602 static inline bool target_psoc_get_wmi_service_ready 603 (struct target_psoc_info *psoc_info) 604 { 605 return psoc_info->info.wmi_service_ready; 606 } 607 608 /** 609 * target_psoc_set_wmi_ready() - set info wmi_ready 610 * @psoc_info: pointer to structure target_psoc_info 611 * @wmi_ready: Ready event flag 612 * 613 * API to set wmi_ready 614 * 615 * Return: void 616 */ 617 static inline void target_psoc_set_wmi_ready 618 (struct target_psoc_info *psoc_info, bool wmi_ready) 619 { 620 if (psoc_info == NULL) 621 return; 622 623 psoc_info->info.wmi_ready = wmi_ready; 624 } 625 626 /** 627 * target_psoc_get_wmi_ready() - get info wmi_ready 628 * @psoc_info: pointer to structure target_psoc_info 629 * 630 * API to get wmi_ready 631 * 632 * Return: bool 633 */ 634 static inline bool target_psoc_get_wmi_ready 635 (struct target_psoc_info *psoc_info) 636 { 637 return psoc_info->info.wmi_ready; 638 } 639 640 /** 641 * target_psoc_set_preferred_hw_mode() - set preferred_hw_mode 642 * @psoc_info: pointer to structure target_psoc_info 643 * @preferred_hw_mode: Preferred HW mode 644 * 645 * API to set preferred_hw_mode 646 * 647 * Return: void 648 */ 649 static inline void target_psoc_set_preferred_hw_mode( 650 struct target_psoc_info *psoc_info, uint32_t preferred_hw_mode) 651 { 652 if (psoc_info == NULL) 653 return; 654 655 psoc_info->info.preferred_hw_mode = preferred_hw_mode; 656 } 657 658 /** 659 * target_psoc_get_preferred_hw_mode() - get preferred_hw_mode 660 * @psoc_info: pointer to structure target_psoc_info 661 * 662 * API to get preferred_hw_mode 663 * 664 * Return: unint32_t 665 */ 666 static inline uint32_t target_psoc_get_preferred_hw_mode 667 (struct target_psoc_info *psoc_info) 668 { 669 if (psoc_info == NULL) 670 return WMI_HOST_HW_MODE_MAX; 671 672 return psoc_info->info.preferred_hw_mode; 673 } 674 675 /** 676 * target_psoc_set_wmi_timeout() - set wmi_timeout 677 * @psoc_info: pointer to structure target_psoc_info 678 * @wmi_timeout: WMI timeout value in sec 679 * 680 * API to set wmi_timeout 681 * 682 * Return: void 683 */ 684 static inline void target_psoc_set_wmi_timeout 685 (struct target_psoc_info *psoc_info, uint32_t wmi_timeout) 686 { 687 if (psoc_info == NULL) 688 return; 689 690 psoc_info->info.wmi_timeout = wmi_timeout; 691 } 692 693 /** 694 * target_psoc_get_wmi_timeout() - get wmi_timeout 695 * @psoc_info: pointer to structure target_psoc_info 696 * 697 * API to get wmi_timeout 698 * 699 * Return: unint32_t 700 */ 701 static inline uint32_t target_psoc_get_wmi_timeout 702 (struct target_psoc_info *psoc_info) 703 { 704 if (psoc_info == NULL) 705 return (uint32_t)-1; 706 707 return psoc_info->info.wmi_timeout; 708 } 709 710 /** 711 * target_psoc_set_total_mac_phy_cnt() - set total_mac_phy 712 * @psoc_info: pointer to structure target_psoc_infoa 713 * @total_mac_phy_cnt: Total MAC PHY cnt 714 * 715 * API to set total_mac_phy 716 * 717 * Return: void 718 */ 719 static inline void target_psoc_set_total_mac_phy_cnt 720 (struct target_psoc_info *psoc_info, uint8_t total_mac_phy_cnt) 721 { 722 if (psoc_info == NULL) 723 return; 724 725 psoc_info->info.total_mac_phy_cnt = total_mac_phy_cnt; 726 } 727 728 /** 729 * target_psoc_get_total_mac_phy_cnt() - get total_mac_phy 730 * @psoc_info: pointer to structure target_psoc_info 731 * 732 * API to get total_mac_phy 733 * 734 * Return: unint8_t 735 */ 736 static inline uint8_t target_psoc_get_total_mac_phy_cnt( 737 struct target_psoc_info *psoc_info) 738 { 739 if (psoc_info == NULL) 740 return 0; 741 742 return psoc_info->info.total_mac_phy_cnt; 743 } 744 745 /** 746 * target_psoc_set_num_radios() - set num of radios 747 * @psoc_info: pointer to structure target_psoc_info 748 * @num_radios: Number of radios 749 * 750 * API to set number of radios 751 * 752 * Return: number of radios 753 */ 754 static inline void target_psoc_set_num_radios( 755 struct target_psoc_info *psoc_info, uint8_t num_radios) 756 { 757 if (psoc_info == NULL) 758 return; 759 760 psoc_info->info.num_radios = num_radios; 761 } 762 763 /** 764 * target_psoc_get_num_radios() - get number of radios 765 * @psoc_info: pointer to structure target_psoc_info 766 * 767 * API to get number_of_radios 768 * 769 * Return: number of radios 770 */ 771 static inline uint8_t target_psoc_get_num_radios 772 (struct target_psoc_info *psoc_info) 773 { 774 if (psoc_info == NULL) 775 return 0; 776 777 return psoc_info->info.num_radios; 778 } 779 780 /** 781 * target_psoc_set_service_bitmap() - set service_bitmap 782 * @psoc_info: pointer to structure target_psoc_info 783 * @service_bitmap: FW service bitmap 784 * 785 * API to set service_bitmap 786 * 787 * Return: void 788 */ 789 static inline void target_psoc_set_service_bitmap 790 (struct target_psoc_info *psoc_info, uint32_t *service_bitmap) 791 { 792 qdf_mem_copy(psoc_info->info.service_bitmap, service_bitmap, 793 sizeof(psoc_info->info.service_bitmap)); 794 } 795 796 /** 797 * target_psoc_get_service_bitmap() - get service_bitmap 798 * @psoc_info: pointer to structure target_psoc_info 799 * 800 * API to get service_bitmap 801 * 802 * Return: unint32_t 803 */ 804 static inline uint32_t *target_psoc_get_service_bitmap 805 (struct target_psoc_info *psoc_info) 806 { 807 return psoc_info->info.service_bitmap; 808 } 809 810 /** 811 * target_psoc_set_num_mem_chunks - set num_mem_chunks 812 * @psoc_info: pointer to structure target_psoc_info 813 & @num_mem_chunks: Num Memory chunks allocated for FW 814 * 815 * API to set num_mem_chunks 816 * 817 * Return: void 818 */ 819 static inline void target_psoc_set_num_mem_chunks( 820 struct target_psoc_info *psoc_info, uint32_t num_mem_chunks) 821 { 822 if (psoc_info == NULL) 823 return; 824 psoc_info->info.num_mem_chunks = num_mem_chunks; 825 } 826 827 /** 828 * target_psoc_get_num_mem_chunks() - get num_mem_chunks 829 * @psoc_info: pointer to structure target_psoc_info 830 * 831 * API to get total_mac_phy 832 * 833 * Return: unint8_t 834 */ 835 static inline uint32_t target_psoc_get_num_mem_chunks 836 (struct target_psoc_info *psoc_info) 837 { 838 if (psoc_info == NULL) 839 return (uint32_t)-1; 840 841 return psoc_info->info.num_mem_chunks; 842 } 843 /** 844 * target_psoc_set_hif_hdl - set hif_hdl 845 * @psoc_info: pointer to structure target_psoc_info 846 * @hif_hdl: HIF handle 847 * 848 * API to set hif_hdl 849 * 850 * Return: void 851 */ 852 static inline void target_psoc_set_hif_hdl 853 (struct target_psoc_info *psoc_info, 854 struct common_hif_handle *hif_hdl) 855 { 856 if (psoc_info == NULL) 857 return; 858 859 psoc_info->hdls.hif_hdl = hif_hdl; 860 } 861 862 /** 863 * target_psoc_get_hif_hdl() - get hif_hdl 864 * @psoc_info: pointer to structure target_psoc_info 865 * 866 * API to get hif_hdl 867 * 868 * Return: hif_hdl 869 */ 870 static inline struct common_hif_handle *target_psoc_get_hif_hdl 871 (struct target_psoc_info *psoc_info) 872 { 873 if (psoc_info == NULL) 874 return NULL; 875 876 return psoc_info->hdls.hif_hdl; 877 } 878 879 /** 880 * target_psoc_set_hif_hdl - set htc_hdl 881 * @psoc_info: pointer to structure target_psoc_info 882 * @htc_hdl: HTC handle 883 * 884 * API to set htc_hdl 885 * 886 * Return: void 887 */ 888 static inline void target_psoc_set_htc_hdl 889 (struct target_psoc_info *psoc_info, 890 struct common_htc_handle *htc_hdl) 891 { 892 if (psoc_info == NULL) 893 return; 894 895 psoc_info->hdls.htc_hdl = htc_hdl; 896 } 897 898 /** 899 * target_psoc_get_htc_hdl() - get htc_hdl 900 * @psoc_info: pointer to structure target_psoc_info 901 * 902 * API to get htc_hdl 903 * 904 * Return: htc_hdl 905 */ 906 static inline struct common_htc_handle *target_psoc_get_htc_hdl 907 (struct target_psoc_info *psoc_info) 908 { 909 if (psoc_info == NULL) 910 return NULL; 911 912 return psoc_info->hdls.htc_hdl; 913 } 914 /** 915 * target_psoc_set_wmi_hdl - set wmi_hdl 916 * @psoc_info: pointer to structure target_psoc_info 917 * @wmi_hdl: WMI handle 918 * 919 * API to set wmi_hdl 920 * 921 * Return: void 922 */ 923 static inline void target_psoc_set_wmi_hdl 924 (struct target_psoc_info *psoc_info, 925 struct common_wmi_handle *wmi_hdl) 926 { 927 if (psoc_info == NULL) 928 return; 929 930 psoc_info->hdls.wmi_hdl = wmi_hdl; 931 } 932 933 /** 934 * target_psoc_get_wmi_hdl() - get wmi_hdl 935 * @psoc_info: pointer to structure target_psoc_info 936 * 937 * API to get wmi_hdl 938 * 939 * Return: wmi_hdl 940 */ 941 static inline struct common_wmi_handle *target_psoc_get_wmi_hdl 942 (struct target_psoc_info *psoc_info) 943 { 944 if (psoc_info == NULL) 945 return NULL; 946 947 return psoc_info->hdls.wmi_hdl; 948 } 949 950 /** 951 * target_psoc_set_accelerator_hdl - set accelerator_hdl 952 * @psoc_info: pointer to structure target_psoc_info 953 * @accelerator_hdl: Accelator handle 954 * 955 * API to set accelerator_hdl 956 * 957 * Return: void 958 */ 959 static inline void target_psoc_set_accelerator_hdl 960 (struct target_psoc_info *psoc_info, 961 struct common_accelerator_handle *accelerator_hdl) 962 { 963 if (psoc_info == NULL) 964 return; 965 966 psoc_info->hdls.accelerator_hdl = accelerator_hdl; 967 } 968 969 /** 970 * target_psoc_get_accelerator_hdl() - get accelerator_hdl 971 * @psoc_info: pointer to structure target_psoc_info 972 * 973 * API to get accelerator_hdl 974 * 975 * Return: accelerator_hdl 976 */ 977 static inline 978 struct common_accelerator_handle *target_psoc_get_accelerator_hdl 979 (struct target_psoc_info *psoc_info) 980 { 981 if (psoc_info == NULL) 982 return NULL; 983 984 return psoc_info->hdls.accelerator_hdl; 985 } 986 987 /** 988 * target_psoc_set_feature_ptr - set feature_ptr 989 * @psoc_info: pointer to structure target_psoc_info 990 * @feature_ptr: set feature pointer 991 * 992 * API to set feature_ptr 993 * 994 * Return: void 995 */ 996 static inline void target_psoc_set_feature_ptr 997 (struct target_psoc_info *psoc_info, void *feature_ptr) 998 { 999 if (psoc_info == NULL) 1000 return; 1001 1002 psoc_info->feature_ptr = feature_ptr; 1003 } 1004 1005 /** 1006 * target_psoc_get_feature_ptr() - get feature_ptr 1007 * @psoc_info: pointer to structure target_psoc_info 1008 * 1009 * API to get feature_ptr 1010 * 1011 * Return: feature_ptr 1012 */ 1013 static inline void *target_psoc_get_feature_ptr 1014 (struct target_psoc_info *psoc_info) 1015 { 1016 if (psoc_info == NULL) 1017 return NULL; 1018 1019 return psoc_info->feature_ptr; 1020 } 1021 1022 /** 1023 * target_psoc_get_version()- get host_fw_ver version 1024 * @psoc_info: pointer to structure target_psoc_info 1025 * 1026 * API to get host_fw_ver version 1027 * 1028 * Return: void 1029 */ 1030 static inline struct host_fw_ver *target_psoc_get_version 1031 (struct target_psoc_info *psoc_info) 1032 { 1033 return &psoc_info->info.version; 1034 } 1035 1036 /** 1037 * target_psoc_get_target_ver()- get target version 1038 * @psoc_info: pointer to structure target_psoc_info 1039 * 1040 * API to get target version 1041 * 1042 * Return: target version 1043 */ 1044 static inline uint32_t target_psoc_get_target_ver 1045 (struct target_psoc_info *psoc_info) 1046 { 1047 return psoc_info->info.version.target_ver; 1048 } 1049 1050 /** 1051 * target_psoc_set_target_ver()- set target version 1052 * @psoc_info: pointer to structure target_psoc_info 1053 * @target_ver: Target version 1054 * 1055 * API to set target version 1056 * 1057 * Return: void 1058 */ 1059 static inline void target_psoc_set_target_ver 1060 (struct target_psoc_info *psoc_info, uint32_t target_ver) 1061 { 1062 if (psoc_info == NULL) 1063 return; 1064 1065 psoc_info->info.version.target_ver = target_ver; 1066 } 1067 1068 /** 1069 * target_psoc_set_target_rev()- set target revision 1070 * @psoc_info: pointer to structure target_psoc_info 1071 * @target_rev: Target revision 1072 * 1073 * API to get target version 1074 * 1075 * Return: void 1076 */ 1077 static inline void target_psoc_set_target_rev 1078 (struct target_psoc_info *psoc_info, uint32_t target_rev) 1079 { 1080 if (psoc_info == NULL) 1081 return; 1082 1083 psoc_info->info.version.target_rev = target_rev; 1084 } 1085 1086 /** 1087 * target_psoc_get_target_rev()- get target revision 1088 * @psoc_info: pointer to structure target_psoc_info 1089 * 1090 * API to get target revision 1091 * 1092 * Return: target revision 1093 */ 1094 static inline uint32_t target_psoc_get_target_rev 1095 (struct target_psoc_info *psoc_info) 1096 { 1097 return psoc_info->info.version.target_rev; 1098 } 1099 1100 /** 1101 * target_psoc_set_dbglog_hdl - set dbglog_hdl 1102 * @psoc_info: pointer to structure target_psoc_info 1103 * @dbglog_hdl: dbglog handle 1104 * 1105 * API to set dbglog_hdl 1106 * 1107 * Return: void 1108 */ 1109 static inline void target_psoc_set_dbglog_hdl 1110 (struct target_psoc_info *psoc_info, 1111 struct common_dbglog_handle *dbglog_hdl) 1112 { 1113 if (psoc_info == NULL) 1114 return; 1115 1116 psoc_info->hdls.dbglog_hdl = dbglog_hdl; 1117 } 1118 1119 /** 1120 * target_psoc_get_dbglog_hdl() - get dbglog_hdl 1121 * @psoc_info: pointer to structure target_psoc_info 1122 * 1123 * API to get dbglog_hdl 1124 * 1125 * Return: dbglog_hdl 1126 */ 1127 static inline struct common_dbglog_handle *target_psoc_get_dbglog_hdl 1128 (struct target_psoc_info *psoc_info) 1129 { 1130 if (psoc_info == NULL) 1131 return NULL; 1132 1133 return psoc_info->hdls.dbglog_hdl; 1134 } 1135 1136 /** 1137 * target_psoc_get_wlan_res_cfg() - get wlan_res_cfg 1138 * @psoc_info: pointer to structure target_psoc_info 1139 * 1140 * API to get wlan_res_cfg 1141 * 1142 * Return: structure pointer to host_fw_ver 1143 */ 1144 static inline target_resource_config *target_psoc_get_wlan_res_cfg 1145 (struct target_psoc_info *psoc_info) 1146 { 1147 if (psoc_info == NULL) 1148 return NULL; 1149 1150 return &psoc_info->info.wlan_res_cfg; 1151 } 1152 1153 /** 1154 * target_psoc_get_wlan_ext_res_cfg() - get wlan_ext_res_cfg 1155 * @psoc_info: pointer to structure target_psoc_info 1156 * 1157 * API to get wlan_ext_res_cfg 1158 * 1159 * Return: structure pointer to wmi_host_ext_resource_config 1160 */ 1161 static inline wmi_host_ext_resource_config *target_psoc_get_wlan_ext_res_cfg 1162 (struct target_psoc_info *psoc_info) 1163 { 1164 if (psoc_info == NULL) 1165 return NULL; 1166 1167 return &psoc_info->info.wlan_ext_res_cfg; 1168 } 1169 1170 /** 1171 * target_psoc_get_event_queue() - get event_queue 1172 * @psoc_info: pointer to structure target_psoc_info 1173 * 1174 * API to get event_queue 1175 * 1176 * Return: structure pointer to qdf_wait_queue_head_t 1177 */ 1178 static inline qdf_event_t *target_psoc_get_event 1179 (struct target_psoc_info *psoc_info) 1180 { 1181 if (psoc_info == NULL) 1182 return NULL; 1183 1184 return &psoc_info->info.event; 1185 } 1186 1187 /** 1188 * target_psoc_get_target_caps() - get target_caps 1189 * @psoc_info: pointer to structure target_psoc_info 1190 * 1191 * API to get target_caps 1192 * 1193 * Return: structure pointer to wlan_psoc_target_capability_info 1194 */ 1195 static inline struct wlan_psoc_target_capability_info 1196 *target_psoc_get_target_caps(struct target_psoc_info *psoc_info) 1197 { 1198 if (psoc_info == NULL) 1199 return NULL; 1200 1201 return &psoc_info->info.target_caps; 1202 } 1203 1204 /** 1205 * target_psoc_get_service_ext_param() - get service_ext_param 1206 * @psoc_info: pointer to structure target_psoc_info 1207 * 1208 * API to get service_ext_param 1209 * 1210 * Return: structure pointer to wlan_psoc_host_service_ext_param 1211 */ 1212 static inline struct wlan_psoc_host_service_ext_param 1213 *target_psoc_get_service_ext_param 1214 (struct target_psoc_info *psoc_info) 1215 { 1216 if (psoc_info == NULL) 1217 return NULL; 1218 1219 return &psoc_info->info.service_ext_param; 1220 } 1221 1222 1223 /** 1224 * target_psoc_get_mac_phy_cap() - get mac_phy_cap 1225 * @psoc_info: pointer to structure target_psoc_info 1226 * 1227 * API to get mac_phy_cap 1228 * 1229 * Return: structure pointer to wlan_psoc_host_mac_phy_caps 1230 */ 1231 static inline struct wlan_psoc_host_mac_phy_caps *target_psoc_get_mac_phy_cap 1232 (struct target_psoc_info *psoc_info) 1233 { 1234 if (psoc_info == NULL) 1235 return NULL; 1236 1237 return psoc_info->info.mac_phy_cap; 1238 } 1239 1240 /** 1241 * target_psoc_get_dbr_ring_caps() - get dbr_ring_cap 1242 * @psoc_info: pointer to structure target_psoc_info 1243 * 1244 * API to get dbr_ring_cap 1245 * 1246 * Return: structure pointer to wlan_psoc_host_dbr_ring_caps 1247 */ 1248 static inline struct wlan_psoc_host_dbr_ring_caps 1249 *target_psoc_get_dbr_ring_caps(struct target_psoc_info *psoc_info) 1250 { 1251 if (psoc_info == NULL) 1252 return NULL; 1253 1254 return psoc_info->info.dbr_ring_cap; 1255 } 1256 /** 1257 * target_psoc_get_mem_chunks() - get mem_chunks 1258 * @psoc_info: pointer to structure target_psoc_info 1259 * 1260 * API to get mem_chunks 1261 * 1262 * Return: structure pointer to wmi_host_mem_chunk 1263 */ 1264 static inline struct wmi_host_mem_chunk *target_psoc_get_mem_chunks 1265 (struct target_psoc_info *psoc_info) 1266 { 1267 if (psoc_info == NULL) 1268 return NULL; 1269 1270 return psoc_info->info.mem_chunks; 1271 } 1272 1273 /** 1274 * target_psoc_get_tif_ops() - get tif_ops 1275 * @psoc_info: pointer to structure target_psoc_info 1276 * 1277 * API to get tif_ops 1278 * 1279 * Return: structure pointer to target_ops 1280 */ 1281 static inline struct target_ops *target_psoc_get_tif_ops 1282 (struct target_psoc_info *psoc_info) 1283 { 1284 if (psoc_info == NULL) 1285 return NULL; 1286 1287 return psoc_info->tif_ops; 1288 } 1289 1290 /** 1291 * target_pdev_set_feature_ptr - set feature_ptr 1292 * @pdev_info: pointer to structure target_pdev_info 1293 * @feature_ptr: Feature pointer 1294 * 1295 * API to set feature_ptr 1296 * 1297 * Return: void 1298 */ 1299 static inline void target_pdev_set_feature_ptr 1300 (struct target_pdev_info *pdev_info, void *feature_ptr) 1301 { 1302 if (pdev_info == NULL) 1303 return; 1304 1305 pdev_info->feature_ptr = feature_ptr; 1306 } 1307 1308 /** 1309 * target_pdev_get_feature_ptr() - get feature_ptr 1310 * @pdev_info: pointer to structure target_pdev_info 1311 * 1312 * API to get feature_ptr 1313 * 1314 * Return: feature_ptr 1315 */ 1316 static inline void *target_pdev_get_feature_ptr 1317 (struct target_pdev_info *pdev_info) 1318 { 1319 if (pdev_info == NULL) 1320 return NULL; 1321 1322 return pdev_info->feature_ptr; 1323 } 1324 1325 /** 1326 * target_pdev_set_wmi_handle - set wmi_handle 1327 * @pdev_info: pointer to structure target_pdev_info 1328 * @wmi_handle: WMI handle 1329 * 1330 * API to set wmi_handle 1331 * 1332 * Return: void 1333 */ 1334 static inline void target_pdev_set_wmi_handle 1335 (struct target_pdev_info *pdev_info, 1336 struct common_wmi_handle *wmi_handle) 1337 { 1338 if (pdev_info == NULL) 1339 return; 1340 1341 pdev_info->wmi_handle = wmi_handle; 1342 } 1343 1344 /** 1345 * target_pdev_get_wmi_handle - get wmi_handle 1346 * @pdev_info: pointer to structure target_dev_info 1347 * 1348 * API to get wmi_handle 1349 * 1350 * Return: wmi_handle 1351 */ 1352 static inline struct common_wmi_handle *target_pdev_get_wmi_handle 1353 (struct target_pdev_info *pdev_info) 1354 { 1355 if (pdev_info == NULL) 1356 return NULL; 1357 1358 return pdev_info->wmi_handle; 1359 } 1360 1361 /** 1362 * target_pdev_set_accelerator_hdl - set accelerator_hdl 1363 * @pdev_info: pointer to structure target_pdev_info 1364 * @accelerator_hdl: Accelator handle 1365 * 1366 * API to set accelerator_hdl 1367 * 1368 * Return: void 1369 */ 1370 static inline void target_pdev_set_accelerator_hdl 1371 (struct target_pdev_info *pdev_info, 1372 struct common_accelerator_handle *accelerator_hdl) 1373 { 1374 if (pdev_info == NULL) 1375 return; 1376 1377 pdev_info->accelerator_hdl = accelerator_hdl; 1378 } 1379 1380 /** 1381 * target_pdev_get_accelerator_hdl - get accelerator_hdl 1382 * @pdev_info: pointer to structure target_dev_info 1383 * 1384 * API to get accelerator_hdl 1385 * 1386 * Return: accelerator_hdl 1387 */ 1388 static inline struct common_accelerator_handle * 1389 target_pdev_get_accelerator_hdl(struct target_pdev_info *pdev_info) 1390 { 1391 if (pdev_info == NULL) 1392 return NULL; 1393 1394 return pdev_info->accelerator_hdl; 1395 } 1396 1397 /** 1398 * target_pdev_set_pdev_idx - set pdev_idx 1399 * @pdev_info: pointer to structure target_pdev_info 1400 * @pdev_idx: PDEV id of FW 1401 * 1402 * API to set pdev_idx 1403 * 1404 * Return: void 1405 */ 1406 static inline void target_pdev_set_pdev_idx 1407 (struct target_pdev_info *pdev_info, int32_t pdev_idx) 1408 { 1409 if (pdev_info == NULL) 1410 return; 1411 1412 pdev_info->pdev_idx = pdev_idx; 1413 } 1414 1415 /** 1416 * target_pdev_get_pdev_idx - get pdev_idx 1417 * @pdev_info: pointer to structure target_dev_info 1418 * 1419 * API to get pdev_idx 1420 * 1421 * Return: int32_t 1422 */ 1423 static inline int32_t target_pdev_get_pdev_idx 1424 (struct target_pdev_info *pdev_info) 1425 { 1426 if (pdev_info == NULL) 1427 return -EINVAL; 1428 1429 return pdev_info->pdev_idx; 1430 } 1431 1432 /** 1433 * target_pdev_set_phy_idx - set phy_idx 1434 * @pdev_info: pointer to structure target_pdev_info 1435 * @phy_idx: phy ID of FW 1436 * 1437 * API to set phy_idx 1438 * 1439 * Return: void 1440 */ 1441 static inline void target_pdev_set_phy_idx 1442 (struct target_pdev_info *pdev_info, int32_t phy_idx) 1443 { 1444 if (pdev_info == NULL) 1445 return; 1446 1447 pdev_info->phy_idx = phy_idx; 1448 } 1449 1450 /** 1451 * target_pdev_get_phy_idx - get phy_idx 1452 * @pdev_info: pointer to structure target_dev_info 1453 * 1454 * API to get phy_idx 1455 * 1456 * Return: int32_t 1457 */ 1458 static inline int32_t target_pdev_get_phy_idx 1459 (struct target_pdev_info *pdev_info) 1460 { 1461 if (pdev_info == NULL) 1462 return -EINVAL; 1463 1464 return pdev_info->phy_idx; 1465 } 1466 1467 /** 1468 * GET_WMI_HDL_FROM_PSOC - get wmi handle from psoc 1469 * @psoc: psoc object 1470 * 1471 * API to get wmi_handle from psoc 1472 * 1473 * Return: wmi_handle on success 1474 * if tgt handle is not initialized, it returns NULL 1475 */ 1476 static inline struct common_wmi_handle *GET_WMI_HDL_FROM_PSOC( 1477 struct wlan_objmgr_psoc *psoc) 1478 { 1479 void *tgt_if_handle; 1480 1481 if (psoc) { 1482 tgt_if_handle = psoc->tgt_if_handle; 1483 1484 if (tgt_if_handle) 1485 return (target_psoc_get_wmi_hdl( 1486 (struct target_psoc_info *)tgt_if_handle)); 1487 else 1488 return NULL; 1489 } 1490 1491 return NULL; 1492 } 1493 1494 /** 1495 * GET_WMI_HDL_FROM_PDEV - get wmi handle from pdev 1496 * @pdev: pdev object 1497 * 1498 * API to get wmi_handle from pdev 1499 * 1500 * Return: wmi_handle on success 1501 * if tgt handle is not initialized, it returns NULL 1502 */ 1503 static inline struct common_wmi_handle *GET_WMI_HDL_FROM_PDEV( 1504 struct wlan_objmgr_pdev *pdev) 1505 { 1506 void *tgt_if_handle; 1507 1508 if (pdev) { 1509 tgt_if_handle = pdev->tgt_if_handle; 1510 1511 if (tgt_if_handle) 1512 return target_pdev_get_wmi_handle(tgt_if_handle); 1513 else 1514 return NULL; 1515 } 1516 1517 return NULL; 1518 } 1519 1520 /** 1521 * get_wmi_unified_hdl_from_psoc - get wmi handle from psoc 1522 * @psoc: psoc object 1523 * 1524 * API to get wmi_handle from psoc 1525 * 1526 * Return: wmi_handle on success 1527 * if tgt handle is not initialized, it returns NULL 1528 */ 1529 static inline wmi_unified_t 1530 get_wmi_unified_hdl_from_psoc(struct wlan_objmgr_psoc *psoc) 1531 { 1532 return (wmi_unified_t)GET_WMI_HDL_FROM_PSOC(psoc); 1533 } 1534 1535 /** 1536 * get_wmi_unified_hdl_from_pdev - get wmi handle from pdev 1537 * @pdev: pdev object 1538 * 1539 * API to get wmi_handle from pdev 1540 * 1541 * Return: wmi_handle on success 1542 * if tgt handle is not initialized, it returns NULL 1543 */ 1544 static inline wmi_unified_t 1545 get_wmi_unified_hdl_from_pdev(struct wlan_objmgr_pdev *pdev) 1546 { 1547 return (wmi_unified_t)GET_WMI_HDL_FROM_PDEV(pdev); 1548 } 1549 1550 /** 1551 * target_if_ext_res_cfg_enable - Enable ext resource config 1552 * @psoc: psoc object 1553 * @tgt_hdl: target_psoc_info pointer 1554 * @evt_buf: Event buffer received from FW 1555 * 1556 * API to enable Ext resource config 1557 * 1558 * Return: none 1559 */ 1560 static inline void target_if_ext_res_cfg_enable(struct wlan_objmgr_psoc *psoc, 1561 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1562 { 1563 if ((tgt_hdl->tif_ops) && 1564 (tgt_hdl->tif_ops->ext_resource_config_enable)) 1565 tgt_hdl->tif_ops->ext_resource_config_enable(psoc, 1566 tgt_hdl, evt_buf); 1567 } 1568 1569 /** 1570 * target_if_peer_cfg_enable - Enable peer config 1571 * @psoc: psoc object 1572 * @tgt_hdl: target_psoc_info pointer 1573 * @evt_buf: Event buffer received from FW 1574 * 1575 * API to enable peer config 1576 * 1577 * Return: none 1578 */ 1579 static inline void target_if_peer_cfg_enable(struct wlan_objmgr_psoc *psoc, 1580 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1581 { 1582 if ((tgt_hdl->tif_ops) && 1583 (tgt_hdl->tif_ops->peer_config)) 1584 tgt_hdl->tif_ops->peer_config(psoc, tgt_hdl, evt_buf); 1585 } 1586 1587 /** 1588 * target_if_mesh_support_enable - Enable MESH mode support 1589 * @psoc: psoc object 1590 * @tgt_hdl: target_psoc_info pointer 1591 * @evt_buf: Event buffer received from FW 1592 * 1593 * API to enable Mesh mode 1594 * 1595 * Return: none 1596 */ 1597 static inline void target_if_mesh_support_enable(struct wlan_objmgr_psoc *psoc, 1598 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1599 { 1600 if ((tgt_hdl->tif_ops) && 1601 (tgt_hdl->tif_ops->mesh_support_enable)) 1602 tgt_hdl->tif_ops->mesh_support_enable(psoc, tgt_hdl, evt_buf); 1603 } 1604 1605 /** 1606 * target_if_eapol_minrate_enable - Enable EAPOL Minrate in Tunnel Mode 1607 * @psoc: psoc object 1608 * @tgt_hdl: target_psoc_info pointer 1609 * @evt_buf: Event buffer received from FW 1610 * 1611 * API to enable eapol minrate 1612 * 1613 * Return: none 1614 */ 1615 static inline void target_if_eapol_minrate_enable(struct wlan_objmgr_psoc *psoc, 1616 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1617 { 1618 if ((tgt_hdl->tif_ops) && 1619 (tgt_hdl->tif_ops->eapol_minrate_enable)) 1620 tgt_hdl->tif_ops->eapol_minrate_enable(psoc, tgt_hdl, evt_buf); 1621 } 1622 1623 /** 1624 * target_if_smart_antenna_enable - Enable Smart antenna module 1625 * @psoc: psoc object 1626 * @tgt_hdl: target_psoc_info pointer 1627 * @evt_buf: Event buffer received from FW 1628 * 1629 * API to enable Smart antenna 1630 * 1631 * Return: none 1632 */ 1633 static inline void target_if_smart_antenna_enable(struct wlan_objmgr_psoc *psoc, 1634 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1635 { 1636 if ((tgt_hdl->tif_ops) && 1637 (tgt_hdl->tif_ops->smart_antenna_enable)) 1638 tgt_hdl->tif_ops->smart_antenna_enable(psoc, tgt_hdl, evt_buf); 1639 } 1640 1641 /** 1642 * target_if_atf_cfg_enable - Enable ATF config 1643 * @psoc: psoc object 1644 * @tgt_hdl: target_psoc_info pointer 1645 * @evt_buf: Event buffer received from FW 1646 * 1647 * API to enable ATF config 1648 * 1649 * Return: none 1650 */ 1651 static inline void target_if_atf_cfg_enable(struct wlan_objmgr_psoc *psoc, 1652 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1653 { 1654 if ((tgt_hdl->tif_ops) && 1655 (tgt_hdl->tif_ops->atf_config_enable)) 1656 tgt_hdl->tif_ops->atf_config_enable(psoc, tgt_hdl, evt_buf); 1657 } 1658 1659 /** 1660 * target_if_qwrap_cfg_enable - Enable QWRAP config 1661 * @psoc: psoc object 1662 * @tgt_hdl: target_psoc_info pointer 1663 * @evt_buf: Event buffer received from FW 1664 * 1665 * API to enable QWRAP config 1666 * 1667 * Return: none 1668 */ 1669 static inline void target_if_qwrap_cfg_enable(struct wlan_objmgr_psoc *psoc, 1670 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1671 { 1672 if ((tgt_hdl->tif_ops) && 1673 (tgt_hdl->tif_ops->qwrap_config_enable)) 1674 tgt_hdl->tif_ops->qwrap_config_enable(psoc, tgt_hdl, evt_buf); 1675 } 1676 1677 /** 1678 * target_if_btcoex_cfg_enable - Enable BT coex config 1679 * @psoc: psoc object 1680 * @tgt_hdl: target_psoc_info pointer 1681 * @evt_buf: Event buffer received from FW 1682 * 1683 * API to enable BT coex config 1684 * 1685 * Return: none 1686 */ 1687 static inline void target_if_btcoex_cfg_enable(struct wlan_objmgr_psoc *psoc, 1688 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1689 { 1690 if ((tgt_hdl->tif_ops) && 1691 (tgt_hdl->tif_ops->btcoex_config_enable)) 1692 tgt_hdl->tif_ops->btcoex_config_enable(psoc, tgt_hdl, evt_buf); 1693 } 1694 1695 /** 1696 * target_if_lteu_cfg_enable - Enable LTEU config 1697 * @psoc: psoc object 1698 * @tgt_hdl: target_psoc_info pointer 1699 * @evt_buf: Event buffer received from FW 1700 * 1701 * API to enable LTEU coex config 1702 * 1703 * Return: none 1704 */ 1705 static inline void target_if_lteu_cfg_enable(struct wlan_objmgr_psoc *psoc, 1706 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1707 { 1708 if ((tgt_hdl->tif_ops) && 1709 (tgt_hdl->tif_ops->lteu_ext_support_enable)) 1710 tgt_hdl->tif_ops->lteu_ext_support_enable(psoc, tgt_hdl, 1711 evt_buf); 1712 } 1713 1714 /** 1715 * target_if_set_init_cmd_dev_param - Set init command params 1716 * @psoc: psoc object 1717 * @tgt_hdl: target_psoc_info pointer 1718 * 1719 * API to set init command param based on config 1720 * 1721 * Return: none 1722 */ 1723 static inline void target_if_set_init_cmd_dev_param( 1724 struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_hdl) 1725 { 1726 if ((tgt_hdl->tif_ops) && 1727 (tgt_hdl->tif_ops->set_init_cmd_dev_based_params)) { 1728 tgt_hdl->tif_ops->set_init_cmd_dev_based_params(psoc, 1729 tgt_hdl); 1730 } 1731 } 1732 1733 /** 1734 * target_if_alloc_pdevs - Allocate PDEVs 1735 * @psoc: psoc object 1736 * @tgt_hdl: target_psoc_info pointer 1737 * 1738 * API allocates PDEVs based on ext service ready param 1739 * 1740 * Return: SUCCESS on pdev allocation or PDEV allocation is not needed 1741 * FAILURE, if allocation fails 1742 */ 1743 static inline QDF_STATUS target_if_alloc_pdevs(struct wlan_objmgr_psoc *psoc, 1744 struct target_psoc_info *tgt_hdl) 1745 { 1746 QDF_STATUS ret_val; 1747 1748 if ((tgt_hdl->tif_ops) && 1749 (tgt_hdl->tif_ops->alloc_pdevs)) 1750 ret_val = tgt_hdl->tif_ops->alloc_pdevs(psoc, tgt_hdl); 1751 else 1752 ret_val = QDF_STATUS_SUCCESS; 1753 1754 return ret_val; 1755 } 1756 1757 /** 1758 * target_if_update_pdev_tgt_info - Update PDEVs info 1759 * @psoc: psoc object 1760 * @tgt_hdl: target_psoc_info pointer 1761 * 1762 * API updates PDEVs info based on config 1763 * 1764 * Return: SUCCESS on pdev updation or PDEV updation is not needed 1765 * FAILURE, if updation fails 1766 */ 1767 static inline QDF_STATUS target_if_update_pdev_tgt_info( 1768 struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_hdl) 1769 { 1770 QDF_STATUS ret_val; 1771 1772 if ((tgt_hdl->tif_ops) && 1773 (tgt_hdl->tif_ops->update_pdev_tgt_info)) 1774 ret_val = tgt_hdl->tif_ops->update_pdev_tgt_info(psoc, 1775 tgt_hdl); 1776 else 1777 ret_val = QDF_STATUS_SUCCESS; 1778 1779 return ret_val; 1780 } 1781 1782 /** 1783 * target_if_print_service_ready_ext_param - Print Service ready ext param 1784 * @psoc: psoc object 1785 * @tgt_hdl: target_psoc_info pointer 1786 * 1787 * API to print service ready ext param 1788 * 1789 * Return: none 1790 */ 1791 static inline void target_if_print_service_ready_ext_param( 1792 struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_hdl) 1793 { 1794 if ((tgt_hdl->tif_ops) && 1795 (tgt_hdl->tif_ops->print_svc_ready_ex_param)) { 1796 tgt_hdl->tif_ops->print_svc_ready_ex_param(psoc, 1797 tgt_hdl); 1798 } 1799 } 1800 1801 /** 1802 * target_if_add_11ax_modes - Add 11ax modes explicitly 1803 * @psoc: psoc object 1804 * @tgt_hdl: target_psoc_info pointer 1805 * 1806 * API to adds 11ax modes 1807 * 1808 * Return: none 1809 */ 1810 static inline void target_if_add_11ax_modes(struct wlan_objmgr_psoc *psoc, 1811 struct target_psoc_info *tgt_hdl) 1812 { 1813 if ((tgt_hdl->tif_ops) && 1814 (tgt_hdl->tif_ops->add_11ax_modes)) { 1815 tgt_hdl->tif_ops->add_11ax_modes(psoc, tgt_hdl); 1816 } 1817 } 1818 1819 /** 1820 * target_if_set_default_config - Set default config in init command 1821 * @psoc: psoc object 1822 * @tgt_hdl: target_psoc_info pointer 1823 * 1824 * API to set default config in init command 1825 * 1826 * Return: none 1827 */ 1828 static inline void target_if_set_default_config(struct wlan_objmgr_psoc *psoc, 1829 struct target_psoc_info *tgt_hdl) 1830 { 1831 if ((tgt_hdl->tif_ops) && 1832 (tgt_hdl->tif_ops->set_default_tgt_config)) { 1833 tgt_hdl->tif_ops->set_default_tgt_config(psoc, tgt_hdl); 1834 } 1835 } 1836 1837 /** 1838 * target_if_sw_version_check - SW version check 1839 * @psoc: psoc object 1840 * @tgt_hdl: target_psoc_info pointer 1841 * @evt_buf: Event buffer received from FW 1842 * 1843 * API checks the SW version 1844 * 1845 * Return: SUCCESS on version matches or version check is not needed 1846 * FAILURE, if check fails 1847 */ 1848 static inline QDF_STATUS target_if_sw_version_check( 1849 struct wlan_objmgr_psoc *psoc, 1850 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1851 { 1852 QDF_STATUS ret_val; 1853 1854 if ((tgt_hdl->tif_ops) && 1855 (tgt_hdl->tif_ops->sw_version_check)) 1856 ret_val = tgt_hdl->tif_ops->sw_version_check(psoc, tgt_hdl, 1857 evt_buf); 1858 else 1859 ret_val = QDF_STATUS_SUCCESS; 1860 1861 return ret_val; 1862 } 1863 1864 /** 1865 * target_if_get_phy_capability - get phy capability 1866 * @target_psoc_info: pointer to structure target_psoc_info 1867 * 1868 * API to get phy capability from the target caps 1869 * 1870 * Return: int32_t 1871 */ 1872 static inline int32_t target_if_get_phy_capability 1873 (struct target_psoc_info *target_psoc_info) 1874 { 1875 if (target_psoc_info == NULL) 1876 return -EINVAL; 1877 1878 return target_psoc_info->info.target_caps.phy_capability; 1879 } 1880 1881 /** 1882 * target_if_set_phy_capability - set phy capability 1883 * @target_psoc_info: pointer to structure target_psoc_info 1884 * @phy_capab: PHY capabilities 1885 * 1886 * API to set phy capability in the target caps 1887 * 1888 * Return: None 1889 */ 1890 static inline void target_if_set_phy_capability 1891 (struct target_psoc_info *target_psoc_info, int phy_capability) 1892 { 1893 if (target_psoc_info == NULL) 1894 return; 1895 1896 target_psoc_info->info.target_caps.phy_capability = phy_capability; 1897 } 1898 1899 /** 1900 * target_if_set_max_frag_entry - set Maximum frag entries 1901 * @target_psoc_info: pointer to structure target_psoc_info 1902 * @max_frag_entry: Maximum frag entries 1903 * 1904 * API to set Maximum frag entries from the target caps 1905 * 1906 * Return: None 1907 */ 1908 static inline void target_if_set_max_frag_entry 1909 (struct target_psoc_info *target_psoc_info, int max_frag_entry) 1910 { 1911 if (target_psoc_info == NULL) 1912 return; 1913 1914 target_psoc_info->info.target_caps.max_frag_entry = max_frag_entry; 1915 } 1916 1917 /** 1918 * target_if_get_max_frag_entry - get Maximum frag entries 1919 * @target_psoc_info: pointer to structure target_psoc_info 1920 * 1921 * API to get Maximum frag entries from the target caps 1922 * 1923 * Return: int32_t 1924 */ 1925 static inline int32_t target_if_get_max_frag_entry 1926 (struct target_psoc_info *target_psoc_info) 1927 { 1928 if (target_psoc_info == NULL) 1929 return -EINVAL; 1930 1931 return target_psoc_info->info.target_caps.max_frag_entry; 1932 } 1933 1934 /** 1935 * target_if_get_ht_cap_info - get ht capabilities info 1936 * @target_psoc_info: pointer to structure target_psoc_info 1937 * 1938 * API to get ht capabilities info from the target caps 1939 * 1940 * Return: int32_t 1941 */ 1942 static inline int32_t target_if_get_ht_cap_info 1943 (struct target_psoc_info *target_psoc_info) 1944 { 1945 if (target_psoc_info == NULL) 1946 return -EINVAL; 1947 1948 return target_psoc_info->info.target_caps.ht_cap_info; 1949 } 1950 1951 /** 1952 * target_if_get_vht_cap_info - get vht capabilities info 1953 * @target_psoc_info: pointer to structure target_psoc_info 1954 * 1955 * API to get vht capabilities info from the target caps 1956 * 1957 * Return: int32_t 1958 */ 1959 static inline int32_t target_if_get_vht_cap_info 1960 (struct target_psoc_info *target_psoc_info) 1961 { 1962 if (target_psoc_info == NULL) 1963 return -EINVAL; 1964 1965 return target_psoc_info->info.target_caps.vht_cap_info; 1966 } 1967 1968 /** 1969 * target_if_get_num_rf_chains - get Number of RF chains supported 1970 * @target_psoc_info: pointer to structure target_psoc_info 1971 * 1972 * API to get Number of RF chains supported from the target caps 1973 * 1974 * Return: int32_t 1975 */ 1976 static inline int32_t target_if_get_num_rf_chains 1977 (struct target_psoc_info *target_psoc_info) 1978 { 1979 if (target_psoc_info == NULL) 1980 return -EINVAL; 1981 1982 return target_psoc_info->info.target_caps.num_rf_chains; 1983 } 1984 1985 /** 1986 * target_if_get_fw_version - get firmware version 1987 * @target_psoc_info: pointer to structure target_psoc_info 1988 * 1989 * API to get firmware version from the target caps 1990 * 1991 * Return: int32_t 1992 */ 1993 static inline int32_t target_if_get_fw_version 1994 (struct target_psoc_info *target_psoc_info) 1995 { 1996 if (target_psoc_info == NULL) 1997 return 0; 1998 1999 return target_psoc_info->info.target_caps.fw_version; 2000 } 2001 2002 /** 2003 * target_if_get_wmi_fw_sub_feat_caps - FW sub feature capabilities 2004 * @target_psoc_info: pointer to structure target_psoc_info 2005 * 2006 * API to get FW sub feature capabilities from the target caps 2007 * 2008 * Return: int32_t 2009 */ 2010 static inline int32_t target_if_get_wmi_fw_sub_feat_caps 2011 (struct target_psoc_info *target_psoc_info) 2012 { 2013 if (target_psoc_info == NULL) 2014 return -EINVAL; 2015 2016 return target_psoc_info->info.target_caps.wmi_fw_sub_feat_caps; 2017 } 2018 2019 /** 2020 * target_if_get_conc_scan_config_bits - Default concurrenct scan config 2021 * @tgt_hdl: pointer to structure target_psoc_info 2022 * 2023 * API to get Default concurrenct scan config from the target caps 2024 * 2025 * Return: int32_t 2026 */ 2027 static inline int32_t target_if_get_conc_scan_config_bits 2028 (struct target_psoc_info *tgt_hdl) 2029 { 2030 if (tgt_hdl == NULL) 2031 return -EINVAL; 2032 2033 return tgt_hdl->info.service_ext_param.default_conc_scan_config_bits; 2034 } 2035 2036 /** 2037 * target_if_get_fw_config_bits - Default HW config bits 2038 * @tgt_hdl: pointer to structure target_psoc_info 2039 * 2040 * API to get Default HW config bits from the target caps 2041 * 2042 * Return: int32_t 2043 */ 2044 static inline int32_t target_if_get_fw_config_bits 2045 (struct target_psoc_info *tgt_hdl) 2046 { 2047 if (tgt_hdl == NULL) 2048 return -EINVAL; 2049 2050 return tgt_hdl->info.service_ext_param.default_fw_config_bits; 2051 } 2052 2053 /** 2054 * target_psoc_get_num_hw_modes - get number of dbs hardware modes 2055 * @tgt_hdl: pointer to structure target_psoc_info 2056 * 2057 * API to get Number of Dual Band Simultaneous (DBS) hardware modes 2058 * 2059 * Return: int32_t 2060 */ 2061 static inline int32_t target_psoc_get_num_hw_modes 2062 (struct target_psoc_info *tgt_hdl) 2063 { 2064 if (tgt_hdl == NULL) 2065 return -EINVAL; 2066 2067 return tgt_hdl->info.service_ext_param.num_hw_modes; 2068 } 2069 2070 /** 2071 * target_if_smart_log enable() - Enable Smart Logs 2072 * @psoc: psoc object 2073 * @tgt_hdl: target_psoc_info pointer 2074 * @evt_buf: Service ready Event buffer received from FW 2075 * 2076 * API to enable Smart Logs 2077 * 2078 * Return: none 2079 */ 2080 static inline void target_if_smart_log_enable 2081 (struct wlan_objmgr_psoc *psoc, 2082 struct target_psoc_info *tgt_hdl, 2083 uint8_t *evt_buf) 2084 { 2085 if ((tgt_hdl->tif_ops) && (tgt_hdl->tif_ops->smart_log_enable)) 2086 tgt_hdl->tif_ops->smart_log_enable(psoc, tgt_hdl, evt_buf); 2087 } 2088 #endif 2089 2090