qcacmn: Modify wmi handle and api for common wmi layer
Modify wmi handle and wmi unified interface API for common wmi layer. Register UMAC callbacks using opaque callbacks. CRs-Fixed: 978579 Change-Id: I505fe4ac339213db30bb00695234c4cfea5a5908
This commit is contained in:
@@ -26,7 +26,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file contains the API definitions for the Unified Wireless Module Interface (WMI).
|
* This file contains the API definitions for the Unified Wireless Module
|
||||||
|
* Interface (WMI).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _WMI_UNIFIED_API_H_
|
#ifndef _WMI_UNIFIED_API_H_
|
||||||
@@ -41,6 +42,32 @@
|
|||||||
typedef cdf_nbuf_t wmi_buf_t;
|
typedef cdf_nbuf_t wmi_buf_t;
|
||||||
#define wmi_buf_data(_buf) cdf_nbuf_data(_buf)
|
#define wmi_buf_data(_buf) cdf_nbuf_data(_buf)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct wmi_ops - service callbacks to upper layer
|
||||||
|
* @service_ready_cbk: service ready callback
|
||||||
|
* @service_ready_ext_cbk: service ready ext callback
|
||||||
|
* @ready_cbk: ready calback
|
||||||
|
* @wma_process_fw_event_handler_cbk: generic event handler callback
|
||||||
|
*/
|
||||||
|
struct wmi_ops {
|
||||||
|
void (*service_ready_cbk)(void *ctx, void *ev);
|
||||||
|
void (*service_ready_ext_cbk)(void *ctx, void *ev);
|
||||||
|
void (*ready_cbk)(void *ctx, void *ev);
|
||||||
|
int (*wma_process_fw_event_handler_cbk)(void *ctx,
|
||||||
|
void *ev);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum wmi_target_type - type of supported wmi command
|
||||||
|
* @WMI_TLV_TARGET: tlv based target
|
||||||
|
* @WMI_NON_TLV_TARGET: non-tlv based target
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
enum wmi_target_type {
|
||||||
|
WMI_TLV_TARGET,
|
||||||
|
WMI_NON_TLV_TARGET
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* attach for unified WMI
|
* attach for unified WMI
|
||||||
*
|
*
|
||||||
@@ -48,7 +75,9 @@ typedef cdf_nbuf_t wmi_buf_t;
|
|||||||
* @return opaque handle.
|
* @return opaque handle.
|
||||||
*/
|
*/
|
||||||
void *wmi_unified_attach(void *scn_handle,
|
void *wmi_unified_attach(void *scn_handle,
|
||||||
int (*func)(struct wmi_unified *, wmi_buf_t));
|
osdev_t osdev, enum wmi_target_type target_type,
|
||||||
|
bool use_cookie, struct wmi_ops *ops);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* detach for unified WMI
|
* detach for unified WMI
|
||||||
*
|
*
|
||||||
@@ -92,7 +121,7 @@ void wmi_buf_free(wmi_buf_t net_buf);
|
|||||||
* @return 0 on success and -ve on failure.
|
* @return 0 on success and -ve on failure.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int buflen,
|
wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, uint32_t buflen,
|
||||||
WMI_CMD_ID cmd_id);
|
WMI_CMD_ID cmd_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,13 +197,9 @@ static inline bool wmi_get_runtime_pm_inprogress(wmi_unified_t wmi_handle)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WMA Callback to process fw event.
|
* WMA Callback to process fw event.
|
||||||
*/
|
*/
|
||||||
typedef int (*wma_process_fw_event_handler_cbk)(struct wmi_unified *wmi_handle,
|
|
||||||
wmi_buf_t evt_buf);
|
|
||||||
|
|
||||||
void wmi_process_fw_event(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf);
|
void wmi_process_fw_event(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf);
|
||||||
uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle);
|
uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle);
|
||||||
#endif /* _WMI_UNIFIED_API_H_ */
|
#endif /* _WMI_UNIFIED_API_H_ */
|
||||||
|
@@ -69,6 +69,7 @@ struct fwdebug {
|
|||||||
|
|
||||||
struct wmi_unified {
|
struct wmi_unified {
|
||||||
ol_scn_t scn_handle; /* handle to device */
|
ol_scn_t scn_handle; /* handle to device */
|
||||||
|
osdev_t osdev; /* handle to use OS-independent services */
|
||||||
cdf_atomic_t pending_cmds;
|
cdf_atomic_t pending_cmds;
|
||||||
HTC_ENDPOINT_ID wmi_endpoint_id;
|
HTC_ENDPOINT_ID wmi_endpoint_id;
|
||||||
uint16_t max_msg_len;
|
uint16_t max_msg_len;
|
||||||
@@ -79,6 +80,7 @@ struct wmi_unified {
|
|||||||
cdf_spinlock_t eventq_lock;
|
cdf_spinlock_t eventq_lock;
|
||||||
cdf_nbuf_queue_t event_queue;
|
cdf_nbuf_queue_t event_queue;
|
||||||
struct work_struct rx_event_work;
|
struct work_struct rx_event_work;
|
||||||
|
int wmi_stop_in_progress;
|
||||||
#ifdef WLAN_OPEN_SOURCE
|
#ifdef WLAN_OPEN_SOURCE
|
||||||
struct fwdebug dbglog;
|
struct fwdebug dbglog;
|
||||||
struct dentry *debugfs_phy;
|
struct dentry *debugfs_phy;
|
||||||
@@ -96,5 +98,8 @@ struct wmi_unified {
|
|||||||
|
|
||||||
int (*wma_process_fw_event_handler_cbk)(struct wmi_unified *wmi_handle,
|
int (*wma_process_fw_event_handler_cbk)(struct wmi_unified *wmi_handle,
|
||||||
wmi_buf_t evt_buf);
|
wmi_buf_t evt_buf);
|
||||||
|
struct wmi_ops ops;
|
||||||
|
void *event_handler_cookie[WMI_UNIFIED_MAX_EVENT];
|
||||||
|
bool use_cookie;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@@ -818,7 +818,7 @@ bool wmi_is_runtime_pm_cmd(WMI_CMD_ID cmd_id)
|
|||||||
*
|
*
|
||||||
* Return: 0 on success
|
* Return: 0 on success
|
||||||
*/
|
*/
|
||||||
int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int len,
|
int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, uint32_t len,
|
||||||
WMI_CMD_ID cmd_id)
|
WMI_CMD_ID cmd_id)
|
||||||
{
|
{
|
||||||
HTC_PACKET *pkt;
|
HTC_PACKET *pkt;
|
||||||
@@ -1034,7 +1034,7 @@ static void wmi_process_fw_event_mc_thread_ctx(struct wmi_unified *wmi_handle,
|
|||||||
wmi_buf_t evt_buf;
|
wmi_buf_t evt_buf;
|
||||||
evt_buf = (wmi_buf_t) htc_packet->pPktContext;
|
evt_buf = (wmi_buf_t) htc_packet->pPktContext;
|
||||||
|
|
||||||
wmi_handle->wma_process_fw_event_handler_cbk(wmi_handle, evt_buf);
|
wmi_handle->ops.wma_process_fw_event_handler_cbk(wmi_handle, evt_buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1204,18 +1204,19 @@ void __wmi_control_rx(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf)
|
|||||||
break;
|
break;
|
||||||
case WMI_SERVICE_READY_EVENTID:
|
case WMI_SERVICE_READY_EVENTID:
|
||||||
cdf_print("%s: WMI UNIFIED SERVICE READY event\n", __func__);
|
cdf_print("%s: WMI UNIFIED SERVICE READY event\n", __func__);
|
||||||
wma_rx_service_ready_event(wmi_handle->scn_handle,
|
wmi_handle->ops.service_ready_cbk(wmi_handle->scn_handle,
|
||||||
wmi_cmd_struct_ptr);
|
wmi_cmd_struct_ptr);
|
||||||
break;
|
break;
|
||||||
case WMI_SERVICE_READY_EXT_EVENTID:
|
case WMI_SERVICE_READY_EXT_EVENTID:
|
||||||
WMA_LOGA("%s: WMI UNIFIED SERVICE READY Extended event",
|
WMA_LOGA("%s: WMI UNIFIED SERVICE READY Extended event",
|
||||||
__func__);
|
__func__);
|
||||||
wma_rx_service_ready_ext_event(wmi_handle->scn_handle,
|
wmi_handle->ops.service_ready_ext_cbk(wmi_handle->scn_handle,
|
||||||
wmi_cmd_struct_ptr);
|
wmi_cmd_struct_ptr);
|
||||||
break;
|
break;
|
||||||
case WMI_READY_EVENTID:
|
case WMI_READY_EVENTID:
|
||||||
cdf_print("%s: WMI UNIFIED READY event\n", __func__);
|
cdf_print("%s: WMI UNIFIED READY event\n", __func__);
|
||||||
wma_rx_ready_event(wmi_handle->scn_handle, wmi_cmd_struct_ptr);
|
wmi_handle->ops.ready_cbk(wmi_handle->scn_handle,
|
||||||
|
wmi_cmd_struct_ptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
@@ -1267,14 +1268,17 @@ void wmi_runtime_pm_init(struct wmi_unified *wmi_handle)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* wmi_unified_attach() - attach for unified WMI
|
* wmi_unified_attach() - attach for unified WMI
|
||||||
*
|
* @scn_handle: handle to SCN
|
||||||
* @param scn_handle : handle to SCN.
|
* @osdev: OS device context
|
||||||
* @wma_process_fw_event_handler_cbk: rx callbacks
|
* @target_type: TLV or not-TLV based target
|
||||||
|
* @use_cookie: cookie based allocation enabled/disabled
|
||||||
|
* @ops: umac rx callbacks
|
||||||
*
|
*
|
||||||
* @Return: wmi handle.
|
* @Return: wmi handle.
|
||||||
*/
|
*/
|
||||||
void *wmi_unified_attach(ol_scn_t scn_handle,
|
void *wmi_unified_attach(void *scn_handle,
|
||||||
wma_process_fw_event_handler_cbk func)
|
osdev_t osdev, enum wmi_target_type target_type,
|
||||||
|
bool use_cookie, struct wmi_ops *ops)
|
||||||
{
|
{
|
||||||
struct wmi_unified *wmi_handle;
|
struct wmi_unified *wmi_handle;
|
||||||
|
|
||||||
@@ -1283,12 +1287,12 @@ void *wmi_unified_attach(ol_scn_t scn_handle,
|
|||||||
sizeof(struct wmi_unified),
|
sizeof(struct wmi_unified),
|
||||||
GFP_ATOMIC);
|
GFP_ATOMIC);
|
||||||
if (wmi_handle == NULL) {
|
if (wmi_handle == NULL) {
|
||||||
cdf_print("allocation of wmi handle failed %zu \n",
|
cdf_print("allocation of wmi handle failed %zu\n",
|
||||||
sizeof(struct wmi_unified));
|
sizeof(struct wmi_unified), GFP_ATOMIC);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
OS_MEMZERO(wmi_handle, sizeof(struct wmi_unified));
|
OS_MEMZERO(wmi_handle, sizeof(struct wmi_unified));
|
||||||
wmi_handle->scn_handle = scn_handle;
|
wmi_handle->scn_handle = (ol_scn_t *)scn_handle;
|
||||||
cdf_atomic_init(&wmi_handle->pending_cmds);
|
cdf_atomic_init(&wmi_handle->pending_cmds);
|
||||||
cdf_atomic_init(&wmi_handle->is_target_suspended);
|
cdf_atomic_init(&wmi_handle->is_target_suspended);
|
||||||
wmi_runtime_pm_init(wmi_handle);
|
wmi_runtime_pm_init(wmi_handle);
|
||||||
@@ -1302,7 +1306,24 @@ void *wmi_unified_attach(ol_scn_t scn_handle,
|
|||||||
#ifdef WMI_INTERFACE_EVENT_LOGGING
|
#ifdef WMI_INTERFACE_EVENT_LOGGING
|
||||||
cdf_spinlock_init(&wmi_handle->wmi_record_lock);
|
cdf_spinlock_init(&wmi_handle->wmi_record_lock);
|
||||||
#endif
|
#endif
|
||||||
wmi_handle->wma_process_fw_event_handler_cbk = func;
|
/* Attach mc_thread context processing function */
|
||||||
|
wmi_handle->ops.wma_process_fw_event_handler_cbk =
|
||||||
|
ops->wma_process_fw_event_handler_cbk;
|
||||||
|
/* Attach service ready callback function */
|
||||||
|
wmi_handle->ops.service_ready_cbk =
|
||||||
|
ops->service_ready_cbk;
|
||||||
|
/* Attach service ready extended callback function */
|
||||||
|
wmi_handle->ops.service_ready_ext_cbk =
|
||||||
|
ops->service_ready_ext_cbk;
|
||||||
|
/* Attach fw ready callback function */
|
||||||
|
wmi_handle->ops.ready_cbk = ops->ready_cbk;
|
||||||
|
if (target_type == WMI_TLV_TARGET)
|
||||||
|
WMA_LOGD("Target is TLV compliant");
|
||||||
|
else
|
||||||
|
WMA_LOGD("Target is NoN-TLV compliant");
|
||||||
|
/* Assign target cookie capablity */
|
||||||
|
wmi_handle->use_cookie = use_cookie;
|
||||||
|
wmi_handle->osdev = osdev;
|
||||||
|
|
||||||
return wmi_handle;
|
return wmi_handle;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user