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_spectral_scaling_params_free() - free Spectral scaling params 239 * @tgt_psoc_info: target psoc info object 240 * 241 * API to free Spectral scaling params 242 * 243 * Return: QDF_STATUS 244 */ 245 QDF_STATUS init_deinit_spectral_scaling_params_free( 246 struct target_psoc_info *tgt_psoc_info); 247 248 /** 249 * init_deinit_populate_phy_reg_cap() - populate phy reg capability 250 * @psoc: PSOC object 251 * @wmi_handle: WMI handle pointer 252 * @event: event buffer received from FW 253 * @info: tgt_info object 254 * @service_ready: service ready determiner 255 * 256 * API to populate phy reg capability 257 * 258 * Return: zero on successful parsing of physical reg capability or failure flag 259 */ 260 int init_deinit_populate_phy_reg_cap(struct wlan_objmgr_psoc *psoc, 261 wmi_unified_t wmi_handle, uint8_t *event, 262 struct tgt_info *info, 263 bool service_ready); 264 265 /** 266 * init_deinit_populate_hal_reg_cap_ext2() - Populate HAL reg capabilities from 267 * service ready ext2 event. 268 * @handle: WMI handle pointer 269 * @event: event buffer received from FW 270 * @info: tgt_info object 271 * 272 * API to populate HAL reg capabilities from service ready ext2 event. 273 * 274 * Return: zero on successful parsing of physical reg capability or failure flag 275 */ 276 int init_deinit_populate_hal_reg_cap_ext2(wmi_unified_t handle, uint8_t *event, 277 struct tgt_info *info); 278 279 /** 280 * init_deinit_populate_mac_phy_cap_ext2() - populate mac phy capabilities from 281 * service ready ext2 event 282 * @handle: WMI handle pointer 283 * @event: event buffer received from FW 284 * @info: tgt_info object 285 * 286 * API to populate mac phy capability from service ready ext2 event. 287 * 288 * Return: zero on successful population of mac physical capability or failure 289 */ 290 int init_deinit_populate_mac_phy_cap_ext2(wmi_unified_t handle, uint8_t *event, 291 struct tgt_info *info); 292 293 /** 294 * init_deinit_populate_scan_radio_cap_ext2() - populate scan radio capabilities 295 * from service ready ext2 event 296 * @handle: WMI handle pointer 297 * @event: event buffer received from FW 298 * @info: tgt_info object 299 * 300 * API to populate scan radio capability from service ready ext2 event. 301 * 302 * Return: zero on successful population of scan radio or failure 303 */ 304 int init_deinit_populate_scan_radio_cap_ext2(wmi_unified_t handle, 305 uint8_t *event, 306 struct tgt_info *info); 307 308 #ifdef WLAN_SUPPORT_TWT 309 /** 310 * init_deinit_populate_twt_cap_ext2() - populate twt capabilities from service 311 * ready ext2 event 312 * @psoc: PSOC object 313 * @handle: WMI handle pointer 314 * @event: event buffer received from FW 315 * @info: tgt_info object 316 * 317 * API to populate twt capability from service ready ext2 event. 318 * Return: zero on successful population of twt capability or failure 319 */ 320 int init_deinit_populate_twt_cap_ext2(struct wlan_objmgr_psoc *psoc, 321 wmi_unified_t handle, uint8_t *event, 322 struct tgt_info *info); 323 #else 324 static inline 325 int init_deinit_populate_twt_cap_ext2(struct wlan_objmgr_psoc *psoc, 326 wmi_unified_t handle, uint8_t *event, 327 struct tgt_info *info) 328 { 329 return 0; 330 } 331 #endif 332 333 /** 334 * init_deinit_populate_dbs_or_sbs_cap_ext2() - populate dbs or sbs capability 335 * from service ready ext2 event 336 * 337 * @psoc: PSOC object 338 * @handle: WMI handle pointer 339 * @event: event buffer received from FW 340 * @info: tgt_info object 341 * 342 * API to populate dbs or sbs capability from service ready ext2 event. 343 * Return: zero on successful dbs or sbs capability or failure 344 */ 345 int init_deinit_populate_dbs_or_sbs_cap_ext2(struct wlan_objmgr_psoc *psoc, 346 wmi_unified_t handle, 347 uint8_t *event, 348 struct tgt_info *info); 349 350 /** 351 * init_deinit_populate_sap_coex_capability() - SAP coex capability 352 * @psoc: PSOC object 353 * @handle: WMI handle pointer 354 * @event: event buffer received from FW 355 * 356 * API to populate SAP coex capabilities which currently indicates whether SAP 357 * is allowed on a coex channel when it's started with fixed chan config 358 * 359 * Return: zero on successful capability fetching or failure 360 */ 361 int init_deinit_populate_sap_coex_capability(struct wlan_objmgr_psoc *psoc, 362 wmi_unified_t handle, 363 uint8_t *event); 364 /** 365 * init_deinit_validate_160_80p80_fw_caps() - validate 160 80p80 fw caps 366 * @psoc: PSOC object 367 * @tgt_info: target_psoc_info object 368 * 369 * API to validate 160 80p80 fw caps 370 * 371 * Return: SUCCESS on successful validation of 160 80p80 forward caps or Failure 372 */ 373 QDF_STATUS init_deinit_validate_160_80p80_fw_caps( 374 struct wlan_objmgr_psoc *psoc, 375 struct target_psoc_info *tgt_info); 376 377 /** 378 * init_deinit_chainmask_config() - config chainmask 379 * @psoc: PSOC object 380 * @tgt_info: target_psoc_info object 381 * 382 * API to config chainmask 383 * 384 * Return: none 385 */ 386 void init_deinit_chainmask_config( 387 struct wlan_objmgr_psoc *psoc, 388 struct target_psoc_info *tgt_info); 389 390 /** 391 * init_deinit_is_service_ext_msg() - check service ext message 392 * @psoc: PSOC object 393 * @tgt_info: target_psoc_info object 394 * 395 * API to check whether service ext message is enabled 396 * 397 * Return: SUCCESS on successful check of service_ext message or Failure 398 */ 399 QDF_STATUS init_deinit_is_service_ext_msg( 400 struct wlan_objmgr_psoc *psoc, 401 struct target_psoc_info *tgt_info); 402 /** 403 * init_deinit_is_preferred_hw_mode_supported() - check support of preferred 404 * hw mode 405 * @psoc: PSOC object 406 * @tgt_info: target_psoc_info object 407 * 408 * API to check whether preferred hardware mode is enabled 409 * 410 * Return: True on support of preferred hardware support or False 411 */ 412 bool init_deinit_is_preferred_hw_mode_supported( 413 struct wlan_objmgr_psoc *psoc, 414 struct target_psoc_info *tgt_info); 415 416 /** 417 * init_deinit_wakeup_host_wait() - wakeup host wait 418 * @psoc: PSOC object 419 * @tgt_info: target_psoc_info object 420 * 421 * API to wakeup FW ready wait queue 422 * 423 * Return: None 424 */ 425 void init_deinit_wakeup_host_wait( 426 struct wlan_objmgr_psoc *psoc, 427 struct target_psoc_info *tgt_info); 428 429 #endif /* _SERVICE_READY_UTIL_H_*/ 430