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