xref: /wlan-driver/qcacld-3.0/components/qmi/dispatcher/inc/wlan_qmi_public_struct.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: wlan_qmi_public_struct.h
19  *
20  * Contains QMI public data structure definitions.
21  */
22 
23 #ifndef _WLAN_QMI_PUBLIC_STRUCT_H_
24 #define _WLAN_QMI_PUBLIC_STRUCT_H_
25 
26 #include "qdf_status.h"
27 #include <qdf_types.h>
28 
29 #ifdef QMI_WFDS
30 #define QMI_WFDS_CE_MAX_SRNG 3
31 #define QMI_WFDS_MEM_ARENA_MAX 8
32 #define QMI_WFDS_PAGE_INFO_ARRAY_MAX_SIZE 255
33 
34 /**
35  * enum wlan_qmi_wfds_srng_dir - SRNG direction
36  * @QMI_WFDS_SRNG_SOURCE_RING: SRNG source ring
37  * @QMI_WFDS_SRNG_DESTINATION_RING: SRNG destination ring
38  */
39 enum wlan_qmi_wfds_srng_dir {
40 	QMI_WFDS_SRNG_SOURCE_RING = 0,
41 	QMI_WFDS_SRNG_DESTINATION_RING = 1,
42 };
43 
44 /**
45  * struct wlan_qmi_wfds_srng_info - SRNG information
46  * @ring_id: SRNG ring id
47  * @dir: SRNG direction
48  * @num_entries: number of entries in SRNG
49  * @entry_size: size of SRNG descriptor
50  * @ring_base_paddr: ring base physical address of SRNG
51  * @hp_paddr: HP physical address of SRNG
52  * @tp_paddr: TP physical address of SRNG
53  */
54 struct wlan_qmi_wfds_srng_info {
55 	uint8_t ring_id;
56 	enum wlan_qmi_wfds_srng_dir dir;
57 	uint32_t num_entries;
58 	uint32_t entry_size;
59 	uint64_t ring_base_paddr;
60 	uint64_t hp_paddr;
61 	uint64_t tp_paddr;
62 };
63 
64 /**
65  * enum wlan_qmi_wfds_pipe_dir - pipe direction
66  * @QMI_WFDS_PIPEDIR_NONE: none pipe direction
67  * @QMI_WFDS_PIPEDIR_IN: target to host pipe direction
68  * @QMI_WFDS_PIPEDIR_OUT:  host to target pipe direction
69  */
70 enum wlan_qmi_wfds_pipe_dir {
71 	QMI_WFDS_PIPEDIR_NONE = 0,
72 	QMI_WFDS_PIPEDIR_IN = 1,
73 	QMI_WFDS_PIPEDIR_OUT = 2,
74 };
75 
76 /**
77  * struct wlan_qmi_wfds_ce_info - CE information
78  * @ce_id: CE id
79  * @ce_dir: CE direction
80  * @srng_info: SRNG information
81  */
82 struct wlan_qmi_wfds_ce_info {
83 	uint8_t ce_id;
84 	enum wlan_qmi_wfds_pipe_dir ce_dir;
85 	struct wlan_qmi_wfds_srng_info srng_info;
86 };
87 
88 /**
89  * struct wlan_qmi_wfds_config_req_msg - WFDS config request message
90  * @ce_info_len: size of ce_info with valid entries
91  * @ce_info: CE information array
92  * @rx_refill_ring: refill SRNG information
93  * @shadow_rdptr_mem_paddr: shadow read memory physical address
94  * @shadow_rdptr_mem_size:  shadow read memory size
95  * @shadow_wrptr_mem_paddr: shadow write memory physical address
96  * @shadow_wrptr_mem_size: shadow write memory size
97  * @rx_pkt_tlv_len: rx packet tlvs length
98  * @rx_rbm: return buffer manager for rx buffers
99  * @pcie_bar_pa: PCIe BAR physical address
100  * @pci_slot: PCIe slot
101  * @lpass_ep_id: LPASS data message service endpoint id
102  */
103 struct wlan_qmi_wfds_config_req_msg {
104 	uint32_t ce_info_len;
105 	struct wlan_qmi_wfds_ce_info ce_info[QMI_WFDS_CE_MAX_SRNG];
106 	struct wlan_qmi_wfds_srng_info rx_refill_ring;
107 	uint64_t shadow_rdptr_mem_paddr;
108 	uint64_t shadow_rdptr_mem_size;
109 	uint64_t shadow_wrptr_mem_paddr;
110 	uint64_t shadow_wrptr_mem_size;
111 	uint32_t rx_pkt_tlv_len;
112 	uint32_t rx_rbm;
113 	uint64_t pcie_bar_pa;
114 	uint32_t pci_slot;
115 	uint32_t lpass_ep_id;
116 };
117 
118 /**
119  * enum wlan_qmi_wfds_mem_arenas - Memory arenas
120  * @QMI_WFDS_MEM_ARENA_TX_BUFFERS: tx buffers memory arena
121  * @QMI_WFDS_MEM_ARENA_CE_TX_MSG_BUFFERS: ce tx message buffers memory arena
122  * @QMI_WFDS_MEM_ARENA_CE_RX_MSG_BUFFERS: ce rx message buffers memory arena
123  */
124 enum wlan_qmi_wfds_mem_arenas {
125 	QMI_WFDS_MEM_ARENA_TX_BUFFERS = 0,
126 	QMI_WFDS_MEM_ARENA_CE_TX_MSG_BUFFERS = 1,
127 	QMI_WFDS_MEM_ARENA_CE_RX_MSG_BUFFERS = 2,
128 };
129 
130 /**
131  * struct wlan_qmi_wfds_mem_arena_info - Memory arena information
132  * @entry_size: entry size
133  * @num_entries: total number of entries required
134  */
135 struct wlan_qmi_wfds_mem_arena_info {
136 	uint16_t entry_size;
137 	uint16_t num_entries;
138 };
139 
140 /**
141  * struct wlan_qmi_wfds_mem_ind_msg - Memory indication message
142  * @mem_arena_info_len: number of valid entries in mem_arena_info array
143  * @mem_arena_info: memory arena information array
144  */
145 struct wlan_qmi_wfds_mem_ind_msg {
146 	uint32_t mem_arena_info_len;
147 	struct wlan_qmi_wfds_mem_arena_info mem_arena_info[QMI_WFDS_MEM_ARENA_MAX];
148 };
149 
150 /**
151  * struct wlan_qmi_wfds_mem_arena_page_info - Memory arena
152  *  page information
153  * @num_entries_per_page: number of entries per page
154  * @page_dma_addr_len: number of valid entries in page_dma_addr array
155  * @page_dma_addr: page dma address array
156  */
157 struct wlan_qmi_wfds_mem_arena_page_info {
158 	uint16_t num_entries_per_page;
159 	uint32_t page_dma_addr_len;
160 	uint64_t page_dma_addr[QMI_WFDS_PAGE_INFO_ARRAY_MAX_SIZE];
161 };
162 
163 /**
164  * struct wlan_qmi_wfds_mem_req_msg - Memory request message
165  *  page information
166  * @mem_arena_page_info_len: number of valid entries in
167  *  mem_arena_page_info array
168  * @mem_arena_page_info: memory arena information
169  */
170 struct wlan_qmi_wfds_mem_req_msg {
171 	uint32_t mem_arena_page_info_len;
172 	struct wlan_qmi_wfds_mem_arena_page_info mem_arena_page_info[QMI_WFDS_MEM_ARENA_MAX];
173 };
174 
175 /**
176  * struct wlan_qmi_wfds_ipcc_info - IPCC information
177  * @ce_id: CE id
178  * @ipcc_trig_addr: IPCC trigger address
179  * @ipcc_trig_data: IPCC trigger data
180  */
181 struct wlan_qmi_wfds_ipcc_info {
182 	uint8_t ce_id;
183 	uint64_t ipcc_trig_addr;
184 	uint32_t ipcc_trig_data;
185 };
186 
187 /**
188  * struct wlan_qmi_wfds_ipcc_map_n_cfg_ind_msg - IPCC map and configure
189  *  indication message
190  * @ipcc_ce_info_len: number of valid entries in ipcc_ce_info array
191  * @ipcc_ce_info: IPCC information for CE
192  */
193 struct wlan_qmi_wfds_ipcc_map_n_cfg_ind_msg {
194 	uint32_t ipcc_ce_info_len;
195 	struct wlan_qmi_wfds_ipcc_info ipcc_ce_info[QMI_WFDS_CE_MAX_SRNG];
196 };
197 
198 /**
199  * enum wlan_qmi_wfds_status - status
200  * @QMI_WFDS_STATUS_SUCCESS: success status
201  * @QMI_WFDS_STATUS_FAILURE: failure status
202  */
203 enum wlan_qmi_wfds_status {
204 	QMI_WFDS_STATUS_SUCCESS = 0,
205 	QMI_WFDS_STATUS_FAILURE = 1,
206 };
207 
208 /**
209  * struct wlan_qmi_wfds_ipcc_map_n_cfg_req_msg - IPCC map and configure
210  *  request message
211  * @status: IPCC configuration status
212  */
213 struct wlan_qmi_wfds_ipcc_map_n_cfg_req_msg {
214 	enum wlan_qmi_wfds_status status;
215 };
216 #endif
217 
218 /**
219  * struct wlan_qmi_psoc_callbacks - struct containing callbacks
220  *  to osif QMI APIs
221  * @qmi_wfds_init: Callback to initialize WFDS QMI handle
222  * @qmi_wfds_deinit: Callback to deinitialize WFDS QMI handle
223  * @qmi_wfds_send_config_msg: Callback to send WFDS configuration message
224  * @qmi_wfds_send_req_mem_msg: Callback to send WFDS request memory message
225  * @qmi_wfds_send_ipcc_map_n_cfg_msg: Callback to send WFDS IPCC map and
226  *  configure message
227  * @qmi_wfds_send_misc_req_msg: Callback to send WFDS misc request message
228  */
229 struct wlan_qmi_psoc_callbacks {
230 #ifdef QMI_WFDS
231 	QDF_STATUS (*qmi_wfds_init)(void);
232 	void (*qmi_wfds_deinit)(void);
233 	QDF_STATUS (*qmi_wfds_send_config_msg)(
234 			struct wlan_qmi_wfds_config_req_msg *src_info);
235 	QDF_STATUS (*qmi_wfds_send_req_mem_msg)(
236 			struct wlan_qmi_wfds_mem_req_msg *src_info);
237 	QDF_STATUS (*qmi_wfds_send_ipcc_map_n_cfg_msg)(
238 			struct wlan_qmi_wfds_ipcc_map_n_cfg_req_msg *src_info);
239 	QDF_STATUS (*qmi_wfds_send_misc_req_msg)(bool is_ssr);
240 #endif
241 };
242 #endif
243