From 3d3cf4f7a9bb6c6b930a2e28c762e2526ec522c2 Mon Sep 17 00:00:00 2001 From: Sathish Kumar Date: Fri, 17 Nov 2017 17:30:41 +0530 Subject: [PATCH] qcacmn: Add WMI interface support for Direct Buffer Rx module Direct Buffer Receive provides the driver with a mechanism by which target can transfer information directly into host memory via DMA. Add support for the following service/events/commands - 1. WMI_SERVICE_SUPPORT_DMA 2. WMI_DMA_CAPABILITIES as part of WMI_SERVICE_READY_EXT_EVENTID 3. WMI_PDEV_DMA_RING_CFG_REQ_CMDID 4. WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID 5. WMI_DMA_BUF_RELEASE_ENTRY Change-Id: I3949026b4542565c49bb538b9545ea607690c793 CRs-Fixed: 2158304 --- wmi_unified_api.h | 55 +++++++++++++++++++++++++ wmi_unified_param.h | 99 +++++++++++++++++++++++++++++++++++++++++++++ wmi_unified_priv.h | 18 +++++++++ 3 files changed, 172 insertions(+) diff --git a/wmi_unified_api.h b/wmi_unified_api.h index 535e1b22c2..870c210806 100644 --- a/wmi_unified_api.h +++ b/wmi_unified_api.h @@ -767,6 +767,16 @@ QDF_STATUS wmi_unified_oem_dma_ring_cfg(void *wmi_hdl, wmi_oem_dma_ring_cfg_req_fixed_param *cfg); #endif +/** + * wmi_unified_dbr_ring_cfg: Configure direct buffer rx rings + * @wmi_hdl: WMI handle + * @cfg: pointer to direct buffer rx config request + * + * Return: QDF status of operation + */ +QDF_STATUS wmi_unified_dbr_ring_cfg(void *wmi_hdl, + struct direct_buf_rx_cfg_req *cfg); + QDF_STATUS wmi_unified_start_oem_data_cmd(void *wmi_hdl, uint32_t data_len, uint8_t *data); @@ -1543,6 +1553,51 @@ QDF_STATUS wmi_extract_reg_cap_service_ready_ext( void *wmi_hdl, uint8_t *evt_buf, uint8_t phy_idx, struct wlan_psoc_host_hal_reg_capabilities_ext *param); + +/** + * wmi_extract_dbr_ring_cap_service_ready_ext: Extract direct buffer rx + * capability received through + * extended service ready event + * @wmi_hdl: WMI handle + * @evt_buf: Event buffer + * @idx: Index of the module for which capability is received + * @param: Pointer to direct buffer rx ring cap struct + * + * Return: QDF status of operation + */ +QDF_STATUS wmi_extract_dbr_ring_cap_service_ready_ext( + void *wmi_hdl, + uint8_t *evt_buf, uint8_t idx, + struct wlan_psoc_host_dbr_ring_caps *param); + +/** + * wmi_extract_dbr_buf_release_fixed : Extract direct buffer rx fixed param + * from buffer release event + * @wmi_hdl: WMI handle + * @evt_buf: Event buffer + * @param: Pointer to direct buffer rx response struct + * + * Return: QDF status of operation + */ +QDF_STATUS wmi_extract_dbr_buf_release_fixed( + void *wmi_hdl, + uint8_t *evt_buf, + struct direct_buf_rx_rsp *param); + +/** + * wmi_extract_dbr_buf_release_entry: Extract direct buffer rx buffer tlv + * + * @wmi_hdl: WMI handle + * @evt_buf: Event buffer + * @idx: Index of the module for which capability is received + * @param: Pointer to direct buffer rx entry + * + * Return: QDF status of operation + */ +QDF_STATUS wmi_extract_dbr_buf_release_entry( + void *wmi_hdl, + uint8_t *evt_buf, uint8_t idx, + struct direct_buf_rx_entry *param); QDF_STATUS wmi_extract_pdev_utf_event(void *wmi_hdl, uint8_t *evt_buf, struct wmi_host_pdev_utf_event *param); diff --git a/wmi_unified_param.h b/wmi_unified_param.h index afef74812c..dbfd03d037 100644 --- a/wmi_unified_param.h +++ b/wmi_unified_param.h @@ -5614,6 +5614,7 @@ typedef enum { wmi_mgmt_tx_bundle_completion_event_id, wmi_radio_tx_power_level_stats_event_id, wmi_report_stats_event_id, + wmi_dma_buf_release_event_id, wmi_events_max, } wmi_conv_event_id; @@ -6025,6 +6026,7 @@ typedef enum { wmi_service_widebw_scan, wmi_service_bcn_offload_start_stop_support, wmi_service_offchan_data_tid_support, + wmi_service_support_dma, wmi_services_max, } wmi_conv_service_ids; @@ -8168,4 +8170,101 @@ struct wdsentry { A_UINT32 flags; }; +#define WMI_HOST_DBR_RING_ADDR_LO_S 0 +#define WMI_HOST_DBR_RING_ADDR_LO 0xffffffff + +#define WMI_HOST_DBR_RING_ADDR_LO_GET(dword) \ + WMI_HOST_F_MS(dword, WMI_HOST_DBR_RING_ADDR_LO) +#define WMI_HOST_DBR_RING_ADDR_LO_SET(dword, val) \ + WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_RING_ADDR_LO) + +#define WMI_HOST_DBR_RING_ADDR_HI_S 0 +#define WMI_HOST_DBR_RING_ADDR_HI 0xf + +#define WMI_HOST_DBR_RING_ADDR_HI_GET(dword) \ + WMI_HOST_F_MS(dword, WMI_HOST_DBR_RING_ADDR_HI) +#define WMI_HOST_DBR_RING_ADDR_HI_SET(dword, val) \ + WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_RING_ADDR_HI) + +#define WMI_HOST_DBR_DATA_ADDR_LO_S 0 +#define WMI_HOST_DBR_DATA_ADDR_LO 0xffffffff + +#define WMI_HOST_DBR_DATA_ADDR_LO_GET(dword) \ + WMI_HOST_F_MS(dword, WMI_HOST_DBR_DATA_ADDR_LO) +#define WMI_HOST_DBR_DATA_ADDR_LO_SET(dword, val) \ + WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_DATA_ADDR_LO) + +#define WMI_HOST_DBR_DATA_ADDR_HI_S 0 +#define WMI_HOST_DBR_DATA_ADDR_HI 0xf + +#define WMI_HOST_DBR_DATA_ADDR_HI_GET(dword) \ + WMI_HOST_F_MS(dword, WMI_HOST_DBR_DATA_ADDR_HI) +#define WMI_HOST_DBR_DATA_ADDR_HI_SET(dword, val) \ + WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_DATA_ADDR_HI) + +#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_S 12 +#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA 0xfffff + +#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_GET(dword) \ + WMI_HOST_F_MS(dword, WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA) +#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_SET(dword, val) \ + WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA) + +/** + * struct direct_buf_rx_entry: direct buffer rx release entry structure + * + * @addr_lo: LSB 32-bits of the buffer + * @addr_hi: MSB 32-bits of the buffer + * @len: Length of the buffer + */ +struct direct_buf_rx_entry { + uint32_t paddr_lo; + uint32_t paddr_hi; + uint32_t len; +}; + +/** + * struct direct_buf_rx_rsp: direct buffer rx response structure + * + * @pdev_id: Index of the pdev for which response is received + * @mod_mod: Index of the module for which respone is received + * @num_buf_release_entry: Number of buffers released through event + * @dbr_entries: Pointer to direct buffer rx entry struct + */ +struct direct_buf_rx_rsp { + uint32_t pdev_id; + uint32_t mod_id; + uint32_t num_buf_release_entry; + struct direct_buf_rx_entry *dbr_entries; +}; + +/** + * struct direct_buf_rx_cfg_req: direct buffer rx config request structure + * + * @pdev_id: Index of the pdev for which response is received + * @mod_id: Index of the module for which respone is received + * @base_paddr_lo: Lower 32bits of ring base address + * @base_paddr_hi: Higher 32bits of ring base address + * @head_idx_paddr_lo: Lower 32bits of head idx register address + * @head_idx_paddr_hi: Higher 32bits of head idx register address + * @tail_idx_paddr_lo: Lower 32bits of tail idx register address + * @tail_idx_paddr_hi: Higher 32bits of tail idx register address + * @buf_size: Size of the buffer for each pointer in the ring + * @num_elems: Number of pointers allocated and part of the source ring + */ +struct direct_buf_rx_cfg_req { + uint32_t pdev_id; + uint32_t mod_id; + uint32_t base_paddr_lo; + uint32_t base_paddr_hi; + uint32_t head_idx_paddr_lo; + uint32_t head_idx_paddr_hi; + uint32_t tail_idx_paddr_hi; + uint32_t tail_idx_paddr_lo; + uint32_t buf_size; + uint32_t num_elems; + uint32_t event_timeout_ms; + uint32_t num_resp_per_event; +}; + #endif /* _WMI_UNIFIED_PARAM_H_ */ diff --git a/wmi_unified_priv.h b/wmi_unified_priv.h index ca0e9c6f78..e989919493 100644 --- a/wmi_unified_priv.h +++ b/wmi_unified_priv.h @@ -628,6 +628,9 @@ QDF_STATUS (*send_oem_dma_cfg_cmd)(wmi_unified_t wmi_handle, wmi_oem_dma_ring_cfg_req_fixed_param *cfg); #endif +QDF_STATUS (*send_dbr_cfg_cmd)(wmi_unified_t wmi_handle, + struct direct_buf_rx_cfg_req *cfg); + QDF_STATUS (*send_start_oem_data_cmd)(wmi_unified_t wmi_handle, uint32_t data_len, uint8_t *data); @@ -1354,6 +1357,21 @@ QDF_STATUS (*extract_reg_cap_service_ready_ext)( uint8_t *evt_buf, uint8_t phy_idx, struct wlan_psoc_host_hal_reg_capabilities_ext *param); +QDF_STATUS (*extract_dbr_ring_cap_service_ready_ext)( + wmi_unified_t wmi_handle, + uint8_t *evt_buf, uint8_t idx, + struct wlan_psoc_host_dbr_ring_caps *param); + +QDF_STATUS (*extract_dbr_buf_release_fixed)( + wmi_unified_t wmi_handle, + uint8_t *evt_buf, + struct direct_buf_rx_rsp *param); + +QDF_STATUS (*extract_dbr_buf_release_entry)( + wmi_unified_t wmi_handle, + uint8_t *evt_buf, uint8_t idx, + struct direct_buf_rx_entry *param); + QDF_STATUS (*extract_pdev_utf_event)(wmi_unified_t wmi_hdl, uint8_t *evt_buf, struct wmi_host_pdev_utf_event *param);