From 44cf05f6c8ea9fe3a0ed605447825c436f889885 Mon Sep 17 00:00:00 2001 From: Naveen Rawat Date: Sat, 29 Apr 2017 16:24:40 -0700 Subject: [PATCH] qcacmn: Parse service ready ext event for WIFI_POS DMA rings cap Parse service ready extension event to get DMA ring capability requested by firmware to enable CIR/CFR capture. This cap is then saved in WIFI_POS psoc private object. Change-Id: I6f6958250af06ac69b627d2f06e120955d625c62 CRs-Fixed: 2040688 --- target_if/wifi_pos/inc/target_if_wifi_pos.h | 24 ++++++++- target_if/wifi_pos/src/target_if_wifi_pos.c | 56 ++++++++++++++++++++ umac/wifi_pos/inc/wifi_pos_api.h | 22 ++++++++ umac/wifi_pos/src/wifi_pos_api.c | 9 ++++ umac/wifi_pos/src/wifi_pos_utils_i.h | 57 ++++++++++++++++++++- 5 files changed, 165 insertions(+), 3 deletions(-) diff --git a/target_if/wifi_pos/inc/target_if_wifi_pos.h b/target_if/wifi_pos/inc/target_if_wifi_pos.h index 18d63eb935..4cd5448e47 100644 --- a/target_if/wifi_pos/inc/target_if_wifi_pos.h +++ b/target_if/wifi_pos/inc/target_if_wifi_pos.h @@ -93,7 +93,6 @@ static inline struct wlan_lmac_if_wifi_pos_tx_ops *target_if_wifi_pos_get_txops( return NULL; } - static inline struct wlan_lmac_if_wifi_pos_rx_ops *target_if_wifi_pos_get_rxops( struct wlan_objmgr_psoc *psoc) { @@ -111,4 +110,27 @@ static inline void target_if_wifi_pos_register_rx_ops( } #endif +#if defined(WLAN_FEATURE_CIF_CFR) && defined(WIFI_POS_CONVERGED) +/** + * target_if_wifi_pos_init_cir_cfr_rings: set DMA ring cap in psoc private + * object + * @psoc: pointer to psoc object + * @hal_soc: pointer to hal soc + * @num_mac: number of mac + * @buf: buffer containing DMA ring cap + * + * Return: status of operation + */ +QDF_STATUS target_if_wifi_pos_init_cir_cfr_rings(struct wlan_objmgr_psoc *psoc, + void *hal_soc, uint8_t num_mac, + void *buf); +#else +static inline QDF_STATUS target_if_wifi_pos_init_cir_cfr_rings( + struct wlan_objmgr_psoc *psoc, void *hal_soc, + uint8_t num_mac, void *buf) +{ + return QDF_STATUS_SUCCESS; +} +#endif + #endif /* _WIFI_POS_TGT_IF_H_ */ diff --git a/target_if/wifi_pos/src/target_if_wifi_pos.c b/target_if/wifi_pos/src/target_if_wifi_pos.c index e540852a1c..133665a4a3 100644 --- a/target_if/wifi_pos/src/target_if_wifi_pos.c +++ b/target_if/wifi_pos/src/target_if_wifi_pos.c @@ -36,6 +36,9 @@ #include "target_if_wifi_pos.h" #include "../../../../umac/wifi_pos/src/wifi_pos_main_i.h" #include "target_if.h" +#ifdef WLAN_FEATURE_CIF_CFR +#include "hal_api.h" +#endif /** * wifi_pos_oem_rsp_ev_handler: handler registered with WMI_OEM_RESPONSE_EVENTID @@ -271,3 +274,56 @@ QDF_STATUS target_if_wifi_pos_deregister_events(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_SUCCESS; } + +#ifdef WLAN_FEATURE_CIF_CFR +static QDF_STATUS target_if_wifi_pos_init_srngs(struct wlan_objmgr_psoc *psoc, + void *hal_soc, struct wifi_pos_psoc_priv_obj *priv_obj) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS target_if_wifi_pos_cfg_fw(struct wlan_objmgr_psoc *psoc, + struct wifi_pos_psoc_priv_obj *priv_obj) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS target_if_wifi_pos_init_cir_cfr_rings(struct wlan_objmgr_psoc *psoc, + void *hal_soc, uint8_t num_mac, + void *buf) +{ + uint8_t i; + struct wifi_pos_psoc_priv_obj *priv_obj = + wifi_pos_get_psoc_priv_obj(psoc); + WMI_OEM_DMA_RING_CAPABILITIES *dma_cap = buf; + + if (!priv_obj) { + target_if_err("unable to get wifi_pos psoc obj"); + return QDF_STATUS_E_NULL_VALUE; + } + + priv_obj->hal_soc = hal_soc; + priv_obj->num_rings = num_mac; + priv_obj->dma_cap = qdf_mem_malloc(priv_obj->num_rings * + sizeof(struct wifi_pos_dma_rings_cap)); + if (!priv_obj->dma_cap) { + target_if_err("unable to get wifi_pos psoc obj"); + return QDF_STATUS_E_NOMEM; + } + + for (i = 0; i < num_mac; i++) { + priv_obj->dma_cap[i].pdev_id = dma_cap[i].pdev_id; + priv_obj->dma_cap[i].min_num_ptr = dma_cap[i].min_num_ptr; + priv_obj->dma_cap[i].min_buf_size = dma_cap[i].min_buf_size; + priv_obj->dma_cap[i].min_buf_align = dma_cap[i].min_buf_align; + } + + /* initialize DMA rings now */ + target_if_wifi_pos_init_srngs(psoc, hal_soc, priv_obj); + + /* send cfg req cmd to firmware */ + target_if_wifi_pos_cfg_fw(psoc, priv_obj); + + return QDF_STATUS_SUCCESS; +} +#endif diff --git a/umac/wifi_pos/inc/wifi_pos_api.h b/umac/wifi_pos/inc/wifi_pos_api.h index 6a25d8b106..099693dd22 100644 --- a/umac/wifi_pos/inc/wifi_pos_api.h +++ b/umac/wifi_pos/inc/wifi_pos_api.h @@ -347,4 +347,26 @@ static inline QDF_STATUS wifi_pos_psoc_disable(struct wlan_objmgr_psoc *psoc) } #endif +#if defined(WLAN_FEATURE_CIF_CFR) && defined(WIFI_POS_CONVERGED) +/** + * wifi_pos_init_cir_cfr_rings: API to set DMA ring cap in wifi pos psoc private + * object + * @psoc: pointer to psoc object + * @hal_soc: hal soc pointer + * @num_mac: number of macs + * @buf: buffer containing dma ring cap + * + * Return: status of operation. + */ +QDF_STATUS wifi_pos_init_cir_cfr_rings(struct wlan_objmgr_psoc *psoc, + void *hal_soc, uint8_t num_mac, void *buf); +#else +static inline QDF_STATUS wifi_pos_init_cir_cfr_rings( + struct wlan_objmgr_psoc *psoc, + void *hal_soc, uint8_t num_mac, void *buf) +{ + return QDF_STATUS_SUCCESS; +} +#endif + #endif diff --git a/umac/wifi_pos/src/wifi_pos_api.c b/umac/wifi_pos/src/wifi_pos_api.c index 1abe5adef7..e917752026 100644 --- a/umac/wifi_pos/src/wifi_pos_api.c +++ b/umac/wifi_pos/src/wifi_pos_api.c @@ -257,3 +257,12 @@ bool wifi_pos_is_app_registered(struct wlan_objmgr_psoc *psoc) return is_app_registered; } +#ifdef WLAN_FEATURE_CIF_CFR +QDF_STATUS wifi_pos_init_cir_cfr_rings(struct wlan_objmgr_psoc *psoc, + void *hal_soc, uint8_t num_mac, void *buf) +{ + return target_if_wifi_pos_init_cir_cfr_rings(psoc, hal_soc, + num_mac, buf); +} +#endif + diff --git a/umac/wifi_pos/src/wifi_pos_utils_i.h b/umac/wifi_pos/src/wifi_pos_utils_i.h index 19b57c06b9..fed26984dc 100644 --- a/umac/wifi_pos/src/wifi_pos_utils_i.h +++ b/umac/wifi_pos/src/wifi_pos_utils_i.h @@ -182,6 +182,42 @@ struct qdf_packed wifi_pos_oem_get_cap_rsp { struct wifi_pos_user_defined_caps user_defined_cap; }; +/** + * struct wifi_pos_dma_rings_cap - capabilities requested by firmware. + * @pdev_id: pdev_id or mac_id of ring + * @min_num_ptr: minimum depth of ring required + * @min_buf_size: minimum size of each buffer + * @min_buf_align: minimum allignment of buffer memory + */ +struct wifi_pos_dma_rings_cap { + uint32_t pdev_id; + uint32_t min_num_ptr; + uint32_t min_buf_size; + uint32_t min_buf_align; +}; + +/** + * struct wifi_pos_dma_rings_cfg - DMA ring parameters to be programmed to FW. + * @pdev_id: pdev_id of ring + * @base_addr_lo: Base address of ring, bits 31:0 + * @base_addr_hi: Base address of ring, bits 63:32 + * @head_idx_addr_lo: Address of head index register, bits 31:0 + * @head_idx_addr_hi: Address of head index register, bits 63:32 + * @tail_idx_addr_lo: Address of tail index register, bits 31:0 + * @tail_idx_addr_hi: Address of tail index register, bits 63:32 + * @num_ptr: Number of pointers in the ring + */ +struct wifi_pos_dma_rings_cfg { + uint32_t pdev_id; + uint32_t base_addr_lo; + uint32_t base_addr_hi; + uint32_t head_idx_addr_lo; + uint32_t head_idx_addr_hi; + uint32_t tail_idx_addr_lo; + uint32_t tail_idx_addr_hi; + uint32_t num_ptr; +}; + /** * struct wifi_pos_psoc_priv_obj - psoc obj data for wifi_pos * @app_pid: pid of app registered to host driver @@ -190,7 +226,22 @@ struct qdf_packed wifi_pos_oem_get_cap_rsp { * @ftm_rr: configured value of FTM Ranging Request capability * @lci_capability: configured value of LCI capability * @rsvd: reserved + * @oem_target_type + * @oem_target_type: oem target type, populated from HDD + * @oem_fw_version: firmware version, populated from HDD + * @driver_version: driver version, populated from HDD + * @allowed_dwell_time_min: allowed dwell time min, populated from HDD + * @allowed_dwell_time_max: allowed dwell time max, populated from HDD + * @current_dwell_time_min: current dwell time min, populated from HDD + * @current_dwell_time_max: current dwell time max, populated from HDD + * @num_rings: DMA ring cap requested by firmware + * @dma_cap: dma cap as read from service ready ext event + * @dma_cfg: DMA ring cfg to be programmed to firmware + * where with num_rows = number of rings num_elements in each row = ring depth + * @wifi_pos_lock: lock to access wifi pos priv object * @wifi_pos_req_handler: function pointer to handle TLV or non-TLV + * @wifi_pos_send_rsp: function pointer to send msg to userspace APP + * * wifi pos request messages * <----- fine_time_meas_cap (in bits) -----> *+----------+-----+-----+------+------+-------+-------+-----+-----+ @@ -210,7 +261,6 @@ struct wifi_pos_psoc_priv_obj { uint32_t lci_capability:1; uint32_t rsvd:30; - /* following are populated from HDD */ uint32_t oem_target_type; uint32_t oem_fw_version; struct wifi_pos_driver_version driver_version; @@ -219,8 +269,11 @@ struct wifi_pos_psoc_priv_obj { uint16_t current_dwell_time_min; uint16_t current_dwell_time_max; - qdf_spinlock_t wifi_pos_lock; + uint8_t num_rings; + struct wifi_pos_dma_rings_cap *dma_cap; + struct wifi_pos_dma_rings_cfg *dma_cfg; + qdf_spinlock_t wifi_pos_lock; QDF_STATUS (*wifi_pos_req_handler)(struct wlan_objmgr_psoc *psoc, struct wifi_pos_req_msg *req); void (*wifi_pos_send_rsp)(uint32_t, uint32_t, uint32_t, uint8_t *);