1 /* 2 * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 /** 20 * DOC: service_ready_util.h 21 * 22 * Public APIs to access (ext)service ready data from psoc object 23 */ 24 #ifndef _SERVICE_READY_UTIL_H_ 25 #define _SERVICE_READY_UTIL_H_ 26 27 #include "wlan_objmgr_psoc_obj.h" 28 #include "service_ready_param.h" 29 #include "target_if.h" 30 31 /** 32 * init_deinit_chainmask_table_alloc() 33 * - allocate chainmask table capability list. 34 * @service_ext_param: pointer to server ext param. 35 * 36 * Allocates capability list based on num_valid_chainmasks for that table. 37 * 38 * Return: QDF Status. 39 */ 40 QDF_STATUS init_deinit_chainmask_table_alloc( 41 struct wlan_psoc_host_service_ext_param *service_ext_param); 42 43 /** 44 * init_deinit_chainmask_table_free() 45 * -free chainmask table capability list. 46 * @service_ext_param: pointer to server ext param. 47 * 48 * free capability list based on num_valid_chainmasks for that table. 49 * 50 * Return: QDF Status. 51 */ 52 QDF_STATUS init_deinit_chainmask_table_free( 53 struct wlan_psoc_host_service_ext_param *service_ext_param); 54 55 /** 56 * init_deinit_populate_service_bitmap() - populate service bitmap 57 * @wmi_handle: wmi handle 58 * @event: event buffer received from FW 59 * @service_bitmap: service bitmap information 60 * 61 * API to populate service bit map 62 * 63 * Return: zero on successful population of service bitmap or failure flag 64 */ 65 int init_deinit_populate_service_bitmap( 66 wmi_unified_t wmi_handle, uint8_t *event, 67 uint32_t *service_bitmap); 68 69 /** 70 * init_deinit_populate_fw_version_cmd() - populate FW version 71 * @wmi_handle: wmi handle 72 * @event: event buffer received from FW 73 * 74 * API to populate FW version 75 * 76 * Return: zero on successful population of fw_version command or failure flag 77 */ 78 int 79 init_deinit_populate_fw_version_cmd(wmi_unified_t wmi_handle, uint8_t *event); 80 81 /** 82 * init_deinit_populate_target_cap() - populate target cap 83 * @wmi_handle: wmi handle 84 * @event: event buffer received from FW 85 * @cap: target capability info object 86 * 87 * API to populate target cap 88 * 89 * Return: zero on successful population of target cap or failure flag 90 */ 91 int init_deinit_populate_target_cap( 92 wmi_unified_t wmi_handle, uint8_t *event, 93 struct wlan_psoc_target_capability_info *cap); 94 95 /** 96 * init_deinit_populate_service_ready_ext_param() - populate service ready ext 97 * parameter 98 * @handle: WMI handle pointer 99 * @evt: event buffer received from FW 100 * @param: service ext param object 101 * 102 * API to populate service ready ext param 103 * 104 * Return: zero on successful parsing of service ready ext parameter or failure 105 */ 106 int init_deinit_populate_service_ready_ext_param( 107 wmi_unified_t handle, uint8_t *evt, 108 struct wlan_psoc_host_service_ext_param *param); 109 110 /** 111 * init_deinit_populate_service_ready_ext2_param() - populate service ready ext2 112 * parameter 113 * @handle: WMI handle pointer 114 * @evt: event buffer received from FW 115 * @info: Target info handle 116 * 117 * API to populate service ready ext2 param 118 * 119 * Return: zero on successful parsing of service ready ext parameter or failure 120 */ 121 int init_deinit_populate_service_ready_ext2_param( 122 wmi_unified_t handle, uint8_t *evt, 123 struct tgt_info *info); 124 125 /** 126 * init_deinit_populate_chainmask_tables() - populate chainmaks tables 127 * @handle: WMI handle pointer 128 * @evt: event buffer received from FW 129 * @param: chainmaks_table object 130 * 131 * API to populate chainmaks tables 132 * 133 * Return: zero on successful parsing of chainmaks tables or failure flag 134 */ 135 int init_deinit_populate_chainmask_tables( 136 wmi_unified_t handle, uint8_t *evt, 137 struct wlan_psoc_host_chainmask_table *param); 138 139 /** 140 * init_deinit_populate_mac_phy_capability() - populate mac phy capability 141 * @handle: WMI handle pointer 142 * @evt: event buffer received from FW 143 * @hw_cap: hw_mode_caps object 144 * @info: tgt_info object 145 * 146 * API to populate mac phy capability 147 * 148 * Return: zero on successful population of mac physical capability or failure 149 */ 150 int init_deinit_populate_mac_phy_capability( 151 wmi_unified_t handle, uint8_t *evt, 152 struct wlan_psoc_host_hw_mode_caps *hw_cap, struct tgt_info *info); 153 154 /** 155 * init_deinit_populate_hw_mode_capability() - populate hw mode capability 156 * @wmi_handle: WMI handle pointer 157 * @event: event buffer received from FW 158 * @tgt_hdl: target_psoc_info object 159 * 160 * API to populate hw mode capability 161 * 162 * Return: zero on successful parsing of hw mode capability or failure 163 */ 164 int init_deinit_populate_hw_mode_capability( 165 wmi_unified_t wmi_handle, 166 uint8_t *event, struct target_psoc_info *tgt_hdl); 167 168 /** 169 * init_deinit_populate_dbr_ring_cap() - populate dbr ring capability 170 * @psoc: PSOC object 171 * @handle: WMI handle pointer 172 * @event: event buffer received from FW 173 * @info: tgt_info object 174 * 175 * API to populate dbr ring capability 176 * 177 * Return: zero on successful parsing of dbr ring capability or failure 178 */ 179 int init_deinit_populate_dbr_ring_cap(struct wlan_objmgr_psoc *psoc, 180 wmi_unified_t handle, uint8_t *event, 181 struct tgt_info *info); 182 183 /** 184 * init_deinit_populate_dbr_ring_cap_ext2() - populate dbr ring capability 185 * from ext2 event 186 * @psoc: PSOC object 187 * @handle: WMI handle pointer 188 * @event: event buffer received from FW 189 * @info: tgt_info object 190 * 191 * API to populate dbr ring capability 192 * 193 * Return: zero on successful parsing of dbr ring capability or failure 194 */ 195 int init_deinit_populate_dbr_ring_cap_ext2(struct wlan_objmgr_psoc *psoc, 196 wmi_unified_t handle, uint8_t *event, 197 struct tgt_info *info); 198 199 /** 200 * init_deinit_populate_spectral_bin_scale_params() - populate Spectral scaling 201 * @psoc: PSOC object 202 * @handle: WMI handle pointer 203 * @event: event buffer received from FW 204 * @info: tgt_info object 205 * 206 * API to populate Spectral bin scaling parameters 207 * 208 * Return: zero on successful parsing of scaling params or failure 209 */ 210 int init_deinit_populate_spectral_bin_scale_params( 211 struct wlan_objmgr_psoc *psoc, 212 wmi_unified_t handle, uint8_t *event, 213 struct tgt_info *info); 214 215 /** 216 * init_deinit_dbr_ring_cap_free() - free dbr ring capability 217 * @tgt_psoc_info: target psoc info object 218 * 219 * API to free dbr ring capability 220 * 221 * Return: QDF_STATUS 222 */ 223 QDF_STATUS init_deinit_dbr_ring_cap_free( 224 struct target_psoc_info *tgt_psoc_info); 225 226 /** 227 * init_deinit_scan_radio_cap_free() - free scan radio capability 228 * @tgt_psoc_info: target psoc info object 229 * 230 * API to free scan radio related capability information. 231 * 232 * Return: QDF_STATUS 233 */ 234 QDF_STATUS init_deinit_scan_radio_cap_free( 235 struct target_psoc_info *tgt_psoc_info); 236 237 /** 238 * init_deinit_msdu_idx_qtype_map_free() - free msdu index to qtype map 239 * @tgt_psoc_info: target psoc info object 240 * 241 * API to free msdu index to qtype map information. 242 * 243 * Return: QDF_STATUS 244 */ 245 QDF_STATUS init_deinit_msdu_idx_qtype_map_free( 246 struct target_psoc_info *tgt_psoc_info); 247 248 /** 249 * init_deinit_spectral_scaling_params_free() - free Spectral scaling params 250 * @tgt_psoc_info: target psoc info object 251 * 252 * API to free Spectral scaling params 253 * 254 * Return: QDF_STATUS 255 */ 256 QDF_STATUS init_deinit_spectral_scaling_params_free( 257 struct target_psoc_info *tgt_psoc_info); 258 259 /** 260 * init_deinit_populate_phy_reg_cap() - populate phy reg capability 261 * @psoc: PSOC object 262 * @wmi_handle: WMI handle pointer 263 * @event: event buffer received from FW 264 * @info: tgt_info object 265 * @service_ready: service ready determiner 266 * 267 * API to populate phy reg capability 268 * 269 * Return: zero on successful parsing of physical reg capability or failure flag 270 */ 271 int init_deinit_populate_phy_reg_cap(struct wlan_objmgr_psoc *psoc, 272 wmi_unified_t wmi_handle, uint8_t *event, 273 struct tgt_info *info, 274 bool service_ready); 275 276 /** 277 * init_deinit_populate_hal_reg_cap_ext2() - Populate HAL reg capabilities from 278 * service ready ext2 event. 279 * @handle: WMI handle pointer 280 * @event: event buffer received from FW 281 * @info: tgt_info object 282 * 283 * API to populate HAL reg capabilities from service ready ext2 event. 284 * 285 * Return: zero on successful parsing of physical reg capability or failure flag 286 */ 287 int init_deinit_populate_hal_reg_cap_ext2(wmi_unified_t handle, uint8_t *event, 288 struct tgt_info *info); 289 290 /** 291 * init_deinit_populate_mac_phy_cap_ext2() - populate mac phy capabilities from 292 * service ready ext2 event 293 * @handle: WMI handle pointer 294 * @event: event buffer received from FW 295 * @info: tgt_info object 296 * 297 * API to populate mac phy capability from service ready ext2 event. 298 * 299 * Return: zero on successful population of mac physical capability or failure 300 */ 301 int init_deinit_populate_mac_phy_cap_ext2(wmi_unified_t handle, uint8_t *event, 302 struct tgt_info *info); 303 304 /** 305 * init_deinit_populate_scan_radio_cap_ext2() - populate scan radio capabilities 306 * from service ready ext2 event 307 * @handle: WMI handle pointer 308 * @event: event buffer received from FW 309 * @info: tgt_info object 310 * 311 * API to populate scan radio capability from service ready ext2 event. 312 * 313 * Return: zero on successful population of scan radio or failure 314 */ 315 int init_deinit_populate_scan_radio_cap_ext2(wmi_unified_t handle, 316 uint8_t *event, 317 struct tgt_info *info); 318 319 /** 320 * init_deinit_populate_msdu_idx_qtype_map_ext2() - populate msdu index to 321 * qtype map from service 322 * ready ext2 event 323 * @handle: WMI handle pointer 324 * @event: event buffer received from FW 325 * @info: tgt_info object 326 * 327 * API to populate HTT msdu index to qtype map from service ready ext2 event. 328 * 329 * Return: zero on successful population or non-zero failure 330 */ 331 int init_deinit_populate_msdu_idx_qtype_map_ext2(wmi_unified_t handle, 332 uint8_t *event, 333 struct tgt_info *info); 334 335 #ifdef WLAN_SUPPORT_TWT 336 /** 337 * init_deinit_populate_twt_cap_ext2() - populate twt capabilities from service 338 * ready ext2 event 339 * @psoc: PSOC object 340 * @handle: WMI handle pointer 341 * @event: event buffer received from FW 342 * @info: tgt_info object 343 * 344 * API to populate twt capability from service ready ext2 event. 345 * Return: zero on successful population of twt capability or failure 346 */ 347 int init_deinit_populate_twt_cap_ext2(struct wlan_objmgr_psoc *psoc, 348 wmi_unified_t handle, uint8_t *event, 349 struct tgt_info *info); 350 #else 351 static inline 352 int init_deinit_populate_twt_cap_ext2(struct wlan_objmgr_psoc *psoc, 353 wmi_unified_t handle, uint8_t *event, 354 struct tgt_info *info) 355 { 356 return 0; 357 } 358 #endif 359 360 /** 361 * init_deinit_populate_dbs_or_sbs_cap_ext2() - populate dbs or sbs capability 362 * from service ready ext2 event 363 * 364 * @psoc: PSOC object 365 * @handle: WMI handle pointer 366 * @event: event buffer received from FW 367 * @info: tgt_info object 368 * 369 * API to populate dbs or sbs capability from service ready ext2 event. 370 * Return: zero on successful dbs or sbs capability or failure 371 */ 372 int init_deinit_populate_dbs_or_sbs_cap_ext2(struct wlan_objmgr_psoc *psoc, 373 wmi_unified_t handle, 374 uint8_t *event, 375 struct tgt_info *info); 376 377 /** 378 * init_deinit_populate_sap_coex_capability() - SAP coex capability 379 * @psoc: PSOC object 380 * @handle: WMI handle pointer 381 * @event: event buffer received from FW 382 * 383 * API to populate SAP coex capabilities which currently indicates whether SAP 384 * is allowed on a coex channel when it's started with fixed chan config 385 * 386 * Return: zero on successful capability fetching or failure 387 */ 388 int init_deinit_populate_sap_coex_capability(struct wlan_objmgr_psoc *psoc, 389 wmi_unified_t handle, 390 uint8_t *event); 391 /** 392 * init_deinit_validate_160_80p80_fw_caps() - validate 160 80p80 fw caps 393 * @psoc: PSOC object 394 * @tgt_info: target_psoc_info object 395 * 396 * API to validate 160 80p80 fw caps 397 * 398 * Return: SUCCESS on successful validation of 160 80p80 forward caps or Failure 399 */ 400 QDF_STATUS init_deinit_validate_160_80p80_fw_caps( 401 struct wlan_objmgr_psoc *psoc, 402 struct target_psoc_info *tgt_info); 403 404 /** 405 * init_deinit_chainmask_config() - config chainmask 406 * @psoc: PSOC object 407 * @tgt_info: target_psoc_info object 408 * 409 * API to config chainmask 410 * 411 * Return: none 412 */ 413 void init_deinit_chainmask_config( 414 struct wlan_objmgr_psoc *psoc, 415 struct target_psoc_info *tgt_info); 416 417 /** 418 * init_deinit_is_service_ext_msg() - check service ext message 419 * @psoc: PSOC object 420 * @tgt_info: target_psoc_info object 421 * 422 * API to check whether service ext message is enabled 423 * 424 * Return: SUCCESS on successful check of service_ext message or Failure 425 */ 426 QDF_STATUS init_deinit_is_service_ext_msg( 427 struct wlan_objmgr_psoc *psoc, 428 struct target_psoc_info *tgt_info); 429 /** 430 * init_deinit_is_preferred_hw_mode_supported() - check support of preferred 431 * hw mode 432 * @psoc: PSOC object 433 * @tgt_info: target_psoc_info object 434 * 435 * API to check whether preferred hardware mode is enabled 436 * 437 * Return: True on support of preferred hardware support or False 438 */ 439 bool init_deinit_is_preferred_hw_mode_supported( 440 struct wlan_objmgr_psoc *psoc, 441 struct target_psoc_info *tgt_info); 442 443 /** 444 * init_deinit_wakeup_host_wait() - wakeup host wait 445 * @psoc: PSOC object 446 * @tgt_info: target_psoc_info object 447 * 448 * API to wakeup FW ready wait queue 449 * 450 * Return: None 451 */ 452 void init_deinit_wakeup_host_wait( 453 struct wlan_objmgr_psoc *psoc, 454 struct target_psoc_info *tgt_info); 455 456 #endif /* _SERVICE_READY_UTIL_H_*/ 457