Jelajahi Sumber

qcacmn: Add WMI reference in PSOC and PSoc reference in WMI

Add WMI reference in PSOC and PSoc reference in WMI.

Change-Id: I6841bec1748447c6c98a81417365cf6e8d228b54
CRs-Fixed: 2002025
Mukul Sharma 8 tahun lalu
induk
melakukan
45223f3b60

+ 42 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h

@@ -241,6 +241,8 @@ struct wlan_soc_timer {
  * @soc_comp_priv_obj[]:   component private object pointers
  * @obj_status[]:          component object status
  * @obj_state:             object state
+ * @tgt_if_handle:         target interface handle
+ *    For OL based target it points to wmi handle
  * @psoc_lock:             psoc lock
  */
 struct wlan_objmgr_psoc {
@@ -254,6 +256,7 @@ struct wlan_objmgr_psoc {
 	void *soc_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS];
 	QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS];
 	WLAN_OBJ_STATE obj_state;
+	void *tgt_if_handle;
 	qdf_spinlock_t psoc_lock;
 };
 
@@ -809,4 +812,43 @@ static inline uint8_t wlan_psoc_get_pdev_count(struct wlan_objmgr_psoc *psoc)
 
 	return psoc->soc_objmgr.wlan_pdev_count;
 }
+
+/**
+ * wlan_psoc_set_tgt_if_handle(): API to set target if handle in psoc object
+ * @psoc: Psoc pointer
+ * @tgt_if_handle: target interface handle
+ *
+ * API to set target interface handle in psoc object
+ *
+ * Caller need to acquire lock with wlan_psoc_obj_lock()
+ *
+ * Return: None
+ */
+static inline void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc,
+			void *tgt_if_handle)
+{
+	/* This API is invoked with lock acquired, do not add log prints */
+	if (psoc == NULL)
+		return;
+	psoc->tgt_if_handle = tgt_if_handle;
+}
+
+/**
+ * wlan_psoc_get_tgt_if_handle(): API to get target interface handle
+ * @psoc: Psoc pointer
+ *
+ * API to get target interface handle from psoc object
+ *
+ * Caller need to acquire lock with wlan_psoc_obj_lock()
+ *
+ * Return: target interface handle
+ */
+static inline void *wlan_psoc_get_tgt_if_handle(struct wlan_objmgr_psoc *psoc)
+{
+	/* This API is invoked with lock acquired, do not add log prints */
+	if (psoc == NULL)
+		return NULL;
+	return psoc->tgt_if_handle;
+}
+
 #endif /* _WLAN_OBJMGR_PSOC_OBJ_H_*/

+ 5 - 1
wmi/inc/wmi_unified_api.h

@@ -41,6 +41,7 @@
 #endif
 #include "htc_api.h"
 #include "wmi_unified_param.h"
+#include "wlan_objmgr_psoc_obj.h"
 
 typedef qdf_nbuf_t wmi_buf_t;
 #define wmi_buf_data(_buf) qdf_nbuf_data(_buf)
@@ -112,11 +113,14 @@ enum wmi_rx_exec_ctx {
  *  @param target_type      : type of supported wmi command
  *  @param use_cookie       : flag to indicate cookie based allocation
  *  @param ops              : handle to wmi ops
+ *  @psoc                   : objmgr psoc
  *  @return opaque handle.
  */
 void *wmi_unified_attach(void *scn_handle,
 			 osdev_t osdev, enum wmi_target_type target_type,
-			 bool use_cookie, struct wmi_rx_ops *ops);
+			 bool use_cookie, struct wmi_rx_ops *ops,
+			 struct wlan_objmgr_psoc *psoc);
+
 
 
 /**

+ 4 - 0
wmi/inc/wmi_unified_priv.h

@@ -1234,6 +1234,9 @@ struct target_abi_version {
 	/** ABI version namespace fourth four dwords */
 };
 
+/* Forward declartion for psoc*/
+struct wlan_objmgr_psoc;
+
 /**
  * struct wmi_init_cmd - Saved wmi INIT command
  * @buf: Buffer containing the wmi INIT command
@@ -1247,6 +1250,7 @@ struct wmi_cmd_init {
 struct wmi_unified {
 	void *scn_handle;    /* handle to device */
 	osdev_t  osdev; /* handle to use OS-independent services */
+	struct wlan_objmgr_psoc *wmi_psoc;
 	qdf_atomic_t pending_cmds;
 	HTC_ENDPOINT_ID wmi_endpoint_id;
 	uint16_t max_msg_len;

+ 7 - 1
wmi/src/wmi_unified.c

@@ -2223,12 +2223,14 @@ static void wmi_runtime_pm_init(struct wmi_unified *wmi_handle)
  * @target_type: TLV or not-TLV based target
  * @use_cookie: cookie based allocation enabled/disabled
  * @ops: umac rx callbacks
+ * @psoc: objmgr psoc
  *
  * @Return: wmi handle.
  */
 void *wmi_unified_attach(void *scn_handle,
 			 osdev_t osdev, enum wmi_target_type target_type,
-			 bool use_cookie, struct wmi_rx_ops *rx_ops)
+			 bool use_cookie, struct wmi_rx_ops *rx_ops,
+			 struct wlan_objmgr_psoc *psoc)
 {
 	struct wmi_unified *wmi_handle;
 
@@ -2273,6 +2275,8 @@ void *wmi_unified_attach(void *scn_handle,
 	wmi_handle->use_cookie = use_cookie;
 	wmi_handle->osdev = osdev;
 	wmi_handle->wmi_stopinprogress = 0;
+	/* Increase the ref count once refcount infra is present */
+	wmi_handle->wmi_psoc = psoc;
 	qdf_spinlock_create(&wmi_handle->ctx_lock);
 
 	return wmi_handle;
@@ -2305,6 +2309,8 @@ void wmi_unified_detach(struct wmi_unified *wmi_handle)
 
 	qdf_spinlock_destroy(&wmi_handle->eventq_lock);
 	qdf_spinlock_destroy(&wmi_handle->ctx_lock);
+	/* Decrease the ref count once refcount infra is present */
+	wmi_handle->wmi_psoc = NULL;
 	OS_FREE(wmi_handle);
 	wmi_handle = NULL;
 }