Переглянути джерело

qcacmn: Add changes for coexistence of WIN/ MCL TLV implementation

Add changes to allow coexistence of WIN/ MCL TLV implementation
through use of CONFIG_MCL flag and change of MACRO names.

Change-Id: I6868c288a43fd3afb19c84b8a9d4ef0dfbee5c94
Acked-by: [email protected]
CRs-Fixed: 1008872
Himanshu Agarwal 9 роки тому
батько
коміт
7c83dcdc38
4 змінених файлів з 74 додано та 21 видалено
  1. 62 12
      wmi_unified.c
  2. 3 4
      wmi_unified_api.c
  3. 2 1
      wmi_unified_non_tlv.c
  4. 7 4
      wmi_unified_tlv.c

+ 62 - 12
wmi_unified.c

@@ -37,12 +37,62 @@
 #include "htc_api.h"
 #include "htc_api.h"
 #include "dbglog_host.h"
-#include "wmi.h"
 #include "wmi_unified_priv.h"
 #include "wmi_unified_param.h"
 
 #include <linux/debugfs.h>
 
+/* This check for CONFIG_WIN temporary added due to redeclaration compilation
+error in MCL. Error is caused due to inclusion of wmi.h in wmi_unified_api.h
+which gets included here through ol_if_athvar.h. Eventually it is expected that
+wmi.h will be removed from wmi_unified_api.h after cleanup, which will need
+WMI_CMD_HDR to be defined here. */
+#ifdef CONFIG_WIN
+/* Copied from wmi.h */
+#undef MS
+#define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)
+#undef SM
+#define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
+#undef WO
+#define WO(_f)      ((_f##_OFFSET) >> 2)
+
+#undef GET_FIELD
+#define GET_FIELD(_addr, _f) MS(*((A_UINT32 *)(_addr) + WO(_f)), _f)
+#undef SET_FIELD
+#define SET_FIELD(_addr, _f, _val)  \
+	    (*((A_UINT32 *)(_addr) + WO(_f)) = \
+		(*((A_UINT32 *)(_addr) + WO(_f)) & ~_f##_MASK) | SM(_val, _f))
+
+#define WMI_GET_FIELD(_msg_buf, _msg_type, _f) \
+	    GET_FIELD(_msg_buf, _msg_type ## _ ## _f)
+
+#define WMI_SET_FIELD(_msg_buf, _msg_type, _f, _val) \
+	    SET_FIELD(_msg_buf, _msg_type ## _ ## _f, _val)
+
+#define WMI_EP_APASS           0x0
+#define WMI_EP_LPASS           0x1
+#define WMI_EP_SENSOR          0x2
+
+/*
+ *  * Control Path
+ *   */
+typedef PREPACK struct {
+	A_UINT32	commandId:24,
+			reserved:2, /* used for WMI endpoint ID */
+			plt_priv:6; /* platform private */
+} POSTPACK WMI_CMD_HDR;        /* used for commands and events */
+
+#define WMI_CMD_HDR_COMMANDID_LSB           0
+#define WMI_CMD_HDR_COMMANDID_MASK          0x00ffffff
+#define WMI_CMD_HDR_COMMANDID_OFFSET        0x00000000
+#define WMI_CMD_HDR_WMI_ENDPOINTID_MASK        0x03000000
+#define WMI_CMD_HDR_WMI_ENDPOINTID_OFFSET      24
+#define WMI_CMD_HDR_PLT_PRIV_LSB               24
+#define WMI_CMD_HDR_PLT_PRIV_MASK              0xff000000
+#define WMI_CMD_HDR_PLT_PRIV_OFFSET            0x00000000
+/* end of copy wmi.h */
+#endif /* CONFIG_WIN */
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0))
 /* TODO Cleanup this backported function */
 int qcacld_bp_seq_printf(struct seq_file *m, const char *f, ...)
@@ -241,7 +291,7 @@ uint32_t wmi_mgmt_log_max_entry = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY;
 uint32_t wmi_record_max_length = WMI_EVENT_DEBUG_ENTRY_MAX_LENGTH;
 uint32_t wmi_display_size = 100;
 
-static uint8_t *wmi_id_to_name(WMI_CMD_ID wmi_command);
+static uint8_t *wmi_id_to_name(uint32_t wmi_command);
 
 /**
  * wmi_log_init() - Initialize WMI event logging
@@ -898,7 +948,7 @@ static QDF_STATUS wmi_debugfs_init(wmi_unified_t wmi_handle)
  *
  * Return: none
  */
-void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, WMI_CMD_ID cmd,
+void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, uint32_t cmd,
 			void *header, uint32_t vdev_id, uint32_t chanfreq)
 {
 	qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock);
@@ -920,7 +970,7 @@ void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, WMI_CMD_ID cmd,
  * Return: none
  */
 static void wmi_debugfs_remove(wmi_unified_t wmi_handle) { }
-void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, WMI_CMD_ID cmd,
+void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, uint32_t cmd,
 			void *header, uint32_t vdev_id, uint32_t chanfreq) { }
 #endif /*WMI_INTERFACE_EVENT_LOGGING */
 
@@ -1007,7 +1057,7 @@ uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle)
 }
 
 #ifndef WMI_NON_TLV_SUPPORT
-static uint8_t *wmi_id_to_name(WMI_CMD_ID wmi_command)
+static uint8_t *wmi_id_to_name(uint32_t wmi_command)
 {
 	switch (wmi_command) {
 		/* initialize the wlan sub system */
@@ -1590,13 +1640,13 @@ static uint8_t *wmi_id_to_name(WMI_CMD_ID wmi_command)
 	return "Invalid WMI cmd";
 }
 
-static inline void wma_log_cmd_id(WMI_CMD_ID cmd_id)
+static inline void wma_log_cmd_id(uint32_t cmd_id)
 {
 	WMI_LOGD("Send WMI command:%s command_id:%d",
 		 wmi_id_to_name(cmd_id), cmd_id);
 }
 #else
-static uint8_t *wmi_id_to_name(WMI_CMD_ID wmi_command)
+static uint8_t *wmi_id_to_name(uint32_t wmi_command)
 {
 	return "Invalid WMI cmd";
 }
@@ -1610,7 +1660,7 @@ static uint8_t *wmi_id_to_name(WMI_CMD_ID wmi_command)
  * Return: true if the command is part of the suspend resume sequence.
  */
 #ifndef WMI_NON_TLV_SUPPORT
-static bool wmi_is_runtime_pm_cmd(WMI_CMD_ID cmd_id)
+static bool wmi_is_runtime_pm_cmd(uint32_t cmd_id)
 {
 	switch (cmd_id) {
 	case WMI_WOW_ENABLE_CMDID:
@@ -1634,7 +1684,7 @@ static bool wmi_is_runtime_pm_cmd(WMI_CMD_ID cmd_id)
  *
  * Return: true if the command is part of the resume sequence.
  */
-static bool wmi_is_pm_resume_cmd(WMI_CMD_ID cmd_id)
+static bool wmi_is_pm_resume_cmd(uint32_t cmd_id)
 {
 	switch (cmd_id) {
 	case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID:
@@ -1646,11 +1696,11 @@ static bool wmi_is_pm_resume_cmd(WMI_CMD_ID cmd_id)
 	}
 }
 #else
-static bool wmi_is_runtime_pm_cmd(WMI_CMD_ID cmd_id)
+static bool wmi_is_runtime_pm_cmd(uint32_t cmd_id)
 {
 	return false;
 }
-static bool wmi_is_pm_resume_cmd(WMI_CMD_ID cmd_id)
+static bool wmi_is_pm_resume_cmd(uint32_t cmd_id)
 {
 	return false;
 }
@@ -1666,7 +1716,7 @@ static bool wmi_is_pm_resume_cmd(WMI_CMD_ID cmd_id)
  * Return: 0 on success
  */
 int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, uint32_t len,
-			 WMI_CMD_ID cmd_id)
+			 uint32_t cmd_id)
 {
 	HTC_PACKET *pkt;
 	A_STATUS status;

+ 3 - 4
wmi_unified_api.c

@@ -30,7 +30,6 @@
 #include "a_debug.h"
 #include "ol_if_athvar.h"
 #include "ol_defines.h"
-#include "wmi.h"
 #include "wmi_unified_priv.h"
 #include "wmi_unified_param.h"
 
@@ -2313,7 +2312,7 @@ wmi_unified_dfs_phyerr_filter_offload_en_cmd(void *wmi_hdl,
 #ifndef WMI_NON_TLV_SUPPORT
 QDF_STATUS wmi_unified_pktlog_wmi_send_cmd(void *wmi_hdl,
 				   WMI_PKTLOG_EVENT pktlog_event,
-				   WMI_CMD_ID cmd_id)
+				   uint32_t cmd_id)
 {
 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
 
@@ -2902,7 +2901,7 @@ QDF_STATUS wmi_unified_process_set_ie_info_cmd(void *wmi_hdl,
 
 	return QDF_STATUS_E_FAILURE;
 }
-
+#ifdef CONFIG_MCL
 /**
  * wmi_unified_send_init_cmd() - wmi init command
  * @wmi_handle:      pointer to wmi handle
@@ -2928,7 +2927,7 @@ QDF_STATUS wmi_unified_send_init_cmd(void *wmi_hdl,
 
 	return QDF_STATUS_E_FAILURE;
 }
-
+#endif
 /**
  * wmi_unified_send_saved_init_cmd() - wmi init command
  * @wmi_handle:      pointer to wmi handle

+ 2 - 1
wmi_unified_non_tlv.c

@@ -31,11 +31,12 @@
 #include "a_debug.h"
 #include "ol_if_athvar.h"
 #include "ol_defines.h"
-#include "wmi.h"
 #include "wmi_unified_api.h"
 #include "wmi_unified_priv.h"
 
 #ifdef WMI_NON_TLV_SUPPORT
+#include "legacy/wmi.h"
+#include "legacy/wmi_unified.h"
 /**
  * send_vdev_create_cmd_non_tlv() - send VDEV create command to fw
  * @wmi_handle: wmi handle

+ 7 - 4
wmi_unified_tlv.c

@@ -1608,7 +1608,7 @@ QDF_STATUS send_scan_chan_list_cmd_tlv(wmi_unified_t wmi_handle,
 	wmi_scan_chan_list_cmd_fixed_param *cmd;
 	int i;
 	uint8_t *buf_ptr;
-	wmi_channel *chan_info, *tchan_info;
+	wmi_channel_param *chan_info, *tchan_info;
 	uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
 
 	len += sizeof(wmi_channel) * chan_list->num_scan_chans;
@@ -1632,7 +1632,8 @@ QDF_STATUS send_scan_chan_list_cmd_tlv(wmi_unified_t wmi_handle,
 	WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)),
 		       WMITLV_TAG_ARRAY_STRUC,
 		       sizeof(wmi_channel) * chan_list->num_scan_chans);
-	chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE);
+	chan_info = (wmi_channel_param *)
+			(buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE);
 	tchan_info = chan_list->chan_info;
 
 	for (i = 0; i < chan_list->num_scan_chans; ++i) {
@@ -9024,7 +9025,7 @@ void wmi_copy_resource_config(wmi_resource_config *resource_cfg,
 			tgt_res_cfg->num_ocb_schedules;
 
 }
-
+#ifdef CONFIG_MCL
 /**
  * send_init_cmd_tlv() - wmi init command
  * @wmi_handle:      pointer to wmi handle
@@ -9144,7 +9145,7 @@ QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle,
 	return QDF_STATUS_SUCCESS;
 
 }
-
+#endif
 /**
  * send_saved_init_cmd_tlv() - wmi init command
  * @wmi_handle:      pointer to wmi handle
@@ -11970,7 +11971,9 @@ struct wmi_ops tlv_ops =  {
 	.send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv,
 	.send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv,
 	.send_process_set_ie_info_cmd = send_process_set_ie_info_cmd_tlv,
+#ifdef CONFIG_MCL
 	.send_init_cmd = send_init_cmd_tlv,
+#endif
 	.save_fw_version_cmd = save_fw_version_cmd_tlv,
 	.check_and_update_fw_version =
 		 check_and_update_fw_version_cmd_tlv,