qcacmn: Add support to send hw_mode in init cmd
Support to add hw_mode in init command is added by FW to let host choose the mode to be use. Change init cmd send API to enable upper layer to send the hw_mode selected. Since this is new TLV in init command, init cmd send API needs to be changed to accommodate this parameter. Change-Id: I172d8d737425599c36666d9fec8a6cdd48085097 CRs-Fixed: 2004652
This commit is contained in:

committed by
qcabuildsw

parent
63987624ef
commit
e77f653463
@@ -1101,9 +1101,7 @@ QDF_STATUS wmi_unified_set_psmode_cmd_send(void *wmi_hdl,
|
|||||||
struct set_ps_mode_params *param);
|
struct set_ps_mode_params *param);
|
||||||
|
|
||||||
QDF_STATUS wmi_unified_init_cmd_send(void *wmi_hdl,
|
QDF_STATUS wmi_unified_init_cmd_send(void *wmi_hdl,
|
||||||
target_resource_config *res_cfg,
|
struct wmi_init_cmd_param *param);
|
||||||
uint8_t num_mem_chunks,
|
|
||||||
struct wmi_host_mem_chunk *mem_chunk);
|
|
||||||
|
|
||||||
bool wmi_service_enabled(void *wmi_hdl, uint32_t service_id);
|
bool wmi_service_enabled(void *wmi_hdl, uint32_t service_id);
|
||||||
|
|
||||||
|
@@ -7090,6 +7090,7 @@ struct wmi_host_ppe_threshold {
|
|||||||
* to be communicated separately.
|
* to be communicated separately.
|
||||||
* @WMI_HOST_HW_MODE_DBS_SBS: 3 PHYs, with 2 on the same band doing SBS
|
* @WMI_HOST_HW_MODE_DBS_SBS: 3 PHYs, with 2 on the same band doing SBS
|
||||||
* as in WMI_HW_MODE_SBS, and 3rd on the other band
|
* as in WMI_HW_MODE_SBS, and 3rd on the other band
|
||||||
|
* @WMI_HOST_HW_MODE_MAX: Max hw_mode_id. Used to indicate invalid mode.
|
||||||
*/
|
*/
|
||||||
enum wmi_host_hw_mode_config_type {
|
enum wmi_host_hw_mode_config_type {
|
||||||
WMI_HOST_HW_MODE_SINGLE = 0,
|
WMI_HOST_HW_MODE_SINGLE = 0,
|
||||||
@@ -7097,6 +7098,7 @@ enum wmi_host_hw_mode_config_type {
|
|||||||
WMI_HOST_HW_MODE_SBS_PASSIVE = 2,
|
WMI_HOST_HW_MODE_SBS_PASSIVE = 2,
|
||||||
WMI_HOST_HW_MODE_SBS = 3,
|
WMI_HOST_HW_MODE_SBS = 3,
|
||||||
WMI_HOST_HW_MODE_DBS_SBS = 4,
|
WMI_HOST_HW_MODE_DBS_SBS = 4,
|
||||||
|
WMI_HOST_HW_MODE_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7393,4 +7395,35 @@ struct wmi_host_proxy_ast_reserve_param {
|
|||||||
uint32_t pdev_id;
|
uint32_t pdev_id;
|
||||||
uint32_t result;
|
uint32_t result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct wmi_host_pdev_band_to_mac - freq range for mac
|
||||||
|
* @pdev_id: PDEV ID to identifiy mac
|
||||||
|
* @start_freq: start frequency value
|
||||||
|
* @end_freq: end frequency value
|
||||||
|
*/
|
||||||
|
struct wmi_host_pdev_band_to_mac {
|
||||||
|
uint32_t pdev_id;
|
||||||
|
uint32_t start_freq;
|
||||||
|
uint32_t end_freq;
|
||||||
|
};
|
||||||
|
#define WMI_HOST_MAX_PDEV 3
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct wmi_init_cmd_param - INIT command params
|
||||||
|
* @target_resource_config: pointer to resource config
|
||||||
|
* @num_mem_chunks: number of memory chunks
|
||||||
|
* @struct wmi_host_mem_chunk: pointer to memory chunks
|
||||||
|
* @hw_mode_index: HW mode index chosen
|
||||||
|
* @num_band_to_mac: Number of band to mac setting
|
||||||
|
* @struct wmi_host_pdev_band_to_mac: band to mac setting
|
||||||
|
*/
|
||||||
|
struct wmi_init_cmd_param {
|
||||||
|
target_resource_config *res_cfg;
|
||||||
|
uint8_t num_mem_chunks;
|
||||||
|
struct wmi_host_mem_chunk *mem_chunks;
|
||||||
|
uint32_t hw_mode_id;
|
||||||
|
uint32_t num_band_to_mac;
|
||||||
|
struct wmi_host_pdev_band_to_mac band_to_mac[WMI_HOST_MAX_PDEV];
|
||||||
|
};
|
||||||
#endif /* _WMI_UNIFIED_PARAM_H_ */
|
#endif /* _WMI_UNIFIED_PARAM_H_ */
|
||||||
|
@@ -923,9 +923,7 @@ host_mem_req * (*extract_host_mem_req)(wmi_unified_t wmi_handle,
|
|||||||
void *evt_buf, uint8_t *num_entries);
|
void *evt_buf, uint8_t *num_entries);
|
||||||
|
|
||||||
QDF_STATUS (*init_cmd_send)(wmi_unified_t wmi_handle,
|
QDF_STATUS (*init_cmd_send)(wmi_unified_t wmi_handle,
|
||||||
target_resource_config *res_cfg,
|
struct wmi_init_cmd_param *param);
|
||||||
uint8_t num_mem_chunks,
|
|
||||||
struct wmi_host_mem_chunk *mem_chunk);
|
|
||||||
|
|
||||||
QDF_STATUS (*save_fw_version)(wmi_unified_t wmi_handle, void *evt_buf);
|
QDF_STATUS (*save_fw_version)(wmi_unified_t wmi_handle, void *evt_buf);
|
||||||
uint32_t (*ready_extract_init_status)(wmi_unified_t wmi_hdl, void *ev);
|
uint32_t (*ready_extract_init_status)(wmi_unified_t wmi_hdl, void *ev);
|
||||||
|
@@ -4578,21 +4578,17 @@ QDF_STATUS wmi_unified_set_psmode_cmd_send(void *wmi_hdl,
|
|||||||
/**
|
/**
|
||||||
* wmi_unified_init_cmd_send() - send initialization cmd to fw
|
* wmi_unified_init_cmd_send() - send initialization cmd to fw
|
||||||
* @wmi_handle: wmi handle
|
* @wmi_handle: wmi handle
|
||||||
* @param tgt_res_cfg: pointer to target resource configuration
|
* @param param: pointer to wmi init param
|
||||||
* @param num_mem_chunks: Number of memory chunks
|
|
||||||
* @param mem_chunks: pointer to target memory chunks
|
|
||||||
*
|
*
|
||||||
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
|
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
|
||||||
*/
|
*/
|
||||||
QDF_STATUS wmi_unified_init_cmd_send(void *wmi_hdl,
|
QDF_STATUS wmi_unified_init_cmd_send(void *wmi_hdl,
|
||||||
target_resource_config *res_cfg, uint8_t num_mem_chunks,
|
struct wmi_init_cmd_param *param)
|
||||||
struct wmi_host_mem_chunk *mem_chunk)
|
|
||||||
{
|
{
|
||||||
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
|
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
|
||||||
|
|
||||||
if (wmi_handle->ops->init_cmd_send)
|
if (wmi_handle->ops->init_cmd_send)
|
||||||
return wmi_handle->ops->init_cmd_send(wmi_handle, res_cfg,
|
return wmi_handle->ops->init_cmd_send(wmi_handle, param);
|
||||||
num_mem_chunks, mem_chunk);
|
|
||||||
|
|
||||||
return QDF_STATUS_E_FAILURE;
|
return QDF_STATUS_E_FAILURE;
|
||||||
}
|
}
|
||||||
|
@@ -5323,15 +5323,12 @@ static void wmi_copy_resource_config_non_tlv(wmi_resource_config *resource_cfg,
|
|||||||
/**
|
/**
|
||||||
* init_cmd_send_non_tlv() - send initialization cmd to fw
|
* init_cmd_send_non_tlv() - send initialization cmd to fw
|
||||||
* @wmi_handle: wmi handle
|
* @wmi_handle: wmi handle
|
||||||
* @param tgt_res_cfg: pointer to target resource configuration
|
* @param param: pointer to wmi init param
|
||||||
* @param num_mem_chunks: Number of memory chunks
|
|
||||||
* @param mem_chunks: pointer to target memory chunks
|
|
||||||
*
|
*
|
||||||
* Return: 0 for success or error code
|
* Return: 0 for success or error code
|
||||||
*/
|
*/
|
||||||
static QDF_STATUS init_cmd_send_non_tlv(wmi_unified_t wmi_handle,
|
static QDF_STATUS init_cmd_send_non_tlv(wmi_unified_t wmi_handle,
|
||||||
target_resource_config *tgt_res_cfg,
|
struct wmi_init_cmd_param *param)
|
||||||
uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks)
|
|
||||||
{
|
{
|
||||||
wmi_buf_t buf;
|
wmi_buf_t buf;
|
||||||
wmi_init_cmd *cmd;
|
wmi_init_cmd *cmd;
|
||||||
@@ -5350,20 +5347,21 @@ static QDF_STATUS init_cmd_send_non_tlv(wmi_unified_t wmi_handle,
|
|||||||
|
|
||||||
cmd = (wmi_init_cmd *) wmi_buf_data(buf);
|
cmd = (wmi_init_cmd *) wmi_buf_data(buf);
|
||||||
|
|
||||||
wmi_copy_resource_config_non_tlv(&cmd->resource_config, tgt_res_cfg);
|
wmi_copy_resource_config_non_tlv(&cmd->resource_config, param->res_cfg);
|
||||||
|
|
||||||
host_mem_chunks = cmd->host_mem_chunks;
|
host_mem_chunks = cmd->host_mem_chunks;
|
||||||
for (idx = 0; idx < num_mem_chunks; ++idx) {
|
for (idx = 0; idx < param->num_mem_chunks; ++idx) {
|
||||||
host_mem_chunks[idx].ptr = mem_chunks[idx].paddr;
|
host_mem_chunks[idx].ptr = param->mem_chunks[idx].paddr;
|
||||||
host_mem_chunks[idx].size = mem_chunks[idx].len;
|
host_mem_chunks[idx].size = param->mem_chunks[idx].len;
|
||||||
host_mem_chunks[idx].req_id = mem_chunks[idx].req_id;
|
host_mem_chunks[idx].req_id = param->mem_chunks[idx].req_id;
|
||||||
qdf_print("chunk %d len %d requested , ptr 0x%x\n",
|
qdf_print("chunk %d len %d requested , ptr 0x%x\n",
|
||||||
idx, cmd->host_mem_chunks[idx].size,
|
idx, cmd->host_mem_chunks[idx].size,
|
||||||
cmd->host_mem_chunks[idx].ptr);
|
cmd->host_mem_chunks[idx].ptr);
|
||||||
}
|
}
|
||||||
cmd->num_host_mem_chunks = num_mem_chunks;
|
cmd->num_host_mem_chunks = param->num_mem_chunks;
|
||||||
if (num_mem_chunks > 1)
|
if (param->num_mem_chunks > 1)
|
||||||
len += ((num_mem_chunks-1) * sizeof(wlan_host_memory_chunk));
|
len += ((param->num_mem_chunks-1) *
|
||||||
|
sizeof(wlan_host_memory_chunk));
|
||||||
|
|
||||||
if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID) < 0) {
|
if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID) < 0) {
|
||||||
wmi_buf_free(buf);
|
wmi_buf_free(buf);
|
||||||
|
@@ -11880,18 +11880,73 @@ error:
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* copy_hw_mode_id_in_init_cmd() - Helper routine to copy hw_mode in init cmd
|
||||||
|
* @buf_ptr: pointer to current position in init command buffer
|
||||||
|
* @len: pointer to length. This will be updated with current lenght of cmd
|
||||||
|
* @param: point host parameters for init command
|
||||||
|
*
|
||||||
|
* Return: Updated pointer of buf_ptr.
|
||||||
|
*/
|
||||||
|
static inline uint8_t *copy_hw_mode_in_init_cmd(uint8_t *buf_ptr,
|
||||||
|
int *len, struct wmi_init_cmd_param *param)
|
||||||
|
{
|
||||||
|
uint16_t idx;
|
||||||
|
|
||||||
|
if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) {
|
||||||
|
wmi_pdev_set_hw_mode_cmd_fixed_param *hw_mode;
|
||||||
|
wmi_pdev_band_to_mac *band_to_mac;
|
||||||
|
|
||||||
|
hw_mode = (wmi_pdev_set_hw_mode_cmd_fixed_param *)
|
||||||
|
(buf_ptr + sizeof(wmi_init_cmd_fixed_param) +
|
||||||
|
sizeof(wmi_resource_config) +
|
||||||
|
WMI_TLV_HDR_SIZE + (param->num_mem_chunks *
|
||||||
|
sizeof(wlan_host_memory_chunk)));
|
||||||
|
|
||||||
|
WMITLV_SET_HDR(&hw_mode->tlv_header,
|
||||||
|
WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param,
|
||||||
|
(WMITLV_GET_STRUCT_TLVLEN
|
||||||
|
(wmi_pdev_set_hw_mode_cmd_fixed_param)));
|
||||||
|
|
||||||
|
hw_mode->hw_mode_index = param->hw_mode_id;
|
||||||
|
hw_mode->num_band_to_mac = param->num_band_to_mac;
|
||||||
|
|
||||||
|
buf_ptr = (uint8_t *) (hw_mode + 1);
|
||||||
|
band_to_mac = (wmi_pdev_band_to_mac *) (buf_ptr +
|
||||||
|
WMI_TLV_HDR_SIZE);
|
||||||
|
for (idx = 0; idx < param->num_band_to_mac; idx++) {
|
||||||
|
WMITLV_SET_HDR(&band_to_mac[idx].tlv_header,
|
||||||
|
WMITLV_TAG_STRUC_wmi_pdev_band_to_mac,
|
||||||
|
WMITLV_GET_STRUCT_TLVLEN
|
||||||
|
(wmi_pdev_band_to_mac));
|
||||||
|
band_to_mac[idx].pdev_id =
|
||||||
|
param->band_to_mac[idx].pdev_id;
|
||||||
|
band_to_mac[idx].start_freq =
|
||||||
|
param->band_to_mac[idx].start_freq;
|
||||||
|
band_to_mac[idx].end_freq =
|
||||||
|
param->band_to_mac[idx].end_freq;
|
||||||
|
}
|
||||||
|
*len += sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) +
|
||||||
|
(param->num_band_to_mac *
|
||||||
|
sizeof(wmi_pdev_band_to_mac)) +
|
||||||
|
WMI_TLV_HDR_SIZE;
|
||||||
|
|
||||||
|
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
|
||||||
|
(param->num_band_to_mac *
|
||||||
|
sizeof(wmi_pdev_band_to_mac)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init_cmd_send_tlv() - send initialization cmd to fw
|
* init_cmd_send_tlv() - send initialization cmd to fw
|
||||||
* @wmi_handle: wmi handle
|
* @wmi_handle: wmi handle
|
||||||
* @param tgt_res_cfg: pointer to target resource configuration
|
* @param param: pointer to wmi init param
|
||||||
* @param num_mem_chunks: Number of memory chunks
|
|
||||||
* @param mem_chunks: pointer to target memory chunks
|
|
||||||
*
|
*
|
||||||
* Return: QDF_STATUS_SUCCESS for success or error code
|
* Return: QDF_STATUS_SUCCESS for success or error code
|
||||||
*/
|
*/
|
||||||
static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle,
|
static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle,
|
||||||
target_resource_config *tgt_res_cfg, uint8_t num_mem_chunks,
|
struct wmi_init_cmd_param *param)
|
||||||
struct wmi_host_mem_chunk *mem_chunks)
|
|
||||||
{
|
{
|
||||||
wmi_buf_t buf;
|
wmi_buf_t buf;
|
||||||
wmi_init_cmd_fixed_param *cmd;
|
wmi_init_cmd_fixed_param *cmd;
|
||||||
@@ -11900,14 +11955,21 @@ static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle,
|
|||||||
uint8_t *buf_ptr;
|
uint8_t *buf_ptr;
|
||||||
wmi_resource_config *resource_cfg;
|
wmi_resource_config *resource_cfg;
|
||||||
wlan_host_memory_chunk *host_mem_chunks;
|
wlan_host_memory_chunk *host_mem_chunks;
|
||||||
uint32_t mem_chunk_len = 0;
|
uint32_t mem_chunk_len = 0, hw_mode_len = 0;
|
||||||
uint16_t idx;
|
uint16_t idx;
|
||||||
int len;
|
int len;
|
||||||
QDF_STATUS ret;
|
QDF_STATUS ret;
|
||||||
|
|
||||||
len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE;
|
len = sizeof(*cmd) + sizeof(wmi_resource_config) +
|
||||||
|
WMI_TLV_HDR_SIZE;
|
||||||
mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS);
|
mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS);
|
||||||
buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len);
|
|
||||||
|
if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX)
|
||||||
|
hw_mode_len = sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) +
|
||||||
|
WMI_TLV_HDR_SIZE +
|
||||||
|
(param->num_band_to_mac * sizeof(wmi_pdev_band_to_mac));
|
||||||
|
|
||||||
|
buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len + hw_mode_len);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
qdf_print("%s: wmi_buf_alloc failed\n", __func__);
|
qdf_print("%s: wmi_buf_alloc failed\n", __func__);
|
||||||
return QDF_STATUS_E_FAILURE;
|
return QDF_STATUS_E_FAILURE;
|
||||||
@@ -11925,29 +11987,33 @@ static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle,
|
|||||||
WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param,
|
WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param,
|
||||||
WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param));
|
WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param));
|
||||||
|
|
||||||
wmi_copy_resource_config(resource_cfg, tgt_res_cfg);
|
wmi_copy_resource_config(resource_cfg, param->res_cfg);
|
||||||
WMITLV_SET_HDR(&resource_cfg->tlv_header,
|
WMITLV_SET_HDR(&resource_cfg->tlv_header,
|
||||||
WMITLV_TAG_STRUC_wmi_resource_config,
|
WMITLV_TAG_STRUC_wmi_resource_config,
|
||||||
WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config));
|
WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config));
|
||||||
|
|
||||||
for (idx = 0; idx < num_mem_chunks; ++idx) {
|
for (idx = 0; idx < param->num_mem_chunks; ++idx) {
|
||||||
WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header),
|
WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header),
|
||||||
WMITLV_TAG_STRUC_wlan_host_memory_chunk,
|
WMITLV_TAG_STRUC_wlan_host_memory_chunk,
|
||||||
WMITLV_GET_STRUCT_TLVLEN
|
WMITLV_GET_STRUCT_TLVLEN
|
||||||
(wlan_host_memory_chunk));
|
(wlan_host_memory_chunk));
|
||||||
host_mem_chunks[idx].ptr = mem_chunks[idx].paddr;
|
host_mem_chunks[idx].ptr = param->mem_chunks[idx].paddr;
|
||||||
host_mem_chunks[idx].size = mem_chunks[idx].len;
|
host_mem_chunks[idx].size = param->mem_chunks[idx].len;
|
||||||
host_mem_chunks[idx].req_id = mem_chunks[idx].req_id;
|
host_mem_chunks[idx].req_id = param->mem_chunks[idx].req_id;
|
||||||
qdf_print("chunk %d len %d requested ,ptr 0x%x ",
|
qdf_print("chunk %d len %d requested ,ptr 0x%x ",
|
||||||
idx, host_mem_chunks[idx].size,
|
idx, host_mem_chunks[idx].size,
|
||||||
host_mem_chunks[idx].ptr);
|
host_mem_chunks[idx].ptr);
|
||||||
}
|
}
|
||||||
cmd->num_host_mem_chunks = num_mem_chunks;
|
cmd->num_host_mem_chunks = param->num_mem_chunks;
|
||||||
len += (num_mem_chunks * sizeof(wlan_host_memory_chunk));
|
len += (param->num_mem_chunks * sizeof(wlan_host_memory_chunk));
|
||||||
|
|
||||||
WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)),
|
WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)),
|
||||||
WMITLV_TAG_ARRAY_STRUC,
|
WMITLV_TAG_ARRAY_STRUC,
|
||||||
(sizeof(wlan_host_memory_chunk) *
|
(sizeof(wlan_host_memory_chunk) *
|
||||||
num_mem_chunks));
|
param->num_mem_chunks));
|
||||||
|
|
||||||
|
/* Fill hw mode id config */
|
||||||
|
buf_ptr = copy_hw_mode_in_init_cmd(buf_ptr, &len, param);
|
||||||
|
|
||||||
num_whitelist = sizeof(version_whitelist) /
|
num_whitelist = sizeof(version_whitelist) /
|
||||||
sizeof(wmi_whitelist_version_info);
|
sizeof(wmi_whitelist_version_info);
|
||||||
|
Reference in New Issue
Block a user