VOS_STATUS vos_wlanRestart(void) { VOS_STATUS vstatus; hdd_context_t *pHddCtx = NULL; v_CONTEXT_t pVosContext = NULL; if(vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL)) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Driver load/unload is in progress, retry later.", __func__); return VOS_STATUS_E_AGAIN; } pVosContext = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL); if(!pVosContext) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__); return VOS_STATUS_E_FAILURE; } pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); if(!pHddCtx) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__); return VOS_STATUS_E_FAILURE; } vstatus = wlan_hdd_restart_driver(pHddCtx); return vstatus; }
// Caller of this function MUST dynamically allocate memory for pBuf // because this funciton will free the memory. eHalStatus palSendMBMessage(tHddHandle hHdd, void *pBuf) { eHalStatus halStatus = eHAL_STATUS_FAILURE; tSirRetStatus sirStatus; v_CONTEXT_t vosContext; v_VOID_t *hHal; vosContext = vos_get_global_context( VOS_MODULE_ID_HDD, hHdd ); if (NULL == vosContext) { VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR, "%s: invalid vosContext", __func__); } else { hHal = vos_get_context( VOS_MODULE_ID_SME, vosContext ); if (NULL == hHal) { VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR, "%s: invalid hHal", __func__); } else { sirStatus = uMacPostCtrlMsg( hHal, pBuf ); if ( eSIR_SUCCESS == sirStatus ) { halStatus = eHAL_STATUS_SUCCESS; } } } vos_mem_free( pBuf ); return( halStatus ); }
void *epping_get_adf_ctx(void) { VosContextType *pVosContext = NULL; adf_os_device_t *pAdfCtx; pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); pAdfCtx = vos_get_context(VOS_MODULE_ID_ADF, pVosContext); return pAdfCtx; }
void vos_event_report_payload(v_U16_t event_Id, v_U16_t length, v_VOID_t *pPayload) { tAniHdr *wmsg = NULL; v_U8_t *pBuf; struct hdd_context_s *pHddCtx; v_CONTEXT_t pVosContext= NULL; event_report_t *pEvent_report; v_U16_t total_len; /*Get the global context */ pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); /*Get the Hdd Context */ pHddCtx = ((VosContextType*)(pVosContext))->pHDDContext; /* Send the log data to the ptt app only if it is registered with the wlan driver*/ if(pHddCtx->ptt_pid != INVALID_PID) { total_len = sizeof(tAniHdr)+sizeof(event_report_t)+length; pBuf = (v_U8_t*)vos_mem_malloc(total_len); if(!pBuf) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "vos_mem_malloc failed"); return; } wmsg = (tAniHdr*)pBuf; wmsg->type = PTT_MSG_DIAG_CMDS_TYPE; wmsg->length = total_len; wmsg->length = DIAG_SWAP16(wmsg->length); pBuf += sizeof(tAniHdr); pEvent_report = (event_report_t*)pBuf; pEvent_report->diag_type = DIAG_TYPE_EVENTS; pEvent_report->event_id = event_Id; pEvent_report->length = length; pBuf += sizeof(event_report_t); memcpy(pBuf, pPayload,length); if( ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, pHddCtx->ptt_pid) < 0) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Ptt Socket error sending message to the app!!")); vos_mem_free((v_VOID_t*)wmsg); pHddCtx->ptt_pid = INVALID_PID; return; } vos_mem_free((v_VOID_t*)wmsg); } return; }
/*---------------------------------------------------------------------------- \brief vos_get_binary_blob() - get binary data from platform This API allows components to get binary data from the platform independent of where the data is stored on the device. <ul> <li> Firmware <li> Configuration Data \param binaryId - identifies the binary data to return to the caller. raw binary data and update the *pBufferSize with the exact size of the data that has been retreived. the size of the binary data in *pBufferSize. size of the data buffer available at pBuffer. Upon success, this retreived and written to the buffer at pBuffer. Input value of 0 is valid and will cause the API to return the size of the binary data in *pBufferSize. retreived and written to the buffer. refer to a valid VOS Binary ID. variable that the API can write to. *pBufferSize is not big enough to contain the binary. \sa --------------------------------------------------------------------------*/ VOS_STATUS vos_get_binary_blob( VOS_BINARY_ID binaryId, v_VOID_t *pBuffer, v_SIZE_t *pBufferSize ) { VOS_STATUS VosSts = VOS_STATUS_SUCCESS; char *pFileName; v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS,NULL); switch (binaryId) { case VOS_BINARY_ID_CONFIG: pFileName = WLAN_CFG_FILE; break; case VOS_BINARY_ID_COUNTRY_INFO: pFileName = WLAN_COUNTRY_INFO_FILE; break; case VOS_BINARY_ID_HO_CONFIG: pFileName = WLAN_HO_CFG_FILE; break; case VOS_BINARY_ID_DICT_CONFIG: pFileName = WLAN_DICT_FILE; break; default: VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "Invalid binaryID"); return VosSts; } if(0 == *pBufferSize ) { VosSts = hdd_get_cfg_file_size(((VosContextType*)(pVosContext))->pHDDContext,pFileName,pBufferSize); if ( !VOS_IS_STATUS_SUCCESS( VosSts )) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s : vos_open failed\n",__func__); return VOS_STATUS_E_FAILURE; } VosSts = VOS_STATUS_E_NOMEM; } else { if(NULL != pBuffer) { VosSts = hdd_read_cfg_file(((VosContextType*)(pVosContext))->pHDDContext,pFileName,pBuffer,pBufferSize); } else { VosSts = VOS_STATUS_E_FAILURE; } } return VosSts; }
/* --------------------------------------------------------- * FUNCTION: wdaGetGlobalSystemRole() * * Get the global HAL system role. * --------------------------------------------------------- */ tBssSystemRole wdaGetGlobalSystemRole(tpAniSirGlobal pMac) { v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_WDA, NULL); tWDA_CbContext *wdaContext = vos_get_context(VOS_MODULE_ID_WDA, pVosContext); if(NULL == wdaContext) { VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, "%s:WDA context is NULL", __func__); VOS_ASSERT(0); return eSYSTEM_UNKNOWN_ROLE; } return wdaContext->wdaGlobalSystemRole; }
VOS_STATUS vos_get_fwbinary( v_VOID_t **ppBinary, v_SIZE_t *pNumBytes ) { v_CONTEXT_t pVosContext; VOS_STATUS status = VOS_STATUS_SUCCESS; pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS,NULL); if(pVosContext) { status = hdd_request_firmware(WLAN_FW_FILE,((VosContextType*)(pVosContext))->pHDDContext,ppBinary,pNumBytes); } return status; }
void vos_clear_concurrent_session_count(void) { v_U8_t i = 0; hdd_context_t *pHddCtx; v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL); if (NULL != pVosContext) { pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext); if (NULL != pHddCtx) { for (i = 0; i < VOS_MAX_NO_OF_MODE; i++) pHddCtx->no_of_active_sessions[i] = 0; } } }
static void epping_target_suspend_acknowledge(void *context) { void *vos_context = vos_get_global_context(VOS_MODULE_ID_WDA, NULL); epping_context_t *pEpping_ctx = vos_get_context(VOS_MODULE_ID_HDD, vos_context); int wow_nack = *((int *)context); if (NULL == pEpping_ctx) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: epping_ctx is NULL", __func__); return; } /* EPPING_TODO: do we need wow_nack? */ pEpping_ctx->wow_nack = wow_nack; }
/**--------------------------------------------------------------------------- * * \brief vos_is_multiple_active_sta_sessions() * * This function checks for presence of multiple active sta connections * and it returns TRUE if the more than 1 active sta connection exists. * * \param - None * * \return - TRUE or FALSE * * --------------------------------------------------------------------------*/ v_BOOL_t vos_is_multiple_active_sta_sessions (void) { hdd_context_t *pHddCtx; v_U8_t j = 0; v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL); if (NULL != pVosContext) { pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext); if (NULL != pHddCtx) { j = pHddCtx->no_of_active_sessions[VOS_STA_MODE]; } } return (j > 1); }
/**--------------------------------------------------------------------------- * * \brief vos_is_sta_active_connection_exists() * * This function checks for the presence of active sta connection * and it returns TRUE if exists. * * \param - None * * \return - VOS_TRUE or VOS_FALSE * * --------------------------------------------------------------------------*/ v_BOOL_t vos_is_sta_active_connection_exists (void) { hdd_context_t *pHddCtx; v_U8_t j = 0; v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL); if (NULL != pVosContext) { pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext); if (NULL != pHddCtx) { j = pHddCtx->no_of_active_sessions[VOS_STA_MODE]; } } return (j ? VOS_TRUE : VOS_FALSE); }
/* --------------------------------------------------------- * FUNCTION: wdaGetGlobalSystemRole() * * Get the global HAL system role. * --------------------------------------------------------- */ tBssSystemRole wdaGetGlobalSystemRole(tpAniSirGlobal pMac) { v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_WDA, NULL); tWDA_CbContext *wdaContext = vos_get_context(VOS_MODULE_ID_WDA, pVosContext); if(NULL == wdaContext) { VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, "%s:WDA context is NULL", __FUNCTION__); VOS_ASSERT(0); return eSYSTEM_UNKNOWN_ROLE; } WDALOG1( wdaLog(pMac, LOG1, FL(" returning %d role\n"), wdaContext->wdaGlobalSystemRole)); return wdaContext->wdaGlobalSystemRole; }
void regdmn_set_regval(struct regulatory *reg) { void *vos_context = vos_get_global_context(VOS_MODULE_ID_WDA, NULL); tp_wma_handle wma = vos_get_context(VOS_MODULE_ID_WDA, vos_context); u_int32_t modeSelect = 0xFFFFFFFF; if (!wma) { WMA_LOGE("%s: Unable to get WMA handle", __func__); return; } wma_get_modeselect(wma, &modeSelect); regdmn_get_ctl_info(reg, wma->reg_cap.wireless_modes, modeSelect); return; }
/** * hdd_state_info_dump() - prints state information of hdd layer */ static void hdd_state_info_dump(void) { v_CONTEXT_t vos_ctx_ptr; hdd_context_t *hdd_ctx_ptr = NULL; hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; VOS_STATUS status; hdd_station_ctx_t *hdd_sta_ctx = NULL; hdd_adapter_t *adapter =NULL; /* get the global voss context */ vos_ctx_ptr = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL); if (NULL != vos_ctx_ptr) { hdd_ctx_ptr = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx_ptr); } else { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Invalid Global VOSS Context", __func__); VOS_ASSERT(0); return; } hddLog(LOG1, FL("mScanPending %d isWlanSuspended %d disable_dfs_flag %d"), hdd_ctx_ptr->scan_info.mScanPending, hdd_ctx_ptr->isWlanSuspended, hdd_ctx_ptr->disable_dfs_flag); status = hdd_get_front_adapter(hdd_ctx_ptr, &adapter_node); while (NULL != adapter_node && VOS_STATUS_SUCCESS == status) { adapter = adapter_node->pAdapter; if (adapter->dev) hddLog(LOG1, FL("device name: %s"), adapter->dev->name); switch (adapter->device_mode) { case WLAN_HDD_INFRA_STATION: case WLAN_HDD_P2P_CLIENT: hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); hddLog(LOG1, FL("connState: %d device_mode: %d"), hdd_sta_ctx->conn_info.connState, adapter->device_mode); break; default: break; } status = hdd_get_next_adapter(hdd_ctx_ptr, adapter_node, &next); adapter_node = next; } }
v_BOOL_t vos_concurrent_sap_sessions_running(v_VOID_t) { v_U8_t i=0; hdd_context_t *pHddCtx; v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); if (NULL != pVosContext) { pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); if (NULL != pHddCtx) { i = pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]; } } return (i>1); }
/* --------------------------------------------------------- * FUNCTION: WMAGetGlobalSystemRole() * * Get the global HAL system role. * --------------------------------------------------------- */ tBssSystemRole WMAGetGlobalSystemRole(tpAniSirGlobal pMac) { v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_WMA, NULL); t_wma_handle *wmaContext = vos_get_context(VOS_MODULE_ID_WMA, pVosContext); if(NULL == wmaContext) { VOS_TRACE( VOS_MODULE_ID_WMA, VOS_TRACE_LEVEL_ERROR, "%s:WMA context is NULL", __func__); VOS_ASSERT(0); return eSYSTEM_UNKNOWN_ROLE; } #ifdef FEATURE_WLAN_INTEGRATED_SOC WMA_LOGD(" returning %d role\n",wmaContext->wmaGlobalSystemRole); #endif /* #ifdef FEATURE_WLAN_INTEGRATED_SOC */ return wmaContext->wmaGlobalSystemRole; }
/*---------------------------------------------------------------------------- \brief vos_get_binary_blob() - get binary data from platform This API allows components to get binary data from the platform independent of where the data is stored on the device. <ul> <li> Firmware <li> Configuration Data \param binaryId - identifies the binary data to return to the caller. raw binary data and update the *pBufferSize with the exact size of the data that has been retreived. the size of the binary data in *pBufferSize. size of the data buffer available at pBuffer. Upon success, this retreived and written to the buffer at pBuffer. Input value of 0 is valid and will cause the API to return the size of the binary data in *pBufferSize. retreived and written to the buffer. refer to a valid VOS Binary ID. variable that the API can write to. *pBufferSize is not big enough to contain the binary. \sa --------------------------------------------------------------------------*/ VOS_STATUS vos_get_binary_blob( VOS_BINARY_ID binaryId, v_VOID_t *pBuffer, v_SIZE_t *pBufferSize ) { VOS_STATUS VosSts = VOS_STATUS_SUCCESS; char *pFileName; v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS,NULL); // get the correct file name from binary Id switch (binaryId) { case VOS_BINARY_ID_CONFIG: pFileName = WLAN_CFG_FILE; break; default: VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "Invalid binaryID"); return VosSts; } if(0 == *pBufferSize ) { /* just a file size request. set the value and return VOS_STATUS_E_NOMEM*/ VosSts = hdd_get_cfg_file_size(((VosContextType*)(pVosContext))->pHDDContext,pFileName,pBufferSize); if ( !VOS_IS_STATUS_SUCCESS( VosSts )) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s : vos_open failed",__func__); return VOS_STATUS_E_FAILURE; } VosSts = VOS_STATUS_E_NOMEM; } else { if(NULL != pBuffer) { // read the contents into the buffer VosSts = hdd_read_cfg_file(((VosContextType*)(pVosContext))->pHDDContext,pFileName,pBuffer,pBufferSize); } else { VosSts = VOS_STATUS_E_FAILURE; } } return VosSts; }
/**--------------------------------------------------------------------------- * * \brief vos_max_concurrent_connections_reached() * * This function checks for presence of concurrency where more than * one connection exists and it returns TRUE if the max concurrency is * reached. * * Example: * STA + STA (wlan0 and wlan1 are connected) - returns TRUE * STA + STA (wlan0 connected and wlan1 disconnected) - returns FALSE * DUT with P2P-GO + P2P-CLIENT connection) - returns TRUE * * \param - None * * \return - VOS_TRUE or VOS_FALSE * * --------------------------------------------------------------------------*/ v_BOOL_t vos_max_concurrent_connections_reached (void) { v_U8_t i = 0, j = 0; hdd_context_t *pHddCtx; v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL); if (NULL != pVosContext) { pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext); if (NULL != pHddCtx) { for (i = 0; i < VOS_MAX_NO_OF_MODE; i++) j += pHddCtx->no_of_active_sessions[i]; return (j > (pHddCtx->cfg_ini->gMaxConcurrentActiveSessions - 1)); } } return VOS_FALSE; }
v_BOOL_t vos_concurrent_open_sessions_running(void) { v_U8_t i=0; v_U8_t j=0; hdd_context_t *pHddCtx; v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); if (NULL != pVosContext) { pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); if (NULL != pHddCtx) { for (i=0; i < VOS_MAX_NO_OF_MODE; i++) { j += pHddCtx->no_of_open_sessions[i]; } } } return (j>1); }
void vos_abort_mac_scan(void) { hdd_context_t *pHddCtx = NULL; v_CONTEXT_t pVosContext = NULL; pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); if(!pVosContext) { hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__); return; } pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); if(!pHddCtx) { hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__); return; } hdd_abort_mac_scan(pHddCtx, eCSR_SCAN_ABORT_DEFAULT); return; }
static int hif_usb_suspend(struct usb_interface *interface, pm_message_t state) { HIF_DEVICE_USB *device = usb_get_intfdata(interface); struct hif_usb_softc *sc = device->sc; void *vos = vos_get_global_context(VOS_MODULE_ID_HIF, NULL); v_VOID_t * temp_module; if (vos == NULL) return 0; /* No need to send WMI_PDEV_SUSPEND_CMDID to FW if WOW is enabled */ temp_module = vos_get_context(VOS_MODULE_ID_WDA, vos); if (!temp_module) { printk("%s: WDA module is NULL\n", __func__); return (-1); } if (wma_check_scan_in_progress(temp_module)) { printk("%s: Scan in progress. Aborting suspend\n", __func__); return (-1); } sc->local_state = state; /* No need to send WMI_PDEV_SUSPEND_CMDID to FW if WOW is enabled */ if (wma_is_wow_mode_selected(temp_module)) { if (wma_enable_wow_in_fw(temp_module, 0)) { pr_warn("%s[%d]: fail\n", __func__, __LINE__); return -1; } } else if ((PM_EVENT_FREEZE & state.event) == PM_EVENT_FREEZE || (PM_EVENT_SUSPEND & state.event) == PM_EVENT_SUSPEND || (PM_EVENT_HIBERNATE & state.event) == PM_EVENT_HIBERNATE) { if (wma_suspend_target (vos_get_context(VOS_MODULE_ID_WDA, vos), 0)) { pr_warn("%s[%d]: fail\n", __func__, __LINE__); return -1; } } usb_hif_flush_all(device); return 0; }
static int hif_usb_resume(struct usb_interface *interface) { HIF_DEVICE_USB *device = usb_get_intfdata(interface); struct hif_usb_softc *sc = device->sc; void *vos = vos_get_global_context(VOS_MODULE_ID_HIF, NULL); v_VOID_t * temp_module; if (vos == NULL) return 0; /* No need to send WMI_PDEV_SUSPEND_CMDID to FW if WOW is enabled */ temp_module = vos_get_context(VOS_MODULE_ID_WDA, vos); if (!temp_module) { printk("%s: WDA module is NULL\n", __func__); return (-1); } if (wma_check_scan_in_progress(temp_module)) { printk("%s: Scan in progress. Aborting suspend\n", __func__); return (-1); } sc->local_state.event = 0; usb_hif_start_recv_pipes(device); #ifdef USB_HIF_TEST_INTERRUPT_IN usb_hif_post_recv_transfers(&device->pipes[HIF_RX_INT_PIPE], HIF_USB_RX_BUFFER_SIZE); #endif /* No need to send WMI_PDEV_RESUME_CMDID to FW if WOW is enabled */ if (!wma_is_wow_mode_selected(temp_module)) { wma_resume_target(temp_module, 0); } else if (wma_disable_wow_in_fw(temp_module, 0)) { pr_warn("%s[%d]: fail\n", __func__, __LINE__); return (-1); } return 0; }
void vos_log_submit(v_VOID_t *plog_hdr_ptr) { log_hdr_type *pHdr = (log_hdr_type*) plog_hdr_ptr; tAniHdr *wmsg = NULL; v_U8_t *pBuf; struct hdd_context_s *pHddCtx; v_CONTEXT_t pVosContext= NULL; v_U16_t data_len; v_U16_t total_len; /*Get the global context */ pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); /*Get the Hdd Context */ pHddCtx = ((VosContextType*)(pVosContext))->pHDDContext; if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Unloading/Loading in Progress. Ignore!!!", __func__); return; } #ifdef WLAN_KD_READY_NOTIFIER /* NL is not ready yet, WLAN KO started first */ if ((pHddCtx->kd_nl_init) && (!pHddCtx->ptt_pid)) { nl_srv_nl_ready_indication(); } #endif /* WLAN_KD_READY_NOTIFIER */ if (nl_srv_is_initialized() != 0) return; /* Send the log data to the ptt app only if it is registered with the wlan driver*/ if(vos_is_multicast_logging()) { data_len = pHdr->len; total_len = sizeof(tAniHdr)+sizeof(v_U32_t)+data_len; pBuf = (v_U8_t*)vos_mem_malloc(total_len); if(!pBuf) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "vos_mem_malloc failed"); return; } vos_mem_zero((v_VOID_t*)pBuf,total_len); wmsg = (tAniHdr*)pBuf; wmsg->type = PTT_MSG_DIAG_CMDS_TYPE; wmsg->length = total_len; wmsg->length = DIAG_SWAP16(wmsg->length); pBuf += sizeof(tAniHdr); /* Diag Type events or log */ *(v_U32_t*)pBuf = DIAG_TYPE_LOGS; pBuf += sizeof(v_U32_t); vos_mem_copy(pBuf, pHdr,data_len); if (ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, INVALID_PID, MSG_DONTWAIT) < 0) { vos_mem_free((v_VOID_t *)wmsg); return; } vos_mem_free((v_VOID_t*)wmsg); } return; }
void vos_log_submit(v_VOID_t *plog_hdr_ptr) { log_hdr_type *pHdr = (log_hdr_type*) plog_hdr_ptr; tAniHdr *wmsg = NULL; v_U8_t *pBuf; struct hdd_context_s *pHddCtx; v_CONTEXT_t pVosContext= NULL; v_U16_t data_len; v_U16_t total_len; /*Get the global context */ pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); /*Get the Hdd Context */ pHddCtx = ((VosContextType*)(pVosContext))->pHDDContext; if ((pHddCtx->isLoadInProgress) || (pHddCtx->isUnloadInProgress)) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Unloading/Loading in Progress. Ignore!!!", __func__); return; } /* Send the log data to the ptt app only if it is registered with the wlan driver*/ if(pHddCtx->ptt_pid) { data_len = pHdr->len; total_len = sizeof(tAniHdr)+sizeof(v_U32_t)+data_len; pBuf = (v_U8_t*)vos_mem_malloc(total_len); if(!pBuf) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "vos_mem_malloc failed"); return; } vos_mem_zero((v_VOID_t*)pBuf,total_len); wmsg = (tAniHdr*)pBuf; wmsg->type = PTT_MSG_DIAG_CMDS_TYPE; wmsg->length = total_len; wmsg->length = DIAG_SWAP16(wmsg->length); pBuf += sizeof(tAniHdr); /* Diag Type events or log */ *(v_U32_t*)pBuf = DIAG_TYPE_LOGS; pBuf += sizeof(v_U32_t); memcpy(pBuf, pHdr,data_len); if(pHddCtx->ptt_pid != INVALID_PID) { if( ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, pHddCtx->ptt_pid) < 0) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Ptt Socket error sending message to the app!!")); vos_mem_free((v_VOID_t *)wmsg); pHddCtx->ptt_pid = INVALID_PID; return; } } vos_mem_free((v_VOID_t*)wmsg); } return; }
int epping_wlan_startup(struct device *parent_dev, v_VOID_t *hif_sc) { int ret = 0; epping_context_t *pEpping_ctx = NULL; VosContextType *pVosContext = NULL; HTC_INIT_INFO htcInfo; struct ol_softc *scn; tSirMacAddr adapter_macAddr; adf_os_device_t adf_ctx; EPPING_LOG(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Enter", __func__); pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); if(pVosContext == NULL) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: Failed vos_get_global_context", __func__); ret = -1; return ret; } pEpping_ctx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext); if(pEpping_ctx == NULL) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: Failed to get pEpping_ctx", __func__); ret = -1; return ret; } pEpping_ctx->parent_dev = (void *)parent_dev; epping_get_dummy_mac_addr(adapter_macAddr); ((VosContextType*)pVosContext)->pHIFContext = hif_sc; /* store target type and target version info in hdd ctx */ pEpping_ctx->target_type = ((struct ol_softc *)hif_sc)->target_type; /* Initialize the timer module */ vos_timer_module_init(); scn = vos_get_context(VOS_MODULE_ID_HIF, pVosContext); if (!scn) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: scn is null!", __func__); return -1; } scn->enableuartprint = 0; scn->enablefwlog = 0; /* Initialize BMI and Download firmware */ if (bmi_download_firmware(scn)) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: BMI failed to download target", __func__); BMICleanup(scn); return -1; } EPPING_LOG(VOS_TRACE_LEVEL_INFO_HIGH, "%s: bmi_download_firmware done", __func__); htcInfo.pContext = pVosContext->pHIFContext; htcInfo.TargetFailure = ol_target_failure; htcInfo.TargetSendSuspendComplete = epping_target_suspend_acknowledge; adf_ctx = vos_get_context(VOS_MODULE_ID_ADF, pVosContext); /* Create HTC */ pVosContext->htc_ctx = HTCCreate(htcInfo.pContext, &htcInfo, adf_ctx); if (!pVosContext->htc_ctx) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to Create HTC", __func__); BMICleanup(scn); return -1; } pEpping_ctx->HTCHandle = vos_get_context(VOS_MODULE_ID_HTC, pVosContext); if (pEpping_ctx->HTCHandle == NULL) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: HTCHandle is NULL", __func__); return -1; } scn->htc_handle = pEpping_ctx->HTCHandle; HIFClaimDevice(scn->hif_hdl, scn); if (bmi_done(scn)) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: Failed to complete BMI phase", __func__); goto error_end; } /* start HIF */ if (HTCWaitTarget(scn->htc_handle) != A_OK) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: HTCWaitTarget error", __func__); goto error_end; } EPPING_LOG(VOS_TRACE_LEVEL_INFO_HIGH, "%s: HTC ready", __func__); ret = epping_connect_service(pEpping_ctx); if (ret != 0) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: HTCWaitTargetdone", __func__); goto error_end; } if (HTCStart(pEpping_ctx->HTCHandle) != A_OK) { goto error_end; } EPPING_LOG(VOS_TRACE_LEVEL_INFO_HIGH, "%s: HTC started", __func__); /* init the tx cookie resource */ ret = epping_cookie_init(pEpping_ctx); if (ret == 0) { pEpping_ctx->epping_adapter = epping_add_adapter(pEpping_ctx, adapter_macAddr, WLAN_HDD_INFRA_STATION); } if (ret < 0 || pEpping_ctx->epping_adapter == NULL) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: epping_add_adaptererror error", __func__); HTCStop(pEpping_ctx->HTCHandle); epping_cookie_cleanup(pEpping_ctx); goto error_end; } #ifdef HIF_PCI { int i; for (i = 0; i < EPPING_MAX_NUM_EPIDS; i++) { epping_register_tx_copier(i, pEpping_ctx); } } #endif /* HIF_PCI */ EPPING_LOG(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Exit", __func__); complete(&pEpping_ctx->wlan_start_comp); return ret; error_end: HTCDestroy(pVosContext->htc_ctx); pVosContext->htc_ctx = NULL; BMICleanup(scn); return -1; }
/* WMI command API */ int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int len, WMI_CMD_ID cmd_id) { HTC_PACKET *pkt; A_STATUS status; void *vos_context; struct ol_softc *scn; A_UINT16 htc_tag = 0; if (wmi_get_runtime_pm_inprogress(wmi_handle)) goto skip_suspend_check; if (adf_os_atomic_read(&wmi_handle->is_target_suspended) && ( (WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID != cmd_id) && (WMI_PDEV_RESUME_CMDID != cmd_id)) ) { pr_err("%s: Target is suspended could not send WMI command: %d\n", __func__, cmd_id); VOS_ASSERT(0); return -EBUSY; } else goto dont_tag; skip_suspend_check: switch(cmd_id) { case WMI_WOW_ENABLE_CMDID: case WMI_PDEV_SUSPEND_CMDID: case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: case WMI_WOW_ADD_WAKE_PATTERN_CMDID: case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: case WMI_PDEV_RESUME_CMDID: case WMI_WOW_DEL_WAKE_PATTERN_CMDID: #ifdef FEATURE_WLAN_D0WOW case WMI_D0_WOW_ENABLE_DISABLE_CMDID: #endif htc_tag = HTC_TX_PACKET_TAG_AUTO_PM; default: break; } dont_tag: /* Do sanity check on the TLV parameter structure */ { void *buf_ptr = (void *) adf_nbuf_data(buf); if (wmitlv_check_command_tlv_params(NULL, buf_ptr, len, cmd_id) != 0) { adf_os_print("\nERROR: %s: Invalid WMI Parameter Buffer for Cmd:%d\n", __func__, cmd_id); return -1; } } if (adf_nbuf_push_head(buf, sizeof(WMI_CMD_HDR)) == NULL) { pr_err("%s, Failed to send cmd %x, no memory\n", __func__, cmd_id); return -ENOMEM; } WMI_SET_FIELD(adf_nbuf_data(buf), WMI_CMD_HDR, COMMANDID, cmd_id); adf_os_atomic_inc(&wmi_handle->pending_cmds); if (adf_os_atomic_read(&wmi_handle->pending_cmds) >= WMI_MAX_CMDS) { vos_context = vos_get_global_context(VOS_MODULE_ID_WDA, NULL); scn = vos_get_context(VOS_MODULE_ID_HIF, vos_context); pr_err("\n%s: hostcredits = %d\n", __func__, wmi_get_host_credits(wmi_handle)); HTC_dump_counter_info(wmi_handle->htc_handle); //dump_CE_register(scn); //dump_CE_debug_register(scn->hif_sc); adf_os_atomic_dec(&wmi_handle->pending_cmds); pr_err("%s: MAX 1024 WMI Pending cmds reached.\n", __func__); vos_set_logp_in_progress(VOS_MODULE_ID_VOSS, TRUE); schedule_work(&recovery_work); return -EBUSY; } pkt = adf_os_mem_alloc(NULL, sizeof(*pkt)); if (!pkt) { adf_os_atomic_dec(&wmi_handle->pending_cmds); pr_err("%s, Failed to alloc htc packet %x, no memory\n", __func__, cmd_id); return -ENOMEM; } SET_HTC_PACKET_INFO_TX(pkt, NULL, adf_nbuf_data(buf), len + sizeof(WMI_CMD_HDR), /* htt_host_data_dl_len(buf)+20 */ wmi_handle->wmi_endpoint_id, htc_tag); SET_HTC_PACKET_NET_BUF_CONTEXT(pkt, buf); WMA_LOGD("Send WMI command:%s command_id:%d", get_wmi_cmd_string(cmd_id), cmd_id); #ifdef WMI_INTERFACE_EVENT_LOGGING adf_os_spin_lock_bh(&wmi_handle->wmi_record_lock); /*Record 16 bytes of WMI cmd data - exclude TLV and WMI headers*/ WMI_COMMAND_RECORD(cmd_id ,((u_int32_t *)adf_nbuf_data(buf) + 2)); adf_os_spin_unlock_bh(&wmi_handle->wmi_record_lock); #endif status = HTCSendPkt(wmi_handle->htc_handle, pkt); if (A_OK != status) { adf_os_atomic_dec(&wmi_handle->pending_cmds); pr_err("%s %d, HTCSendPkt failed\n", __func__, __LINE__); } return ((status == A_OK) ? EOK : -1); }
void vos_event_report_payload(v_U16_t event_Id, v_U16_t length, v_VOID_t *pPayload) { tAniHdr *wmsg = NULL; v_U8_t *pBuf; struct hdd_context_s *pHddCtx; v_CONTEXT_t pVosContext= NULL; event_report_t *pEvent_report; v_U16_t total_len; /*Get the global context */ pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); if (!pVosContext) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: vos context is NULL", __func__); return; } /*Get the Hdd Context */ pHddCtx = ((VosContextType*)(pVosContext))->pHDDContext; if (!pHddCtx) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: hdd context is NULL", __func__); return; } #ifdef WLAN_KD_READY_NOTIFIER /* NL is not ready yet, WLAN KO started first */ if ((pHddCtx->kd_nl_init) && (!pHddCtx->ptt_pid)) { nl_srv_nl_ready_indication(); } #endif /* WLAN_KD_READY_NOTIFIER */ if (nl_srv_is_initialized() != 0) return; /* Send the log data to the ptt app only if it is registered with the wlan driver*/ if(vos_is_multicast_logging()) { total_len = sizeof(tAniHdr)+sizeof(event_report_t)+length; pBuf = (v_U8_t*)vos_mem_malloc(total_len); if(!pBuf) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "vos_mem_malloc failed"); return; } wmsg = (tAniHdr*)pBuf; wmsg->type = PTT_MSG_DIAG_CMDS_TYPE; wmsg->length = total_len; wmsg->length = DIAG_SWAP16(wmsg->length); pBuf += sizeof(tAniHdr); pEvent_report = (event_report_t*)pBuf; pEvent_report->diag_type = DIAG_TYPE_EVENTS; pEvent_report->event_id = event_Id; pEvent_report->length = length; pBuf += sizeof(event_report_t); vos_mem_copy(pBuf, pPayload,length); if( ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, INVALID_PID, MSG_DONTWAIT) < 0) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Ptt Socket error sending message to the app!!")); vos_mem_free((v_VOID_t*)wmsg); return; } vos_mem_free((v_VOID_t*)wmsg); } return; }