Browse Source

qcacmn: Add support for WMI DIAG events over CE7

Add support for handling firmware WMI DIAG events over CE7.

Change-Id: I3d6c0b08313e816809a65eb77d9728fc4b4488f3
CRs-Fixed: 2787010
Karthik Kantamneni 4 years ago
parent
commit
268ab400cd
5 changed files with 116 additions and 0 deletions
  1. 10 0
      hif/src/ce/ce_assignment.h
  2. 3 0
      hif/src/ce/ce_main.c
  3. 21 0
      wmi/inc/wmi_unified_api.h
  4. 3 0
      wmi/inc/wmi_unified_priv.h
  5. 79 0
      wmi/src/wmi_unified.c

+ 10 - 0
hif/src/ce/ce_assignment.h

@@ -1321,9 +1321,14 @@ static struct CE_attr host_ce_config_wlan_qca6750[] = {
 	{ /* CE5 */ CE_ATTR_FLAGS, 0, 0, 2048, 512, NULL,},
 	/* Target autonomous HIF_memcpy */
 	{ /* CE6 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,},
+#ifdef WLAN_FEATURE_WMI_DIAG_OVER_CE7
+	/* target->host WMI_DIAG */
+	{ /* CE7 */ CE_ATTR_FLAGS, 0, 0,  2048, 32, NULL,},
+#else
 	/* ce_diag, the Diagnostic Window */
 	{ /* CE7 */ (CE_ATTR_DIAG_FLAGS | CE_ATTR_DISABLE_INTR), 0,
 		0, DIAG_TRANSFER_LIMIT, 0, NULL,},
+#endif
 	/* Reserved for target */
 	{ /* CE8 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,},
 	/* CE 9, 10, 11 belong to CoreBsp & MHI driver */
@@ -1345,9 +1350,14 @@ static struct CE_pipe_config target_ce_config_wlan_qca6750[] = {
 	{ /* CE5 */ 5, PIPEDIR_IN,  32, 2048, CE_ATTR_FLAGS, 0,},
 	/* Reserved for target autonomous HIF_memcpy */
 	{ /* CE6 */ 6, PIPEDIR_INOUT, 32, 16384, CE_ATTR_FLAGS, 0,},
+#ifdef WLAN_FEATURE_WMI_DIAG_OVER_CE7
+	/* target->host WMI_DIAG */
+	{ /* CE7 */ 7, PIPEDIR_IN, 32, 2048, CE_ATTR_FLAGS, 0,},
+#else
 	/* CE7 used only by Host */
 	{ /* CE7 */ 7, PIPEDIR_INOUT_H2H, 0, 0,
 		(CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR), 0,},
+#endif
 	/* Reserved for target */
 	{ /* CE8 */ 8, PIPEDIR_INOUT, 32, 16384, CE_ATTR_FLAGS, 0,},
 	/* CE 9, 10, 11 belong to CoreBsp & MHI driver */

+ 3 - 0
hif/src/ce/ce_main.c

@@ -683,6 +683,9 @@ static struct service_to_pipe target_service_to_ce_map_qca6750[] = {
 	{ HTT_DATA_MSG_SVC, PIPEDIR_OUT, 4, },
 	{ HTT_DATA_MSG_SVC, PIPEDIR_IN, 1, },
 	{ PACKET_LOG_SVC, PIPEDIR_IN, 5, },
+#ifdef WLAN_FEATURE_WMI_DIAG_OVER_CE7
+	{ WMI_CONTROL_DIAG_SVC, PIPEDIR_IN, 7, },
+#endif
 	/* (Additions here) */
 	{ 0, 0, 0, },
 };

+ 21 - 0
wmi/inc/wmi_unified_api.h

@@ -455,6 +455,27 @@ QDF_STATUS
 wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle,
 				HTC_HANDLE htc_handle);
 
+#ifdef WLAN_FEATURE_WMI_DIAG_OVER_CE7
+/**
+ * wmi_diag_connect_pdev_htc_service()
+ * WMI DIAG API to get connect to HTC service
+ * @wmi_handle: handle to WMI.
+ * @htc_handle: handle to HTC.
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAULT for failure
+ */
+QDF_STATUS
+wmi_diag_connect_pdev_htc_service(struct wmi_unified *wmi_handle,
+				  HTC_HANDLE htc_handle);
+#else
+static inline QDF_STATUS
+wmi_diag_connect_pdev_htc_service(struct wmi_unified *wmi_handle,
+				  HTC_HANDLE htc_handle)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /*
  * WMI API to verify the host has enough credits to suspend
  *  @param wmi_handle      : handle to WMI.

+ 3 - 0
wmi/inc/wmi_unified_priv.h

@@ -2577,6 +2577,9 @@ struct wmi_soc {
 	uint16_t max_msg_len[WMI_MAX_RADIOS];
 	struct wmi_ops *ops;
 	const uint32_t *svc_ids;
+#ifdef WLAN_FEATURE_WMI_DIAG_OVER_CE7
+	HTC_ENDPOINT_ID wmi_diag_endpoint_id;
+#endif
 	uint32_t wmi_events[wmi_events_max];
 	/* WMI service bitmap received from target */
 	uint32_t *wmi_service_bitmap;

+ 79 - 0
wmi/src/wmi_unified.c

@@ -2395,6 +2395,35 @@ static void wmi_control_rx(void *ctx, HTC_PACKET *htc_packet)
 	wmi_process_control_rx(wmi_handle, evt_buf);
 }
 
+#ifdef WLAN_FEATURE_WMI_DIAG_OVER_CE7
+/**
+ * wmi_control_diag_rx() - process diag fw events callbacks
+ * @ctx: handle to wmi
+ * @htc_packet: pointer to htc packet
+ *
+ * Return: none
+ */
+static void wmi_control_diag_rx(void *ctx, HTC_PACKET *htc_packet)
+{
+	struct wmi_soc *soc = (struct wmi_soc *)ctx;
+	struct wmi_unified *wmi_handle;
+	wmi_buf_t evt_buf;
+
+	evt_buf = (wmi_buf_t)htc_packet->pPktContext;
+
+	wmi_handle = soc->wmi_pdev[0];
+	if (!wmi_handle) {
+		WMI_LOGE
+		("unable to get wmi_handle for diag event end point id:%d\n",
+		 htc_packet->Endpoint);
+		qdf_nbuf_free(evt_buf);
+		return;
+	}
+
+	wmi_process_control_rx(wmi_handle, evt_buf);
+}
+#endif
+
 #ifdef WLAN_FEATURE_WMI_SEND_RECV_QMI
 QDF_STATUS wmi_unified_cmd_send_over_qmi(struct wmi_unified *wmi_handle,
 					 wmi_buf_t buf, uint32_t buflen,
@@ -3192,6 +3221,56 @@ wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef WLAN_FEATURE_WMI_DIAG_OVER_CE7
+/**
+ * wmi_diag_connect_pdev_htc_service()
+ * WMI DIAG API to get connect to HTC service
+ *
+ * @wmi_handle: handle to WMI.
+ * @htc_handle: handle to HTC
+ *
+ * @Return: QDF_STATUS
+ */
+QDF_STATUS wmi_diag_connect_pdev_htc_service(struct wmi_unified *wmi_handle,
+					     HTC_HANDLE htc_handle)
+{
+	QDF_STATUS status;
+	struct htc_service_connect_resp response;
+	struct htc_service_connect_req connect;
+
+	OS_MEMZERO(&connect, sizeof(connect));
+	OS_MEMZERO(&response, sizeof(response));
+
+	/* meta data is unused for now */
+	connect.pMetaData = NULL;
+	connect.MetaDataLength = 0;
+	connect.EpCallbacks.pContext = wmi_handle->soc;
+	connect.EpCallbacks.EpTxCompleteMultiple = NULL;
+	connect.EpCallbacks.EpRecv = wmi_control_diag_rx /* wmi diag rx */;
+	connect.EpCallbacks.EpRecvRefill = NULL;
+	connect.EpCallbacks.EpSendFull = NULL;
+	connect.EpCallbacks.EpTxComplete = NULL;
+	connect.EpCallbacks.ep_log_pkt = wmi_htc_log_pkt;
+
+	/* connect to wmi diag service */
+	connect.service_id = WMI_CONTROL_DIAG_SVC;
+	status = htc_connect_service(htc_handle, &connect, &response);
+
+	if (QDF_IS_STATUS_ERROR(status)) {
+		WMI_LOGE("Failed to connect to WMI DIAG service status:%d\n",
+			 status);
+		return status;
+	}
+
+	if (wmi_handle->soc->is_async_ep)
+		htc_set_async_ep(htc_handle, response.Endpoint, true);
+
+	wmi_handle->soc->wmi_diag_endpoint_id = response.Endpoint;
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /**
  * wmi_get_host_credits() -  WMI API to get updated host_credits
  *