Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*--------------------------------------------------------------------*/
- /* Static function prototypes */
- /*--------------------------------------------------------------------*/
- static void proc_dnld_rsp(tpAniSirGlobal, uint16_t, uint32_t *);
- static void proc_get_req(tpAniSirGlobal, uint16_t, uint32_t *);
- static uint8_t check_param(tpAniSirGlobal, uint16_t, uint32_t, uint32_t,
- uint32_t *);
- /*--------------------------------------------------------------------*/
- /* Module global variables */
- /*--------------------------------------------------------------------*/
- /* CFG function table */
- void (*g_cfg_func[])(tpAniSirGlobal, uint16_t, uint32_t *) = {
- proc_dnld_rsp, proc_get_req
- };
- /**---------------------------------------------------------------------
- * cfg_process_mb_msg()
- *
- ***FUNCTION:
- * CFG mailbox message processing function.
- *
- ***LOGIC:
- *
- ***ASSUMPTIONS:
- * None.
- *
- ***NOTE:
- *
- * @param pMsg Message pointer
- *
- * @return None.
- *
- */
- void cfg_process_mb_msg(tpAniSirGlobal pMac, tSirMbMsg *pMsg)
- {
- uint16_t index;
- uint16_t len;
- uint32_t *pParam;
- /* Use type[7:0] as index to function table */
- index = CFG_GET_FUNC_INDX(pMsg->type);
- if (index >= QDF_ARRAY_SIZE(g_cfg_func)) {
- qdf_mem_free(pMsg);
- return;
- }
- len = pMsg->msgLen - WNI_CFG_MB_HDR_LEN;
- pParam = ((uint32_t *) pMsg) + 1;
- /* Call processing function */
- g_cfg_func[index] (pMac, len, pParam);
- /* Free up buffer */
- qdf_mem_free(pMsg);
- } /*** end cfg_process_mb_msg() ***/
- /**---------------------------------------------------------------------
- * proc_dnld_rsp()
- *
- * FUNCTION:
- * This function processes CFG_DNLD_RSP message from host.
- *
- * LOGIC:
- *
- * ASSUMPTIONS:
- *
- * NOTE:
- *
- * @param length: message length
- * @param pParam: parameter list pointer
- *
- * @return None
- *
- */
- static void proc_dnld_rsp(tpAniSirGlobal pMac, uint16_t length, uint32_t *pParam)
- {
- int32_t i;
- uint32_t expLen, retVal, bufStart, bufEnd;
- uint32_t *pSrc, *pDst, *pDstEnd;
- uint32_t strSize, j;
- uint8_t pStr[CFG_MAX_STR_LEN];
- tpCfgBinHdr pHdr;
- tSirMsgQ mmhMsg;
- /* First Dword must contain the AP or STA magic dword */
- pe_debug("CFG size: %d bytes MAGIC dword is: 0x%x",
- length, sir_read_u32_n((uint8_t *) pParam));
- /* if the string is not correct, return failure */
- if (*pParam == CFG_STA_MAGIC_DWORD) {
- }
- else {
- pe_warn("Invalid magic dword: 0x%x",
- sir_read_u32_n((uint8_t *) pParam));
- retVal = WNI_CFG_INVALID_LEN;
- goto end;
- }
- pParam++;
- length -= 4;
- /* Parse the Cfg header */
- pHdr = (tpCfgBinHdr) pParam;
- pParam += (sizeof(tCfgBinHdr) >> 2);
- pe_debug("CFG hdr totParams: %d intParams: %d strBufSize: %d/%d",
- pHdr->controlSize, pHdr->iBufSize, pHdr->sBufSize,
- pMac->cfg.gCfgMaxSBufSize);
- expLen =
- ((CFG_PARAM_MAX_NUM + 3 * pMac->cfg.gCfgMaxIBufSize) << 2) +
- pHdr->sBufSize + sizeof(tCfgBinHdr);
- if (length != expLen) {
- pe_warn("<CFG> DNLD_RSP invalid length: %d (exp: %d)", length,
- expLen);
- retVal = WNI_CFG_INVALID_LEN;
- goto end;
- }
- if (pHdr->controlSize != CFG_PARAM_MAX_NUM) {
- pe_warn("<CFG> Total parameter count mismatch");
- retVal = WNI_CFG_INVALID_LEN;
- goto end;
- }
- if (pHdr->iBufSize != pMac->cfg.gCfgMaxIBufSize) {
- pe_warn("<CFG> Integer parameter count mismatch");
- retVal = WNI_CFG_INVALID_LEN;
- goto end;
- }
- /* Copy control array */
- pDst = (uint32_t *) pMac->cfg.gCfgEntry;
- pDstEnd = pDst + CFG_PARAM_MAX_NUM;
- pSrc = pParam;
- while (pDst < pDstEnd) {
- *pDst++ = *pSrc++;
- }
- /* Copy default values */
- pDst = pMac->cfg.gCfgIBuf;
- pDstEnd = pDst + pMac->cfg.gCfgMaxIBufSize;
- while (pDst < pDstEnd) {
- *pDst++ = *pSrc++;
- }
- /* Copy min values */
- pDst = pMac->cfg.gCfgIBufMin;
- pDstEnd = pDst + pMac->cfg.gCfgMaxIBufSize;
- while (pDst < pDstEnd) {
- *pDst++ = *pSrc++;
- }
- /* Copy max values */
- pDst = pMac->cfg.gCfgIBufMax;
- pDstEnd = pDst + pMac->cfg.gCfgMaxIBufSize;
- while (pDst < pDstEnd) {
- *pDst++ = *pSrc++;
- }
- for (i = 0; i < pMac->cfg.gCfgMaxIBufSize; i++)
- if (pMac->cfg.gCfgIBuf[i] < pMac->cfg.gCfgIBufMin[i] ||
- pMac->cfg.gCfgIBuf[i] > pMac->cfg.gCfgIBufMax[i]) {
- pe_debug("cfg id: %d Invalid def value: %d min: %d max: %d",
- i, pMac->cfg.gCfgIBuf[i],
- pMac->cfg.gCfgIBufMin[i],
- pMac->cfg.gCfgIBufMax[i]);
- }
- /* Calculate max string buffer lengths for all string parameters */
- bufEnd = pMac->cfg.gCfgMaxSBufSize;
- for (i = CFG_PARAM_MAX_NUM - 1; i >= 0; i--) {
- if ((pMac->cfg.gCfgEntry[i].control & CFG_CTL_INT) != 0)
- continue;
- if ((pMac->cfg.gCfgEntry[i].control & CFG_CTL_VALID) == 0)
- continue;
- bufStart = pMac->cfg.gCfgEntry[i].control & CFG_BUF_INDX_MASK;
- pMac->cfg.gCfgSBuf[bufStart] =
- (uint8_t) (bufEnd - bufStart - 2);
- pe_debug("id: %d max: %d bufStart: %d bufEnd: %d", i,
- pMac->cfg.gCfgSBuf[bufStart], bufStart, bufEnd);
- bufEnd = bufStart;
- }
- /* Initialize string defaults */
- strSize = pHdr->sBufSize;
- while (strSize) {
- uint32_t paramId, paramLen, paramLenCeil4;
- if (strSize < 4) {
- pe_warn("parsing str defaults, rem: %d bytes",
- strSize);
- retVal = WNI_CFG_INVALID_LEN;
- goto end;
- }
- paramId = *pSrc >> 16;
- paramLen = *pSrc & 0xff;
- pSrc++;
- strSize -= 4;
- paramLenCeil4 = ((paramLen + 3) >> 2);
- if (strSize < paramLenCeil4 << 2) {
- pe_warn("parsing str defaults, rem: %d bytes",
- strSize);
- pe_warn("param id: %d len: %d bytes",
- paramId, paramLen);
- retVal = WNI_CFG_INVALID_LEN;
- goto end;
- }
- for (j = 0; j < paramLenCeil4; j++) {
- pStr[4 * j] = (uint8_t) (*pSrc >> 24) & 0xff;
- pStr[4 * j + 1] = (uint8_t) (*pSrc >> 16) & 0xff;
- pStr[4 * j + 2] = (uint8_t) (*pSrc >> 8) & 0xff;
- pStr[4 * j + 3] = (uint8_t) (*pSrc) & 0xff;
- pSrc++;
- strSize -= 4;
- }
- pe_debug("set str id: %d len: %d", paramId, paramLen);
- if (cfg_set_str(pMac, (uint16_t) paramId, pStr, paramLen) !=
- eSIR_SUCCESS) {
- pe_warn("setting str default param %d len %d",
- paramId, paramLen);
- retVal = WNI_CFG_INVALID_LEN;
- goto end;
- }
- }
- /* Set status to READY */
- pMac->cfg.gCfgStatus = CFG_SUCCESS;
- retVal = WNI_CFG_SUCCESS;
- pe_debug("<CFG> Completed successfully");
- end:
- if (retVal != WNI_CFG_SUCCESS)
- pMac->cfg.gCfgStatus = CFG_FAILURE;
- /* Send response message to host */
- pMac->cfg.gParamList[WNI_CFG_DNLD_CNF_RES] = retVal;
- cfg_send_host_msg(pMac, WNI_CFG_DNLD_CNF, WNI_CFG_DNLD_CNF_LEN,
- WNI_CFG_DNLD_CNF_NUM, pMac->cfg.gParamList, 0, 0);
- /* notify WMA that the config has downloaded */
- mmhMsg.type = SIR_CFG_DOWNLOAD_COMPLETE_IND;
- mmhMsg.bodyptr = NULL;
- mmhMsg.bodyval = 0;
- MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type));
- if (wma_post_ctrl_msg(pMac, &mmhMsg) != eSIR_SUCCESS) {
- pe_err("WMAPostMsgApi failed!");
- }
- } /*** end procDnldRsp() ***/
- /**---------------------------------------------------------------------
- * proc_get_req()
- *
- * FUNCTION:
- * This function processes CFG_GET_REQ message from host.
- *
- * LOGIC:
- *
- * ASSUMPTIONS:
- *
- * NOTE:
- * For every parameter ID specified on the list, CFG will send a separate
- * CFG_GET_RSP back to host.
- *
- * @param length: message length
- * @param pParam: parameter list pointer
- *
- * @return None
- *
- */
- static void proc_get_req(tpAniSirGlobal pMac, uint16_t length, uint32_t *pParam)
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement