qcacmn: WMI registration change to support to WIN modularization

Change WMI initialization sequence to support WMI modularization.
TLV and Non-TLV modules calls WMI module registration based on target type.
WMI attach will call respective attach routines based on registration.

Change-Id: Id56446f491d129758537913d2d5d6633f8dec918
CRs-Fixed: 2179854
This commit is contained in:
Pratik Gandhi
2018-01-30 19:05:41 +05:30
committed by Gerrit - the friendly Code Review server
parent 6c99befe8c
commit 6c8fdba41b
9 changed files with 170 additions and 75 deletions

View File

@@ -108,7 +108,8 @@ struct wmi_rx_ops {
*/
enum wmi_target_type {
WMI_TLV_TARGET,
WMI_NON_TLV_TARGET
WMI_NON_TLV_TARGET,
WMI_MAX_TARGET_TYPE
};
/**

View File

@@ -1542,6 +1542,17 @@ QDF_STATUS (*send_offload_11k_cmd)(wmi_unified_t wmi_handle,
QDF_STATUS (*send_invoke_neighbor_report_cmd)(wmi_unified_t wmi_handle,
struct wmi_invoke_neighbor_report_params *params);
void (*wmi_pdev_id_conversion_enable)(wmi_unified_t wmi_handle);
void (*wmi_free_allocated_event)(A_UINT32 cmd_event_id,
void **wmi_cmd_struct_ptr);
int (*wmi_check_and_pad_event)(void *os_handle, void *param_struc_ptr,
A_UINT32 param_buf_len,
A_UINT32 wmi_cmd_event_id,
void **wmi_cmd_struct_ptr);
int (*wmi_check_command_params)(void *os_handle, void *param_struc_ptr,
A_UINT32 param_buf_len,
A_UINT32 wmi_cmd_event_id);
};
/* Forward declartion for psoc*/
@@ -1652,15 +1663,16 @@ struct wmi_soc {
};
void wmi_unified_register_module(enum wmi_target_type target_type,
void (*wmi_attach)(wmi_unified_t wmi_handle));
void wmi_tlv_init(void);
void wmi_non_tlv_init(void);
#ifdef WMI_NON_TLV_SUPPORT
/* ONLY_NON_TLV_TARGET:TLV attach dummy function defintion for case when
* driver supports only NON-TLV target (WIN mainline) */
#define wmi_tlv_attach(x) qdf_print("TLV Unavailable\n")
#define wmi_tlv_pdev_id_conversion_enable(wmi_hdl) \
qdf_print("PDEV conversion Not Available")
#else
void wmi_tlv_attach(wmi_unified_t wmi_handle);
void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle);
#endif
void wmi_non_tlv_attach(wmi_unified_t wmi_handle);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -28,6 +28,7 @@
#include "wmi_tlv_platform.c"
#include "wmi_tlv_defs.h"
#include "wmi_version.h"
#include "qdf_module.h"
#define WMITLV_GET_ATTRIB_NUM_TLVS 0xFFFFFFFF
@@ -475,6 +476,7 @@ wmitlv_check_command_tlv_params(void *os_handle, void *param_struc_ptr,
(os_handle, param_struc_ptr, param_buf_len, is_cmd_id,
wmi_cmd_event_id);
}
qdf_export_symbol(wmitlv_check_command_tlv_params);
/**
* wmitlv_check_and_pad_tlvs() - tlv helper function
@@ -981,6 +983,7 @@ wmitlv_check_and_pad_event_tlvs(void *os_handle, void *param_struc_ptr,
(os_handle, param_struc_ptr, param_buf_len, is_cmd_id,
wmi_cmd_event_id, wmi_cmd_struct_ptr);
}
qdf_export_symbol(wmitlv_check_and_pad_event_tlvs);
/**
* wmitlv_check_and_pad_command_tlvs() - tlv helper function
@@ -1102,6 +1105,7 @@ void wmitlv_free_allocated_event_tlvs(A_UINT32 cmd_event_id,
{
wmitlv_free_allocated_tlvs(0, cmd_event_id, wmi_cmd_struct_ptr);
}
qdf_export_symbol(wmitlv_free_allocated_event_tlvs);
/**
* wmi_versions_are_compatible() - tlv helper function

View File

@@ -31,6 +31,7 @@
#include "htc_api.h"
#include "htc_api.h"
#include "wmi_unified_priv.h"
#include "qdf_module.h"
#ifndef WMI_NON_TLV_SUPPORT
#include "wmi_tlv_helper.h"
@@ -1210,6 +1211,7 @@ void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, uint32_t cmd,
void *header, uint32_t vdev_id, uint32_t chanfreq) { }
static inline void wmi_log_buffer_free(struct wmi_unified *wmi_handle) { }
#endif /*WMI_INTERFACE_EVENT_LOGGING */
qdf_export_symbol(wmi_mgmt_cmd_record);
int wmi_get_host_credits(wmi_unified_t wmi_handle);
/* WMI buffer APIs */
@@ -1244,11 +1246,13 @@ wmi_buf_alloc_debug(wmi_unified_t wmi_handle, uint16_t len, uint8_t *file_name,
return wmi_buf;
}
qdf_export_symbol(wmi_buf_alloc_debug);
void wmi_buf_free(wmi_buf_t net_buf)
{
qdf_nbuf_free(net_buf);
}
qdf_export_symbol(wmi_buf_free);
#else
wmi_buf_t wmi_buf_alloc(wmi_unified_t wmi_handle, uint16_t len)
{
@@ -1273,11 +1277,13 @@ wmi_buf_t wmi_buf_alloc(wmi_unified_t wmi_handle, uint16_t len)
qdf_nbuf_set_pktlen(wmi_buf, len);
return wmi_buf;
}
qdf_export_symbol(wmi_buf_alloc);
void wmi_buf_free(wmi_buf_t net_buf)
{
qdf_nbuf_free(net_buf);
}
qdf_export_symbol(wmi_buf_free);
#endif
/**
@@ -1292,6 +1298,7 @@ uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle)
{
return wmi_handle->max_msg_len - WMI_MIN_HEAD_ROOM;
}
qdf_export_symbol(wmi_get_max_msg_len);
#ifndef WMI_CMD_STRINGS
static uint8_t *wmi_id_to_name(uint32_t wmi_command)
@@ -1372,7 +1379,7 @@ QDF_STATUS wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf,
if (wmi_handle->target_type == WMI_TLV_TARGET) {
void *buf_ptr = (void *)qdf_nbuf_data(buf);
if (wmitlv_check_command_tlv_params(NULL, buf_ptr, len, cmd_id)
if (wmi_handle->ops->wmi_check_command_params(NULL, buf_ptr, len, cmd_id)
!= 0) {
QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR,
"\nERROR: %s: Invalid WMI Param Buffer for Cmd:%d",
@@ -1454,6 +1461,7 @@ QDF_STATUS wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf,
return QDF_STATUS_SUCCESS;
}
qdf_export_symbol(wmi_unified_cmd_send);
/**
* wmi_unified_get_event_handler_ix() - gives event handler's index
@@ -1573,6 +1581,7 @@ int wmi_unified_register_event_handler(wmi_unified_t wmi_handle,
return 0;
}
qdf_export_symbol(wmi_unified_register_event_handler);
/**
* wmi_unified_unregister_event() - unregister wmi event handler
@@ -1651,6 +1660,7 @@ int wmi_unified_unregister_event_handler(wmi_unified_t wmi_handle,
return 0;
}
qdf_export_symbol(wmi_unified_unregister_event_handler);
/**
* wmi_process_fw_event_default_ctx() - process in default caller context
@@ -1838,7 +1848,7 @@ void __wmi_control_rx(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf)
if (wmi_handle->target_type == WMI_TLV_TARGET) {
/* Validate and pad(if necessary) the TLVs */
tlv_ok_status =
wmitlv_check_and_pad_event_tlvs(wmi_handle->scn_handle,
wmi_handle->ops->wmi_check_and_pad_event(wmi_handle->scn_handle,
data, len, id,
&wmi_cmd_struct_ptr);
if (tlv_ok_status != 0) {
@@ -1883,7 +1893,7 @@ end:
/* Free event buffer and allocated event tlv */
#ifndef WMI_NON_TLV_SUPPORT
if (wmi_handle->target_type == WMI_TLV_TARGET)
wmitlv_free_allocated_event_tlvs(id, &wmi_cmd_struct_ptr);
wmi_handle->ops->wmi_free_allocated_event(id, &wmi_cmd_struct_ptr);
#endif
qdf_nbuf_free(evt_buf);
@@ -2107,6 +2117,19 @@ error:
return NULL;
}
qdf_export_symbol(wmi_unified_get_pdev_handle);
static void (*wmi_attach_register[WMI_MAX_TARGET_TYPE])(wmi_unified_t);
void wmi_unified_register_module(enum wmi_target_type target_type,
void (*wmi_attach)(wmi_unified_t wmi_handle))
{
if (target_type < WMI_MAX_TARGET_TYPE)
wmi_attach_register[target_type] = wmi_attach;
return;
}
qdf_export_symbol(wmi_unified_register_module);
/**
* wmi_unified_attach() - attach for unified WMI
@@ -2170,10 +2193,12 @@ void *wmi_unified_attach(void *scn_handle,
rx_ops->wma_process_fw_event_handler_cbk;
wmi_handle->target_type = target_type;
soc->target_type = target_type;
if (target_type == WMI_TLV_TARGET)
wmi_tlv_attach(wmi_handle);
else
wmi_non_tlv_attach(wmi_handle);
if (wmi_attach_register[target_type]) {
wmi_attach_register[target_type](wmi_handle);
} else {
WMI_LOGE("wmi attach is not registered");
goto error;
}
/* Assign target cookie capablity */
wmi_handle->use_cookie = use_cookie;
wmi_handle->osdev = osdev;
@@ -2493,6 +2518,7 @@ wmi_flush_endpoint(wmi_unified_t wmi_handle)
htc_flush_endpoint(wmi_handle->htc_handle,
wmi_handle->wmi_endpoint_id, 0);
}
qdf_export_symbol(wmi_flush_endpoint);
/**
* generic function to block unified WMI command
@@ -2518,7 +2544,7 @@ wmi_stop(wmi_unified_t wmi_handle)
void wmi_pdev_id_conversion_enable(wmi_unified_t wmi_handle)
{
if (wmi_handle->target_type == WMI_TLV_TARGET)
wmi_tlv_pdev_id_conversion_enable(wmi_handle);
wmi_handle->ops->wmi_pdev_id_conversion_enable(wmi_handle);
}
#endif

View File

@@ -26,6 +26,7 @@
*/
#include "wmi_unified_priv.h"
#include "wmi_unified_param.h"
#include "qdf_module.h"
/**
* wmi_unified_vdev_create_send() - send VDEV create command to fw
@@ -628,6 +629,7 @@ wmi_unified_dbglog_cmd_send(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
qdf_export_symbol(wmi_unified_dbglog_cmd_send);
/**
* wmi_unified_vdev_set_param_send() - WMI vdev set parameter function
@@ -4040,6 +4042,7 @@ QDF_STATUS wmi_unified_smart_ant_enable_tx_feedback_cmd_send(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
qdf_export_symbol(wmi_unified_smart_ant_enable_tx_feedback_cmd_send);
/**
* wmi_unified_vdev_spectral_configure_cmd_send() - WMI set spectral config function
@@ -4847,6 +4850,7 @@ uint8_t *wmi_extract_dbglog_data_len(void *wmi_hdl, void *evt_buf,
return NULL;
}
qdf_export_symbol(wmi_extract_dbglog_data_len);
/**
* wmi_send_ext_resource_config() - send extended resource configuration
@@ -5189,6 +5193,7 @@ QDF_STATUS wmi_extract_wds_addr_event(void *wmi_hdl, void *evt_buf,
}
return QDF_STATUS_E_FAILURE;
}
qdf_export_symbol(wmi_extract_wds_addr_event);
/**
* wmi_extract_dcs_interference_type() - extract dcs interference type
@@ -7193,6 +7198,7 @@ QDF_STATUS wmi_extract_wds_entry(void *wmi_hdl, uint8_t *evt_buf,
return QDF_STATUS_E_FAILURE;
}
qdf_export_symbol(wmi_extract_wds_entry);
#ifdef WLAN_FEATURE_NAN_CONVERGENCE
QDF_STATUS wmi_unified_ndp_initiator_req_cmd_send(void *wmi_hdl,

View File

@@ -40,6 +40,7 @@ QDF_STATUS wmi_extract_dfs_cac_complete_event(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
EXPORT_SYMBOL(wmi_extract_dfs_cac_complete_event);
QDF_STATUS wmi_extract_dfs_radar_detection_event(void *wmi_hdl,
uint8_t *evt_buf,
@@ -70,3 +71,4 @@ QDF_STATUS wmi_extract_wlan_radar_event_info(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
#endif
EXPORT_SYMBOL(wmi_extract_dfs_radar_detection_event);

View File

@@ -8410,6 +8410,16 @@ QDF_STATUS send_wds_entry_list_cmd_non_tlv(wmi_unified_t wmi_handle)
}
/**
* wmi_non_tlv_pdev_id_conversion_enable() - Enable pdev_id conversion
*
* Return None.
*/
void wmi_non_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle)
{
qdf_print("PDEV conversion Not Available");
}
struct wmi_ops non_tlv_ops = {
.send_vdev_create_cmd = send_vdev_create_cmd_non_tlv,
.send_vdev_delete_cmd = send_vdev_delete_cmd_non_tlv,
@@ -8644,6 +8654,7 @@ struct wmi_ops non_tlv_ops = {
.send_fils_discovery_send_cmd = send_fils_discovery_send_cmd_non_tlv,
.extract_swfda_vdev_id = extract_swfda_vdev_id_non_tlv,
#endif /* WLAN_SUPPORT_FILS */
.wmi_pdev_id_conversion_enable = wmi_non_tlv_pdev_id_conversion_enable,
};
/**
@@ -9323,3 +9334,15 @@ void wmi_non_tlv_attach(struct wmi_unified *wmi_handle)
qdf_print("%s: Not supported\n", __func__);
#endif
}
EXPORT_SYMBOL(wmi_non_tlv_attach);
/**
* wmi_non_tlv_init() - Initialize WMI NON TLV module by registering Non TLV
* attach routine.
*
* Return: None
*/
void wmi_non_tlv_init(void)
{
wmi_unified_register_module(WMI_NON_TLV_TARGET, &wmi_non_tlv_attach);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@@ -41,6 +41,7 @@ QDF_STATUS wmi_extract_reg_chan_list_update_event(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
EXPORT_SYMBOL(wmi_extract_reg_chan_list_update_event);
/*
* wmi_unified_send_start_11d_scan_cmd() - start 11d scan
@@ -58,6 +59,7 @@ QDF_STATUS wmi_unified_send_start_11d_scan_cmd(wmi_unified_t wmi_handle,
return QDF_STATUS_E_FAILURE;
}
EXPORT_SYMBOL(wmi_unified_send_start_11d_scan_cmd);
/*
* wmi_unified_send_stop_11d_scan_cmd() - stop 11d scan
@@ -75,6 +77,7 @@ QDF_STATUS wmi_unified_send_stop_11d_scan_cmd(wmi_unified_t wmi_handle,
return QDF_STATUS_E_FAILURE;
}
EXPORT_SYMBOL(wmi_unified_send_stop_11d_scan_cmd);
QDF_STATUS wmi_extract_reg_11d_new_cc_event(void *wmi_hdl,
uint8_t *evt_buf,
@@ -89,6 +92,7 @@ QDF_STATUS wmi_extract_reg_11d_new_cc_event(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
EXPORT_SYMBOL(wmi_extract_reg_11d_new_cc_event);
QDF_STATUS wmi_unified_set_user_country_code_cmd_send(void *wmi_hdl,
uint8_t pdev_id, struct cc_regdmn_s *rd)
@@ -101,6 +105,7 @@ QDF_STATUS wmi_unified_set_user_country_code_cmd_send(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
EXPORT_SYMBOL(wmi_unified_set_user_country_code_cmd_send);
QDF_STATUS wmi_extract_reg_ch_avoid_event(void *wmi_hdl,
uint8_t *evt_buf,
@@ -115,3 +120,4 @@ QDF_STATUS wmi_extract_reg_ch_avoid_event(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
EXPORT_SYMBOL(wmi_extract_reg_ch_avoid_event);

View File

@@ -21343,6 +21343,67 @@ send_pdev_caldata_version_check_cmd_tlv(wmi_unified_t wmi_handle,
return QDF_STATUS_SUCCESS;
}
/**
* convert_host_pdev_id_to_target_pdev_id() - Convert pdev_id from
* host to target defines.
* @param pdev_id: host pdev_id to be converted.
* Return: target pdev_id after conversion.
*/
static uint32_t convert_host_pdev_id_to_target_pdev_id(uint32_t pdev_id)
{
switch (pdev_id) {
case WMI_HOST_PDEV_ID_SOC:
return WMI_PDEV_ID_SOC;
case WMI_HOST_PDEV_ID_0:
return WMI_PDEV_ID_1ST;
case WMI_HOST_PDEV_ID_1:
return WMI_PDEV_ID_2ND;
case WMI_HOST_PDEV_ID_2:
return WMI_PDEV_ID_3RD;
}
QDF_ASSERT(0);
return WMI_PDEV_ID_SOC;
}
/**
* convert_target_pdev_id_to_host_pdev_id() - Convert pdev_id from
* target to host defines.
* @param pdev_id: target pdev_id to be converted.
* Return: host pdev_id after conversion.
*/
static uint32_t convert_target_pdev_id_to_host_pdev_id(uint32_t pdev_id)
{
switch (pdev_id) {
case WMI_PDEV_ID_SOC:
return WMI_HOST_PDEV_ID_SOC;
case WMI_PDEV_ID_1ST:
return WMI_HOST_PDEV_ID_0;
case WMI_PDEV_ID_2ND:
return WMI_HOST_PDEV_ID_1;
case WMI_PDEV_ID_3RD:
return WMI_HOST_PDEV_ID_2;
}
QDF_ASSERT(0);
return WMI_HOST_PDEV_ID_SOC;
}
/**
* wmi_tlv_pdev_id_conversion_enable() - Enable pdev_id conversion
*
* Return None.
*/
static void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle)
{
wmi_handle->ops->convert_pdev_id_host_to_target =
convert_host_pdev_id_to_target_pdev_id;
wmi_handle->ops->convert_pdev_id_target_to_host =
convert_target_pdev_id_to_host_pdev_id;
}
/**
* extract_pdev_caldata_version_check_ev_param_tlv() - extract caldata from event
* @wmi_handle: wmi handle
@@ -22156,6 +22217,10 @@ struct wmi_ops tlv_ops = {
#endif /* WLAN_SUPPORT_FILS */
.send_offload_11k_cmd = send_offload_11k_cmd_tlv,
.send_invoke_neighbor_report_cmd = send_invoke_neighbor_report_cmd_tlv,
.wmi_pdev_id_conversion_enable = wmi_tlv_pdev_id_conversion_enable,
.wmi_free_allocated_event = wmitlv_free_allocated_event_tlvs,
.wmi_check_and_pad_event = wmitlv_check_and_pad_event_tlvs,
.wmi_check_command_params = wmitlv_check_command_tlv_params,
};
/**
@@ -23067,67 +23132,6 @@ static void populate_target_defines_tlv(struct wmi_unified *wmi_handle)
{ }
#endif
/**
* convert_host_pdev_id_to_target_pdev_id() - Convert pdev_id from
* host to target defines.
* @param pdev_id: host pdev_id to be converted.
* Return: target pdev_id after conversion.
*/
static uint32_t convert_host_pdev_id_to_target_pdev_id(uint32_t pdev_id)
{
switch (pdev_id) {
case WMI_HOST_PDEV_ID_SOC:
return WMI_PDEV_ID_SOC;
case WMI_HOST_PDEV_ID_0:
return WMI_PDEV_ID_1ST;
case WMI_HOST_PDEV_ID_1:
return WMI_PDEV_ID_2ND;
case WMI_HOST_PDEV_ID_2:
return WMI_PDEV_ID_3RD;
}
QDF_ASSERT(0);
return WMI_PDEV_ID_SOC;
}
/**
* convert_target_pdev_id_to_host_pdev_id() - Convert pdev_id from
* target to host defines.
* @param pdev_id: target pdev_id to be converted.
* Return: host pdev_id after conversion.
*/
static uint32_t convert_target_pdev_id_to_host_pdev_id(uint32_t pdev_id)
{
switch (pdev_id) {
case WMI_PDEV_ID_SOC:
return WMI_HOST_PDEV_ID_SOC;
case WMI_PDEV_ID_1ST:
return WMI_HOST_PDEV_ID_0;
case WMI_PDEV_ID_2ND:
return WMI_HOST_PDEV_ID_1;
case WMI_PDEV_ID_3RD:
return WMI_HOST_PDEV_ID_2;
}
QDF_ASSERT(0);
return WMI_HOST_PDEV_ID_SOC;
}
/**
* wmi_tlv_pdev_id_conversion_enable() - Enable pdev_id conversion
*
* Return None.
*/
void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle)
{
wmi_handle->ops->convert_pdev_id_host_to_target =
convert_host_pdev_id_to_target_pdev_id;
wmi_handle->ops->convert_pdev_id_target_to_host =
convert_target_pdev_id_to_host_pdev_id;
}
/**
* wmi_ocb_ut_attach() - Attach OCB test framework
* @wmi_handle: wmi handle
@@ -23162,3 +23166,14 @@ void wmi_tlv_attach(wmi_unified_t wmi_handle)
populate_tlv_service(wmi_handle->services);
populate_target_defines_tlv(wmi_handle);
}
EXPORT_SYMBOL(wmi_tlv_attach);
/**
* wmi_tlv_init() - Initialize WMI TLV module by registering TLV attach routine
*
* Return: None
*/
void wmi_tlv_init(void)
{
wmi_unified_register_module(WMI_TLV_TARGET, &wmi_tlv_attach);
}