Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved. |
| 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 | /**========================================================================= |
Jeff Johnson | 2f5cfec | 2013-02-22 21:25:10 -0800 | [diff] [blame] | 29 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 30 | \file vos_api.c |
| 31 | |
| 32 | \brief Stub file for all virtual Operating System Services (vOSS) APIs |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 33 | |
| 34 | ========================================================================*/ |
| 35 | /*=========================================================================== |
| 36 | |
| 37 | EDIT HISTORY FOR FILE |
| 38 | |
| 39 | |
| 40 | This section contains comments describing changes made to the module. |
| 41 | Notice that changes are listed in reverse chronological order. |
| 42 | |
| 43 | |
| 44 | $Header:$ $DateTime: $ $Author: $ |
| 45 | |
| 46 | |
| 47 | when who what, where, why |
| 48 | -------- --- -------------------------------------------------------- |
| 49 | 03/29/09 kanand Created module. |
| 50 | ===========================================================================*/ |
| 51 | |
| 52 | /*-------------------------------------------------------------------------- |
| 53 | Include Files |
| 54 | ------------------------------------------------------------------------*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | #include <vos_mq.h> |
| 56 | #include "vos_sched.h" |
| 57 | #include <vos_api.h> |
| 58 | #include "sirTypes.h" |
| 59 | #include "sirApi.h" |
| 60 | #include "sirMacProtDef.h" |
| 61 | #include "sme_Api.h" |
| 62 | #include "macInitApi.h" |
| 63 | #include "wlan_qct_sys.h" |
| 64 | #include "wlan_qct_tl.h" |
| 65 | #include "wlan_hdd_misc.h" |
| 66 | #include "i_vos_packet.h" |
| 67 | #include "vos_nvitem.h" |
| 68 | #include "wlan_qct_wda.h" |
| 69 | #include "wlan_hdd_main.h" |
| 70 | #include <linux/vmalloc.h> |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 71 | #include "wlan_hdd_cfg80211.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 72 | |
Dino Mycle | 3f783bc | 2014-08-08 17:40:22 +0530 | [diff] [blame] | 73 | #include <linux/wcnss_wlan.h> |
| 74 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 75 | #include "sapApi.h" |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 76 | #include "vos_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 77 | |
| 78 | |
| 79 | |
| 80 | #ifdef WLAN_BTAMP_FEATURE |
| 81 | #include "bapApi.h" |
| 82 | #include "bapInternal.h" |
| 83 | #include "bap_hdd_main.h" |
| 84 | #endif //WLAN_BTAMP_FEATURE |
| 85 | |
| 86 | |
| 87 | /*--------------------------------------------------------------------------- |
| 88 | * Preprocessor Definitions and Constants |
| 89 | * ------------------------------------------------------------------------*/ |
| 90 | /* Amount of time to wait for WDA to perform an asynchronous activity. |
| 91 | This value should be larger than the timeout used by WDI to wait for |
| 92 | a response from WCNSS since in the event that WCNSS is not responding, |
| 93 | WDI should handle that timeout */ |
| 94 | #define VOS_WDA_TIMEOUT 15000 |
| 95 | |
| 96 | /* Approximate amount of time to wait for WDA to stop WDI */ |
| 97 | #define VOS_WDA_STOP_TIMEOUT WDA_STOP_TIMEOUT |
| 98 | |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 99 | /* Approximate amount of time to wait for WDA to issue a DUMP req */ |
| 100 | #define VOS_WDA_RESP_TIMEOUT WDA_STOP_TIMEOUT |
| 101 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 102 | /*--------------------------------------------------------------------------- |
| 103 | * Data definitions |
| 104 | * ------------------------------------------------------------------------*/ |
| 105 | static VosContextType gVosContext; |
| 106 | static pVosContextType gpVosContext; |
| 107 | |
| 108 | /*--------------------------------------------------------------------------- |
| 109 | * Forward declaration |
| 110 | * ------------------------------------------------------------------------*/ |
| 111 | v_VOID_t vos_sys_probe_thread_cback ( v_VOID_t *pUserData ); |
| 112 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 113 | v_VOID_t vos_core_return_msg(v_PVOID_t pVContext, pVosMsgWrapper pMsgWrapper); |
| 114 | |
| 115 | v_VOID_t vos_fetch_tl_cfg_parms ( WLANTL_ConfigInfoType *pTLConfig, |
| 116 | hdd_config_t * pConfig ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 117 | |
| 118 | |
| 119 | /*--------------------------------------------------------------------------- |
| 120 | |
| 121 | \brief vos_preOpen() - PreOpen the vOSS Module |
| 122 | |
| 123 | The \a vos_preOpen() function allocates the Vos Context, but do not |
| 124 | initialize all the members. This overal initialization will happen |
| 125 | at vos_Open(). |
| 126 | The reason why we need vos_preOpen() is to get a minimum context |
| 127 | where to store BAL and SAL relative data, which happens before |
| 128 | vos_Open() is called. |
| 129 | |
| 130 | \param pVosContext: A pointer to where to store the VOS Context |
| 131 | |
| 132 | |
| 133 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 134 | is ready to be used. |
| 135 | |
| 136 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 137 | |
| 138 | \sa vos_Open() |
| 139 | |
| 140 | ---------------------------------------------------------------------------*/ |
| 141 | VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext ) |
| 142 | { |
| 143 | if ( pVosContext == NULL) |
| 144 | return VOS_STATUS_E_FAILURE; |
| 145 | |
| 146 | /* Allocate the VOS Context */ |
| 147 | *pVosContext = NULL; |
| 148 | gpVosContext = &gVosContext; |
| 149 | |
| 150 | if (NULL == gpVosContext) |
| 151 | { |
| 152 | /* Critical Error ...Cannot proceed further */ |
| 153 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 154 | "%s: Failed to allocate VOS Context", __func__); |
| 155 | VOS_ASSERT(0); |
| 156 | return VOS_STATUS_E_RESOURCES; |
| 157 | } |
| 158 | |
| 159 | vos_mem_zero(gpVosContext, sizeof(VosContextType)); |
| 160 | |
| 161 | *pVosContext = gpVosContext; |
| 162 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 163 | /* Initialize the spinlock */ |
| 164 | vos_trace_spin_lock_init(); |
| 165 | /* it is the right time to initialize MTRACE structures */ |
| 166 | #if defined(TRACE_RECORD) |
| 167 | vosTraceInit(); |
| 168 | #endif |
| 169 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 170 | return VOS_STATUS_SUCCESS; |
| 171 | |
| 172 | } /* vos_preOpen()*/ |
| 173 | |
| 174 | |
| 175 | /*--------------------------------------------------------------------------- |
| 176 | |
| 177 | \brief vos_preClose() - PreClose the vOSS Module |
| 178 | |
| 179 | The \a vos_preClose() function frees the Vos Context. |
| 180 | |
| 181 | \param pVosContext: A pointer to where the VOS Context was stored |
| 182 | |
| 183 | |
| 184 | \return VOS_STATUS_SUCCESS - Always successful |
| 185 | |
| 186 | |
| 187 | \sa vos_preClose() |
| 188 | \sa vos_close() |
| 189 | ---------------------------------------------------------------------------*/ |
| 190 | VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext ) |
| 191 | { |
| 192 | |
| 193 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 194 | "%s: De-allocating the VOS Context", __func__); |
| 195 | |
| 196 | if (( pVosContext == NULL) || (*pVosContext == NULL)) |
| 197 | { |
| 198 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 199 | "%s: vOS Context is Null", __func__); |
| 200 | return VOS_STATUS_E_FAILURE; |
| 201 | } |
| 202 | |
| 203 | if (gpVosContext != *pVosContext) |
| 204 | { |
| 205 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 206 | "%s: Context mismatch", __func__); |
| 207 | return VOS_STATUS_E_FAILURE; |
| 208 | } |
| 209 | |
| 210 | *pVosContext = gpVosContext = NULL; |
| 211 | |
| 212 | return VOS_STATUS_SUCCESS; |
| 213 | |
| 214 | } /* vos_preClose()*/ |
| 215 | |
| 216 | /*--------------------------------------------------------------------------- |
| 217 | |
| 218 | \brief vos_open() - Open the vOSS Module |
| 219 | |
| 220 | The \a vos_open() function opens the vOSS Scheduler |
| 221 | Upon successful initialization: |
| 222 | |
| 223 | - All VOS submodules should have been initialized |
| 224 | |
| 225 | - The VOS scheduler should have opened |
| 226 | |
| 227 | - All the WLAN SW components should have been opened. This includes |
| 228 | SYS, MAC, SME, WDA and TL. |
| 229 | |
| 230 | |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 231 | \param devHandle: pointer to the OS specific device handle |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 232 | |
| 233 | |
| 234 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 235 | is ready to be used. |
| 236 | |
| 237 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 238 | are unavailable to initilize the scheduler |
| 239 | |
| 240 | |
| 241 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 242 | |
| 243 | \sa vos_preOpen() |
| 244 | |
| 245 | ---------------------------------------------------------------------------*/ |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 246 | VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, void *devHandle ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 247 | |
| 248 | { |
| 249 | VOS_STATUS vStatus = VOS_STATUS_SUCCESS; |
| 250 | int iter = 0; |
| 251 | tSirRetStatus sirStatus = eSIR_SUCCESS; |
| 252 | tMacOpenParameters macOpenParms; |
| 253 | WLANTL_ConfigInfoType TLConfig; |
| 254 | |
| 255 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, |
| 256 | "%s: Opening VOSS", __func__); |
| 257 | |
| 258 | if (NULL == gpVosContext) |
| 259 | { |
| 260 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 261 | "%s: Trying to open VOSS without a PreOpen", __func__); |
| 262 | VOS_ASSERT(0); |
| 263 | return VOS_STATUS_E_FAILURE; |
| 264 | } |
| 265 | |
| 266 | /* Initialize the timer module */ |
| 267 | vos_timer_module_init(); |
| 268 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 269 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 270 | /* Initialize the probe event */ |
| 271 | if (vos_event_init(&gpVosContext->ProbeEvent) != VOS_STATUS_SUCCESS) |
| 272 | { |
| 273 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 274 | "%s: Unable to init probeEvent", __func__); |
| 275 | VOS_ASSERT(0); |
| 276 | return VOS_STATUS_E_FAILURE; |
| 277 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 278 | if (vos_event_init( &(gpVosContext->wdaCompleteEvent) ) != VOS_STATUS_SUCCESS ) |
| 279 | { |
| 280 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 281 | "%s: Unable to init wdaCompleteEvent", __func__); |
| 282 | VOS_ASSERT(0); |
| 283 | |
| 284 | goto err_probe_event; |
| 285 | } |
| 286 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 287 | /* Initialize the free message queue */ |
| 288 | vStatus = vos_mq_init(&gpVosContext->freeVosMq); |
| 289 | if (! VOS_IS_STATUS_SUCCESS(vStatus)) |
| 290 | { |
| 291 | |
| 292 | /* Critical Error ... Cannot proceed further */ |
| 293 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 294 | "%s: Failed to initialize VOS free message queue", __func__); |
| 295 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 296 | goto err_wda_complete_event; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | for (iter = 0; iter < VOS_CORE_MAX_MESSAGES; iter++) |
| 300 | { |
| 301 | (gpVosContext->aMsgWrappers[iter]).pVosMsg = |
| 302 | &(gpVosContext->aMsgBuffers[iter]); |
| 303 | INIT_LIST_HEAD(&gpVosContext->aMsgWrappers[iter].msgNode); |
| 304 | vos_mq_put(&gpVosContext->freeVosMq, &(gpVosContext->aMsgWrappers[iter])); |
| 305 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 306 | |
| 307 | /* Now Open the VOS Scheduler */ |
| 308 | vStatus= vos_sched_open(gpVosContext, &gpVosContext->vosSched, |
| 309 | sizeof(VosSchedContext)); |
| 310 | |
| 311 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 312 | { |
| 313 | /* Critical Error ... Cannot proceed further */ |
| 314 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 315 | "%s: Failed to open VOS Scheduler", __func__); |
| 316 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 317 | goto err_msg_queue; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 318 | } |
| 319 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 320 | /* |
| 321 | ** Need to open WDA first because it calls WDI_Init, which calls wpalOpen |
| 322 | ** The reason that is needed becasue vos_packet_open need to use PAL APIs |
| 323 | */ |
| 324 | |
| 325 | /*Open the WDA module */ |
| 326 | vos_mem_set(&macOpenParms, sizeof(macOpenParms), 0); |
| 327 | /* UMA is supported in hardware for performing the |
| 328 | ** frame translation 802.11 <-> 802.3 |
| 329 | */ |
| 330 | macOpenParms.frameTransRequired = 1; |
| 331 | macOpenParms.driverType = eDRIVER_TYPE_PRODUCTION; |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 332 | vStatus = WDA_open( gpVosContext, devHandle, &macOpenParms ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 333 | |
| 334 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 335 | { |
| 336 | /* Critical Error ... Cannot proceed further */ |
| 337 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 338 | "%s: Failed to open WDA module", __func__); |
| 339 | VOS_ASSERT(0); |
| 340 | goto err_sched_close; |
| 341 | } |
| 342 | |
| 343 | /* Initialize here the VOS Packet sub module */ |
| 344 | vStatus = vos_packet_open( gpVosContext, &gpVosContext->vosPacket, |
| 345 | sizeof( vos_pkt_context_t ) ); |
| 346 | |
| 347 | if ( !VOS_IS_STATUS_SUCCESS( vStatus ) ) |
| 348 | { |
| 349 | /* Critical Error ... Cannot proceed further */ |
| 350 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 351 | "%s: Failed to open VOS Packet Module", __func__); |
| 352 | VOS_ASSERT(0); |
| 353 | goto err_wda_close; |
| 354 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | |
| 356 | /* Open the SYS module */ |
| 357 | vStatus = sysOpen(gpVosContext); |
| 358 | |
| 359 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 360 | { |
| 361 | /* Critical Error ... Cannot proceed further */ |
| 362 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 363 | "%s: Failed to open SYS module", __func__); |
| 364 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 365 | goto err_packet_close; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 366 | } |
| 367 | |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 368 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 369 | /* initialize the NV module */ |
| 370 | vStatus = vos_nv_open(); |
| 371 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 372 | { |
| 373 | // NV module cannot be initialized |
| 374 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 375 | "%s: Failed to initialize the NV module", __func__); |
| 376 | goto err_sys_close; |
| 377 | } |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 378 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 379 | |
| 380 | /* If we arrive here, both threads dispacthing messages correctly */ |
| 381 | |
| 382 | /* Now proceed to open the MAC */ |
| 383 | |
| 384 | /* UMA is supported in hardware for performing the |
| 385 | frame translation 802.11 <-> 802.3 */ |
| 386 | macOpenParms.frameTransRequired = 1; |
| 387 | sirStatus = macOpen(&(gpVosContext->pMACContext), gpVosContext->pHDDContext, |
| 388 | &macOpenParms); |
| 389 | |
| 390 | if (eSIR_SUCCESS != sirStatus) |
| 391 | { |
| 392 | /* Critical Error ... Cannot proceed further */ |
| 393 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 394 | "%s: Failed to open MAC", __func__); |
| 395 | VOS_ASSERT(0); |
| 396 | goto err_nv_close; |
| 397 | } |
| 398 | |
| 399 | /* Now proceed to open the SME */ |
| 400 | vStatus = sme_Open(gpVosContext->pMACContext); |
| 401 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 402 | { |
| 403 | /* Critical Error ... Cannot proceed further */ |
| 404 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 405 | "%s: Failed to open SME", __func__); |
| 406 | VOS_ASSERT(0); |
| 407 | goto err_mac_close; |
| 408 | } |
| 409 | |
| 410 | /* Now proceed to open TL. Read TL config first */ |
| 411 | vos_fetch_tl_cfg_parms ( &TLConfig, |
| 412 | ((hdd_context_t*)(gpVosContext->pHDDContext))->cfg_ini); |
| 413 | |
| 414 | vStatus = WLANTL_Open(gpVosContext, &TLConfig); |
| 415 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 416 | { |
| 417 | /* Critical Error ... Cannot proceed further */ |
| 418 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 419 | "%s: Failed to open TL", __func__); |
| 420 | VOS_ASSERT(0); |
| 421 | goto err_sme_close; |
| 422 | } |
| 423 | |
| 424 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, |
| 425 | "%s: VOSS successfully Opened", __func__); |
| 426 | |
| 427 | *pVosContext = gpVosContext; |
| 428 | |
| 429 | return VOS_STATUS_SUCCESS; |
| 430 | |
| 431 | |
| 432 | err_sme_close: |
| 433 | sme_Close(gpVosContext->pMACContext); |
| 434 | |
| 435 | err_mac_close: |
| 436 | macClose(gpVosContext->pMACContext); |
| 437 | |
| 438 | err_nv_close: |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 439 | |
| 440 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 441 | vos_nv_close(); |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 442 | |
| 443 | err_sys_close: |
| 444 | #endif |
| 445 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 446 | sysClose(gpVosContext); |
| 447 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 448 | err_packet_close: |
| 449 | vos_packet_close( gpVosContext ); |
| 450 | |
| 451 | err_wda_close: |
| 452 | WDA_close(gpVosContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 453 | |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 454 | err_sched_close: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 455 | vos_sched_close(gpVosContext); |
| 456 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 457 | |
| 458 | err_msg_queue: |
| 459 | vos_mq_deinit(&gpVosContext->freeVosMq); |
| 460 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 461 | err_wda_complete_event: |
| 462 | vos_event_destroy( &gpVosContext->wdaCompleteEvent ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 463 | |
| 464 | err_probe_event: |
| 465 | vos_event_destroy(&gpVosContext->ProbeEvent); |
| 466 | |
| 467 | return VOS_STATUS_E_FAILURE; |
| 468 | |
| 469 | } /* vos_open() */ |
| 470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 471 | /*--------------------------------------------------------------------------- |
| 472 | |
| 473 | \brief vos_preStart() - |
| 474 | |
| 475 | The \a vos_preStart() function to download CFG. |
| 476 | including: |
| 477 | - ccmStart |
| 478 | |
| 479 | - WDA: triggers the CFG download |
| 480 | |
| 481 | |
| 482 | \param pVosContext: The VOS context |
| 483 | |
| 484 | |
| 485 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 486 | is ready to be used. |
| 487 | |
| 488 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 489 | are unavailable to initilize the scheduler |
| 490 | |
| 491 | |
| 492 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 493 | |
| 494 | \sa vos_start |
| 495 | |
| 496 | ---------------------------------------------------------------------------*/ |
| 497 | VOS_STATUS vos_preStart( v_CONTEXT_t vosContext ) |
| 498 | { |
| 499 | VOS_STATUS vStatus = VOS_STATUS_SUCCESS; |
| 500 | pVosContextType pVosContext = (pVosContextType)vosContext; |
| 501 | |
| 502 | VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, |
| 503 | "vos prestart"); |
| 504 | |
Manjunathappa Prakash | fb58546 | 2013-12-23 19:07:07 -0800 | [diff] [blame] | 505 | if (gpVosContext != pVosContext) |
| 506 | { |
| 507 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 508 | "%s: Context mismatch", __func__); |
| 509 | VOS_ASSERT(0); |
| 510 | return VOS_STATUS_E_INVAL; |
| 511 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 512 | |
Manjunathappa Prakash | fb58546 | 2013-12-23 19:07:07 -0800 | [diff] [blame] | 513 | if (pVosContext->pMACContext == NULL) |
| 514 | { |
| 515 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 516 | "%s: MAC NULL context", __func__); |
| 517 | VOS_ASSERT(0); |
| 518 | return VOS_STATUS_E_INVAL; |
| 519 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 520 | |
Manjunathappa Prakash | fb58546 | 2013-12-23 19:07:07 -0800 | [diff] [blame] | 521 | if (pVosContext->pWDAContext == NULL) |
| 522 | { |
| 523 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 524 | "%s: WDA NULL context", __func__); |
| 525 | VOS_ASSERT(0); |
| 526 | return VOS_STATUS_E_INVAL; |
| 527 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 528 | |
| 529 | /* call macPreStart */ |
| 530 | vStatus = macPreStart(gpVosContext->pMACContext); |
| 531 | if ( !VOS_IS_STATUS_SUCCESS(vStatus) ) |
| 532 | { |
| 533 | VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL, |
| 534 | "Failed at macPreStart "); |
| 535 | return VOS_STATUS_E_FAILURE; |
| 536 | } |
| 537 | |
| 538 | /* call ccmStart */ |
| 539 | ccmStart(gpVosContext->pMACContext); |
| 540 | |
| 541 | /* Reset wda wait event */ |
| 542 | vos_event_reset(&gpVosContext->wdaCompleteEvent); |
| 543 | |
| 544 | |
| 545 | /*call WDA pre start*/ |
| 546 | vStatus = WDA_preStart(gpVosContext); |
| 547 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 548 | { |
| 549 | VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL, |
| 550 | "Failed to WDA prestart"); |
| 551 | macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP); |
| 552 | ccmStop(gpVosContext->pMACContext); |
| 553 | VOS_ASSERT(0); |
| 554 | return VOS_STATUS_E_FAILURE; |
| 555 | } |
| 556 | |
| 557 | /* Need to update time out of complete */ |
| 558 | vStatus = vos_wait_single_event( &gpVosContext->wdaCompleteEvent, |
| 559 | VOS_WDA_TIMEOUT ); |
| 560 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 561 | { |
| 562 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 563 | { |
| 564 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 0288240 | 2013-11-17 21:55:29 -0800 | [diff] [blame] | 565 | "%s: Timeout occurred before WDA complete", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 566 | } |
| 567 | else |
| 568 | { |
| 569 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 570 | "%s: WDA_preStart reporting other error", __func__); |
| 571 | } |
Sameer Thalappil | 6d69cbd | 2013-06-27 13:07:15 -0700 | [diff] [blame] | 572 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 573 | "%s: Test MC thread by posting a probe message to SYS", __func__); |
| 574 | wlan_sys_probe(); |
| 575 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 576 | macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP); |
| 577 | ccmStop(gpVosContext->pMACContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 578 | VOS_ASSERT( 0 ); |
| 579 | return VOS_STATUS_E_FAILURE; |
| 580 | } |
| 581 | |
| 582 | return VOS_STATUS_SUCCESS; |
| 583 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 584 | |
| 585 | /*--------------------------------------------------------------------------- |
| 586 | |
| 587 | \brief vos_start() - Start the Libra SW Modules |
| 588 | |
| 589 | The \a vos_start() function starts all the components of the Libra SW |
| 590 | including: |
| 591 | - SAL/BAL, which in turn starts SSC |
| 592 | |
| 593 | - the MAC (HAL and PE) |
| 594 | |
| 595 | - SME |
| 596 | |
| 597 | - TL |
| 598 | |
| 599 | - SYS: triggers the CFG download |
| 600 | |
| 601 | |
| 602 | \param pVosContext: The VOS context |
| 603 | |
| 604 | |
| 605 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 606 | is ready to be used. |
| 607 | |
| 608 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 609 | are unavailable to initilize the scheduler |
| 610 | |
| 611 | |
| 612 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 613 | |
| 614 | \sa vos_preStart() |
| 615 | \sa vos_open() |
| 616 | |
| 617 | ---------------------------------------------------------------------------*/ |
| 618 | VOS_STATUS vos_start( v_CONTEXT_t vosContext ) |
| 619 | { |
| 620 | VOS_STATUS vStatus = VOS_STATUS_SUCCESS; |
| 621 | tSirRetStatus sirStatus = eSIR_SUCCESS; |
| 622 | pVosContextType pVosContext = (pVosContextType)vosContext; |
| 623 | tHalMacStartParameters halStartParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 624 | |
| 625 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 626 | "%s: Starting Libra SW", __func__); |
| 627 | |
| 628 | /* We support only one instance for now ...*/ |
| 629 | if (gpVosContext != pVosContext) |
| 630 | { |
| 631 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 632 | "%s: mismatch in context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 633 | return VOS_STATUS_E_FAILURE; |
| 634 | } |
| 635 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 636 | if (( pVosContext->pWDAContext == NULL) || ( pVosContext->pMACContext == NULL) |
| 637 | || ( pVosContext->pTLContext == NULL)) |
| 638 | { |
| 639 | if (pVosContext->pWDAContext == NULL) |
| 640 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 641 | "%s: WDA NULL context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 642 | else if (pVosContext->pMACContext == NULL) |
| 643 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 644 | "%s: MAC NULL context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 645 | else |
| 646 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 647 | "%s: TL NULL context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 648 | |
| 649 | return VOS_STATUS_E_FAILURE; |
| 650 | } |
| 651 | |
| 652 | /* WDA_Start will be called after NV image download because the |
| 653 | NV image data has to be updated at HAL before HAL_Start gets executed*/ |
| 654 | |
| 655 | /* Start the NV Image Download */ |
| 656 | |
| 657 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
| 658 | |
| 659 | vStatus = WDA_NVDownload_Start(pVosContext); |
| 660 | |
| 661 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 662 | { |
| 663 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 664 | "%s: Failed to start NV Download", __func__); |
| 665 | return VOS_STATUS_E_FAILURE; |
| 666 | } |
| 667 | |
| 668 | vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), |
| 669 | VOS_WDA_TIMEOUT ); |
| 670 | |
| 671 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 672 | { |
| 673 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 674 | { |
| 675 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 676 | "%s: Timeout occurred before WDA_NVDownload_start complete", __func__); |
| 677 | } |
| 678 | else |
| 679 | { |
| 680 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 681 | "%s: WDA_NVDownload_start reporting other error", __func__); |
| 682 | } |
| 683 | VOS_ASSERT(0); |
Madan Mohan Koyyalamudi | ec231f8 | 2012-11-28 16:01:28 -0800 | [diff] [blame] | 684 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
Sameer Thalappil | b511beb | 2013-09-09 17:11:51 -0700 | [diff] [blame] | 685 | if (vos_is_logp_in_progress(VOS_MODULE_ID_VOSS, NULL)) |
| 686 | { |
Pradeep Kumar Goudagunta | 22d8e4d | 2014-07-17 15:03:51 +0530 | [diff] [blame] | 687 | if (isSsrPanicOnFailure()) |
| 688 | VOS_BUG(0); |
Sameer Thalappil | b511beb | 2013-09-09 17:11:51 -0700 | [diff] [blame] | 689 | } |
Madan Mohan Koyyalamudi | ec231f8 | 2012-11-28 16:01:28 -0800 | [diff] [blame] | 690 | WDA_setNeedShutdown(vosContext); |
| 691 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 692 | } |
| 693 | |
| 694 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 695 | "%s: WDA_NVDownload_start correctly started", __func__); |
| 696 | |
| 697 | /* Start the WDA */ |
| 698 | vStatus = WDA_start(pVosContext); |
| 699 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 700 | { |
| 701 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Siddharth Bhal | bea38ad | 2014-10-12 14:10:52 +0530 | [diff] [blame] | 702 | "%s: Failed to start WDA - WDA_shutdown needed", __func__); |
| 703 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 704 | { |
| 705 | WDA_setNeedShutdown(vosContext); |
| 706 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 707 | return VOS_STATUS_E_FAILURE; |
| 708 | } |
| 709 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 710 | "%s: WDA correctly started", __func__); |
| 711 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 712 | /* Start the MAC */ |
| 713 | vos_mem_zero((v_PVOID_t)&halStartParams, sizeof(tHalMacStartParameters)); |
| 714 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 715 | /* Start the MAC */ |
| 716 | sirStatus = macStart(pVosContext->pMACContext,(v_PVOID_t)&halStartParams); |
| 717 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 718 | if (eSIR_SUCCESS != sirStatus) |
| 719 | { |
| 720 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 721 | "%s: Failed to start MAC", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 722 | goto err_wda_stop; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 723 | } |
| 724 | |
| 725 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 726 | "%s: MAC correctly started", __func__); |
| 727 | |
| 728 | /* START SME */ |
| 729 | vStatus = sme_Start(pVosContext->pMACContext); |
| 730 | |
| 731 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 732 | { |
| 733 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 734 | "%s: Failed to start SME", __func__); |
| 735 | goto err_mac_stop; |
| 736 | } |
| 737 | |
| 738 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 739 | "%s: SME correctly started", __func__); |
| 740 | |
| 741 | /** START TL */ |
| 742 | vStatus = WLANTL_Start(pVosContext); |
| 743 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 744 | { |
| 745 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 746 | "%s: Failed to start TL", __func__); |
| 747 | goto err_sme_stop; |
| 748 | } |
| 749 | |
| 750 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 751 | "TL correctly started"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 752 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 753 | "%s: VOSS Start is successful!!", __func__); |
| 754 | |
| 755 | return VOS_STATUS_SUCCESS; |
| 756 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 757 | |
| 758 | err_sme_stop: |
Kiet Lam | a72a232 | 2013-11-15 11:18:11 +0530 | [diff] [blame] | 759 | sme_Stop(pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 760 | |
| 761 | err_mac_stop: |
| 762 | macStop( pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET ); |
| 763 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | err_wda_stop: |
| 765 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 766 | vStatus = WDA_stop( pVosContext, HAL_STOP_TYPE_RF_KILL); |
| 767 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 768 | { |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 769 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 770 | "%s: Failed to stop WDA", __func__); |
| 771 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vStatus ) ); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 772 | WDA_setNeedShutdown(vosContext); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 773 | } |
| 774 | else |
| 775 | { |
| 776 | vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), |
| 777 | VOS_WDA_TIMEOUT ); |
| 778 | if( vStatus != VOS_STATUS_SUCCESS ) |
| 779 | { |
| 780 | if( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 781 | { |
| 782 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 783 | "%s: Timeout occurred before WDA_stop complete", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 784 | |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 785 | } |
| 786 | else |
| 787 | { |
| 788 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 789 | "%s: WDA_stop reporting other error", __func__); |
| 790 | } |
| 791 | VOS_ASSERT( 0 ); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 792 | WDA_setNeedShutdown(vosContext); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 793 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 794 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 795 | |
| 796 | return VOS_STATUS_E_FAILURE; |
| 797 | |
| 798 | } /* vos_start() */ |
| 799 | |
| 800 | |
| 801 | /* vos_stop function */ |
| 802 | VOS_STATUS vos_stop( v_CONTEXT_t vosContext ) |
| 803 | { |
| 804 | VOS_STATUS vosStatus; |
| 805 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 806 | /* WDA_Stop is called before the SYS so that the processing of Riva |
| 807 | pending responces will not be handled during uninitialization of WLAN driver */ |
| 808 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
| 809 | |
| 810 | vosStatus = WDA_stop( vosContext, HAL_STOP_TYPE_RF_KILL ); |
| 811 | |
| 812 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 813 | { |
| 814 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 815 | "%s: Failed to stop WDA", __func__); |
| 816 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 817 | WDA_setNeedShutdown(vosContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 818 | } |
Madan Mohan Koyyalamudi | a2fc641 | 2012-10-21 12:06:12 -0700 | [diff] [blame] | 819 | else |
| 820 | { |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 821 | vosStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), |
| 822 | VOS_WDA_STOP_TIMEOUT ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 823 | |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 824 | if ( vosStatus != VOS_STATUS_SUCCESS ) |
| 825 | { |
| 826 | if ( vosStatus == VOS_STATUS_E_TIMEOUT ) |
| 827 | { |
| 828 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 829 | "%s: Timeout occurred before WDA complete", __func__); |
| 830 | } |
| 831 | else |
| 832 | { |
| 833 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 834 | "%s: WDA_stop reporting other error", __func__ ); |
| 835 | } |
Sameer Thalappil | 6d69cbd | 2013-06-27 13:07:15 -0700 | [diff] [blame] | 836 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 837 | "%s: Test MC thread by posting a probe message to SYS", __func__); |
| 838 | wlan_sys_probe(); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 839 | WDA_setNeedShutdown(vosContext); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 840 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 841 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 842 | |
| 843 | /* SYS STOP will stop SME and MAC */ |
| 844 | vosStatus = sysStop( vosContext); |
| 845 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 846 | { |
| 847 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 848 | "%s: Failed to stop SYS", __func__); |
| 849 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 850 | } |
| 851 | |
| 852 | vosStatus = WLANTL_Stop( vosContext ); |
| 853 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 854 | { |
| 855 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 856 | "%s: Failed to stop TL", __func__); |
| 857 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 858 | } |
| 859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 860 | |
| 861 | return VOS_STATUS_SUCCESS; |
| 862 | } |
| 863 | |
| 864 | |
| 865 | /* vos_close function */ |
| 866 | VOS_STATUS vos_close( v_CONTEXT_t vosContext ) |
| 867 | { |
| 868 | VOS_STATUS vosStatus; |
| 869 | |
| 870 | #ifdef WLAN_BTAMP_FEATURE |
| 871 | vosStatus = WLANBAP_Close(vosContext); |
| 872 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 873 | { |
| 874 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 875 | "%s: Failed to close BAP", __func__); |
| 876 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 877 | } |
| 878 | #endif // WLAN_BTAMP_FEATURE |
| 879 | |
| 880 | |
| 881 | vosStatus = WLANTL_Close(vosContext); |
| 882 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 883 | { |
| 884 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 885 | "%s: Failed to close TL", __func__); |
| 886 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 887 | } |
| 888 | |
| 889 | vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext); |
| 890 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 891 | { |
| 892 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 893 | "%s: Failed to close SME", __func__); |
| 894 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 895 | } |
| 896 | |
| 897 | vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext); |
| 898 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 899 | { |
| 900 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 901 | "%s: Failed to close MAC", __func__); |
| 902 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 903 | } |
| 904 | |
| 905 | ((pVosContextType)vosContext)->pMACContext = NULL; |
| 906 | |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 907 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 908 | vosStatus = vos_nv_close(); |
| 909 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 910 | { |
| 911 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 912 | "%s: Failed to close NV", __func__); |
| 913 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 914 | } |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 915 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 916 | |
| 917 | vosStatus = sysClose( vosContext ); |
| 918 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 919 | { |
| 920 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 921 | "%s: Failed to close SYS", __func__); |
| 922 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 923 | } |
| 924 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 925 | if ( TRUE == WDA_needShutdown(vosContext )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 926 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 927 | /* if WDA stop failed, call WDA shutdown to cleanup WDA/WDI */ |
| 928 | vosStatus = WDA_shutdown( vosContext, VOS_TRUE ); |
| 929 | if (VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 930 | { |
Madan Mohan Koyyalamudi | b5da533 | 2012-10-15 17:23:21 -0700 | [diff] [blame] | 931 | hdd_set_ssr_required( HDD_SSR_REQUIRED ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 932 | } |
| 933 | else |
| 934 | { |
| 935 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 936 | "%s: Failed to shutdown WDA", __func__ ); |
| 937 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 938 | } |
| 939 | } |
| 940 | else |
| 941 | { |
| 942 | vosStatus = WDA_close( vosContext ); |
| 943 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 944 | { |
| 945 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 946 | "%s: Failed to close WDA", __func__); |
| 947 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 948 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 949 | } |
| 950 | |
| 951 | /* Let DXE return packets in WDA_close and then free them here */ |
| 952 | vosStatus = vos_packet_close( vosContext ); |
| 953 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 954 | { |
| 955 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 956 | "%s: Failed to close VOSS Packet", __func__); |
| 957 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 958 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 959 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 960 | |
| 961 | vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq); |
| 962 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 963 | vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent); |
| 964 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 965 | { |
| 966 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 967 | "%s: failed to destroy wdaCompleteEvent", __func__); |
| 968 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 969 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 970 | |
| 971 | vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent); |
| 972 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 973 | { |
| 974 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 975 | "%s: failed to destroy ProbeEvent", __func__); |
| 976 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 977 | } |
| 978 | |
| 979 | return VOS_STATUS_SUCCESS; |
| 980 | } |
| 981 | |
| 982 | |
| 983 | /**--------------------------------------------------------------------------- |
| 984 | |
| 985 | \brief vos_get_context() - get context data area |
| 986 | |
| 987 | Each module in the system has a context / data area that is allocated |
| 988 | and maanged by voss. This API allows any user to get a pointer to its |
| 989 | allocated context data area from the VOSS global context. |
| 990 | |
| 991 | \param vosContext - the VOSS Global Context. |
| 992 | |
| 993 | \param moduleId - the module ID, who's context data are is being retrived. |
| 994 | |
| 995 | \return - pointer to the context data area. |
| 996 | |
| 997 | - NULL if the context data is not allocated for the module ID |
| 998 | specified |
| 999 | |
| 1000 | --------------------------------------------------------------------------*/ |
| 1001 | v_VOID_t* vos_get_context( VOS_MODULE_ID moduleId, |
| 1002 | v_CONTEXT_t pVosContext ) |
| 1003 | { |
| 1004 | v_PVOID_t pModContext = NULL; |
| 1005 | |
| 1006 | if (pVosContext == NULL) |
| 1007 | { |
| 1008 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1009 | "%s: vos context pointer is null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1010 | return NULL; |
| 1011 | } |
| 1012 | |
| 1013 | if (gpVosContext != pVosContext) |
| 1014 | { |
| 1015 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1016 | "%s: pVosContext != gpVosContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1017 | return NULL; |
| 1018 | } |
| 1019 | |
| 1020 | switch(moduleId) |
| 1021 | { |
| 1022 | case VOS_MODULE_ID_TL: |
| 1023 | { |
| 1024 | pModContext = gpVosContext->pTLContext; |
| 1025 | break; |
| 1026 | } |
| 1027 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1028 | #ifdef WLAN_BTAMP_FEATURE |
| 1029 | case VOS_MODULE_ID_BAP: |
| 1030 | { |
| 1031 | pModContext = gpVosContext->pBAPContext; |
| 1032 | break; |
| 1033 | } |
| 1034 | #endif //WLAN_BTAMP_FEATURE |
| 1035 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1036 | case VOS_MODULE_ID_SAP: |
| 1037 | { |
| 1038 | pModContext = gpVosContext->pSAPContext; |
| 1039 | break; |
| 1040 | } |
| 1041 | |
| 1042 | case VOS_MODULE_ID_HDD_SOFTAP: |
| 1043 | { |
| 1044 | pModContext = gpVosContext->pHDDSoftAPContext; |
| 1045 | break; |
| 1046 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1047 | |
| 1048 | case VOS_MODULE_ID_HDD: |
| 1049 | { |
| 1050 | pModContext = gpVosContext->pHDDContext; |
| 1051 | break; |
| 1052 | } |
| 1053 | |
| 1054 | case VOS_MODULE_ID_SME: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1055 | case VOS_MODULE_ID_PE: |
Katya Nigam | 70d6833 | 2013-09-16 16:49:45 +0530 | [diff] [blame] | 1056 | case VOS_MODULE_ID_PMC: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1057 | { |
| 1058 | /* |
| 1059 | ** In all these cases, we just return the MAC Context |
| 1060 | */ |
| 1061 | pModContext = gpVosContext->pMACContext; |
| 1062 | break; |
| 1063 | } |
| 1064 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1065 | case VOS_MODULE_ID_WDA: |
| 1066 | { |
| 1067 | /* For WDA module */ |
| 1068 | pModContext = gpVosContext->pWDAContext; |
| 1069 | break; |
| 1070 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | |
| 1072 | case VOS_MODULE_ID_VOSS: |
| 1073 | { |
| 1074 | /* For SYS this is VOS itself*/ |
| 1075 | pModContext = gpVosContext; |
| 1076 | break; |
| 1077 | } |
| 1078 | |
| 1079 | default: |
| 1080 | { |
| 1081 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i " |
| 1082 | "does not have its context maintained by VOSS", __func__, moduleId); |
| 1083 | VOS_ASSERT(0); |
| 1084 | return NULL; |
| 1085 | } |
| 1086 | } |
| 1087 | |
| 1088 | if (pModContext == NULL ) |
| 1089 | { |
| 1090 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i " |
| 1091 | "context is Null", __func__, moduleId); |
| 1092 | } |
| 1093 | |
| 1094 | return pModContext; |
| 1095 | |
| 1096 | } /* vos_get_context()*/ |
| 1097 | |
| 1098 | |
| 1099 | /**--------------------------------------------------------------------------- |
| 1100 | |
| 1101 | \brief vos_get_global_context() - get VOSS global Context |
| 1102 | |
| 1103 | This API allows any user to get the VOS Global Context pointer from a |
| 1104 | module context data area. |
| 1105 | |
| 1106 | \param moduleContext - the input module context pointer |
| 1107 | |
| 1108 | \param moduleId - the module ID who's context pointer is input in |
| 1109 | moduleContext. |
| 1110 | |
| 1111 | \return - pointer to the VOSS global context |
| 1112 | |
| 1113 | - NULL if the function is unable to retreive the VOSS context. |
| 1114 | |
| 1115 | --------------------------------------------------------------------------*/ |
| 1116 | v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId, |
| 1117 | v_VOID_t *moduleContext ) |
| 1118 | { |
| 1119 | if (gpVosContext == NULL) |
| 1120 | { |
| 1121 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1122 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1123 | } |
| 1124 | |
| 1125 | return gpVosContext; |
| 1126 | |
| 1127 | } /* vos_get_global_context() */ |
| 1128 | |
| 1129 | |
| 1130 | v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext) |
| 1131 | { |
| 1132 | if (gpVosContext == NULL) |
| 1133 | { |
| 1134 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1135 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1136 | return 1; |
| 1137 | } |
| 1138 | |
| 1139 | return gpVosContext->isLogpInProgress; |
| 1140 | } |
| 1141 | |
| 1142 | void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value) |
| 1143 | { |
| 1144 | if (gpVosContext == NULL) |
| 1145 | { |
| 1146 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1147 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1148 | return; |
| 1149 | } |
| 1150 | |
| 1151 | gpVosContext->isLogpInProgress = value; |
| 1152 | } |
| 1153 | |
| 1154 | v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext) |
| 1155 | { |
| 1156 | if (gpVosContext == NULL) |
| 1157 | { |
| 1158 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1159 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1160 | return 0; |
| 1161 | } |
| 1162 | |
| 1163 | return gpVosContext->isLoadUnloadInProgress; |
| 1164 | } |
| 1165 | |
| 1166 | void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value) |
| 1167 | { |
| 1168 | if (gpVosContext == NULL) |
| 1169 | { |
| 1170 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1171 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1172 | return; |
| 1173 | } |
| 1174 | |
| 1175 | gpVosContext->isLoadUnloadInProgress = value; |
| 1176 | } |
| 1177 | |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 1178 | v_U8_t vos_is_reinit_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext) |
| 1179 | { |
| 1180 | if (gpVosContext == NULL) |
| 1181 | { |
| 1182 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1183 | "%s: global voss context is NULL", __func__); |
| 1184 | return 1; |
| 1185 | } |
| 1186 | |
| 1187 | return gpVosContext->isReInitInProgress; |
| 1188 | } |
| 1189 | |
| 1190 | void vos_set_reinit_in_progress(VOS_MODULE_ID moduleId, v_U8_t value) |
| 1191 | { |
| 1192 | if (gpVosContext == NULL) |
| 1193 | { |
| 1194 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1195 | "%s: global voss context is NULL", __func__); |
| 1196 | return; |
| 1197 | } |
| 1198 | |
| 1199 | gpVosContext->isReInitInProgress = value; |
| 1200 | } |
| 1201 | |
| 1202 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1203 | /**--------------------------------------------------------------------------- |
| 1204 | |
| 1205 | \brief vos_alloc_context() - allocate a context within the VOSS global Context |
| 1206 | |
| 1207 | This API allows any user to allocate a user context area within the |
| 1208 | VOS Global Context. |
| 1209 | |
| 1210 | \param pVosContext - pointer to the global Vos context |
| 1211 | |
| 1212 | \param moduleId - the module ID who's context area is being allocated. |
| 1213 | |
| 1214 | \param ppModuleContext - pointer to location where the pointer to the |
| 1215 | allocated context is returned. Note this |
| 1216 | output pointer is valid only if the API |
| 1217 | returns VOS_STATUS_SUCCESS |
| 1218 | |
| 1219 | \param size - the size of the context area to be allocated. |
| 1220 | |
| 1221 | \return - VOS_STATUS_SUCCESS - the context for the module ID has been |
| 1222 | allocated successfully. The pointer to the context area |
| 1223 | can be found in *ppModuleContext. |
| 1224 | \note This function returns VOS_STATUS_SUCCESS if the |
| 1225 | module context was already allocated and the size |
| 1226 | allocated matches the size on this call. |
| 1227 | |
| 1228 | VOS_STATUS_E_INVAL - the moduleId is not a valid or does |
| 1229 | not identify a module that can have a context allocated. |
| 1230 | |
| 1231 | VOS_STATUS_E_EXISTS - vos could allocate the requested context |
| 1232 | because a context for this module ID already exists and it is |
| 1233 | a *different* size that specified on this call. |
| 1234 | |
| 1235 | VOS_STATUS_E_NOMEM - vos could not allocate memory for the |
| 1236 | requested context area. |
| 1237 | |
| 1238 | \sa vos_get_context(), vos_free_context() |
| 1239 | |
| 1240 | --------------------------------------------------------------------------*/ |
| 1241 | VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, |
| 1242 | v_VOID_t **ppModuleContext, v_SIZE_t size ) |
| 1243 | { |
| 1244 | v_VOID_t ** pGpModContext = NULL; |
| 1245 | |
| 1246 | if ( pVosContext == NULL) { |
| 1247 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1248 | "%s: vos context is null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1249 | return VOS_STATUS_E_FAILURE; |
| 1250 | } |
| 1251 | |
| 1252 | if (( gpVosContext != pVosContext) || ( ppModuleContext == NULL)) { |
| 1253 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1254 | "%s: context mismatch or null param passed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1255 | return VOS_STATUS_E_FAILURE; |
| 1256 | } |
| 1257 | |
| 1258 | switch(moduleID) |
| 1259 | { |
| 1260 | case VOS_MODULE_ID_TL: |
| 1261 | { |
| 1262 | pGpModContext = &(gpVosContext->pTLContext); |
| 1263 | break; |
| 1264 | } |
| 1265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1266 | #ifdef WLAN_BTAMP_FEATURE |
| 1267 | case VOS_MODULE_ID_BAP: |
| 1268 | { |
| 1269 | pGpModContext = &(gpVosContext->pBAPContext); |
| 1270 | break; |
| 1271 | } |
| 1272 | #endif //WLAN_BTAMP_FEATURE |
| 1273 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1274 | case VOS_MODULE_ID_SAP: |
| 1275 | { |
| 1276 | pGpModContext = &(gpVosContext->pSAPContext); |
| 1277 | break; |
| 1278 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1279 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1280 | case VOS_MODULE_ID_WDA: |
| 1281 | { |
| 1282 | pGpModContext = &(gpVosContext->pWDAContext); |
| 1283 | break; |
| 1284 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1285 | case VOS_MODULE_ID_SME: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1286 | case VOS_MODULE_ID_PE: |
Katya Nigam | 70d6833 | 2013-09-16 16:49:45 +0530 | [diff] [blame] | 1287 | case VOS_MODULE_ID_PMC: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1288 | case VOS_MODULE_ID_HDD: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1289 | case VOS_MODULE_ID_HDD_SOFTAP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1290 | default: |
| 1291 | { |
| 1292 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i " |
| 1293 | "does not have its context allocated by VOSS", __func__, moduleID); |
| 1294 | VOS_ASSERT(0); |
| 1295 | return VOS_STATUS_E_INVAL; |
| 1296 | } |
| 1297 | } |
| 1298 | |
| 1299 | if ( NULL != *pGpModContext) |
| 1300 | { |
| 1301 | /* |
| 1302 | ** Context has already been allocated! |
| 1303 | ** Prevent double allocation |
| 1304 | */ |
| 1305 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1306 | "%s: Module ID %i context has already been allocated", |
| 1307 | __func__, moduleID); |
| 1308 | return VOS_STATUS_E_EXISTS; |
| 1309 | } |
| 1310 | |
| 1311 | /* |
| 1312 | ** Dynamically allocate the context for module |
| 1313 | */ |
| 1314 | |
| 1315 | *ppModuleContext = kmalloc(size, GFP_KERNEL); |
| 1316 | |
| 1317 | |
| 1318 | if ( *ppModuleContext == NULL) |
| 1319 | { |
| 1320 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Failed to " |
| 1321 | "allocate Context for module ID %i", __func__, moduleID); |
| 1322 | VOS_ASSERT(0); |
| 1323 | return VOS_STATUS_E_NOMEM; |
| 1324 | } |
| 1325 | |
| 1326 | if (moduleID==VOS_MODULE_ID_TL) |
| 1327 | { |
| 1328 | vos_mem_zero(*ppModuleContext, size); |
| 1329 | } |
| 1330 | |
| 1331 | *pGpModContext = *ppModuleContext; |
| 1332 | |
| 1333 | return VOS_STATUS_SUCCESS; |
| 1334 | |
| 1335 | } /* vos_alloc_context() */ |
| 1336 | |
| 1337 | |
| 1338 | /**--------------------------------------------------------------------------- |
| 1339 | |
| 1340 | \brief vos_free_context() - free an allocated a context within the |
| 1341 | VOSS global Context |
| 1342 | |
| 1343 | This API allows a user to free the user context area within the |
| 1344 | VOS Global Context. |
| 1345 | |
| 1346 | \param pVosContext - pointer to the global Vos context |
| 1347 | |
| 1348 | \param moduleId - the module ID who's context area is being free |
| 1349 | |
| 1350 | \param pModuleContext - pointer to module context area to be free'd. |
| 1351 | |
| 1352 | \return - VOS_STATUS_SUCCESS - the context for the module ID has been |
| 1353 | free'd. The pointer to the context area is not longer |
| 1354 | available. |
| 1355 | |
| 1356 | VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not |
| 1357 | valid pointers. |
| 1358 | |
| 1359 | VOS_STATUS_E_INVAL - the moduleId is not a valid or does |
| 1360 | not identify a module that can have a context free'd. |
| 1361 | |
| 1362 | VOS_STATUS_E_EXISTS - vos could not free the requested |
| 1363 | context area because a context for this module ID does not |
| 1364 | exist in the global vos context. |
| 1365 | |
| 1366 | \sa vos_get_context() |
| 1367 | |
| 1368 | --------------------------------------------------------------------------*/ |
| 1369 | VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, |
| 1370 | v_VOID_t *pModuleContext ) |
| 1371 | { |
| 1372 | v_VOID_t ** pGpModContext = NULL; |
| 1373 | |
| 1374 | if (( pVosContext == NULL) || ( gpVosContext != pVosContext) || |
| 1375 | ( pModuleContext == NULL)) |
| 1376 | { |
| 1377 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1378 | "%s: Null params or context mismatch", __func__); |
| 1379 | return VOS_STATUS_E_FAILURE; |
| 1380 | } |
| 1381 | |
| 1382 | |
| 1383 | switch(moduleID) |
| 1384 | { |
| 1385 | case VOS_MODULE_ID_TL: |
| 1386 | { |
| 1387 | pGpModContext = &(gpVosContext->pTLContext); |
| 1388 | break; |
| 1389 | } |
| 1390 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1391 | #ifdef WLAN_BTAMP_FEATURE |
| 1392 | case VOS_MODULE_ID_BAP: |
| 1393 | { |
| 1394 | pGpModContext = &(gpVosContext->pBAPContext); |
| 1395 | break; |
| 1396 | } |
| 1397 | #endif //WLAN_BTAMP_FEATURE |
| 1398 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1399 | case VOS_MODULE_ID_SAP: |
| 1400 | { |
| 1401 | pGpModContext = &(gpVosContext->pSAPContext); |
| 1402 | break; |
| 1403 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1404 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1405 | case VOS_MODULE_ID_WDA: |
| 1406 | { |
| 1407 | pGpModContext = &(gpVosContext->pWDAContext); |
| 1408 | break; |
| 1409 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1410 | case VOS_MODULE_ID_HDD: |
| 1411 | case VOS_MODULE_ID_SME: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1412 | case VOS_MODULE_ID_PE: |
Katya Nigam | 70d6833 | 2013-09-16 16:49:45 +0530 | [diff] [blame] | 1413 | case VOS_MODULE_ID_PMC: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1414 | case VOS_MODULE_ID_HDD_SOFTAP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1415 | default: |
| 1416 | { |
| 1417 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i " |
| 1418 | "does not have its context allocated by VOSS", __func__, moduleID); |
| 1419 | VOS_ASSERT(0); |
| 1420 | return VOS_STATUS_E_INVAL; |
| 1421 | } |
| 1422 | } |
| 1423 | |
| 1424 | if ( NULL == *pGpModContext) |
| 1425 | { |
| 1426 | /* |
| 1427 | ** Context has not been allocated or freed already! |
| 1428 | */ |
| 1429 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i " |
| 1430 | "context has not been allocated or freed already", __func__,moduleID); |
| 1431 | return VOS_STATUS_E_FAILURE; |
| 1432 | } |
| 1433 | |
| 1434 | if (*pGpModContext != pModuleContext) |
| 1435 | { |
| 1436 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1437 | "%s: pGpModContext != pModuleContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1438 | return VOS_STATUS_E_FAILURE; |
| 1439 | } |
| 1440 | |
| 1441 | if(pModuleContext != NULL) |
| 1442 | kfree(pModuleContext); |
| 1443 | |
| 1444 | *pGpModContext = NULL; |
| 1445 | |
| 1446 | return VOS_STATUS_SUCCESS; |
| 1447 | |
| 1448 | } /* vos_free_context() */ |
| 1449 | |
| 1450 | |
| 1451 | /**--------------------------------------------------------------------------- |
| 1452 | |
| 1453 | \brief vos_mq_post_message() - post a message to a message queue |
| 1454 | |
| 1455 | This API allows messages to be posted to a specific message queue. Messages |
| 1456 | can be posted to the following message queues: |
| 1457 | |
| 1458 | <ul> |
| 1459 | <li> SME |
| 1460 | <li> PE |
| 1461 | <li> HAL |
| 1462 | <li> TL |
| 1463 | </ul> |
| 1464 | |
| 1465 | \param msgQueueId - identifies the message queue upon which the message |
| 1466 | will be posted. |
| 1467 | |
| 1468 | \param message - a pointer to a message buffer. Memory for this message |
| 1469 | buffer is allocated by the caller and free'd by the vOSS after the |
| 1470 | message is posted to the message queue. If the consumer of the |
| 1471 | message needs anything in this message, it needs to copy the contents |
| 1472 | before returning from the message queue handler. |
| 1473 | |
| 1474 | \return VOS_STATUS_SUCCESS - the message has been successfully posted |
| 1475 | to the message queue. |
| 1476 | |
| 1477 | VOS_STATUS_E_INVAL - The value specified by msgQueueId does not |
| 1478 | refer to a valid Message Queue Id. |
| 1479 | |
| 1480 | VOS_STATUS_E_FAULT - message is an invalid pointer. |
| 1481 | |
| 1482 | VOS_STATUS_E_FAILURE - the message queue handler has reported |
| 1483 | an unknown failure. |
| 1484 | |
| 1485 | \sa |
| 1486 | |
| 1487 | --------------------------------------------------------------------------*/ |
| 1488 | VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg ) |
| 1489 | { |
| 1490 | pVosMqType pTargetMq = NULL; |
| 1491 | pVosMsgWrapper pMsgWrapper = NULL; |
| 1492 | |
| 1493 | if ((gpVosContext == NULL) || (pMsg == NULL)) |
| 1494 | { |
| 1495 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1496 | "%s: Null params or global vos context is null", __func__); |
| 1497 | VOS_ASSERT(0); |
| 1498 | return VOS_STATUS_E_FAILURE; |
| 1499 | } |
| 1500 | |
| 1501 | switch (msgQueueId) |
| 1502 | { |
| 1503 | /// Message Queue ID for messages bound for SME |
| 1504 | case VOS_MQ_ID_SME: |
| 1505 | { |
| 1506 | pTargetMq = &(gpVosContext->vosSched.smeMcMq); |
| 1507 | break; |
| 1508 | } |
| 1509 | |
| 1510 | /// Message Queue ID for messages bound for PE |
| 1511 | case VOS_MQ_ID_PE: |
| 1512 | { |
| 1513 | pTargetMq = &(gpVosContext->vosSched.peMcMq); |
| 1514 | break; |
| 1515 | } |
| 1516 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1517 | /// Message Queue ID for messages bound for WDA |
| 1518 | case VOS_MQ_ID_WDA: |
| 1519 | { |
| 1520 | pTargetMq = &(gpVosContext->vosSched.wdaMcMq); |
| 1521 | break; |
| 1522 | } |
| 1523 | |
| 1524 | /// Message Queue ID for messages bound for WDI |
| 1525 | case VOS_MQ_ID_WDI: |
| 1526 | { |
| 1527 | pTargetMq = &(gpVosContext->vosSched.wdiMcMq); |
| 1528 | break; |
| 1529 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1530 | |
| 1531 | /// Message Queue ID for messages bound for TL |
| 1532 | case VOS_MQ_ID_TL: |
| 1533 | { |
| 1534 | pTargetMq = &(gpVosContext->vosSched.tlMcMq); |
| 1535 | break; |
| 1536 | } |
| 1537 | |
| 1538 | /// Message Queue ID for messages bound for the SYS module |
| 1539 | case VOS_MQ_ID_SYS: |
| 1540 | { |
| 1541 | pTargetMq = &(gpVosContext->vosSched.sysMcMq); |
| 1542 | break; |
| 1543 | } |
| 1544 | |
| 1545 | default: |
| 1546 | |
| 1547 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1548 | ("%s: Trying to queue msg into unknown MC Msg queue ID %d"), |
| 1549 | __func__, msgQueueId); |
| 1550 | |
| 1551 | return VOS_STATUS_E_FAILURE; |
| 1552 | } |
| 1553 | |
| 1554 | VOS_ASSERT(NULL !=pTargetMq); |
| 1555 | if (pTargetMq == NULL) |
| 1556 | { |
| 1557 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1558 | "%s: pTargetMq == NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1559 | return VOS_STATUS_E_FAILURE; |
| 1560 | } |
| 1561 | |
| 1562 | /* |
| 1563 | ** Try and get a free Msg wrapper |
| 1564 | */ |
| 1565 | pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq); |
| 1566 | |
| 1567 | if (NULL == pMsgWrapper) |
| 1568 | { |
| 1569 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1570 | "%s: VOS Core run out of message wrapper", __func__); |
| 1571 | |
| 1572 | return VOS_STATUS_E_RESOURCES; |
| 1573 | } |
| 1574 | |
| 1575 | /* |
| 1576 | ** Copy the message now |
| 1577 | */ |
| 1578 | vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, |
| 1579 | (v_VOID_t*)pMsg, sizeof(vos_msg_t)); |
| 1580 | |
| 1581 | vos_mq_put(pTargetMq, pMsgWrapper); |
| 1582 | |
| 1583 | set_bit(MC_POST_EVENT_MASK, &gpVosContext->vosSched.mcEventFlag); |
| 1584 | wake_up_interruptible(&gpVosContext->vosSched.mcWaitQueue); |
| 1585 | |
| 1586 | return VOS_STATUS_SUCCESS; |
| 1587 | |
| 1588 | } /* vos_mq_post_message()*/ |
| 1589 | |
| 1590 | |
| 1591 | /**--------------------------------------------------------------------------- |
| 1592 | |
| 1593 | \brief vos_tx_mq_serialize() - serialize a message to the Tx execution flow |
| 1594 | |
| 1595 | This API allows messages to be posted to a specific message queue in the |
| 1596 | Tx excution flow. Messages for the Tx execution flow can be posted only |
| 1597 | to the following queue. |
| 1598 | |
| 1599 | <ul> |
| 1600 | <li> TL |
| 1601 | <li> SSC/WDI |
| 1602 | </ul> |
| 1603 | |
| 1604 | \param msgQueueId - identifies the message queue upon which the message |
| 1605 | will be posted. |
| 1606 | |
| 1607 | \param message - a pointer to a message buffer. Body memory for this message |
| 1608 | buffer is allocated by the caller and free'd by the vOSS after the |
| 1609 | message is dispacthed to the appropriate component. If the consumer |
| 1610 | of the message needs to keep anything in the body, it needs to copy |
| 1611 | the contents before returning from the message handler. |
| 1612 | |
| 1613 | \return VOS_STATUS_SUCCESS - the message has been successfully posted |
| 1614 | to the message queue. |
| 1615 | |
| 1616 | VOS_STATUS_E_INVAL - The value specified by msgQueueId does not |
| 1617 | refer to a valid Message Queue Id. |
| 1618 | |
| 1619 | VOS_STATUS_E_FAULT - message is an invalid pointer. |
| 1620 | |
| 1621 | VOS_STATUS_E_FAILURE - the message queue handler has reported |
| 1622 | an unknown failure. |
| 1623 | |
| 1624 | \sa |
| 1625 | |
| 1626 | --------------------------------------------------------------------------*/ |
| 1627 | VOS_STATUS vos_tx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg ) |
| 1628 | { |
| 1629 | pVosMqType pTargetMq = NULL; |
| 1630 | pVosMsgWrapper pMsgWrapper = NULL; |
| 1631 | |
| 1632 | if ((gpVosContext == NULL) || (pMsg == NULL)) |
| 1633 | { |
| 1634 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1635 | "%s: Null params or global vos context is null", __func__); |
| 1636 | VOS_ASSERT(0); |
| 1637 | return VOS_STATUS_E_FAILURE; |
| 1638 | } |
| 1639 | |
| 1640 | switch (msgQueueId) |
| 1641 | { |
| 1642 | /// Message Queue ID for messages bound for SME |
| 1643 | case VOS_MQ_ID_TL: |
| 1644 | { |
| 1645 | pTargetMq = &(gpVosContext->vosSched.tlTxMq); |
| 1646 | break; |
| 1647 | } |
| 1648 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1649 | /// Message Queue ID for messages bound for SSC |
| 1650 | case VOS_MQ_ID_WDI: |
| 1651 | { |
| 1652 | pTargetMq = &(gpVosContext->vosSched.wdiTxMq); |
| 1653 | break; |
| 1654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1655 | |
| 1656 | /// Message Queue ID for messages bound for the SYS module |
| 1657 | case VOS_MQ_ID_SYS: |
| 1658 | { |
| 1659 | pTargetMq = &(gpVosContext->vosSched.sysTxMq); |
| 1660 | break; |
| 1661 | } |
| 1662 | |
| 1663 | default: |
| 1664 | |
| 1665 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 1666 | "%s: Trying to queue msg into unknown Tx Msg queue ID %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1667 | __func__, msgQueueId); |
| 1668 | |
| 1669 | return VOS_STATUS_E_FAILURE; |
| 1670 | } |
| 1671 | |
| 1672 | if (pTargetMq == NULL) |
| 1673 | { |
| 1674 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1675 | "%s: pTargetMq == NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1676 | return VOS_STATUS_E_FAILURE; |
| 1677 | } |
| 1678 | |
| 1679 | |
| 1680 | /* |
| 1681 | ** Try and get a free Msg wrapper |
| 1682 | */ |
| 1683 | pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq); |
| 1684 | |
| 1685 | if (NULL == pMsgWrapper) |
| 1686 | { |
| 1687 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 1688 | "%s: VOS Core run out of message wrapper", __func__); |
| 1689 | |
| 1690 | return VOS_STATUS_E_RESOURCES; |
| 1691 | } |
| 1692 | |
| 1693 | /* |
| 1694 | ** Copy the message now |
| 1695 | */ |
| 1696 | vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, |
| 1697 | (v_VOID_t*)pMsg, sizeof(vos_msg_t)); |
| 1698 | |
| 1699 | vos_mq_put(pTargetMq, pMsgWrapper); |
| 1700 | |
| 1701 | set_bit(TX_POST_EVENT_MASK, &gpVosContext->vosSched.txEventFlag); |
| 1702 | wake_up_interruptible(&gpVosContext->vosSched.txWaitQueue); |
| 1703 | |
| 1704 | return VOS_STATUS_SUCCESS; |
| 1705 | |
| 1706 | } /* vos_tx_mq_serialize()*/ |
| 1707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1708 | /**--------------------------------------------------------------------------- |
| 1709 | |
| 1710 | \brief vos_rx_mq_serialize() - serialize a message to the Rx execution flow |
| 1711 | |
| 1712 | This API allows messages to be posted to a specific message queue in the |
| 1713 | Tx excution flow. Messages for the Rx execution flow can be posted only |
| 1714 | to the following queue. |
| 1715 | |
| 1716 | <ul> |
| 1717 | <li> TL |
| 1718 | <li> WDI |
| 1719 | </ul> |
| 1720 | |
| 1721 | \param msgQueueId - identifies the message queue upon which the message |
| 1722 | will be posted. |
| 1723 | |
| 1724 | \param message - a pointer to a message buffer. Body memory for this message |
| 1725 | buffer is allocated by the caller and free'd by the vOSS after the |
| 1726 | message is dispacthed to the appropriate component. If the consumer |
| 1727 | of the message needs to keep anything in the body, it needs to copy |
| 1728 | the contents before returning from the message handler. |
| 1729 | |
| 1730 | \return VOS_STATUS_SUCCESS - the message has been successfully posted |
| 1731 | to the message queue. |
| 1732 | |
| 1733 | VOS_STATUS_E_INVAL - The value specified by msgQueueId does not |
| 1734 | refer to a valid Message Queue Id. |
| 1735 | |
| 1736 | VOS_STATUS_E_FAULT - message is an invalid pointer. |
| 1737 | |
| 1738 | VOS_STATUS_E_FAILURE - the message queue handler has reported |
| 1739 | an unknown failure. |
| 1740 | |
| 1741 | \sa |
| 1742 | |
| 1743 | --------------------------------------------------------------------------*/ |
| 1744 | |
| 1745 | VOS_STATUS vos_rx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg ) |
| 1746 | { |
| 1747 | pVosMqType pTargetMq = NULL; |
| 1748 | pVosMsgWrapper pMsgWrapper = NULL; |
| 1749 | if ((gpVosContext == NULL) || (pMsg == NULL)) |
| 1750 | { |
| 1751 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1752 | "%s: Null params or global vos context is null", __func__); |
| 1753 | VOS_ASSERT(0); |
| 1754 | return VOS_STATUS_E_FAILURE; |
| 1755 | } |
| 1756 | |
| 1757 | switch (msgQueueId) |
| 1758 | { |
| 1759 | |
| 1760 | case VOS_MQ_ID_SYS: |
| 1761 | { |
| 1762 | pTargetMq = &(gpVosContext->vosSched.sysRxMq); |
| 1763 | break; |
| 1764 | } |
| 1765 | |
| 1766 | /// Message Queue ID for messages bound for WDI |
| 1767 | case VOS_MQ_ID_WDI: |
| 1768 | { |
| 1769 | pTargetMq = &(gpVosContext->vosSched.wdiRxMq); |
| 1770 | break; |
| 1771 | } |
Katya Nigam | 664f503 | 2014-05-05 12:24:32 +0530 | [diff] [blame] | 1772 | case VOS_MQ_ID_TL: |
| 1773 | { |
| 1774 | pTargetMq = &(gpVosContext->vosSched.tlRxMq); |
| 1775 | break; |
| 1776 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1777 | |
| 1778 | default: |
| 1779 | |
| 1780 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 1781 | "%s: Trying to queue msg into unknown Rx Msg queue ID %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1782 | __func__, msgQueueId); |
| 1783 | |
| 1784 | return VOS_STATUS_E_FAILURE; |
| 1785 | } |
| 1786 | |
| 1787 | if (pTargetMq == NULL) |
| 1788 | { |
| 1789 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1790 | "%s: pTargetMq == NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1791 | return VOS_STATUS_E_FAILURE; |
| 1792 | } |
| 1793 | |
| 1794 | |
| 1795 | /* |
| 1796 | ** Try and get a free Msg wrapper |
| 1797 | */ |
| 1798 | pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq); |
| 1799 | |
| 1800 | if (NULL == pMsgWrapper) |
| 1801 | { |
| 1802 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1803 | "%s: VOS Core run out of message wrapper", __func__); |
| 1804 | |
| 1805 | return VOS_STATUS_E_RESOURCES; |
| 1806 | } |
| 1807 | |
| 1808 | /* |
| 1809 | ** Copy the message now |
| 1810 | */ |
| 1811 | vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, |
| 1812 | (v_VOID_t*)pMsg, sizeof(vos_msg_t)); |
| 1813 | |
| 1814 | vos_mq_put(pTargetMq, pMsgWrapper); |
| 1815 | |
| 1816 | set_bit(RX_POST_EVENT_MASK, &gpVosContext->vosSched.rxEventFlag); |
| 1817 | wake_up_interruptible(&gpVosContext->vosSched.rxWaitQueue); |
| 1818 | |
| 1819 | return VOS_STATUS_SUCCESS; |
| 1820 | |
| 1821 | } /* vos_rx_mq_serialize()*/ |
| 1822 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1823 | v_VOID_t |
| 1824 | vos_sys_probe_thread_cback |
| 1825 | ( |
| 1826 | v_VOID_t *pUserData |
| 1827 | ) |
| 1828 | { |
| 1829 | if (gpVosContext != pUserData) |
| 1830 | { |
| 1831 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1832 | "%s: gpVosContext != pUserData", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1833 | return; |
| 1834 | } |
| 1835 | |
| 1836 | if (vos_event_set(&gpVosContext->ProbeEvent)!= VOS_STATUS_SUCCESS) |
| 1837 | { |
| 1838 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1839 | "%s: vos_event_set failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1840 | return; |
| 1841 | } |
| 1842 | |
| 1843 | } /* vos_sys_probe_thread_cback() */ |
| 1844 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1845 | v_VOID_t vos_WDAComplete_cback |
| 1846 | ( |
| 1847 | v_VOID_t *pUserData |
| 1848 | ) |
| 1849 | { |
| 1850 | |
| 1851 | if (gpVosContext != pUserData) |
| 1852 | { |
| 1853 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1854 | "%s: gpVosContext != pUserData", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1855 | return; |
| 1856 | } |
| 1857 | |
| 1858 | if (vos_event_set(&gpVosContext->wdaCompleteEvent)!= VOS_STATUS_SUCCESS) |
| 1859 | { |
| 1860 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1861 | "%s: vos_event_set failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1862 | return; |
| 1863 | } |
| 1864 | |
| 1865 | } /* vos_WDAComplete_cback() */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1866 | |
| 1867 | v_VOID_t vos_core_return_msg |
| 1868 | ( |
| 1869 | v_PVOID_t pVContext, |
| 1870 | pVosMsgWrapper pMsgWrapper |
| 1871 | ) |
| 1872 | { |
| 1873 | pVosContextType pVosContext = (pVosContextType) pVContext; |
| 1874 | |
| 1875 | VOS_ASSERT( gpVosContext == pVosContext); |
| 1876 | |
| 1877 | if (gpVosContext != pVosContext) |
| 1878 | { |
| 1879 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1880 | "%s: gpVosContext != pVosContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1881 | return; |
| 1882 | } |
| 1883 | |
| 1884 | VOS_ASSERT( NULL !=pMsgWrapper ); |
| 1885 | |
| 1886 | if (pMsgWrapper == NULL) |
| 1887 | { |
| 1888 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1889 | "%s: pMsgWrapper == NULL in function", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1890 | return; |
| 1891 | } |
| 1892 | |
| 1893 | /* |
| 1894 | ** Return the message on the free message queue |
| 1895 | */ |
| 1896 | INIT_LIST_HEAD(&pMsgWrapper->msgNode); |
| 1897 | vos_mq_put(&pVosContext->freeVosMq, pMsgWrapper); |
| 1898 | |
| 1899 | } /* vos_core_return_msg() */ |
| 1900 | |
| 1901 | |
| 1902 | /** |
| 1903 | @brief vos_fetch_tl_cfg_parms() - this function will attempt to read the |
| 1904 | TL config params from the registry |
| 1905 | |
| 1906 | @param pAdapter : [inout] pointer to TL config block |
| 1907 | |
| 1908 | @return |
| 1909 | None |
| 1910 | |
| 1911 | */ |
| 1912 | v_VOID_t |
| 1913 | vos_fetch_tl_cfg_parms |
| 1914 | ( |
| 1915 | WLANTL_ConfigInfoType *pTLConfig, |
| 1916 | hdd_config_t * pConfig |
| 1917 | ) |
| 1918 | { |
| 1919 | if (pTLConfig == NULL) |
| 1920 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1921 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s NULL ptr passed in!", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1922 | return; |
| 1923 | } |
| 1924 | |
| 1925 | pTLConfig->ucAcWeights[0] = pConfig->WfqBkWeight; |
| 1926 | pTLConfig->ucAcWeights[1] = pConfig->WfqBeWeight; |
| 1927 | pTLConfig->ucAcWeights[2] = pConfig->WfqViWeight; |
| 1928 | pTLConfig->ucAcWeights[3] = pConfig->WfqVoWeight; |
Dhanashri Atre | d8c20a3 | 2014-01-03 17:20:55 -0800 | [diff] [blame] | 1929 | pTLConfig->ucReorderAgingTime[0] = pConfig->BkReorderAgingTime;/*WLANTL_AC_BK*/ |
| 1930 | pTLConfig->ucReorderAgingTime[1] = pConfig->BeReorderAgingTime;/*WLANTL_AC_BE*/ |
| 1931 | pTLConfig->ucReorderAgingTime[2] = pConfig->ViReorderAgingTime;/*WLANTL_AC_VI*/ |
| 1932 | pTLConfig->ucReorderAgingTime[3] = pConfig->VoReorderAgingTime;/*WLANTL_AC_VO*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1933 | pTLConfig->uDelayedTriggerFrmInt = pConfig->DelayedTriggerFrmInt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1934 | pTLConfig->uMinFramesProcThres = pConfig->MinFramesProcThres; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1935 | |
| 1936 | } |
| 1937 | |
| 1938 | v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx) |
| 1939 | { |
| 1940 | return hdd_is_apps_power_collapse_allowed((hdd_context_t*) pHddCtx); |
| 1941 | } |
| 1942 | |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 1943 | void vos_abort_mac_scan(v_U8_t sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1944 | { |
| 1945 | hdd_context_t *pHddCtx = NULL; |
| 1946 | v_CONTEXT_t pVosContext = NULL; |
| 1947 | |
| 1948 | /* Get the Global VOSS Context */ |
| 1949 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 1950 | if(!pVosContext) { |
| 1951 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__); |
| 1952 | return; |
| 1953 | } |
| 1954 | |
| 1955 | /* Get the HDD context */ |
| 1956 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 1957 | if(!pHddCtx) { |
| 1958 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__); |
| 1959 | return; |
| 1960 | } |
| 1961 | |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 1962 | hdd_abort_mac_scan(pHddCtx, sessionId, eCSR_SCAN_ABORT_DEFAULT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1963 | return; |
| 1964 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1965 | /*--------------------------------------------------------------------------- |
| 1966 | |
| 1967 | \brief vos_shutdown() - shutdown VOS |
| 1968 | |
| 1969 | - All VOS submodules are closed. |
| 1970 | |
| 1971 | - All the WLAN SW components should have been opened. This includes |
| 1972 | SYS, MAC, SME and TL. |
| 1973 | |
| 1974 | |
| 1975 | \param vosContext: Global vos context |
| 1976 | |
| 1977 | |
| 1978 | \return VOS_STATUS_SUCCESS - Operation successfull & vos is shutdown |
| 1979 | |
| 1980 | VOS_STATUS_E_FAILURE - Failure to close |
| 1981 | |
| 1982 | ---------------------------------------------------------------------------*/ |
| 1983 | VOS_STATUS vos_shutdown(v_CONTEXT_t vosContext) |
| 1984 | { |
| 1985 | VOS_STATUS vosStatus; |
| 1986 | |
| 1987 | #ifdef WLAN_BTAMP_FEATURE |
| 1988 | vosStatus = WLANBAP_Close(vosContext); |
| 1989 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1990 | { |
| 1991 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1992 | "%s: Failed to close BAP", __func__); |
| 1993 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1994 | } |
| 1995 | #endif // WLAN_BTAMP_FEATURE |
| 1996 | |
| 1997 | vosStatus = WLANTL_Close(vosContext); |
| 1998 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1999 | { |
| 2000 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2001 | "%s: Failed to close TL", __func__); |
| 2002 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2003 | } |
| 2004 | |
| 2005 | vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext); |
| 2006 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2007 | { |
| 2008 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2009 | "%s: Failed to close SME", __func__); |
| 2010 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2011 | } |
| 2012 | |
| 2013 | vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext); |
| 2014 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2015 | { |
| 2016 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2017 | "%s: Failed to close MAC", __func__); |
| 2018 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2019 | } |
| 2020 | |
| 2021 | ((pVosContextType)vosContext)->pMACContext = NULL; |
| 2022 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2023 | vosStatus = sysClose( vosContext ); |
| 2024 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2025 | { |
| 2026 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2027 | "%s: Failed to close SYS", __func__); |
| 2028 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2029 | } |
| 2030 | |
| 2031 | /* Let DXE return packets in WDA_close and then free them here */ |
| 2032 | vosStatus = vos_packet_close( vosContext ); |
| 2033 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2034 | { |
| 2035 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2036 | "%s: Failed to close VOSS Packet", __func__); |
| 2037 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2038 | } |
| 2039 | |
| 2040 | vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq); |
| 2041 | |
| 2042 | vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent); |
| 2043 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2044 | { |
| 2045 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2046 | "%s: failed to destroy wdaCompleteEvent", __func__); |
| 2047 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2048 | } |
| 2049 | |
| 2050 | vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent); |
| 2051 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2052 | { |
| 2053 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2054 | "%s: failed to destroy ProbeEvent", __func__); |
| 2055 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2056 | } |
| 2057 | |
| 2058 | return VOS_STATUS_SUCCESS; |
| 2059 | } |
| 2060 | |
| 2061 | /*--------------------------------------------------------------------------- |
| 2062 | |
| 2063 | \brief vos_wda_shutdown() - VOS interface to wda shutdown |
| 2064 | |
| 2065 | - WDA/WDI shutdown |
| 2066 | |
| 2067 | \param vosContext: Global vos context |
| 2068 | |
| 2069 | |
| 2070 | \return VOS_STATUS_SUCCESS - Operation successfull |
| 2071 | |
| 2072 | VOS_STATUS_E_FAILURE - Failure to close |
| 2073 | |
| 2074 | ---------------------------------------------------------------------------*/ |
| 2075 | VOS_STATUS vos_wda_shutdown(v_CONTEXT_t vosContext) |
| 2076 | { |
| 2077 | VOS_STATUS vosStatus; |
| 2078 | vosStatus = WDA_shutdown(vosContext, VOS_FALSE); |
| 2079 | |
| 2080 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2081 | { |
| 2082 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2083 | "%s: failed to shutdown WDA", __func__); |
| 2084 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2085 | } |
| 2086 | return vosStatus; |
| 2087 | } |
| 2088 | /** |
| 2089 | @brief vos_wlanShutdown() - This API will shutdown WLAN driver |
| 2090 | |
| 2091 | This function is called when Riva subsystem crashes. There are two |
| 2092 | methods (or operations) in WLAN driver to handle Riva crash, |
| 2093 | 1. shutdown: Called when Riva goes down, this will shutdown WLAN |
| 2094 | driver without handshaking with Riva. |
| 2095 | 2. re-init: Next API |
| 2096 | @param |
| 2097 | NONE |
| 2098 | @return |
| 2099 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 2100 | VOS_STATUS_E_FAILURE - Operation failed. |
| 2101 | |
| 2102 | */ |
| 2103 | VOS_STATUS vos_wlanShutdown(void) |
| 2104 | { |
| 2105 | VOS_STATUS vstatus; |
| 2106 | vstatus = vos_watchdog_wlan_shutdown(); |
| 2107 | return vstatus; |
| 2108 | } |
| 2109 | /** |
| 2110 | @brief vos_wlanReInit() - This API will re-init WLAN driver |
| 2111 | |
| 2112 | This function is called when Riva subsystem reboots. There are two |
| 2113 | methods (or operations) in WLAN driver to handle Riva crash, |
| 2114 | 1. shutdown: Previous API |
| 2115 | 2. re-init: Called when Riva comes back after the crash. This will |
| 2116 | re-initialize WLAN driver. In some cases re-open may be |
| 2117 | referred instead of re-init. |
| 2118 | @param |
| 2119 | NONE |
| 2120 | @return |
| 2121 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 2122 | VOS_STATUS_E_FAILURE - Operation failed. |
| 2123 | |
| 2124 | */ |
| 2125 | VOS_STATUS vos_wlanReInit(void) |
| 2126 | { |
| 2127 | VOS_STATUS vstatus; |
| 2128 | vstatus = vos_watchdog_wlan_re_init(); |
| 2129 | return vstatus; |
| 2130 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2131 | /** |
| 2132 | @brief vos_wlanRestart() - This API will reload WLAN driver. |
| 2133 | |
| 2134 | This function is called if driver detects any fatal state which |
| 2135 | can be recovered by a WLAN module reload ( Android framwork initiated ). |
| 2136 | Note that this API will not initiate any RIVA subsystem restart. |
| 2137 | |
| 2138 | The function wlan_hdd_restart_driver protects against re-entrant calls. |
| 2139 | |
| 2140 | @param |
| 2141 | NONE |
| 2142 | @return |
| 2143 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 2144 | VOS_STATUS_E_FAILURE - Operation failed. |
| 2145 | VOS_STATUS_E_EMPTY - No configured interface |
| 2146 | VOS_STATUS_E_ALREADY - Request already in progress |
| 2147 | |
| 2148 | |
| 2149 | */ |
| 2150 | VOS_STATUS vos_wlanRestart(void) |
| 2151 | { |
| 2152 | VOS_STATUS vstatus; |
| 2153 | hdd_context_t *pHddCtx = NULL; |
| 2154 | v_CONTEXT_t pVosContext = NULL; |
| 2155 | |
| 2156 | /* Check whether driver load unload is in progress */ |
| 2157 | if(vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL)) |
| 2158 | { |
| 2159 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2160 | "%s: Driver load/unload is in progress, retry later.", __func__); |
| 2161 | return VOS_STATUS_E_AGAIN; |
| 2162 | } |
| 2163 | |
| 2164 | /* Get the Global VOSS Context */ |
| 2165 | pVosContext = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL); |
| 2166 | if(!pVosContext) { |
| 2167 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 2168 | "%s: Global VOS context is Null", __func__); |
| 2169 | return VOS_STATUS_E_FAILURE; |
| 2170 | } |
| 2171 | |
| 2172 | /* Get the HDD context */ |
| 2173 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 2174 | if(!pHddCtx) { |
| 2175 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 2176 | "%s: HDD context is Null", __func__); |
| 2177 | return VOS_STATUS_E_FAILURE; |
| 2178 | } |
| 2179 | |
| 2180 | /* Reload the driver */ |
| 2181 | vstatus = wlan_hdd_restart_driver(pHddCtx); |
| 2182 | return vstatus; |
| 2183 | } |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2184 | |
| 2185 | |
| 2186 | /** |
| 2187 | @brief vos_fwDumpReq() |
| 2188 | |
| 2189 | This function is called to issue dump commands to Firmware |
| 2190 | |
| 2191 | @param |
Siddharth Bhal | 6811560 | 2015-01-18 20:44:55 +0530 | [diff] [blame^] | 2192 | cmd - Command No. to execute |
| 2193 | arg1 - argument 1 to cmd |
| 2194 | arg2 - argument 2 to cmd |
| 2195 | arg3 - argument 3 to cmd |
| 2196 | arg4 - argument 4 to cmd |
| 2197 | async - asynchronous event. Don't wait for completion. |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2198 | @return |
| 2199 | NONE |
| 2200 | */ |
| 2201 | 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^] | 2202 | tANI_U32 arg3, tANI_U32 arg4, tANI_U8 async) |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2203 | { |
Siddharth Bhal | 6811560 | 2015-01-18 20:44:55 +0530 | [diff] [blame^] | 2204 | WDA_HALDumpCmdReq(NULL, cmd, arg1, arg2, arg3, arg4, NULL, 0); |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2205 | } |
Dino Mycle | 3f783bc | 2014-08-08 17:40:22 +0530 | [diff] [blame] | 2206 | |
| 2207 | v_U64_t vos_get_monotonic_boottime(void) |
| 2208 | { |
| 2209 | struct timespec ts; |
| 2210 | wcnss_get_monotonic_boottime(&ts); |
| 2211 | return (((v_U64_t)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000)); |
| 2212 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 2213 | |
| 2214 | /**--------------------------------------------------------------------------- |
| 2215 | |
| 2216 | \brief vos_randomize_n_bytes() - HDD Random Mac Addr Generator |
| 2217 | |
| 2218 | This generates the random mac address for WLAN interface |
| 2219 | |
| 2220 | \param - mac_addr - pointer to Mac address |
| 2221 | |
| 2222 | \return - 0 for success, < 0 for failure |
| 2223 | |
| 2224 | --------------------------------------------------------------------------*/ |
| 2225 | |
| 2226 | VOS_STATUS vos_randomize_n_bytes(void *start_addr, tANI_U32 n) |
| 2227 | { |
| 2228 | |
| 2229 | if (start_addr == NULL ) |
| 2230 | return VOS_STATUS_E_FAILURE; |
| 2231 | |
| 2232 | get_random_bytes( start_addr, n); |
| 2233 | |
| 2234 | return eHAL_STATUS_SUCCESS; |
| 2235 | } |
c_hpothu | 8adb97b | 2014-12-08 19:38:20 +0530 | [diff] [blame] | 2236 | |
| 2237 | /**--------------------------------------------------------------------------- |
| 2238 | |
| 2239 | \brief vos_is_wlan_in_badState() - get isFatalError flag from WD Ctx |
| 2240 | |
| 2241 | \param - VOS_MODULE_ID - module id |
| 2242 | - moduleContext - module context |
| 2243 | |
| 2244 | \return - isFatalError value if WDCtx is valid otherwise true |
| 2245 | |
| 2246 | --------------------------------------------------------------------------*/ |
| 2247 | v_BOOL_t vos_is_wlan_in_badState(VOS_MODULE_ID moduleId, |
| 2248 | v_VOID_t *moduleContext) |
| 2249 | { |
| 2250 | struct _VosWatchdogContext *pVosWDCtx = get_vos_watchdog_ctxt(); |
| 2251 | |
| 2252 | if (pVosWDCtx == NULL){ |
| 2253 | VOS_TRACE(moduleId, VOS_TRACE_LEVEL_ERROR, |
| 2254 | "%s: global wd context is null", __func__); |
| 2255 | |
| 2256 | return TRUE; |
| 2257 | } |
| 2258 | return pVosWDCtx->isFatalError; |
| 2259 | } |