qcacmn: Restructure and add new files in wmi layer
Add new directory structure and new files for tlv and non-tlv implementation. wmi layer shall not use global context of other layer, remove global context and unused methods. CRs-Fixed: 978547 Change-Id: I230f59052d9db8e1660cc087b09e03641227f490
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||
*
|
||||
@@ -25,8 +25,6 @@
|
||||
* to the Linux Foundation.
|
||||
*/
|
||||
|
||||
/* wmi_tlv_platform.c file will be different for different components like Pronto firmware, Pronto windows host driver,
|
||||
Pronto LA host driver because their memory management functions are different */
|
||||
#include "wmi_tlv_platform.c"
|
||||
#include "wmi_tlv_defs.h"
|
||||
#include "wmi_version.h"
|
||||
@@ -41,10 +39,14 @@
|
||||
#define WMITLV_GET_TAG_ARRAY_SIZE(val) ((val >> 21) & 0x000001FF)
|
||||
#define WMITLV_GET_TAG_VARIED(val) ((val >> 30) & 0x00000001)
|
||||
|
||||
#define WMITLV_SET_ATTRB0(id) ((WMITLV_GET_TAG_NUM_TLV_ATTRIB(id) << 24) | (id & 0x00FFFFFF))
|
||||
#define WMITLV_SET_ATTRB1(tagID, tagStructSize, tagArraySize, tagVaried) (((tagVaried&0x1)<<30) | ((tagArraySize&0x1FF)<<21) | ((tagStructSize&0x1FF)<<12) | (tagID&0xFFF))
|
||||
#define WMITLV_SET_ATTRB0(id) ((WMITLV_GET_TAG_NUM_TLV_ATTRIB(id) << 24) | \
|
||||
(id & 0x00FFFFFF))
|
||||
#define WMITLV_SET_ATTRB1(tagID, tagStructSize, tagArraySize, tagVaried) \
|
||||
(((tagVaried&0x1)<<30) | ((tagArraySize&0x1FF)<<21) | \
|
||||
((tagStructSize&0x1FF)<<12) | (tagID&0xFFF))
|
||||
|
||||
#define WMITLV_OP_SET_TLV_ATTRIB_macro(param_ptr, param_len, wmi_cmd_event_id, elem_tlv_tag, elem_struc_type, elem_name, var_len, arr_size) \
|
||||
#define WMITLV_OP_SET_TLV_ATTRIB_macro(param_ptr, param_len, wmi_cmd_event_id, \
|
||||
elem_tlv_tag, elem_struc_type, elem_name, var_len, arr_size) \
|
||||
WMITLV_SET_ATTRB1(elem_tlv_tag, sizeof(elem_struc_type), arr_size, var_len),
|
||||
|
||||
#define WMITLV_GET_CMD_EVT_ATTRB_LIST(id) \
|
||||
@@ -60,21 +62,26 @@ A_UINT32 evt_attr_list[] = {
|
||||
};
|
||||
|
||||
#ifdef NO_DYNAMIC_MEM_ALLOC
|
||||
static wmitlv_cmd_param_info *g_wmi_static_cmd_param_info_buf = NULL;
|
||||
A_UINT32 g_wmi_static_max_cmd_param_tlvs = 0;
|
||||
static wmitlv_cmd_param_info *g_wmi_static_cmd_param_info_buf;
|
||||
A_UINT32 g_wmi_static_max_cmd_param_tlvs;
|
||||
#endif
|
||||
|
||||
/* TLV helper routines */
|
||||
|
||||
/*
|
||||
* WMI TLV Helper function to set the static cmd_param_tlv structure and number of TLVs that can be
|
||||
* accomodated in the structure. This function should be used when dynamic memory allocation is not
|
||||
* supported.
|
||||
/**
|
||||
* wmitlv_set_static_param_tlv_buf() - tlv helper function
|
||||
* @param_tlv_buf: tlv buffer parameter
|
||||
* @max_tlvs_accomodated: max no of tlv entries
|
||||
*
|
||||
* When dynamic memory allocation is not supported by any component then NO_DYNAMIC_MEMALLOC
|
||||
* macro has to be defined in respective tlv_platform.c file. And respective component has to allocate
|
||||
* cmd_param_tlv structure buffer to accomodate whatever number of TLV's. Both the buffer address
|
||||
* and number of TLV's that can be accomodated in the buffer should be sent as arguments to this function.
|
||||
*
|
||||
* WMI TLV Helper function to set the static cmd_param_tlv structure
|
||||
* and number of TLVs that can be accomodated in the structure.
|
||||
* This function should be used when dynamic memory allocation is not
|
||||
* supported. When dynamic memory allocation is not supported by any
|
||||
* component then NO_DYNAMIC_MEMALLOC macro has to be defined in respective
|
||||
* tlv_platform.c file. And respective component has to allocate
|
||||
* cmd_param_tlv structure buffer to accomodate whatever number of TLV's.
|
||||
* Both the buffer address and number of TLV's that can be accomodated in
|
||||
* the buffer should be sent as arguments to this function.
|
||||
*
|
||||
* Return None
|
||||
*/
|
||||
@@ -88,9 +95,18 @@ wmitlv_set_static_param_tlv_buf(void *param_tlv_buf,
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* WMI TLV Helper functions to find the attributes of the Command/Event TLVs.
|
||||
* Return 0 if success. Return >=1 if failure.
|
||||
/**
|
||||
* wmitlv_get_attributes() - tlv helper function
|
||||
* @is_cmd_id: boolean for command attribute
|
||||
* @cmd_event_id: command event id
|
||||
* @curr_tlv_order: tlv order
|
||||
* @tlv_attr_ptr: pointer to tlv attribute
|
||||
*
|
||||
*
|
||||
* WMI TLV Helper functions to find the attributes of the
|
||||
* Command/Event TLVs.
|
||||
*
|
||||
* Return: 0 if success. Return >=1 if failure.
|
||||
*/
|
||||
A_UINT32 wmitlv_get_attributes(A_UINT32 is_cmd_id, A_UINT32 cmd_event_id,
|
||||
A_UINT32 curr_tlv_order,
|
||||
@@ -112,7 +128,8 @@ A_UINT32 wmitlv_get_attributes(A_UINT32 is_cmd_id, A_UINT32 cmd_event_id,
|
||||
if (WMITLV_GET_CMDID(cmd_event_id) ==
|
||||
WMITLV_GET_CMDID(pAttrArrayList[i])) {
|
||||
tlv_attr_ptr->cmd_num_tlv = num_tlvs;
|
||||
/* Return success from here when only number of TLVS for this command/event is required */
|
||||
/* Return success from here when only number of TLVS for
|
||||
* this command/event is required */
|
||||
if (curr_tlv_order == WMITLV_GET_ATTRIB_NUM_TLVS) {
|
||||
wmi_tlv_print_verbose
|
||||
("%s: WMI TLV attribute definitions for %s:0x%x found; num_of_tlvs:%d\n",
|
||||
@@ -121,7 +138,8 @@ A_UINT32 wmitlv_get_attributes(A_UINT32 is_cmd_id, A_UINT32 cmd_event_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return failure if tlv_order is more than the expected number of TLVs */
|
||||
/* Return failure if tlv_order is more than the expected
|
||||
* number of TLVs */
|
||||
if (curr_tlv_order >= num_tlvs) {
|
||||
wmi_tlv_print_error
|
||||
("%s: ERROR: TLV order %d greater than num_of_tlvs:%d for %s:0x%x\n",
|
||||
@@ -163,10 +181,18 @@ A_UINT32 wmitlv_get_attributes(A_UINT32 is_cmd_id, A_UINT32 cmd_event_id,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to vaidate the prepared TLV's for an WMI event/command to be sent
|
||||
* Return 0 if success.
|
||||
* <0 if failure.
|
||||
/**
|
||||
* wmitlv_check_tlv_params() - tlv helper function
|
||||
* @os_handle: os context handle
|
||||
* @param_struc_ptr: pointer to tlv structure
|
||||
* @is_cmd_id: boolean for command attribute
|
||||
* @wmi_cmd_event_id: command event id
|
||||
*
|
||||
*
|
||||
* Helper Function to vaidate the prepared TLV's for
|
||||
* an WMI event/command to be sent.
|
||||
*
|
||||
* Return: 0 if success. Return < 0 if failure.
|
||||
*/
|
||||
static int
|
||||
wmitlv_check_tlv_params(void *os_handle, void *param_struc_ptr,
|
||||
@@ -178,6 +204,7 @@ wmitlv_check_tlv_params(void *os_handle, void *param_struc_ptr,
|
||||
A_UINT32 tlv_index = 0;
|
||||
A_UINT8 *buf_ptr = (unsigned char *)param_struc_ptr;
|
||||
A_UINT32 expected_num_tlvs, expected_tlv_len;
|
||||
A_INT32 error = -1;
|
||||
|
||||
/* Get the number of TLVs for this command/event */
|
||||
if (wmitlv_get_attributes
|
||||
@@ -251,7 +278,9 @@ wmitlv_check_tlv_params(void *os_handle, void *param_struc_ptr,
|
||||
expected_tlv_len =
|
||||
attr_struct_ptr.tag_array_size *
|
||||
attr_struct_ptr.tag_struct_size;
|
||||
/* Paddding is only required for Byte array Tlvs all other array tlv's should be aligned to 4 bytes during their definition */
|
||||
/* Paddding is only required for Byte array Tlvs all other
|
||||
* array tlv's should be aligned to 4 bytes during their
|
||||
* definition */
|
||||
if (WMITLV_TAG_ARRAY_BYTE ==
|
||||
attr_struct_ptr.tag_id) {
|
||||
expected_tlv_len =
|
||||
@@ -278,8 +307,9 @@ wmitlv_check_tlv_params(void *os_handle, void *param_struc_ptr,
|
||||
goto Error_wmitlv_check_tlv_params;
|
||||
}
|
||||
|
||||
/* Incase of variable length TLV's, there is no expectation on the length field so do whatever checking
|
||||
you can depending on the TLV tag if TLV length is non-zero */
|
||||
/* Incase of variable length TLV's, there is no expectation
|
||||
* on the length field so do whatever checking you can
|
||||
* depending on the TLV tag if TLV length is non-zero */
|
||||
if (curr_tlv_len != 0) {
|
||||
/* Verify TLV length is aligned to the size of structure */
|
||||
if ((curr_tlv_len %
|
||||
@@ -345,8 +375,7 @@ wmitlv_check_tlv_params(void *os_handle, void *param_struc_ptr,
|
||||
|| (curr_tlv_tag ==
|
||||
WMITLV_TAG_ARRAY_BYTE)
|
||||
|| (curr_tlv_tag ==
|
||||
WMITLV_TAG_ARRAY_FIXED_STRUC))
|
||||
{
|
||||
WMITLV_TAG_ARRAY_FIXED_STRUC)) {
|
||||
/* Nothing to verify here */
|
||||
} else {
|
||||
wmi_tlv_print_error
|
||||
@@ -392,30 +421,47 @@ wmitlv_check_tlv_params(void *os_handle, void *param_struc_ptr,
|
||||
__func__, wmi_cmd_event_id, tlv_index, expected_num_tlvs);
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
Error_wmitlv_check_tlv_params:
|
||||
return (-1);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to vaidate the prepared TLV's for an WMI event to be sent
|
||||
* Return 0 if success.
|
||||
* <0 if failure.
|
||||
/**
|
||||
* wmitlv_check_event_tlv_params() - tlv helper function
|
||||
* @os_handle: os context handle
|
||||
* @param_struc_ptr: pointer to tlv structure
|
||||
* @is_cmd_id: boolean for command attribute
|
||||
* @wmi_cmd_event_id: command event id
|
||||
*
|
||||
*
|
||||
* Helper Function to vaidate the prepared TLV's for
|
||||
* an WMI event/command to be sent.
|
||||
*
|
||||
* Return: 0 if success. Return < 0 if failure.
|
||||
*/
|
||||
int
|
||||
wmitlv_check_event_tlv_params(void *os_handle, void *param_struc_ptr,
|
||||
A_UINT32 param_buf_len, A_UINT32 wmi_cmd_event_id)
|
||||
{
|
||||
A_UINT32 is_cmd_id = 0;
|
||||
return (wmitlv_check_tlv_params
|
||||
|
||||
return wmitlv_check_tlv_params
|
||||
(os_handle, param_struc_ptr, param_buf_len, is_cmd_id,
|
||||
wmi_cmd_event_id));
|
||||
wmi_cmd_event_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to vaidate the prepared TLV's for an WMI command to be sent
|
||||
* Return 0 if success.
|
||||
* <0 if failure.
|
||||
/**
|
||||
* wmitlv_check_command_tlv_params() - tlv helper function
|
||||
* @os_handle: os context handle
|
||||
* @param_struc_ptr: pointer to tlv structure
|
||||
* @is_cmd_id: boolean for command attribute
|
||||
* @wmi_cmd_event_id: command event id
|
||||
*
|
||||
*
|
||||
* Helper Function to vaidate the prepared TLV's for
|
||||
* an WMI event/command to be sent.
|
||||
*
|
||||
* Return: 0 if success. Return < 0 if failure.
|
||||
*/
|
||||
int
|
||||
wmitlv_check_command_tlv_params(void *os_handle, void *param_struc_ptr,
|
||||
@@ -423,15 +469,26 @@ wmitlv_check_command_tlv_params(void *os_handle, void *param_struc_ptr,
|
||||
A_UINT32 wmi_cmd_event_id)
|
||||
{
|
||||
A_UINT32 is_cmd_id = 1;
|
||||
return (wmitlv_check_tlv_params
|
||||
|
||||
return wmitlv_check_tlv_params
|
||||
(os_handle, param_struc_ptr, param_buf_len, is_cmd_id,
|
||||
wmi_cmd_event_id));
|
||||
wmi_cmd_event_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to vaidate the TLV's coming for an event/command and also pads data to TLV's if necessary
|
||||
* Return 0 if success.
|
||||
<0 if failure.
|
||||
/**
|
||||
* wmitlv_check_and_pad_tlvs() - tlv helper function
|
||||
* @os_handle: os context handle
|
||||
* @param_buf_len: length of tlv parameter
|
||||
* @param_struc_ptr: pointer to tlv structure
|
||||
* @is_cmd_id: boolean for command attribute
|
||||
* @wmi_cmd_event_id: command event id
|
||||
* @wmi_cmd_struct_ptr: wmi command structure
|
||||
*
|
||||
*
|
||||
* vaidate the TLV's coming for an event/command and
|
||||
* also pads data to TLV's if necessary
|
||||
*
|
||||
* Return: 0 if success. Return < 0 if failure.
|
||||
*/
|
||||
static int
|
||||
wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
@@ -447,6 +504,7 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
wmitlv_cmd_param_info *cmd_param_tlvs_ptr = NULL;
|
||||
A_UINT32 remaining_expected_tlvs = 0xFFFFFFFF;
|
||||
A_UINT32 len_wmi_cmd_struct_buf;
|
||||
A_INT32 error = -1;
|
||||
|
||||
/* Get the number of TLVs for this command/event */
|
||||
if (wmitlv_get_attributes
|
||||
@@ -455,7 +513,7 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
wmi_tlv_print_error
|
||||
("%s: ERROR: Couldn't get expected number of TLVs for Cmd=%d\n",
|
||||
__func__, wmi_cmd_event_id);
|
||||
return -1;
|
||||
return error;
|
||||
}
|
||||
/* NOTE: the returned number of TLVs is in "attr_struct_ptr.cmd_num_tlv" */
|
||||
|
||||
@@ -467,8 +525,10 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
wmi_tlv_os_mem_alloc(os_handle, *wmi_cmd_struct_ptr,
|
||||
len_wmi_cmd_struct_buf);
|
||||
#else
|
||||
/* Dynamic memory allocation is not supported. Use the buffer g_wmi_static_cmd_param_info_buf, which should be set using wmi_tlv_set_static_param_tlv_buf(),
|
||||
for base structure of format wmi_cmd_event_id##_param_tlvs */
|
||||
/* Dynamic memory allocation is not supported. Use the buffer
|
||||
* g_wmi_static_cmd_param_info_buf, which should be set using
|
||||
* wmi_tlv_set_static_param_tlv_buf(),
|
||||
* for base structure of format wmi_cmd_event_id##_param_tlvs */
|
||||
*wmi_cmd_struct_ptr = g_wmi_static_cmd_param_info_buf;
|
||||
if (attr_struct_ptr.cmd_num_tlv > g_wmi_static_max_cmd_param_tlvs) {
|
||||
/* Error: Expecting more TLVs that accomodated for static structure */
|
||||
@@ -476,7 +536,7 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
("%s: Error: Expecting more TLVs that accomodated for static structure. Expected:%d Accomodated:%d\n",
|
||||
__func__, attr_struct_ptr.cmd_num_tlv,
|
||||
g_wmi_static_max_cmd_param_tlvs);
|
||||
return -1;
|
||||
return error;
|
||||
}
|
||||
#endif
|
||||
if (*wmi_cmd_struct_ptr == NULL) {
|
||||
@@ -484,7 +544,7 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
wmi_tlv_print_error
|
||||
("%s: Error: unable to alloc memory (size=%d) for TLV\n",
|
||||
__func__, len_wmi_cmd_struct_buf);
|
||||
return -1;
|
||||
return error;
|
||||
}
|
||||
|
||||
cmd_param_tlvs_ptr = (wmitlv_cmd_param_info *) *wmi_cmd_struct_ptr;
|
||||
@@ -603,9 +663,12 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
A_UINT32 i;
|
||||
|
||||
if (attr_struct_ptr.tag_varied_size == WMITLV_SIZE_FIX) {
|
||||
/* This is not allowed. The tag WMITLV_TAG_ARRAY_STRUC can only be used with variable-length structure array
|
||||
should not have a fixed number of elements (contradicting). Use WMITLV_TAG_ARRAY_FIXED_STRUC tag for
|
||||
fixed size structure array(where structure never change without breaking compatibility) */
|
||||
/* This is not allowed. The tag WMITLV_TAG_ARRAY_STRUC can
|
||||
* only be used with variable-length structure array
|
||||
* should not have a fixed number of elements (contradicting).
|
||||
* Use WMITLV_TAG_ARRAY_FIXED_STRUC tag for fixed size
|
||||
* structure array(where structure never change without
|
||||
* breaking compatibility) */
|
||||
wmi_tlv_print_error
|
||||
("%s: ERROR: TLV (tag=%d) should be variable-length and not fixed length\n",
|
||||
__func__, curr_tlv_tag);
|
||||
@@ -642,8 +705,9 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
tlv_buf_ptr = (A_UINT8 *) new_tlv_buf;
|
||||
for (i = 0; i < num_of_elems; i++) {
|
||||
if (tlv_size_diff > 0) {
|
||||
/* Incoming structure size is greater than expected structure size.
|
||||
so copy the number of bytes equal to expected structure size */
|
||||
/* Incoming structure size is greater than expected
|
||||
* structure size. so copy the number of bytes equal
|
||||
* to expected structure size */
|
||||
wmi_tlv_OS_MEMCPY(tlv_buf_ptr,
|
||||
(void *)(buf_ptr +
|
||||
i *
|
||||
@@ -651,9 +715,9 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
attr_struct_ptr.
|
||||
tag_struct_size);
|
||||
} else {
|
||||
/* Incoming structure size is smaller than expected structure size.
|
||||
so copy the number of bytes equal to incoming structure size
|
||||
(other bytes would be zeroes) */
|
||||
/* Incoming structure size is smaller than expected
|
||||
* structure size. so copy the number of bytes equal
|
||||
* to incoming structure size */
|
||||
wmi_tlv_OS_MEMCPY(tlv_buf_ptr,
|
||||
(void *)(buf_ptr +
|
||||
i *
|
||||
@@ -669,12 +733,14 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
A_UINT32 buf_mov_len;
|
||||
|
||||
if (tlv_size_diff < 0) {
|
||||
/* Incoming structure size is smaller than expected size then this needs padding for each element in the array */
|
||||
/* Incoming structure size is smaller than expected size
|
||||
* then this needs padding for each element in the array */
|
||||
|
||||
/* Find amount of bytes to be padded for one element */
|
||||
num_padding_bytes = tlv_size_diff * -1;
|
||||
|
||||
/* Move subsequent TLVs by number of bytes to be padded for all elements */
|
||||
/* Move subsequent TLVs by number of bytes to be padded
|
||||
* for all elements */
|
||||
if (param_buf_len >
|
||||
(buf_idx + curr_tlv_len)) {
|
||||
src_addr =
|
||||
@@ -692,13 +758,16 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
buf_mov_len);
|
||||
}
|
||||
|
||||
/* Move subsequent elements of array down by number of bytes to be padded for one element and alse set padding bytes to zero */
|
||||
/* Move subsequent elements of array down by number of
|
||||
* bytes to be padded for one element and alse set
|
||||
* padding bytes to zero */
|
||||
tlv_buf_ptr = buf_ptr;
|
||||
for (i = 0; i < num_of_elems; i++) {
|
||||
src_addr =
|
||||
tlv_buf_ptr + in_tlv_len;
|
||||
if (i != (num_of_elems - 1)) {
|
||||
/* Need not move anything for last element in the array */
|
||||
/* Need not move anything for last element
|
||||
* in the array */
|
||||
dst_addr =
|
||||
tlv_buf_ptr +
|
||||
in_tlv_len +
|
||||
@@ -722,18 +791,21 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
tag_struct_size;
|
||||
}
|
||||
|
||||
/* Update the number of padding bytes to total number of bytes padded for all elements in the array */
|
||||
/* Update the number of padding bytes to total number
|
||||
* of bytes padded for all elements in the array */
|
||||
num_padding_bytes =
|
||||
num_padding_bytes * num_of_elems;
|
||||
|
||||
new_tlv_buf = buf_ptr;
|
||||
} else {
|
||||
/* Incoming structure size is greater than expected size then this needs shrinking for each element in the array */
|
||||
/* Incoming structure size is greater than expected size
|
||||
* then this needs shrinking for each element in the array */
|
||||
|
||||
/* Find amount of bytes to be shrinked for one element */
|
||||
num_padding_bytes = tlv_size_diff * -1;
|
||||
|
||||
/* Move subsequent elements of array up by number of bytes to be shrinked for one element */
|
||||
/* Move subsequent elements of array up by number of bytes
|
||||
* to be shrinked for one element */
|
||||
tlv_buf_ptr = buf_ptr;
|
||||
for (i = 0; i < (num_of_elems - 1); i++) {
|
||||
src_addr =
|
||||
@@ -754,7 +826,8 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
tag_struct_size;
|
||||
}
|
||||
|
||||
/* Move subsequent TLVs by number of bytes to be shrinked for all elements */
|
||||
/* Move subsequent TLVs by number of bytes to be shrinked
|
||||
* for all elements */
|
||||
if (param_buf_len >
|
||||
(buf_idx + curr_tlv_len)) {
|
||||
src_addr =
|
||||
@@ -772,7 +845,8 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
buf_mov_len);
|
||||
}
|
||||
|
||||
/* Update the number of padding bytes to total number of bytes shrinked for all elements in the array */
|
||||
/* Update the number of padding bytes to total number of
|
||||
* bytes shrinked for all elements in the array */
|
||||
num_padding_bytes =
|
||||
num_padding_bytes * num_of_elems;
|
||||
|
||||
@@ -824,8 +898,9 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
wmi_tlv_OS_MEMCPY(new_tlv_buf, (void *)buf_ptr,
|
||||
curr_tlv_len);
|
||||
#else
|
||||
/* Dynamic memory allocation is not supported. Padding has to be done with in the existing buffer assuming we have enough space
|
||||
to grow */
|
||||
/* Dynamic memory allocation is not supported. Padding has
|
||||
* to be done with in the existing buffer assuming we have
|
||||
* enough space to grow */
|
||||
{
|
||||
/* Note: tlv_size_diff is a value less than zero */
|
||||
/* Move the Subsequent TLVs by amount of bytes needs to be padded */
|
||||
@@ -861,7 +936,7 @@ wmitlv_check_and_pad_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
buf_idx += curr_tlv_len + num_padding_bytes;
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
Error_wmitlv_check_and_pad_tlvs:
|
||||
if (is_cmd_id) {
|
||||
wmitlv_free_allocated_command_tlvs(wmi_cmd_event_id,
|
||||
@@ -871,13 +946,21 @@ Error_wmitlv_check_and_pad_tlvs:
|
||||
wmi_cmd_struct_ptr);
|
||||
}
|
||||
*wmi_cmd_struct_ptr = NULL;
|
||||
return (-1);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to validate and pad(if necessary) for incoming WMI Event TLVs
|
||||
* Return 0 if success.
|
||||
<0 if failure.
|
||||
/**
|
||||
* wmitlv_check_and_pad_event_tlvs() - tlv helper function
|
||||
* @os_handle: os context handle
|
||||
* @param_struc_ptr: pointer to tlv structure
|
||||
* @param_buf_len: length of tlv parameter
|
||||
* @wmi_cmd_event_id: command event id
|
||||
* @wmi_cmd_struct_ptr: wmi command structure
|
||||
*
|
||||
*
|
||||
* validate and pad(if necessary) for incoming WMI Event TLVs
|
||||
*
|
||||
* Return: 0 if success. Return < 0 if failure.
|
||||
*/
|
||||
int
|
||||
wmitlv_check_and_pad_event_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
@@ -886,15 +969,23 @@ wmitlv_check_and_pad_event_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
void **wmi_cmd_struct_ptr)
|
||||
{
|
||||
A_UINT32 is_cmd_id = 0;
|
||||
return (wmitlv_check_and_pad_tlvs
|
||||
return wmitlv_check_and_pad_tlvs
|
||||
(os_handle, param_struc_ptr, param_buf_len, is_cmd_id,
|
||||
wmi_cmd_event_id, wmi_cmd_struct_ptr));
|
||||
wmi_cmd_event_id, wmi_cmd_struct_ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to validate and pad(if necessary) for incoming WMI Command TLVs
|
||||
* Return 0 if success.
|
||||
<0 if failure.
|
||||
/**
|
||||
* wmitlv_check_and_pad_command_tlvs() - tlv helper function
|
||||
* @os_handle: os context handle
|
||||
* @param_struc_ptr: pointer to tlv structure
|
||||
* @param_buf_len: length of tlv parameter
|
||||
* @wmi_cmd_event_id: command event id
|
||||
* @wmi_cmd_struct_ptr: wmi command structure
|
||||
*
|
||||
*
|
||||
* validate and pad(if necessary) for incoming WMI Command TLVs
|
||||
*
|
||||
* Return: 0 if success. Return < 0 if failure.
|
||||
*/
|
||||
int
|
||||
wmitlv_check_and_pad_command_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
@@ -903,14 +994,21 @@ wmitlv_check_and_pad_command_tlvs(void *os_handle, void *param_struc_ptr,
|
||||
void **wmi_cmd_struct_ptr)
|
||||
{
|
||||
A_UINT32 is_cmd_id = 1;
|
||||
return (wmitlv_check_and_pad_tlvs
|
||||
return wmitlv_check_and_pad_tlvs
|
||||
(os_handle, param_struc_ptr, param_buf_len, is_cmd_id,
|
||||
wmi_cmd_event_id, wmi_cmd_struct_ptr));
|
||||
wmi_cmd_event_id, wmi_cmd_struct_ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to free any allocated buffers for WMI Event/Command TLV processing
|
||||
* Return None
|
||||
/**
|
||||
* wmitlv_free_allocated_tlvs() - tlv helper function
|
||||
* @is_cmd_id: bollean to check if cmd or event tlv
|
||||
* @cmd_event_id: command or event id
|
||||
* @wmi_cmd_struct_ptr: wmi command structure
|
||||
*
|
||||
*
|
||||
* free any allocated buffers for WMI Event/Command TLV processing
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void wmitlv_free_allocated_tlvs(A_UINT32 is_cmd_id,
|
||||
A_UINT32 cmd_event_id,
|
||||
@@ -965,9 +1063,15 @@ break;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to free any allocated buffers for WMI Command TLV processing
|
||||
* Return None
|
||||
/**
|
||||
* wmitlv_free_allocated_command_tlvs() - tlv helper function
|
||||
* @cmd_event_id: command or event id
|
||||
* @wmi_cmd_struct_ptr: wmi command structure
|
||||
*
|
||||
*
|
||||
* free any allocated buffers for WMI Event/Command TLV processing
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void wmitlv_free_allocated_command_tlvs(A_UINT32 cmd_event_id,
|
||||
void **wmi_cmd_struct_ptr)
|
||||
@@ -975,9 +1079,15 @@ void wmitlv_free_allocated_command_tlvs(A_UINT32 cmd_event_id,
|
||||
wmitlv_free_allocated_tlvs(1, cmd_event_id, wmi_cmd_struct_ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to free any allocated buffers for WMI Event TLV processing
|
||||
* Return None
|
||||
/**
|
||||
* wmitlv_free_allocated_event_tlvs() - tlv helper function
|
||||
* @cmd_event_id: command or event id
|
||||
* @wmi_cmd_struct_ptr: wmi command structure
|
||||
*
|
||||
*
|
||||
* free any allocated buffers for WMI Event/Command TLV processing
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void wmitlv_free_allocated_event_tlvs(A_UINT32 cmd_event_id,
|
||||
void **wmi_cmd_struct_ptr)
|
||||
@@ -985,9 +1095,15 @@ void wmitlv_free_allocated_event_tlvs(A_UINT32 cmd_event_id,
|
||||
wmitlv_free_allocated_tlvs(0, cmd_event_id, wmi_cmd_struct_ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if the two given versions are compatible.
|
||||
* Else return 0 if Incompatible.
|
||||
/**
|
||||
* wmi_versions_are_compatible() - tlv helper function
|
||||
* @vers1: host wmi version
|
||||
* @vers2: target wmi version
|
||||
*
|
||||
*
|
||||
* check if two given wmi versions are compatible
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
int
|
||||
wmi_versions_are_compatible(wmi_abi_version *vers1, wmi_abi_version *vers2)
|
||||
@@ -1008,9 +1124,17 @@ wmi_versions_are_compatible(wmi_abi_version *vers1, wmi_abi_version *vers2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if the two given versions are compatible.
|
||||
* Else return 0 if Incompatible.
|
||||
/**
|
||||
* wmi_versions_can_downgrade() - tlv helper function
|
||||
* @version_whitelist_table: version table
|
||||
* @my_vers: host version
|
||||
* @opp_vers: target version
|
||||
* @out_vers: downgraded version
|
||||
*
|
||||
*
|
||||
* check if target wmi version can be downgraded
|
||||
*
|
||||
* Return: 0 if success. Return < 0 if failure.
|
||||
*/
|
||||
int
|
||||
wmi_versions_can_downgrade(int num_whitelist,
|
||||
@@ -1111,13 +1235,21 @@ wmi_versions_can_downgrade(int num_whitelist,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* wmi_cmp_and_set_abi_version() - tlv helper function
|
||||
* @version_whitelist_table: version table
|
||||
* @my_vers: host version
|
||||
* @opp_vers: target version
|
||||
* @out_vers: downgraded version
|
||||
*
|
||||
* This routine will compare and set the WMI ABI version.
|
||||
* First, compare my version with the opposite side's version.
|
||||
* If incompatible, then check the whitelist to see if our side can downgrade.
|
||||
* Finally, fill in the final ABI version into the output, out_vers.
|
||||
* Return 0 if the output version is compatible .
|
||||
* Else return 1 if the output version is incompatible. .
|
||||
* Return 0 if the output version is compatible
|
||||
* Else return 1 if the output version is incompatible
|
||||
*
|
||||
* Return: 0 if the output version is compatible else < 0.
|
||||
*/
|
||||
int
|
||||
wmi_cmp_and_set_abi_version(int num_whitelist,
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||
*
|
||||
@@ -36,12 +36,8 @@
|
||||
#include "wmi.h"
|
||||
#include "wma.h"
|
||||
|
||||
/* QCA Main host has dynamic memory allocation and should not define NO_DYNAMIC_MEM_ALLOC */
|
||||
/* #define NO_DYNAMIC_MEM_ALLOC */
|
||||
|
||||
/* Following macro definitions use OS or platform specific functions */
|
||||
/* Following macro definitions use QCA MAIN windows host driver(applicable for Perigrene and its future platforms,
|
||||
Pronto and its future platforms) specific APIs */
|
||||
#define dummy_print(fmt, ...) {}
|
||||
#define wmi_tlv_print_verbose dummy_print
|
||||
#define wmi_tlv_print_error cdf_print
|
@@ -247,77 +247,83 @@ uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle)
|
||||
static uint8_t *get_wmi_cmd_string(WMI_CMD_ID wmi_command)
|
||||
{
|
||||
switch (wmi_command) {
|
||||
/** initialize the wlan sub system */
|
||||
/* initialize the wlan sub system */
|
||||
CASE_RETURN_STRING(WMI_INIT_CMDID);
|
||||
|
||||
/* Scan specific commands */
|
||||
|
||||
/** start scan request to FW */
|
||||
/* start scan request to FW */
|
||||
CASE_RETURN_STRING(WMI_START_SCAN_CMDID);
|
||||
/** stop scan request to FW */
|
||||
/* stop scan request to FW */
|
||||
CASE_RETURN_STRING(WMI_STOP_SCAN_CMDID);
|
||||
/** full list of channels as defined by the regulatory that will be used by scanner */
|
||||
/* full list of channels as defined by the regulatory
|
||||
* that will be used by scanner */
|
||||
CASE_RETURN_STRING(WMI_SCAN_CHAN_LIST_CMDID);
|
||||
/** overwrite default priority table in scan scheduler */
|
||||
/* overwrite default priority table in scan scheduler */
|
||||
CASE_RETURN_STRING(WMI_SCAN_SCH_PRIO_TBL_CMDID);
|
||||
/** This command to adjust the priority and min.max_rest_time
|
||||
/* This command to adjust the priority and min.max_rest_time
|
||||
* of an on ongoing scan request.
|
||||
*/
|
||||
CASE_RETURN_STRING(WMI_SCAN_UPDATE_REQUEST_CMDID);
|
||||
|
||||
/* PDEV(physical device) specific commands */
|
||||
/** set regulatorty ctl id used by FW to determine the exact ctl power limits */
|
||||
/* set regulatorty ctl id used by FW to determine the exact
|
||||
* ctl power limits */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SET_REGDOMAIN_CMDID);
|
||||
/** set channel. mainly used for supporting monitor mode */
|
||||
/* set channel. mainly used for supporting monitor mode */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SET_CHANNEL_CMDID);
|
||||
/** set pdev specific parameters */
|
||||
/* set pdev specific parameters */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SET_PARAM_CMDID);
|
||||
/** enable packet log */
|
||||
/* enable packet log */
|
||||
CASE_RETURN_STRING(WMI_PDEV_PKTLOG_ENABLE_CMDID);
|
||||
/** disable packet log*/
|
||||
/* disable packet log*/
|
||||
CASE_RETURN_STRING(WMI_PDEV_PKTLOG_DISABLE_CMDID);
|
||||
/** set wmm parameters */
|
||||
/* set wmm parameters */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SET_WMM_PARAMS_CMDID);
|
||||
/** set HT cap ie that needs to be carried probe requests HT/VHT channels */
|
||||
/* set HT cap ie that needs to be carried probe requests
|
||||
* HT/VHT channels */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SET_HT_CAP_IE_CMDID);
|
||||
/** set VHT cap ie that needs to be carried on probe requests on VHT channels */
|
||||
/* set VHT cap ie that needs to be carried on probe
|
||||
* requests on VHT channels */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SET_VHT_CAP_IE_CMDID);
|
||||
|
||||
/** Command to send the DSCP-to-TID map to the target */
|
||||
/* Command to send the DSCP-to-TID map to the target */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SET_DSCP_TID_MAP_CMDID);
|
||||
/** set quiet ie parameters. primarily used in AP mode */
|
||||
/* set quiet ie parameters. primarily used in AP mode */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SET_QUIET_MODE_CMDID);
|
||||
/** Enable/Disable Green AP Power Save */
|
||||
/* Enable/Disable Green AP Power Save */
|
||||
CASE_RETURN_STRING(WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID);
|
||||
/** get TPC config for the current operating channel */
|
||||
/* get TPC config for the current operating channel */
|
||||
CASE_RETURN_STRING(WMI_PDEV_GET_TPC_CONFIG_CMDID);
|
||||
|
||||
/** set the base MAC address for the physical device before a VDEV is created.
|
||||
* For firmware that doesn’t support this feature and this command, the pdev
|
||||
* MAC address will not be changed. */
|
||||
/* set the base MAC address for the physical device before
|
||||
* a VDEV is created. For firmware that does not support
|
||||
* this feature and this command, the pdev MAC address will
|
||||
* not be changed. */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SET_BASE_MACADDR_CMDID);
|
||||
|
||||
/* eeprom content dump , the same to bdboard data */
|
||||
CASE_RETURN_STRING(WMI_PDEV_DUMP_CMDID);
|
||||
|
||||
/* VDEV(virtual device) specific commands */
|
||||
/** vdev create */
|
||||
/* vdev create */
|
||||
CASE_RETURN_STRING(WMI_VDEV_CREATE_CMDID);
|
||||
/** vdev delete */
|
||||
/* vdev delete */
|
||||
CASE_RETURN_STRING(WMI_VDEV_DELETE_CMDID);
|
||||
/** vdev start request */
|
||||
/* vdev start request */
|
||||
CASE_RETURN_STRING(WMI_VDEV_START_REQUEST_CMDID);
|
||||
/** vdev restart request (RX only, NO TX, used for CAC period)*/
|
||||
/* vdev restart request (RX only, NO TX, used for CAC period)*/
|
||||
CASE_RETURN_STRING(WMI_VDEV_RESTART_REQUEST_CMDID);
|
||||
/** vdev up request */
|
||||
/* vdev up request */
|
||||
CASE_RETURN_STRING(WMI_VDEV_UP_CMDID);
|
||||
/** vdev stop request */
|
||||
/* vdev stop request */
|
||||
CASE_RETURN_STRING(WMI_VDEV_STOP_CMDID);
|
||||
/** vdev down request */
|
||||
/* vdev down request */
|
||||
CASE_RETURN_STRING(WMI_VDEV_DOWN_CMDID);
|
||||
/* set a vdev param */
|
||||
CASE_RETURN_STRING(WMI_VDEV_SET_PARAM_CMDID);
|
||||
/* set a key (used for setting per peer unicast and per vdev multicast) */
|
||||
/* set a key (used for setting per peer unicast
|
||||
* and per vdev multicast) */
|
||||
CASE_RETURN_STRING(WMI_VDEV_INSTALL_KEY_CMDID);
|
||||
|
||||
/* wnm sleep mode command */
|
||||
@@ -343,217 +349,229 @@ static uint8_t *get_wmi_cmd_string(WMI_CMD_ID wmi_command)
|
||||
CASE_RETURN_STRING(WMI_PEER_FLUSH_TIDS_CMDID);
|
||||
/** set a parameter of a peer */
|
||||
CASE_RETURN_STRING(WMI_PEER_SET_PARAM_CMDID);
|
||||
/** set peer to associated state. will cary all parameters determined during assocication time */
|
||||
/* set peer to associated state. will cary all parameters
|
||||
* determined during assocication time */
|
||||
CASE_RETURN_STRING(WMI_PEER_ASSOC_CMDID);
|
||||
/**add a wds (4 address ) entry. used only for testing WDS feature on AP products */
|
||||
/* add a wds (4 address ) entry. used only for testing
|
||||
* WDS feature on AP products */
|
||||
CASE_RETURN_STRING(WMI_PEER_ADD_WDS_ENTRY_CMDID);
|
||||
/**remove wds (4 address ) entry. used only for testing WDS feature on AP products */
|
||||
/* remove wds (4 address ) entry. used only for testing WDS
|
||||
* feature on AP products */
|
||||
CASE_RETURN_STRING(WMI_PEER_REMOVE_WDS_ENTRY_CMDID);
|
||||
/** set up mcast group infor for multicast to unicast conversion */
|
||||
/* set up mcast info for multicast to unicast conversion */
|
||||
CASE_RETURN_STRING(WMI_PEER_MCAST_GROUP_CMDID);
|
||||
/** request peer info from FW. FW shall respond with PEER_INFO_EVENTID */
|
||||
/* request peer info from FW to get PEER_INFO_EVENTID */
|
||||
CASE_RETURN_STRING(WMI_PEER_INFO_REQ_CMDID);
|
||||
|
||||
/* beacon/management specific commands */
|
||||
|
||||
/** transmit beacon by reference . used for transmitting beacon on low latency interface like pcie */
|
||||
/* transmit beacon by reference. used for transmitting beacon
|
||||
* on low latency interface like pcie */
|
||||
CASE_RETURN_STRING(WMI_BCN_TX_CMDID);
|
||||
/** transmit beacon by value */
|
||||
/* transmit beacon by value */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SEND_BCN_CMDID);
|
||||
/** set the beacon template. used in beacon offload mode to setup the
|
||||
* the common beacon template with the FW to be used by FW to generate beacons */
|
||||
/* set the beacon template. used in beacon offload mode to setup
|
||||
* the common beacon template with the FW to be used by FW to
|
||||
* generate beacons */
|
||||
CASE_RETURN_STRING(WMI_BCN_TMPL_CMDID);
|
||||
/** set beacon filter with FW */
|
||||
/* set beacon filter with FW */
|
||||
CASE_RETURN_STRING(WMI_BCN_FILTER_RX_CMDID);
|
||||
/* enable/disable filtering of probe requests in the firmware */
|
||||
CASE_RETURN_STRING(WMI_PRB_REQ_FILTER_RX_CMDID);
|
||||
/** transmit management frame by value. will be deprecated */
|
||||
/* transmit management frame by value. will be deprecated */
|
||||
CASE_RETURN_STRING(WMI_MGMT_TX_CMDID);
|
||||
/** set the probe response template. used in beacon offload mode to setup the
|
||||
* the common probe response template with the FW to be used by FW to generate
|
||||
* probe responses */
|
||||
/* set the probe response template. used in beacon offload mode
|
||||
* to setup the common probe response template with the FW to
|
||||
* be used by FW to generate probe responses */
|
||||
CASE_RETURN_STRING(WMI_PRB_TMPL_CMDID);
|
||||
|
||||
/** commands to directly control ba negotiation directly from host. only used in test mode */
|
||||
/* commands to directly control ba negotiation directly from
|
||||
* host. only used in test mode */
|
||||
|
||||
/** turn off FW Auto addba mode and let host control addba */
|
||||
/* turn off FW Auto addba mode and let host control addba */
|
||||
CASE_RETURN_STRING(WMI_ADDBA_CLEAR_RESP_CMDID);
|
||||
/** send add ba request */
|
||||
/* send add ba request */
|
||||
CASE_RETURN_STRING(WMI_ADDBA_SEND_CMDID);
|
||||
CASE_RETURN_STRING(WMI_ADDBA_STATUS_CMDID);
|
||||
/** send del ba */
|
||||
/* send del ba */
|
||||
CASE_RETURN_STRING(WMI_DELBA_SEND_CMDID);
|
||||
/** set add ba response will be used by FW to generate addba response*/
|
||||
/* set add ba response will be used by FW to generate
|
||||
* addba response*/
|
||||
CASE_RETURN_STRING(WMI_ADDBA_SET_RESP_CMDID);
|
||||
/** send single VHT MPDU with AMSDU */
|
||||
/* send single VHT MPDU with AMSDU */
|
||||
CASE_RETURN_STRING(WMI_SEND_SINGLEAMSDU_CMDID);
|
||||
|
||||
/** Station power save specific config */
|
||||
/** enable/disable station powersave */
|
||||
/* Station power save specific config */
|
||||
/* enable/disable station powersave */
|
||||
CASE_RETURN_STRING(WMI_STA_POWERSAVE_MODE_CMDID);
|
||||
/** set station power save specific parameter */
|
||||
/* set station power save specific parameter */
|
||||
CASE_RETURN_STRING(WMI_STA_POWERSAVE_PARAM_CMDID);
|
||||
/** set station mimo powersave mode */
|
||||
/* set station mimo powersave mode */
|
||||
CASE_RETURN_STRING(WMI_STA_MIMO_PS_MODE_CMDID);
|
||||
|
||||
/** DFS-specific commands */
|
||||
/** enable DFS (radar detection)*/
|
||||
/* DFS-specific commands */
|
||||
/* enable DFS (radar detection)*/
|
||||
CASE_RETURN_STRING(WMI_PDEV_DFS_ENABLE_CMDID);
|
||||
/** disable DFS (radar detection)*/
|
||||
/* disable DFS (radar detection)*/
|
||||
CASE_RETURN_STRING(WMI_PDEV_DFS_DISABLE_CMDID);
|
||||
/** enable DFS phyerr/parse filter offload */
|
||||
/* enable DFS phyerr/parse filter offload */
|
||||
CASE_RETURN_STRING(WMI_DFS_PHYERR_FILTER_ENA_CMDID);
|
||||
/** enable DFS phyerr/parse filter offload */
|
||||
/* enable DFS phyerr/parse filter offload */
|
||||
CASE_RETURN_STRING(WMI_DFS_PHYERR_FILTER_DIS_CMDID);
|
||||
|
||||
/* Roaming specific commands */
|
||||
/** set roam scan mode */
|
||||
/* set roam scan mode */
|
||||
CASE_RETURN_STRING(WMI_ROAM_SCAN_MODE);
|
||||
/** set roam scan rssi threshold below which roam scan is enabled */
|
||||
/* set roam scan rssi threshold below which roam
|
||||
* scan is enabled */
|
||||
CASE_RETURN_STRING(WMI_ROAM_SCAN_RSSI_THRESHOLD);
|
||||
/** set roam scan period for periodic roam scan mode */
|
||||
/* set roam scan period for periodic roam scan mode */
|
||||
CASE_RETURN_STRING(WMI_ROAM_SCAN_PERIOD);
|
||||
/** set roam scan trigger rssi change threshold */
|
||||
/* set roam scan trigger rssi change threshold */
|
||||
CASE_RETURN_STRING(WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD);
|
||||
/** set roam AP profile */
|
||||
/* set roam AP profile */
|
||||
CASE_RETURN_STRING(WMI_ROAM_AP_PROFILE);
|
||||
/** set channel list for roam scans */
|
||||
/* set channel list for roam scans */
|
||||
CASE_RETURN_STRING(WMI_ROAM_CHAN_LIST);
|
||||
/** offload scan specific commands */
|
||||
/** set offload scan AP profile */
|
||||
/* offload scan specific commands */
|
||||
/* set offload scan AP profile */
|
||||
CASE_RETURN_STRING(WMI_OFL_SCAN_ADD_AP_PROFILE);
|
||||
/** remove offload scan AP profile */
|
||||
/* remove offload scan AP profile */
|
||||
CASE_RETURN_STRING(WMI_OFL_SCAN_REMOVE_AP_PROFILE);
|
||||
/** set offload scan period */
|
||||
/* set offload scan period */
|
||||
CASE_RETURN_STRING(WMI_OFL_SCAN_PERIOD);
|
||||
|
||||
/* P2P specific commands */
|
||||
/**set P2P device info. FW will used by FW to create P2P IE to be carried in probe response
|
||||
* generated during p2p listen and for p2p discoverability */
|
||||
/* set P2P device info. FW will used by FW to create P2P IE
|
||||
* to be carried in probe response generated during p2p listen
|
||||
* and for p2p discoverability */
|
||||
CASE_RETURN_STRING(WMI_P2P_DEV_SET_DEVICE_INFO);
|
||||
/** enable/disable p2p discoverability on STA/AP VDEVs */
|
||||
/* enable/disable p2p discoverability on STA/AP VDEVs */
|
||||
CASE_RETURN_STRING(WMI_P2P_DEV_SET_DISCOVERABILITY);
|
||||
/** set p2p ie to be carried in beacons generated by FW for GO */
|
||||
/* set p2p ie to be carried in beacons generated by FW for GO */
|
||||
CASE_RETURN_STRING(WMI_P2P_GO_SET_BEACON_IE);
|
||||
/** set p2p ie to be carried in probe response frames generated by FW for GO */
|
||||
/* set p2p ie to be carried in probe response frames generated
|
||||
* by FW for GO */
|
||||
CASE_RETURN_STRING(WMI_P2P_GO_SET_PROBE_RESP_IE);
|
||||
/** set the vendor specific p2p ie data. FW will use this to parse the P2P NoA
|
||||
/* set the vendor specific p2p ie data.
|
||||
* FW will use this to parse the P2P NoA
|
||||
* attribute in the beacons/probe responses received.
|
||||
*/
|
||||
CASE_RETURN_STRING(WMI_P2P_SET_VENDOR_IE_DATA_CMDID);
|
||||
/** set the configure of p2p find offload */
|
||||
/* set the configure of p2p find offload */
|
||||
CASE_RETURN_STRING(WMI_P2P_DISC_OFFLOAD_CONFIG_CMDID);
|
||||
/** set the vendor specific p2p ie data for p2p find offload using */
|
||||
/* set the vendor specific p2p ie data for p2p find offload */
|
||||
CASE_RETURN_STRING(WMI_P2P_DISC_OFFLOAD_APPIE_CMDID);
|
||||
/** set the BSSID/device name pattern of p2p find offload */
|
||||
/* set the BSSID/device name pattern of p2p find offload */
|
||||
CASE_RETURN_STRING(WMI_P2P_DISC_OFFLOAD_PATTERN_CMDID);
|
||||
/** set OppPS related parameters **/
|
||||
/* set OppPS related parameters **/
|
||||
CASE_RETURN_STRING(WMI_P2P_SET_OPPPS_PARAM_CMDID);
|
||||
|
||||
/** AP power save specific config */
|
||||
/** set AP power save specific param */
|
||||
/* AP power save specific config
|
||||
* set AP power save specific param */
|
||||
CASE_RETURN_STRING(WMI_AP_PS_PEER_PARAM_CMDID);
|
||||
/** set AP UAPSD coex pecific param */
|
||||
/* set AP UAPSD coex pecific param */
|
||||
CASE_RETURN_STRING(WMI_AP_PS_PEER_UAPSD_COEX_CMDID);
|
||||
|
||||
/** Rate-control specific commands */
|
||||
/* Rate-control specific commands */
|
||||
CASE_RETURN_STRING(WMI_PEER_RATE_RETRY_SCHED_CMDID);
|
||||
|
||||
/** WLAN Profiling commands. */
|
||||
/* WLAN Profiling commands. */
|
||||
CASE_RETURN_STRING(WMI_WLAN_PROFILE_TRIGGER_CMDID);
|
||||
CASE_RETURN_STRING(WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID);
|
||||
CASE_RETURN_STRING(WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID);
|
||||
CASE_RETURN_STRING(WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID);
|
||||
CASE_RETURN_STRING(WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID);
|
||||
|
||||
/** Suspend resume command Ids */
|
||||
/* Suspend resume command Ids */
|
||||
CASE_RETURN_STRING(WMI_PDEV_SUSPEND_CMDID);
|
||||
CASE_RETURN_STRING(WMI_PDEV_RESUME_CMDID);
|
||||
|
||||
/* Beacon filter commands */
|
||||
/** add a beacon filter */
|
||||
/* add a beacon filter */
|
||||
CASE_RETURN_STRING(WMI_ADD_BCN_FILTER_CMDID);
|
||||
/** remove a beacon filter */
|
||||
/* remove a beacon filter */
|
||||
CASE_RETURN_STRING(WMI_RMV_BCN_FILTER_CMDID);
|
||||
|
||||
/* WOW Specific WMI commands */
|
||||
/** add pattern for awake */
|
||||
/* add pattern for awake */
|
||||
CASE_RETURN_STRING(WMI_WOW_ADD_WAKE_PATTERN_CMDID);
|
||||
/** deleta a wake pattern */
|
||||
/* deleta a wake pattern */
|
||||
CASE_RETURN_STRING(WMI_WOW_DEL_WAKE_PATTERN_CMDID);
|
||||
/** enable/deisable wake event */
|
||||
/* enable/deisable wake event */
|
||||
CASE_RETURN_STRING(WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID);
|
||||
/** enable WOW */
|
||||
/* enable WOW */
|
||||
CASE_RETURN_STRING(WMI_WOW_ENABLE_CMDID);
|
||||
/** host woke up from sleep event to FW. Generated in response to WOW Hardware event */
|
||||
/* host woke up from sleep event to FW. Generated in response
|
||||
* to WOW Hardware event */
|
||||
CASE_RETURN_STRING(WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID);
|
||||
|
||||
/* RTT measurement related cmd */
|
||||
/** reques to make an RTT measurement */
|
||||
/* reques to make an RTT measurement */
|
||||
CASE_RETURN_STRING(WMI_RTT_MEASREQ_CMDID);
|
||||
/** reques to report a tsf measurement */
|
||||
/* reques to report a tsf measurement */
|
||||
CASE_RETURN_STRING(WMI_RTT_TSF_CMDID);
|
||||
|
||||
/** spectral scan command */
|
||||
/** configure spectral scan */
|
||||
/* spectral scan command */
|
||||
/* configure spectral scan */
|
||||
CASE_RETURN_STRING(WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID);
|
||||
/** enable/disable spectral scan and trigger */
|
||||
/* enable/disable spectral scan and trigger */
|
||||
CASE_RETURN_STRING(WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID);
|
||||
|
||||
/* F/W stats */
|
||||
/** one time request for stats */
|
||||
/* one time request for stats */
|
||||
CASE_RETURN_STRING(WMI_REQUEST_STATS_CMDID);
|
||||
/** Push MCC Adaptive Scheduler Stats to Firmware */
|
||||
/* Push MCC Adaptive Scheduler Stats to Firmware */
|
||||
CASE_RETURN_STRING(WMI_MCC_SCHED_TRAFFIC_STATS_CMDID);
|
||||
|
||||
/** ARP OFFLOAD REQUEST*/
|
||||
/* ARP OFFLOAD REQUEST*/
|
||||
CASE_RETURN_STRING(WMI_SET_ARP_NS_OFFLOAD_CMDID);
|
||||
|
||||
/** Proactive ARP Response Add Pattern Command*/
|
||||
/* Proactive ARP Response Add Pattern Command*/
|
||||
CASE_RETURN_STRING(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID);
|
||||
|
||||
/** Proactive ARP Response Del Pattern Command*/
|
||||
/* Proactive ARP Response Del Pattern Command*/
|
||||
CASE_RETURN_STRING(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID);
|
||||
|
||||
/** NS offload confid*/
|
||||
/* NS offload confid*/
|
||||
CASE_RETURN_STRING(WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID);
|
||||
|
||||
/* GTK offload Specific WMI commands */
|
||||
CASE_RETURN_STRING(WMI_GTK_OFFLOAD_CMDID);
|
||||
|
||||
/* CSA offload Specific WMI commands */
|
||||
/** csa offload enable */
|
||||
/* csa offload enable */
|
||||
CASE_RETURN_STRING(WMI_CSA_OFFLOAD_ENABLE_CMDID);
|
||||
/** chan switch command */
|
||||
/* chan switch command */
|
||||
CASE_RETURN_STRING(WMI_CSA_OFFLOAD_CHANSWITCH_CMDID);
|
||||
|
||||
/* Chatter commands */
|
||||
/* Change chatter mode of operation */
|
||||
CASE_RETURN_STRING(WMI_CHATTER_SET_MODE_CMDID);
|
||||
/** chatter add coalescing filter command */
|
||||
/* chatter add coalescing filter command */
|
||||
CASE_RETURN_STRING(WMI_CHATTER_ADD_COALESCING_FILTER_CMDID);
|
||||
/** chatter delete coalescing filter command */
|
||||
/* chatter delete coalescing filter command */
|
||||
CASE_RETURN_STRING(WMI_CHATTER_DELETE_COALESCING_FILTER_CMDID);
|
||||
/** chatter coalecing query command */
|
||||
/* chatter coalecing query command */
|
||||
CASE_RETURN_STRING(WMI_CHATTER_COALESCING_QUERY_CMDID);
|
||||
|
||||
/**addba specific commands */
|
||||
/** start the aggregation on this TID */
|
||||
/* addba specific commands */
|
||||
/* start the aggregation on this TID */
|
||||
CASE_RETURN_STRING(WMI_PEER_TID_ADDBA_CMDID);
|
||||
/** stop the aggregation on this TID */
|
||||
/* stop the aggregation on this TID */
|
||||
CASE_RETURN_STRING(WMI_PEER_TID_DELBA_CMDID);
|
||||
|
||||
/** set station mimo powersave method */
|
||||
/* set station mimo powersave method */
|
||||
CASE_RETURN_STRING(WMI_STA_DTIM_PS_METHOD_CMDID);
|
||||
/** Configure the Station UAPSD AC Auto Trigger Parameters */
|
||||
/* Configure the Station UAPSD AC Auto Trigger Parameters */
|
||||
CASE_RETURN_STRING(WMI_STA_UAPSD_AUTO_TRIG_CMDID);
|
||||
/** Configure the Keep Alive Parameters */
|
||||
/* Configure the Keep Alive Parameters */
|
||||
CASE_RETURN_STRING(WMI_STA_KEEPALIVE_CMDID);
|
||||
|
||||
/* Request ssn from target for a sta/tid pair */
|
||||
CASE_RETURN_STRING(WMI_BA_REQ_SSN_CMDID);
|
||||
/* misc command group */
|
||||
/** echo command mainly used for testing */
|
||||
/* echo command mainly used for testing */
|
||||
CASE_RETURN_STRING(WMI_ECHO_CMDID);
|
||||
|
||||
/* !!IMPORTANT!!
|
||||
@@ -579,7 +597,7 @@ static uint8_t *get_wmi_cmd_string(WMI_CMD_ID wmi_command)
|
||||
CASE_RETURN_STRING(WMI_FORCE_FW_HANG_CMDID);
|
||||
/* Set Mcast/Bdcast filter */
|
||||
CASE_RETURN_STRING(WMI_SET_MCASTBCAST_FILTER_CMDID);
|
||||
/** set thermal management params **/
|
||||
/* set thermal management params */
|
||||
CASE_RETURN_STRING(WMI_THERMAL_MGMT_CMDID);
|
||||
CASE_RETURN_STRING(WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID);
|
||||
CASE_RETURN_STRING(WMI_LRO_CONFIG_CMDID);
|
||||
@@ -597,30 +615,30 @@ static uint8_t *get_wmi_cmd_string(WMI_CMD_ID wmi_command)
|
||||
|
||||
/* FWTEST Commands */
|
||||
CASE_RETURN_STRING(WMI_FWTEST_VDEV_MCC_SET_TBTT_MODE_CMDID);
|
||||
/** set NoA descs **/
|
||||
/* set NoA descs */
|
||||
CASE_RETURN_STRING(WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID);
|
||||
|
||||
/** TDLS Configuration */
|
||||
/** enable/disable TDLS */
|
||||
/* TDLS Configuration */
|
||||
/* enable/disable TDLS */
|
||||
CASE_RETURN_STRING(WMI_TDLS_SET_STATE_CMDID);
|
||||
/** set tdls peer state */
|
||||
/* set tdls peer state */
|
||||
CASE_RETURN_STRING(WMI_TDLS_PEER_UPDATE_CMDID);
|
||||
|
||||
/** Resmgr Configuration */
|
||||
/** Adaptive OCS is enabled by default in the FW. This command is used to
|
||||
* disable FW based adaptive OCS.
|
||||
/* Resmgr Configuration */
|
||||
/* Adaptive OCS is enabled by default in the FW.
|
||||
* This command is used to disable FW based adaptive OCS.
|
||||
*/
|
||||
CASE_RETURN_STRING
|
||||
(WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID);
|
||||
/** set the requested channel time quota for the home channels */
|
||||
/* set the requested channel time quota for the home channels */
|
||||
CASE_RETURN_STRING(WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID);
|
||||
/** set the requested latency for the home channels */
|
||||
/* set the requested latency for the home channels */
|
||||
CASE_RETURN_STRING(WMI_RESMGR_SET_CHAN_LATENCY_CMDID);
|
||||
|
||||
/** STA SMPS Configuration */
|
||||
/** force SMPS mode */
|
||||
/* STA SMPS Configuration */
|
||||
/* force SMPS mode */
|
||||
CASE_RETURN_STRING(WMI_STA_SMPS_FORCE_MODE_CMDID);
|
||||
/** set SMPS parameters */
|
||||
/* set SMPS parameters */
|
||||
CASE_RETURN_STRING(WMI_STA_SMPS_PARAM_CMDID);
|
||||
|
||||
/* Wlan HB commands */
|
||||
@@ -635,19 +653,19 @@ static uint8_t *get_wmi_cmd_string(WMI_CMD_ID wmi_command)
|
||||
/* set udp pkt filter for wlan HB */
|
||||
CASE_RETURN_STRING(WMI_HB_SET_UDP_PKT_FILTER_CMDID);
|
||||
|
||||
/** Wlan RMC commands*/
|
||||
/** enable/disable RMC */
|
||||
/* Wlan RMC commands*/
|
||||
/* enable/disable RMC */
|
||||
CASE_RETURN_STRING(WMI_RMC_SET_MODE_CMDID);
|
||||
/** configure action frame period */
|
||||
/* configure action frame period */
|
||||
CASE_RETURN_STRING(WMI_RMC_SET_ACTION_PERIOD_CMDID);
|
||||
/** For debug/future enhancement purposes only,
|
||||
/* For debug/future enhancement purposes only,
|
||||
* configures/finetunes RMC algorithms */
|
||||
CASE_RETURN_STRING(WMI_RMC_CONFIG_CMDID);
|
||||
|
||||
/** WLAN MHF offload commands */
|
||||
/* WLAN MHF offload commands */
|
||||
/** enable/disable MHF offload */
|
||||
CASE_RETURN_STRING(WMI_MHF_OFFLOAD_SET_MODE_CMDID);
|
||||
/** Plumb routing table for MHF offload */
|
||||
/* Plumb routing table for MHF offload */
|
||||
CASE_RETURN_STRING(WMI_MHF_OFFLOAD_PLUMB_ROUTING_TBL_CMDID);
|
||||
|
||||
/* location scan commands */
|
||||
@@ -749,6 +767,7 @@ static uint8_t *get_wmi_cmd_string(WMI_CMD_ID wmi_command)
|
||||
CASE_RETURN_STRING(WMI_BPF_DEL_VDEV_INSTRUCTIONS_CMDID);
|
||||
|
||||
}
|
||||
|
||||
return "Invalid WMI cmd";
|
||||
}
|
||||
|
||||
@@ -790,14 +809,20 @@ bool wmi_is_runtime_pm_cmd(WMI_CMD_ID cmd_id)
|
||||
}
|
||||
}
|
||||
|
||||
/* WMI command API */
|
||||
/**
|
||||
* wmi_unified_cmd_send() - WMI command API
|
||||
* @wmi_handle: handle to wmi
|
||||
* @buf: wmi buf
|
||||
* @len: wmi buffer length
|
||||
* @cmd_id: wmi command id
|
||||
*
|
||||
* Return: 0 on success
|
||||
*/
|
||||
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;
|
||||
struct ol_softc *scn;
|
||||
uint16_t htc_tag = 0;
|
||||
|
||||
if (wmi_get_runtime_pm_inprogress(wmi_handle)) {
|
||||
if (wmi_is_runtime_pm_cmd(cmd_id))
|
||||
@@ -805,7 +830,7 @@ int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int len,
|
||||
} else if (cdf_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\n",
|
||||
cdf_print("%s: Target is suspended could not send WMI command \n",
|
||||
__func__);
|
||||
CDF_ASSERT(0);
|
||||
return -EBUSY;
|
||||
@@ -818,9 +843,9 @@ int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int len,
|
||||
if (wmitlv_check_command_tlv_params(NULL, buf_ptr, len, cmd_id)
|
||||
!= 0) {
|
||||
cdf_print
|
||||
("\nERROR: %s: Invalid WMI Parameter Buffer for Cmd:%d\n",
|
||||
("\nERROR: %s: Invalid WMI Param Buffer for Cmd:%d\n",
|
||||
__func__, cmd_id);
|
||||
return -1;
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -834,12 +859,9 @@ int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int len,
|
||||
|
||||
cdf_atomic_inc(&wmi_handle->pending_cmds);
|
||||
if (cdf_atomic_read(&wmi_handle->pending_cmds) >= WMI_MAX_CMDS) {
|
||||
scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
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); */
|
||||
cdf_atomic_dec(&wmi_handle->pending_cmds);
|
||||
pr_err("%s: MAX 1024 WMI Pending cmds reached.\n", __func__);
|
||||
CDF_BUG(0);
|
||||
@@ -857,7 +879,6 @@ int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int len,
|
||||
SET_HTC_PACKET_INFO_TX(pkt,
|
||||
NULL,
|
||||
cdf_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);
|
||||
@@ -884,15 +905,24 @@ int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int len,
|
||||
cdf_atomic_dec(&wmi_handle->pending_cmds);
|
||||
pr_err("%s %d, htc_send_pkt failed\n", __func__, __LINE__);
|
||||
}
|
||||
if (status)
|
||||
return CDF_STATUS_E_FAILURE;
|
||||
|
||||
return ((status == A_OK) ? EOK : -1);
|
||||
return CDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* WMI Event handler register API */
|
||||
/**
|
||||
* wmi_unified_get_event_handler_ix() - gives event handler's index
|
||||
* @wmi_handle: handle to wmi
|
||||
* @event_id: wmi event id
|
||||
*
|
||||
* Return: event handler's index
|
||||
*/
|
||||
int wmi_unified_get_event_handler_ix(wmi_unified_t wmi_handle,
|
||||
WMI_EVT_ID event_id)
|
||||
{
|
||||
uint32_t idx = 0;
|
||||
int32_t invalid_idx = -1;
|
||||
for (idx = 0; (idx < wmi_handle->max_event_idx &&
|
||||
idx < WMI_UNIFIED_MAX_EVENT); ++idx) {
|
||||
if (wmi_handle->event_id[idx] == event_id &&
|
||||
@@ -900,9 +930,18 @@ int wmi_unified_get_event_handler_ix(wmi_unified_t wmi_handle,
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
return invalid_idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_unified_register_event_handler() - register wmi event handler
|
||||
* @wmi_handle: handle to wmi
|
||||
* @event_id: wmi event id
|
||||
* @handler_func: wmi event handler function
|
||||
*
|
||||
* Return: 0 on success
|
||||
*/
|
||||
int wmi_unified_register_event_handler(wmi_unified_t wmi_handle,
|
||||
WMI_EVT_ID event_id,
|
||||
wmi_unified_event_handler handler_func)
|
||||
@@ -910,31 +949,40 @@ int wmi_unified_register_event_handler(wmi_unified_t wmi_handle,
|
||||
uint32_t idx = 0;
|
||||
|
||||
if (wmi_unified_get_event_handler_ix(wmi_handle, event_id) != -1) {
|
||||
printk("%s : event handler already registered 0x%x \n",
|
||||
cdf_print("%s : event handler already registered 0x%x \n",
|
||||
__func__, event_id);
|
||||
return -1;
|
||||
return CDF_STATUS_E_FAILURE;
|
||||
}
|
||||
if (wmi_handle->max_event_idx == WMI_UNIFIED_MAX_EVENT) {
|
||||
printk("%s : no more event handlers 0x%x \n",
|
||||
cdf_print("%s : no more event handlers 0x%x \n",
|
||||
__func__, event_id);
|
||||
return -1;
|
||||
return CDF_STATUS_E_FAILURE;
|
||||
}
|
||||
idx = wmi_handle->max_event_idx;
|
||||
wmi_handle->event_handler[idx] = handler_func;
|
||||
wmi_handle->event_id[idx] = event_id;
|
||||
wmi_handle->max_event_idx++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_unified_unregister_event_handler() - unregister wmi event handler
|
||||
* @wmi_handle: handle to wmi
|
||||
* @event_id: wmi event id
|
||||
*
|
||||
* Return: 0 on success
|
||||
*/
|
||||
int wmi_unified_unregister_event_handler(wmi_unified_t wmi_handle,
|
||||
WMI_EVT_ID event_id)
|
||||
{
|
||||
uint32_t idx = 0;
|
||||
if ((idx =
|
||||
wmi_unified_get_event_handler_ix(wmi_handle, event_id)) == -1) {
|
||||
printk("%s : event handler is not registered: event id 0x%x \n",
|
||||
|
||||
idx = wmi_unified_get_event_handler_ix(wmi_handle, event_id);
|
||||
if (idx == -1) {
|
||||
cdf_print("%s : event handler is not registered: event id 0x%x \n",
|
||||
__func__, event_id);
|
||||
return -1;
|
||||
return CDF_STATUS_E_FAILURE;
|
||||
}
|
||||
wmi_handle->event_handler[idx] = NULL;
|
||||
wmi_handle->event_id[idx] = 0;
|
||||
@@ -943,48 +991,19 @@ int wmi_unified_unregister_event_handler(wmi_unified_t wmi_handle,
|
||||
wmi_handle->event_handler[wmi_handle->max_event_idx];
|
||||
wmi_handle->event_id[idx] =
|
||||
wmi_handle->event_id[wmi_handle->max_event_idx];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0 /* currently not used */
|
||||
static int wmi_unified_event_rx(struct wmi_unified *wmi_handle,
|
||||
wmi_buf_t evt_buf)
|
||||
{
|
||||
uint32_t id;
|
||||
uint8_t *event;
|
||||
uint16_t len;
|
||||
int status = -1;
|
||||
uint32_t idx = 0;
|
||||
|
||||
ASSERT(evt_buf != NULL);
|
||||
|
||||
id = WMI_GET_FIELD(cdf_nbuf_data(evt_buf), WMI_CMD_HDR, COMMANDID);
|
||||
|
||||
if (cdf_nbuf_pull_head(evt_buf, sizeof(WMI_CMD_HDR)) == NULL)
|
||||
goto end;
|
||||
|
||||
idx = wmi_unified_get_event_handler_ix(wmi_handle, id);
|
||||
if (idx == -1) {
|
||||
pr_err("%s : event handler is not registered: event id: 0x%x\n",
|
||||
__func__, id);
|
||||
goto end;
|
||||
}
|
||||
|
||||
event = cdf_nbuf_data(evt_buf);
|
||||
len = cdf_nbuf_len(evt_buf);
|
||||
|
||||
/* Call the WMI registered event handler */
|
||||
status = wmi_handle->event_handler[idx] (wmi_handle->scn_handle,
|
||||
event, len);
|
||||
|
||||
end:
|
||||
cdf_nbuf_free(evt_buf);
|
||||
return status;
|
||||
}
|
||||
#endif /* 0 */
|
||||
/*
|
||||
* Event process by below function will be in tasket context.
|
||||
* Please use this method only for time sensitive functions.
|
||||
/**
|
||||
* wmi_process_fw_event_tasklet_ctx() - process in tasklet context
|
||||
* @wmi_handle: handle to wmi
|
||||
* @htc_packet: pointer to htc packet
|
||||
*
|
||||
* Event process by below function will be in tasket context,
|
||||
* need to use this method only for time sensitive functions.
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void wmi_process_fw_event_tasklet_ctx(struct wmi_unified *wmi_handle,
|
||||
HTC_PACKET *htc_packet)
|
||||
@@ -997,11 +1016,17 @@ static void wmi_process_fw_event_tasklet_ctx(struct wmi_unified *wmi_handle,
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* wmi_process_fw_event_mc_thread_ctx() - process in mc thread context
|
||||
* @wmi_handle: handle to wmi
|
||||
* @htc_packet: pointer to htc packet
|
||||
*
|
||||
* Event process by below function will be in mc_thread context.
|
||||
* By default all event will be executed in mc_thread context.
|
||||
* Use this method for all events which are processed by protocol stack.
|
||||
* This method will reduce context switching and race conditions.
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void wmi_process_fw_event_mc_thread_ctx(struct wmi_unified *wmi_handle,
|
||||
HTC_PACKET *htc_packet)
|
||||
@@ -1013,10 +1038,16 @@ static void wmi_process_fw_event_mc_thread_ctx(struct wmi_unified *wmi_handle,
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* wmi_process_fw_event_worker_thread_ctx() - process in worker thread context
|
||||
* @wmi_handle: handle to wmi
|
||||
* @htc_packet: pointer to htc packet
|
||||
*
|
||||
* Event process by below function will be in worker thread context.
|
||||
* Use this method for events which are not critical and not
|
||||
* handled in protocol stack.
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void wmi_process_fw_event_worker_thread_ctx
|
||||
(struct wmi_unified *wmi_handle, HTC_PACKET *htc_packet)
|
||||
@@ -1040,9 +1071,16 @@ static void wmi_process_fw_event_worker_thread_ctx
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Temporarily added to support older WMI events. We should move all events to unified
|
||||
/**
|
||||
* wmi_control_rx() - process in worker thread context
|
||||
* @ctx: handle to wmi
|
||||
* @htc_packet: pointer to htc packet
|
||||
*
|
||||
* Temporarily added to support older WMI events.
|
||||
* We should move all events to unified
|
||||
* when the target is ready to support it.
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void wmi_control_rx(void *ctx, HTC_PACKET *htc_packet)
|
||||
{
|
||||
@@ -1079,11 +1117,27 @@ void wmi_control_rx(void *ctx, HTC_PACKET *htc_packet)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_process_fw_event() - process any fw event
|
||||
* @wmi_handle: wmi handle
|
||||
* @evt_buf: fw event buffer
|
||||
*
|
||||
* This function process any fw event to serialize it through mc thread.
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void wmi_process_fw_event(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf)
|
||||
{
|
||||
__wmi_control_rx(wmi_handle, evt_buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* __wmi_control_rx() - process serialize wmi event callback
|
||||
* @wmi_handle: wmi handle
|
||||
* @evt_buf: fw event buffer
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void __wmi_control_rx(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf)
|
||||
{
|
||||
uint32_t id;
|
||||
@@ -1123,7 +1177,7 @@ void __wmi_control_rx(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf)
|
||||
|
||||
idx = wmi_unified_get_event_handler_ix(wmi_handle, id);
|
||||
if (idx == -1) {
|
||||
pr_err
|
||||
cdf_print
|
||||
("%s : event handler is not registered: event id 0x%x\n",
|
||||
__func__, id);
|
||||
goto end;
|
||||
@@ -1146,10 +1200,10 @@ void __wmi_control_rx(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf)
|
||||
|
||||
switch (id) {
|
||||
default:
|
||||
pr_info("%s: Unhandled WMI event %d\n", __func__, id);
|
||||
cdf_print("%s: Unhandled WMI event %d\n", __func__, id);
|
||||
break;
|
||||
case WMI_SERVICE_READY_EVENTID:
|
||||
pr_info("%s: WMI UNIFIED SERVICE READY event\n", __func__);
|
||||
cdf_print("%s: WMI UNIFIED SERVICE READY event\n", __func__);
|
||||
wma_rx_service_ready_event(wmi_handle->scn_handle,
|
||||
wmi_cmd_struct_ptr);
|
||||
break;
|
||||
@@ -1160,7 +1214,7 @@ void __wmi_control_rx(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf)
|
||||
wmi_cmd_struct_ptr);
|
||||
break;
|
||||
case WMI_READY_EVENTID:
|
||||
pr_info("%s: WMI UNIFIED READY event\n", __func__);
|
||||
cdf_print("%s: WMI UNIFIED READY event\n", __func__);
|
||||
wma_rx_ready_event(wmi_handle->scn_handle, wmi_cmd_struct_ptr);
|
||||
break;
|
||||
}
|
||||
@@ -1169,6 +1223,14 @@ end:
|
||||
cdf_nbuf_free(evt_buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_rx_event_work() - process rx event in rx work queue context
|
||||
* @work: rx work queue struct
|
||||
*
|
||||
* This function process any fw event to serialize it through rx worker thread.
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void wmi_rx_event_work(struct work_struct *work)
|
||||
{
|
||||
struct wmi_unified *wmi = container_of(work, struct wmi_unified,
|
||||
@@ -1203,15 +1265,25 @@ void wmi_runtime_pm_init(struct wmi_unified *wmi_handle)
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* wmi_unified_attach() - attach for unified WMI
|
||||
*
|
||||
* @param scn_handle : handle to SCN.
|
||||
* @wma_process_fw_event_handler_cbk: rx callbacks
|
||||
*
|
||||
* @Return: wmi handle.
|
||||
*/
|
||||
void *wmi_unified_attach(ol_scn_t scn_handle,
|
||||
wma_process_fw_event_handler_cbk func)
|
||||
{
|
||||
struct wmi_unified *wmi_handle;
|
||||
|
||||
wmi_handle =
|
||||
(struct wmi_unified *)os_malloc(NULL, sizeof(struct wmi_unified),
|
||||
(struct wmi_unified *)os_malloc(NULL,
|
||||
sizeof(struct wmi_unified),
|
||||
GFP_ATOMIC);
|
||||
if (wmi_handle == NULL) {
|
||||
printk("allocation of wmi handle failed %zu \n",
|
||||
cdf_print("allocation of wmi handle failed %zu \n",
|
||||
sizeof(struct wmi_unified));
|
||||
return NULL;
|
||||
}
|
||||
@@ -1231,9 +1303,17 @@ void *wmi_unified_attach(ol_scn_t scn_handle,
|
||||
cdf_spinlock_init(&wmi_handle->wmi_record_lock);
|
||||
#endif
|
||||
wmi_handle->wma_process_fw_event_handler_cbk = func;
|
||||
|
||||
return wmi_handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_unified_detach() - detach for unified WMI
|
||||
*
|
||||
* @wmi_handle : handle to wmi.
|
||||
*
|
||||
* @Return: none.
|
||||
*/
|
||||
void wmi_unified_detach(struct wmi_unified *wmi_handle)
|
||||
{
|
||||
wmi_buf_t buf;
|
||||
@@ -1296,7 +1376,8 @@ void wmi_htc_tx_complete(void *ctx, HTC_PACKET *htc_pkt)
|
||||
WMI_CMD_HDR, COMMANDID);
|
||||
|
||||
#ifdef QCA_WIFI_3_0_EMU
|
||||
printk("\nSent WMI command:%s command_id:0x%x over dma and recieved tx complete interupt\n",
|
||||
cdf_print
|
||||
("\nSent WMI command:%s command_id:0x%x over dma and recieved tx complete interupt\n",
|
||||
get_wmi_cmd_string(cmd_id), cmd_id);
|
||||
#endif
|
||||
|
||||
@@ -1318,6 +1399,13 @@ void wmi_htc_tx_complete(void *ctx, HTC_PACKET *htc_pkt)
|
||||
cdf_atomic_dec(&wmi_handle->pending_cmds);
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_get_host_credits() - WMI API to get updated host_credits
|
||||
*
|
||||
* @wmi_handle: handle to WMI.
|
||||
*
|
||||
* @Return: updated host_credits.
|
||||
*/
|
||||
int
|
||||
wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle,
|
||||
void *htc_handle)
|
||||
@@ -1345,13 +1433,14 @@ wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle,
|
||||
|
||||
/* connect to control service */
|
||||
connect.service_id = WMI_CONTROL_SVC;
|
||||
status = htc_connect_service(htc_handle, &connect,
|
||||
&response);
|
||||
|
||||
if ((status =
|
||||
htc_connect_service(htc_handle, &connect, &response)) != EOK) {
|
||||
printk
|
||||
if (status != EOK) {
|
||||
cdf_print
|
||||
("Failed to connect to WMI CONTROL service status:%d \n",
|
||||
status);
|
||||
return -1;;
|
||||
return status;
|
||||
}
|
||||
wmi_handle->wmi_endpoint_id = response.Endpoint;
|
||||
wmi_handle->htc_handle = htc_handle;
|
||||
@@ -1360,6 +1449,13 @@ wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle,
|
||||
return EOK;
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_get_host_credits() - WMI API to get updated host_credits
|
||||
*
|
||||
* @wmi_handle: handle to WMI.
|
||||
*
|
||||
* @Return: updated host_credits.
|
||||
*/
|
||||
int wmi_get_host_credits(wmi_unified_t wmi_handle)
|
||||
{
|
||||
int host_credits;
|
||||
@@ -1369,11 +1465,26 @@ int wmi_get_host_credits(wmi_unified_t wmi_handle)
|
||||
return host_credits;
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_get_pending_cmds() - WMI API to get WMI Pending Commands in the HTC queue
|
||||
*
|
||||
* @wmi_handle: handle to WMI.
|
||||
*
|
||||
* @Return: Pending Commands in the HTC queue.
|
||||
*/
|
||||
int wmi_get_pending_cmds(wmi_unified_t wmi_handle)
|
||||
{
|
||||
return cdf_atomic_read(&wmi_handle->pending_cmds);
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_set_target_suspend() - WMI API to set target suspend state
|
||||
*
|
||||
* @wmi_handle: handle to WMI.
|
||||
* @val: suspend state boolean.
|
||||
*
|
||||
* @Return: none.
|
||||
*/
|
||||
void wmi_set_target_suspend(wmi_unified_t wmi_handle, A_BOOL val)
|
||||
{
|
||||
cdf_atomic_set(&wmi_handle->is_target_suspended, val);
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||
*
|
||||
@@ -34,5 +34,5 @@
|
||||
*/
|
||||
wmi_whitelist_version_info version_whitelist[] = {
|
||||
{0, 0, 0x5F414351, 0x00004C4D, 0, 0}
|
||||
, /* Placeholder: Major=0, Minor=0, Namespace="QCA_ML" (Dummy entry) */
|
||||
/* Placeholder: Major=0, Minor=0, Namespace="QCA_ML" (Dummy entry) */
|
||||
};
|
Reference in New Issue
Block a user