Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -0800 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | #if !defined( __VOS_API_H ) |
| 29 | #define __VOS_API_H |
| 30 | |
| 31 | /**========================================================================= |
| 32 | |
| 33 | \file vos_Api.h |
| 34 | |
| 35 | \brief virtual Operating System Services (vOSS) API |
| 36 | |
| 37 | Header file that inludes all the vOSS API definitions. |
| 38 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 39 | |
| 40 | ========================================================================*/ |
| 41 | /*=========================================================================== |
| 42 | |
| 43 | EDIT HISTORY FOR FILE |
| 44 | |
| 45 | |
| 46 | This section contains comments describing changes made to the module. |
| 47 | Notice that changes are listed in reverse chronological order. |
| 48 | |
| 49 | |
| 50 | $Header:$ $DateTime: $ $Author: $ |
| 51 | |
| 52 | |
| 53 | when who what, where, why |
| 54 | -------- --- -------------------------------------------------------- |
| 55 | 06/23/08 hba Added vos_preOpen() |
| 56 | 05/18/08 lac Created module. |
| 57 | ===========================================================================*/ |
| 58 | |
| 59 | /*-------------------------------------------------------------------------- |
| 60 | Include Files |
| 61 | ------------------------------------------------------------------------*/ |
| 62 | // one stop shopping. This brings in the entire vOSS API. |
| 63 | #include <vos_types.h> |
| 64 | #include <vos_status.h> |
| 65 | #include <vos_memory.h> |
| 66 | #include <vos_list.h> |
| 67 | #include <vos_getBin.h> |
| 68 | #include <vos_trace.h> |
| 69 | #include <vos_event.h> |
| 70 | #include <vos_lock.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 71 | #include <vos_nvitem.h> |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 72 | #include <vos_mq.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 73 | #include <vos_packet.h> |
| 74 | #include <vos_threads.h> |
| 75 | #include <vos_timer.h> |
| 76 | #include <vos_pack_align.h> |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 77 | #include <asm/arch_timer.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 78 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 79 | /** |
| 80 | * enum userspace_log_level - Log level at userspace |
| 81 | * @LOG_LEVEL_NO_COLLECTION: verbose_level 0 corresponds to no collection |
| 82 | * @LOG_LEVEL_NORMAL_COLLECT: verbose_level 1 correspond to normal log level, |
| 83 | * with minimal user impact. this is the default value |
| 84 | * @LOG_LEVEL_ISSUE_REPRO: verbose_level 2 are enabled when user is lazily |
| 85 | * trying to reproduce a problem, wifi performances and power can be impacted |
| 86 | * but device should not otherwise be significantly impacted |
| 87 | * @LOG_LEVEL_ACTIVE: verbose_level 3+ are used when trying to |
| 88 | * actively debug a problem |
| 89 | * |
| 90 | * Various log levels defined in the userspace for logging applications |
| 91 | */ |
| 92 | enum userspace_log_level { |
| 93 | LOG_LEVEL_NO_COLLECTION, |
| 94 | LOG_LEVEL_NORMAL_COLLECT, |
| 95 | LOG_LEVEL_ISSUE_REPRO, |
| 96 | LOG_LEVEL_ACTIVE, |
| 97 | }; |
| 98 | |
| 99 | /** |
| 100 | * enum wifi_driver_log_level - Log level defined in the driver for logging |
| 101 | * @WLAN_LOG_LEVEL_OFF: No logging |
| 102 | * @WLAN_LOG_LEVEL_NORMAL: Default logging |
| 103 | * @WLAN_LOG_LEVEL_REPRO: Normal debug level |
| 104 | * @WLAN_LOG_LEVEL_ACTIVE: Active debug level |
| 105 | * |
| 106 | * Log levels defined for logging by the wifi driver |
| 107 | */ |
| 108 | enum wifi_driver_log_level { |
| 109 | WLAN_LOG_LEVEL_OFF, |
| 110 | WLAN_LOG_LEVEL_NORMAL, |
| 111 | WLAN_LOG_LEVEL_REPRO, |
| 112 | WLAN_LOG_LEVEL_ACTIVE, |
| 113 | }; |
| 114 | |
| 115 | /** |
| 116 | * enum wifi_logging_ring_id - Ring id of logging entities |
| 117 | * @RING_ID_WAKELOCK: Power events ring id |
| 118 | * @RING_ID_CONNECTIVITY: Connectivity event ring id |
| 119 | * @RING_ID_PER_PACKET_STATS: Per packet statistic ring id |
| 120 | * |
| 121 | * This enum has the ring id values of logging rings |
| 122 | */ |
| 123 | enum wifi_logging_ring_id { |
| 124 | RING_ID_WAKELOCK, |
| 125 | RING_ID_CONNECTIVITY, |
| 126 | RING_ID_PER_PACKET_STATS, |
| 127 | }; |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 128 | |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 129 | /* 15 Min */ |
| 130 | #define WLAN_POWER_COLLAPSE_FAIL_THRESHOLD (1000 * 60 * 15) |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 131 | /** |
| 132 | * enum log_event_type - Type of event initiating bug report |
| 133 | * @WLAN_LOG_TYPE_NON_FATAL: Non fatal event |
| 134 | * @WLAN_LOG_TYPE_FATAL: Fatal event |
| 135 | * |
| 136 | * Enum indicating the type of event that is initiating the bug report |
| 137 | */ |
| 138 | enum log_event_type { |
| 139 | WLAN_LOG_TYPE_NON_FATAL, |
| 140 | WLAN_LOG_TYPE_FATAL, |
| 141 | }; |
| 142 | |
| 143 | /** |
| 144 | * enum log_event_indicator - Module triggering bug report |
| 145 | * @WLAN_LOG_INDICATOR_UNUSED: Unused |
| 146 | * @WLAN_LOG_INDICATOR_FRAMEWORK: Framework triggers bug report |
| 147 | * @WLAN_LOG_INDICATOR_HOST_DRIVER: Host driver triggers bug report |
| 148 | * @WLAN_LOG_INDICATOR_FIRMWARE: FW initiates bug report |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 149 | * @WLAN_LOG_INDICATOR_IOCTL: Bug report is initiated by IOCTL |
| 150 | * @WLAN_LOG_INDICATOR_HOST_ONLY: Host initiated and only Host |
| 151 | * logs are needed |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 152 | * |
| 153 | * Enum indicating the module that triggered the bug report |
| 154 | */ |
| 155 | enum log_event_indicator { |
| 156 | WLAN_LOG_INDICATOR_UNUSED, |
| 157 | WLAN_LOG_INDICATOR_FRAMEWORK, |
| 158 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 159 | WLAN_LOG_INDICATOR_FIRMWARE, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 160 | WLAN_LOG_INDICATOR_IOCTL, |
| 161 | WLAN_LOG_INDICATOR_HOST_ONLY, |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 162 | }; |
| 163 | |
| 164 | /** |
| 165 | * enum log_event_host_reason_code - Reason code for bug report |
| 166 | * @WLAN_LOG_REASON_CODE_UNUSED: Unused |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 167 | * @WLAN_LOG_REASON_ROAM_FAIL: Driver initiated roam has failed |
| 168 | * @WLAN_LOG_REASON_THREAD_STUCK: Monitor Health of host threads and report |
| 169 | * fatal event if some thread is stuck |
| 170 | * @WLAN_LOG_REASON_DATA_STALL: Unable to send/receive data due to low resource |
| 171 | * scenario for a prolonged period |
| 172 | * @WLAN_LOG_REASON_SME_COMMAND_STUCK: SME command is stuck in SME active queue |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 173 | * @WLAN_LOG_REASON_QUEUE_FULL: Defer queue becomes full for a prolonged period |
| 174 | * @WLAN_LOG_REASON_POWER_COLLAPSE_FAIL: Unable to allow apps power collapse |
| 175 | * for a prolonged period |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 176 | * @WLAN_LOG_REASON_MALLOC_FAIL: Memory allocation Fails |
| 177 | * @WLAN_LOG_REASON_VOS_MSG_UNDER_RUN: VOS Core runs out of message wrapper |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 178 | * @WLAN_LOG_REASON_IOCTL: Initiated by IOCTL |
| 179 | * @WLAN_LOG_REASON_CODE_FRAMEWORK: Initiated by framework |
| 180 | * @WLAN_LOG_REASON_DEL_BSS_STA_FAIL: DEL BSS/STA rsp is failure |
| 181 | * @WLAN_LOG_REASON_ADD_BSS_STA_FAIL: ADD BSS/STA rsp is failure |
| 182 | * @WLAN_LOG_REASON_ENTER_IMPS_BMPS_FAIL: Enter IMPS/BMPS rsp failure |
| 183 | * @WLAN_LOG_REASON_EXIT_IMPS_BMPS_FAIL: Exit IMPS/BMPS rsp failure |
| 184 | * @WLAN_LOG_REASON_HDD_TIME_OUT: Wait for event Timeout in HDD layer |
| 185 | * @WLAN_LOG_REASON_MGMT_FRAME_TIMEOUT:Management frame timedout |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 186 | * @WLAN_LOG_REASON_SME_OUT_OF_CMD_BUFL sme out of cmd buffer |
| 187 | * @WLAN_LOG_REASON_SCAN_NOT_ALLOWED: scan not allowed due to connection states |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 188 | * This enum contains the different reason codes for bug report |
| 189 | */ |
| 190 | enum log_event_host_reason_code { |
| 191 | WLAN_LOG_REASON_CODE_UNUSED, |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 192 | WLAN_LOG_REASON_ROAM_FAIL, |
| 193 | WLAN_LOG_REASON_THREAD_STUCK, |
| 194 | WLAN_LOG_REASON_DATA_STALL, |
| 195 | WLAN_LOG_REASON_SME_COMMAND_STUCK, |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 196 | WLAN_LOG_REASON_QUEUE_FULL, |
| 197 | WLAN_LOG_REASON_POWER_COLLAPSE_FAIL, |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 198 | WLAN_LOG_REASON_MALLOC_FAIL, |
| 199 | WLAN_LOG_REASON_VOS_MSG_UNDER_RUN, |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 200 | WLAN_LOG_REASON_IOCTL, |
| 201 | WLAN_LOG_REASON_CODE_FRAMEWORK, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 202 | WLAN_LOG_REASON_DEL_BSS_STA_FAIL, |
| 203 | WLAN_LOG_REASON_ADD_BSS_STA_FAIL, |
| 204 | WLAN_LOG_REASON_ENTER_IMPS_BMPS_FAIL, |
| 205 | WLAN_LOG_REASON_EXIT_IMPS_BMPS_FAIL, |
| 206 | WLAN_LOG_REASON_HDD_TIME_OUT, |
| 207 | WLAN_LOG_REASON_MGMT_FRAME_TIMEOUT, |
| 208 | WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF, |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 209 | WLAN_LOG_REASON_SCAN_NOT_ALLOWED, |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 210 | }; |
| 211 | |
Arunk Khandavalli | af6c3af | 2017-01-16 11:44:46 +0530 | [diff] [blame] | 212 | /** |
| 213 | * vos_wdi_trace_event_type: Trace type for WDI Write/Read |
| 214 | * VOS_WDI_READ: Log the WDI read event |
| 215 | * VOS_WDI_WRITE: Log the WDI write event |
| 216 | */ |
| 217 | typedef enum |
| 218 | { |
| 219 | VOS_WDI_READ, |
| 220 | VOS_WDI_WRITE, |
| 221 | } vos_wdi_trace_event_type; |
| 222 | |
Anurag Chouhan | f0d0ba1 | 2018-02-09 15:13:43 +0530 | [diff] [blame] | 223 | /** |
| 224 | * enum vos_hang_reason - host hang/ssr reason |
| 225 | * @VOS_REASON_UNSPECIFIED: Unspecified reason |
| 226 | * @VOS_GET_MSG_BUFF_FAILURE: Unable to get the message buffer |
| 227 | * @VOS_ACTIVE_LIST_TIMEOUT: Current command processing is timedout |
| 228 | * @VOS_SCAN_REQ_EXPIRED: Scan request timed out |
| 229 | * @VOS_TRANSMISSIONS_TIMEOUT: transmission timed out |
| 230 | * @VOS_DXE_FAILURE: dxe failure |
| 231 | * @VOS_WDI_FAILURE: wdi failure |
| 232 | */ |
| 233 | enum vos_hang_reason { |
| 234 | VOS_REASON_UNSPECIFIED = 0, |
| 235 | VOS_GET_MSG_BUFF_FAILURE = 1, |
| 236 | VOS_ACTIVE_LIST_TIMEOUT = 2, |
| 237 | VOS_SCAN_REQ_EXPIRED = 3, |
| 238 | VOS_TRANSMISSIONS_TIMEOUT = 4, |
| 239 | VOS_DXE_FAILURE = 5, |
| 240 | VOS_WDI_FAILURE = 6, |
| 241 | }; |
| 242 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 243 | /*------------------------------------------------------------------------- |
| 244 | Function declarations and documenation |
| 245 | ------------------------------------------------------------------------*/ |
| 246 | |
| 247 | /**-------------------------------------------------------------------------- |
| 248 | |
| 249 | \brief vos_preOpen() - PreOpen the vOSS Module |
| 250 | |
| 251 | The \a vos_preOpen() function allocates the Vos Context, but do not |
| 252 | initialize all the members. This overal initialization will happen |
| 253 | at vos_Open(). |
| 254 | The reason why we need vos_preOpen() is to get a minimum context |
| 255 | where to store BAL and SAL relative data, which happens before |
| 256 | vos_Open() is called. |
| 257 | |
| 258 | \param pVosContext: A pointer to where to store the VOS Context |
| 259 | |
| 260 | |
| 261 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 262 | is ready to be used. |
| 263 | |
| 264 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 265 | |
| 266 | \sa vos_open() |
| 267 | |
| 268 | ---------------------------------------------------------------------------*/ |
| 269 | VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext ); |
| 270 | |
| 271 | VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext ); |
| 272 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 273 | |
| 274 | VOS_STATUS vos_preStart( v_CONTEXT_t vosContext ); |
| 275 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 276 | |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 277 | VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, void *devHandle ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 278 | |
Katya Nigam | e7b69a8 | 2015-04-28 15:24:06 +0530 | [diff] [blame] | 279 | VOS_STATUS vos_mon_start( v_CONTEXT_t vosContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 280 | |
Katya Nigam | e7b69a8 | 2015-04-28 15:24:06 +0530 | [diff] [blame] | 281 | VOS_STATUS vos_mon_stop( v_CONTEXT_t vosContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | |
| 283 | VOS_STATUS vos_start( v_CONTEXT_t vosContext ); |
| 284 | |
| 285 | VOS_STATUS vos_stop( v_CONTEXT_t vosContext ); |
| 286 | |
| 287 | VOS_STATUS vos_close( v_CONTEXT_t vosContext ); |
| 288 | |
| 289 | /* vos shutdown will not close control transport and will not handshake with Riva */ |
| 290 | VOS_STATUS vos_shutdown( v_CONTEXT_t vosContext ); |
| 291 | |
| 292 | /* the wda interface to shutdown */ |
| 293 | VOS_STATUS vos_wda_shutdown( v_CONTEXT_t vosContext ); |
| 294 | |
| 295 | /**--------------------------------------------------------------------------- |
| 296 | |
| 297 | \brief vos_get_context() - get context data area |
| 298 | |
| 299 | Each module in the system has a context / data area that is allocated |
| 300 | and maanged by voss. This API allows any user to get a pointer to its |
| 301 | allocated context data area from the VOSS global context. |
| 302 | |
| 303 | \param vosContext - the VOSS Global Context. |
| 304 | |
| 305 | \param moduleId - the module ID, who's context data are is being retrived. |
| 306 | |
| 307 | \return - pointer to the context data area. |
| 308 | |
| 309 | - NULL if the context data is not allocated for the module ID |
| 310 | specified |
| 311 | |
| 312 | --------------------------------------------------------------------------*/ |
| 313 | v_VOID_t *vos_get_context( VOS_MODULE_ID moduleId, |
| 314 | v_CONTEXT_t vosContext ); |
| 315 | |
| 316 | |
| 317 | /**--------------------------------------------------------------------------- |
| 318 | |
| 319 | \brief vos_get_global_context() - get VOSS global Context |
| 320 | |
| 321 | This API allows any user to get the VOS Global Context pointer from a |
| 322 | module context data area. |
| 323 | |
| 324 | \param moduleContext - the input module context pointer |
| 325 | |
| 326 | \param moduleId - the module ID who's context pointer is input in |
| 327 | moduleContext. |
| 328 | |
| 329 | \return - pointer to the VOSS global context |
| 330 | |
| 331 | - NULL if the function is unable to retreive the VOSS context. |
| 332 | |
| 333 | --------------------------------------------------------------------------*/ |
| 334 | v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId, |
| 335 | v_VOID_t *moduleContext ); |
| 336 | |
| 337 | v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext); |
| 338 | void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value); |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 339 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 340 | v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext); |
| 341 | void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value); |
| 342 | |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 343 | v_U8_t vos_is_reinit_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext); |
| 344 | void vos_set_reinit_in_progress(VOS_MODULE_ID moduleId, v_U8_t value); |
Mihir Shete | ccafc0c | 2015-04-17 16:13:15 +0530 | [diff] [blame] | 345 | VOS_STATUS vos_logger_pkt_serialize(vos_pkt_t *pPacket, uint32 pkt_type); |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 346 | bool vos_is_log_report_in_progress(void); |
| 347 | void vos_reset_log_report_in_progress(void); |
| 348 | int vos_set_log_completion(uint32 is_fatal, uint32 indicator, uint32 reason_code); |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 349 | void vos_get_log_and_reset_completion(uint32 *is_fatal, |
| 350 | uint32 *indicator, uint32 *reason_code, bool reset); |
| 351 | v_BOOL_t vos_isFatalEventEnabled(void); |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 352 | VOS_STATUS vos_fatal_event_logs_req( uint32_t is_fatal, uint32_t indicator, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 353 | uint32_t reason_code, bool wait_required, |
| 354 | bool dump_vos_trace); |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 355 | VOS_STATUS vos_process_done_indication(v_U8_t type, v_U32_t reason_code); |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 356 | void vos_flush_host_logs_for_fatal(void); |
| 357 | |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 358 | void vos_send_fatal_event_done(void); |
| 359 | |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 360 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 361 | /**--------------------------------------------------------------------------- |
| 362 | |
| 363 | \brief vos_alloc_context() - allocate a context within the VOSS global Context |
| 364 | |
| 365 | This API allows any user to allocate a user context area within the |
| 366 | VOS Global Context. |
| 367 | |
| 368 | \param pVosContext - pointer to the global Vos context |
| 369 | |
| 370 | \param moduleId - the module ID who's context area is being allocated. |
| 371 | |
| 372 | \param ppModuleContext - pointer to location where the pointer to the |
| 373 | allocated context is returned. Note this |
| 374 | output pointer is valid only if the API |
| 375 | returns VOS_STATUS_SUCCESS |
| 376 | |
| 377 | \param size - the size of the context area to be allocated. |
| 378 | |
| 379 | \return - VOS_STATUS_SUCCESS - the context for the module ID has been |
| 380 | allocated successfully. The pointer to the context area |
| 381 | can be found in *ppModuleContext. |
| 382 | \note This function returns VOS_STATUS_SUCCESS if the |
| 383 | module context was already allocated and the size |
| 384 | allocated matches the size on this call. |
| 385 | |
| 386 | VOS_STATUS_E_INVAL - the moduleId is not a valid or does |
| 387 | not identify a module that can have a context allocated. |
| 388 | |
| 389 | VOS_STATUS_E_EXISTS - vos could allocate the requested context |
| 390 | because a context for this module ID already exists and it is |
| 391 | a *different* size that specified on this call. |
| 392 | |
| 393 | VOS_STATUS_E_NOMEM - vos could not allocate memory for the |
| 394 | requested context area. |
| 395 | |
| 396 | \sa vos_get_context(), vos_free_context() |
| 397 | |
| 398 | --------------------------------------------------------------------------*/ |
| 399 | VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, |
| 400 | v_VOID_t **ppModuleContext, v_SIZE_t size ); |
| 401 | |
| 402 | |
| 403 | /**--------------------------------------------------------------------------- |
| 404 | |
| 405 | \brief vos_free_context() - free an allocated a context within the |
| 406 | VOSS global Context |
| 407 | |
| 408 | This API allows a user to free the user context area within the |
| 409 | VOS Global Context. |
| 410 | |
| 411 | \param pVosContext - pointer to the global Vos context |
| 412 | |
| 413 | \param moduleId - the module ID who's context area is being free |
| 414 | |
| 415 | \param pModuleContext - pointer to module context area to be free'd. |
| 416 | |
| 417 | \return - VOS_STATUS_SUCCESS - the context for the module ID has been |
| 418 | free'd. The pointer to the context area is not longer |
| 419 | available. |
| 420 | |
| 421 | VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not |
| 422 | valid pointers. |
| 423 | |
| 424 | VOS_STATUS_E_INVAL - the moduleId is not a valid or does |
| 425 | not identify a module that can have a context free'd. |
| 426 | |
| 427 | VOS_STATUS_E_EXISTS - vos could not free the requested |
| 428 | context area because a context for this module ID does not |
| 429 | exist in the global vos context. |
| 430 | |
| 431 | \sa vos_get_context() |
| 432 | |
| 433 | --------------------------------------------------------------------------*/ |
| 434 | VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, |
| 435 | v_VOID_t *pModuleContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 436 | v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 437 | |
| 438 | /** |
| 439 | @brief vos_wlanShutdown() - This API will shutdown WLAN driver |
| 440 | |
| 441 | This function is called when Riva subsystem crashes. There are two |
| 442 | methods (or operations) in WLAN driver to handle Riva crash, |
| 443 | 1. shutdown: Called when Riva goes down, this will shutdown WLAN |
| 444 | driver without handshaking with Riva. |
| 445 | 2. re-init: Next API |
| 446 | |
| 447 | @param |
| 448 | NONE |
| 449 | @return |
| 450 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 451 | VOS_STATUS_E_FAILURE - Operation failed. |
| 452 | |
| 453 | */ |
| 454 | VOS_STATUS vos_wlanShutdown(void); |
| 455 | |
| 456 | /** |
| 457 | @brief vos_wlanReInit() - This API will re-init WLAN driver |
| 458 | |
| 459 | This function is called when Riva subsystem reboots. There are two |
| 460 | methods (or operations) in WLAN driver to handle Riva crash, |
| 461 | 1. shutdown: Previous API |
| 462 | 2. re-init: Called when Riva comes back after the crash. This will |
| 463 | re-initialize WLAN driver. In some cases re-open may be |
| 464 | referred instead of re-init. |
| 465 | @param |
| 466 | NONE |
| 467 | @return |
| 468 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 469 | VOS_STATUS_E_FAILURE - Operation failed. |
| 470 | |
| 471 | */ |
| 472 | VOS_STATUS vos_wlanReInit(void); |
| 473 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 474 | /** |
| 475 | @brief vos_wlanRestart() - This API will reload WLAN driver. |
| 476 | |
| 477 | This function is called if driver detects any fatal state which |
| 478 | can be recovered by a WLAN module reload ( Android framwork initiated ). |
| 479 | Note that this API will not initiate any RIVA subsystem restart. |
| 480 | |
| 481 | @param |
Anurag Chouhan | f0d0ba1 | 2018-02-09 15:13:43 +0530 | [diff] [blame] | 482 | reason: vos_hang_reason |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 483 | @return |
| 484 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 485 | VOS_STATUS_E_FAILURE - Operation failed. |
| 486 | |
| 487 | */ |
Anurag Chouhan | f0d0ba1 | 2018-02-09 15:13:43 +0530 | [diff] [blame] | 488 | VOS_STATUS vos_wlanRestart(enum vos_hang_reason reason); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 489 | |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 490 | /** |
| 491 | @brief vos_fwDumpReq() |
| 492 | |
| 493 | This function is called to issue dump commands to Firmware |
| 494 | |
| 495 | @param |
Siddharth Bhal | 6811560 | 2015-01-18 20:44:55 +0530 | [diff] [blame] | 496 | cmd - Command No. to execute |
| 497 | arg1 - argument 1 to cmd |
| 498 | arg2 - argument 2 to cmd |
| 499 | arg3 - argument 3 to cmd |
| 500 | arg4 - argument 4 to cmd |
| 501 | async - asynchronous event. Don't wait for completion. |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 502 | @return |
| 503 | NONE |
| 504 | */ |
| 505 | v_VOID_t vos_fwDumpReq(tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2, |
Siddharth Bhal | 6811560 | 2015-01-18 20:44:55 +0530 | [diff] [blame] | 506 | tANI_U32 arg3, tANI_U32 arg4, tANI_U8 async); |
Dino Mycle | 3f783bc | 2014-08-08 17:40:22 +0530 | [diff] [blame] | 507 | |
Anand N Sunkad | 860e5ea | 2015-03-30 14:41:51 +0530 | [diff] [blame] | 508 | v_VOID_t vos_flush_work(struct work_struct *work); |
| 509 | v_VOID_t vos_flush_delayed_work(struct delayed_work *dwork); |
| 510 | |
Anand N Sunkad | dc63c79 | 2015-06-03 14:33:24 +0530 | [diff] [blame] | 511 | v_VOID_t vos_init_work(struct work_struct *work , void *callbackptr); |
| 512 | v_VOID_t vos_init_delayed_work(struct delayed_work *dwork , void *callbackptr); |
| 513 | |
Dino Mycle | 3f783bc | 2014-08-08 17:40:22 +0530 | [diff] [blame] | 514 | v_U64_t vos_get_monotonic_boottime(void); |
| 515 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 516 | VOS_STATUS vos_randomize_n_bytes(void *mac_addr, tANI_U32 n); |
| 517 | |
c_hpothu | 8adb97b | 2014-12-08 19:38:20 +0530 | [diff] [blame] | 518 | v_BOOL_t vos_is_wlan_in_badState(VOS_MODULE_ID moduleId, |
| 519 | v_VOID_t *moduleContext); |
Girish Gowli | a33f037 | 2015-01-19 15:39:04 +0530 | [diff] [blame] | 520 | v_VOID_t vos_set_roam_delay_stats_enabled(v_U8_t value); |
| 521 | v_U8_t vos_get_roam_delay_stats_enabled(v_VOID_t); |
Katya Nigam | a6fbf66 | 2015-03-17 18:35:47 +0530 | [diff] [blame] | 522 | v_U32_t vos_get_dxeReplenishRXTimerVal(void); |
| 523 | v_BOOL_t vos_get_dxeSSREnable(void); |
Mihir Shete | e2ae82a | 2015-03-16 14:08:49 +0530 | [diff] [blame] | 524 | |
| 525 | v_U8_t vos_is_fw_logging_enabled(void); |
Mihir Shete | be94ebb | 2015-05-26 12:07:14 +0530 | [diff] [blame] | 526 | v_U8_t vos_is_fw_ev_logging_enabled(void); |
Mihir Shete | e2ae82a | 2015-03-16 14:08:49 +0530 | [diff] [blame] | 527 | |
Mihir Shete | d627460 | 2015-04-28 16:13:21 +0530 | [diff] [blame] | 528 | v_U8_t vos_is_fw_logging_supported(void); |
Sushant Kaushik | 215778f | 2015-05-21 14:05:36 +0530 | [diff] [blame] | 529 | void vos_set_multicast_logging(uint8_t value); |
| 530 | v_U8_t vos_is_multicast_logging(void); |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 531 | void vos_set_ring_log_level(v_U32_t ring_id, v_U32_t log_level); |
| 532 | v_U8_t vos_get_ring_log_level(v_U32_t ring_id); |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 533 | void get_rate_and_MCS(per_packet_stats *stats, uint32 rateindex); |
| 534 | |
Hanumantha Reddy Pothula | 05b0b55 | 2015-06-18 14:26:10 +0530 | [diff] [blame] | 535 | v_BOOL_t vos_isUnloadInProgress(void); |
Abhishek Singh | 30fd58c | 2015-07-15 14:19:21 +0530 | [diff] [blame] | 536 | v_BOOL_t vos_isLoadUnloadInProgress(void); |
| 537 | |
Sravan Kumar Kairam | 1871d40 | 2016-08-04 13:18:25 +0530 | [diff] [blame] | 538 | bool vos_get_rx_wow_dump(void); |
| 539 | void vos_set_rx_wow_dump(bool value); |
| 540 | |
Sravan Kumar Kairam | b0edc61 | 2016-10-26 13:55:24 +0530 | [diff] [blame] | 541 | void vos_set_hdd_bad_sta(uint8_t sta_id); |
| 542 | void vos_reset_hdd_bad_sta(uint8_t sta_id); |
| 543 | |
Abhishek Singh | 880d712 | 2015-08-26 16:23:04 +0530 | [diff] [blame] | 544 | void vos_probe_threads(void); |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 545 | void vos_per_pkt_stats_to_user(void *perPktStat); |
| 546 | void vos_updatePktStatsInfo(void * pktStat); |
Manjeet Singh | 87a6eb7 | 2016-06-28 19:23:55 +0530 | [diff] [blame] | 547 | bool vos_is_wlan_logging_enabled(void); |
Rajeev Kumar Sirasanagandla | 63f85cf | 2016-06-29 16:52:15 +0530 | [diff] [blame] | 548 | |
| 549 | v_BOOL_t vos_is_probe_rsp_offload_enabled(void); |
Abhishek Singh | 8a3e4dc | 2017-01-02 10:39:18 +0530 | [diff] [blame] | 550 | void vos_set_snoc_high_freq_voting(bool enable); |
Arunk Khandavalli | af6c3af | 2017-01-16 11:44:46 +0530 | [diff] [blame] | 551 | void vos_smd_dump_stats(void); |
| 552 | void vos_log_wdi_event(uint16 msg, vos_wdi_trace_event_type event); |
| 553 | void vos_dump_wdi_events(void); |
Sravan Kumar Kairam | d9e8cbb | 2017-01-17 12:17:28 +0530 | [diff] [blame] | 554 | |
| 555 | bool vos_check_arp_target_ip(vos_pkt_t *pPacket); |
Asodi T,Venkateswara Reddy | 9826c87 | 2017-01-18 19:08:25 +0530 | [diff] [blame] | 556 | void vos_update_arp_fw_tx_delivered(void); |
| 557 | void vos_update_arp_rx_drop_reorder(void); |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 558 | v_U16_t vos_get_rate_from_rateidx(uint32 rateindex); |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 559 | |
| 560 | /** |
| 561 | * vos_check_monitor_state() - vos api to check monitor mode capture state |
| 562 | * |
| 563 | * This function is used to check whether capture of monitor mode is ON/OFF |
| 564 | * |
| 565 | * Return: TRUE - capture is ON, FALSE - capture is OFF |
| 566 | */ |
| 567 | v_BOOL_t vos_check_monitor_state(void); |
| 568 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 569 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) |
| 570 | static inline uint64_t __vos_get_log_timestamp(void) |
| 571 | { |
| 572 | return arch_counter_get_cntvct(); |
| 573 | } |
| 574 | #else |
| 575 | static inline uint64_t __vos_get_log_timestamp(void) |
| 576 | { |
| 577 | return arch_counter_get_cntpct(); |
| 578 | } |
| 579 | #endif /* LINUX_VERSION_CODE */ |
| 580 | |
Anurag Chouhan | f0d0ba1 | 2018-02-09 15:13:43 +0530 | [diff] [blame] | 581 | /** |
| 582 | * vos_get_recovery_reason() - get self recovery reason |
| 583 | * @reason: recovery reason |
| 584 | * |
| 585 | * Return: None |
| 586 | */ |
| 587 | void vos_get_recovery_reason(enum vos_hang_reason *reason); |
| 588 | |
| 589 | /** |
| 590 | * vos_reset_recovery_reason() - reset the reason to unspecified |
| 591 | * |
| 592 | * Return: None |
| 593 | */ |
| 594 | void vos_reset_recovery_reason(void); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 595 | #endif // if !defined __VOS_NVITEM_H |