blob: fcb7c72f5616a3feda62498045bfbfcea18b6b9e [file] [log] [blame]
Ghanim Fodi2c8ba072017-01-12 15:14:15 +02001/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
Amir Levy9659e592016-10-27 18:08:27 +03002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _IPA3_I_H_
14#define _IPA3_I_H_
15
16#include <linux/bitops.h>
17#include <linux/cdev.h>
18#include <linux/export.h>
19#include <linux/idr.h>
20#include <linux/list.h>
21#include <linux/mutex.h>
22#include <linux/skbuff.h>
23#include <linux/slab.h>
24#include <linux/ipa.h>
25#include <linux/ipa_usb.h>
Amir Levy9659e592016-10-27 18:08:27 +030026#include <asm/dma-iommu.h>
27#include <linux/iommu.h>
28#include <linux/platform_device.h>
29#include <linux/firmware.h>
30#include "ipa_hw_defs.h"
31#include "ipa_qmi_service.h"
32#include "../ipa_api.h"
33#include "ipahal/ipahal_reg.h"
34#include "ipahal/ipahal.h"
35#include "ipahal/ipahal_fltrt.h"
36#include "../ipa_common_i.h"
37#include "ipa_uc_offload_i.h"
38
39#define DRV_NAME "ipa"
40#define NAT_DEV_NAME "ipaNatTable"
41#define IPA_COOKIE 0x57831603
42#define MTU_BYTE 1500
43
Skylar Chang652ee8e2017-02-10 11:40:30 -080044#define IPA_EP_NOT_ALLOCATED (-1)
Amir Levy9659e592016-10-27 18:08:27 +030045#define IPA3_MAX_NUM_PIPES 31
Amir Levy9659e592016-10-27 18:08:27 +030046#define IPA_SYS_DESC_FIFO_SZ 0x800
47#define IPA_SYS_TX_DATA_DESC_FIFO_SZ 0x1000
Skylar Changd407e592017-03-30 11:25:30 -070048#define IPA_COMMON_EVENT_RING_SIZE 0x7C00
Amir Levy9659e592016-10-27 18:08:27 +030049#define IPA_LAN_RX_HEADER_LENGTH (2)
50#define IPA_QMAP_HEADER_LENGTH (4)
51#define IPA_DL_CHECKSUM_LENGTH (8)
52#define IPA_NUM_DESC_PER_SW_TX (3)
53#define IPA_GENERIC_RX_POOL_SZ 192
54#define IPA_UC_FINISH_MAX 6
55#define IPA_UC_WAIT_MIN_SLEEP 1000
56#define IPA_UC_WAII_MAX_SLEEP 1200
Sunil Paidimarri226cf032016-10-14 13:33:08 -070057/*
58 * The transport descriptor size was changed to GSI_CHAN_RE_SIZE_16B, but
59 * IPA users still use sps_iovec size as FIFO element size.
60 */
61#define IPA_FIFO_ELEMENT_SIZE 8
Amir Levy9659e592016-10-27 18:08:27 +030062
63#define IPA_MAX_STATUS_STAT_NUM 30
64
65#define IPA_IPC_LOG_PAGES 50
66
67#define IPADBG(fmt, args...) \
68 do { \
69 pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
70 if (ipa3_ctx) { \
71 IPA_IPC_LOGGING(ipa3_ctx->logbuf, \
72 DRV_NAME " %s:%d " fmt, ## args); \
73 IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, \
74 DRV_NAME " %s:%d " fmt, ## args); \
75 } \
76 } while (0)
77
78#define IPADBG_LOW(fmt, args...) \
79 do { \
80 pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
81 if (ipa3_ctx) \
82 IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, \
83 DRV_NAME " %s:%d " fmt, ## args); \
84 } while (0)
85
86#define IPAERR(fmt, args...) \
87 do { \
88 pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
89 if (ipa3_ctx) { \
90 IPA_IPC_LOGGING(ipa3_ctx->logbuf, \
91 DRV_NAME " %s:%d " fmt, ## args); \
92 IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, \
93 DRV_NAME " %s:%d " fmt, ## args); \
94 } \
95 } while (0)
96
97#define WLAN_AMPDU_TX_EP 15
98#define WLAN_PROD_TX_EP 19
99#define WLAN1_CONS_RX_EP 14
100#define WLAN2_CONS_RX_EP 16
101#define WLAN3_CONS_RX_EP 17
102#define WLAN4_CONS_RX_EP 18
103
104#define IPA_RAM_NAT_OFST 0
105#define IPA_RAM_NAT_SIZE 0
106#define IPA_MEM_CANARY_VAL 0xdeadbeef
107
108#define IPA_STATS
109
110#ifdef IPA_STATS
111#define IPA_STATS_INC_CNT(val) (++val)
112#define IPA_STATS_DEC_CNT(val) (--val)
113#define IPA_STATS_EXCP_CNT(__excp, __base) do { \
114 if (__excp < 0 || __excp >= IPAHAL_PKT_STATUS_EXCEPTION_MAX) \
115 break; \
116 ++__base[__excp]; \
117 } while (0)
118#else
119#define IPA_STATS_INC_CNT(x) do { } while (0)
120#define IPA_STATS_DEC_CNT(x)
121#define IPA_STATS_EXCP_CNT(__excp, __base) do { } while (0)
122#endif
123
124#define IPA_HDR_BIN0 0
125#define IPA_HDR_BIN1 1
126#define IPA_HDR_BIN2 2
127#define IPA_HDR_BIN3 3
128#define IPA_HDR_BIN4 4
129#define IPA_HDR_BIN_MAX 5
130
131#define IPA_HDR_PROC_CTX_BIN0 0
132#define IPA_HDR_PROC_CTX_BIN1 1
133#define IPA_HDR_PROC_CTX_BIN_MAX 2
134
Amir Levy9659e592016-10-27 18:08:27 +0300135#define IPA_RX_POOL_CEIL 32
136#define IPA_RX_SKB_SIZE 1792
137
138#define IPA_A5_MUX_HDR_NAME "ipa_excp_hdr"
139#define IPA_LAN_RX_HDR_NAME "ipa_lan_hdr"
140#define IPA_INVALID_L4_PROTOCOL 0xFF
141
Amir Levy9659e592016-10-27 18:08:27 +0300142#define IPA_HDR_PROC_CTX_TABLE_ALIGNMENT_BYTE 8
143#define IPA_HDR_PROC_CTX_TABLE_ALIGNMENT(start_ofst) \
144 (((start_ofst) + IPA_HDR_PROC_CTX_TABLE_ALIGNMENT_BYTE - 1) & \
145 ~(IPA_HDR_PROC_CTX_TABLE_ALIGNMENT_BYTE - 1))
146
147#define MAX_RESOURCE_TO_CLIENTS (IPA_CLIENT_MAX)
148#define IPA_MEM_PART(x_) (ipa3_ctx->ctrl->mem_partition.x_)
149
150#define IPA_GSI_CHANNEL_STOP_MAX_RETRY 10
151#define IPA_GSI_CHANNEL_STOP_PKT_SIZE 1
152
153#define IPA_GSI_CHANNEL_EMPTY_MAX_RETRY 15
154#define IPA_GSI_CHANNEL_EMPTY_SLEEP_MIN_USEC (1000)
155#define IPA_GSI_CHANNEL_EMPTY_SLEEP_MAX_USEC (2000)
156
157#define IPA_SLEEP_CLK_RATE_KHZ (32)
158
159#define IPA3_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES 120
160#define IPA3_ACTIVE_CLIENTS_LOG_LINE_LEN 96
161#define IPA3_ACTIVE_CLIENTS_LOG_HASHTABLE_SIZE 50
162#define IPA3_ACTIVE_CLIENTS_LOG_NAME_LEN 40
163
164struct ipa3_active_client_htable_entry {
165 struct hlist_node list;
166 char id_string[IPA3_ACTIVE_CLIENTS_LOG_NAME_LEN];
167 int count;
168 enum ipa_active_client_log_type type;
169};
170
171struct ipa3_active_clients_log_ctx {
172 char *log_buffer[IPA3_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES];
173 int log_head;
174 int log_tail;
175 bool log_rdy;
176 struct hlist_head htable[IPA3_ACTIVE_CLIENTS_LOG_HASHTABLE_SIZE];
177};
178
179struct ipa3_client_names {
180 enum ipa_client_type names[MAX_RESOURCE_TO_CLIENTS];
181 int length;
182};
183
184struct ipa_smmu_cb_ctx {
185 bool valid;
186 struct device *dev;
187 struct dma_iommu_mapping *mapping;
188 struct iommu_domain *iommu;
189 unsigned long next_addr;
190 u32 va_start;
191 u32 va_size;
192 u32 va_end;
193};
194
195/**
196 * struct ipa3_flt_entry - IPA filtering table entry
197 * @link: entry's link in global filtering enrties list
198 * @rule: filter rule
199 * @cookie: cookie used for validity check
200 * @tbl: filter table
201 * @rt_tbl: routing table
202 * @hw_len: entry's size
203 * @id: rule handle - globally unique
204 * @prio: rule 10bit priority which defines the order of the rule
205 * among other rules at the same integrated table
206 * @rule_id: rule 10bit ID to be returned in packet status
207 */
208struct ipa3_flt_entry {
209 struct list_head link;
210 struct ipa_flt_rule rule;
211 u32 cookie;
212 struct ipa3_flt_tbl *tbl;
213 struct ipa3_rt_tbl *rt_tbl;
214 u32 hw_len;
215 int id;
216 u16 prio;
217 u16 rule_id;
218};
219
220/**
221 * struct ipa3_rt_tbl - IPA routing table
222 * @link: table's link in global routing tables list
223 * @head_rt_rule_list: head of routing rules list
224 * @name: routing table name
225 * @idx: routing table index
226 * @rule_cnt: number of rules in routing table
227 * @ref_cnt: reference counter of routing table
228 * @set: collection of routing tables
229 * @cookie: cookie used for validity check
230 * @in_sys: flag indicating if the table is located in system memory
231 * @sz: the size of the routing table
232 * @curr_mem: current routing tables block in sys memory
233 * @prev_mem: previous routing table block in sys memory
234 * @id: routing table id
235 * @rule_ids: idr structure that holds the rule_id for each rule
236 */
237struct ipa3_rt_tbl {
238 struct list_head link;
239 struct list_head head_rt_rule_list;
240 char name[IPA_RESOURCE_NAME_MAX];
241 u32 idx;
242 u32 rule_cnt;
243 u32 ref_cnt;
244 struct ipa3_rt_tbl_set *set;
245 u32 cookie;
246 bool in_sys[IPA_RULE_TYPE_MAX];
247 u32 sz[IPA_RULE_TYPE_MAX];
248 struct ipa_mem_buffer curr_mem[IPA_RULE_TYPE_MAX];
249 struct ipa_mem_buffer prev_mem[IPA_RULE_TYPE_MAX];
250 int id;
251 struct idr rule_ids;
252};
253
254/**
255 * struct ipa3_hdr_entry - IPA header table entry
256 * @link: entry's link in global header table entries list
257 * @hdr: the header
258 * @hdr_len: header length
259 * @name: name of header table entry
260 * @type: l2 header type
261 * @is_partial: flag indicating if header table entry is partial
262 * @is_hdr_proc_ctx: false - hdr entry resides in hdr table,
263 * true - hdr entry resides in DDR and pointed to by proc ctx
264 * @phys_base: physical address of entry in DDR when is_hdr_proc_ctx is true,
265 * else 0
266 * @proc_ctx: processing context header
267 * @offset_entry: entry's offset
268 * @cookie: cookie used for validity check
269 * @ref_cnt: reference counter of routing table
270 * @id: header entry id
271 * @is_eth2_ofst_valid: is eth2_ofst field valid?
272 * @eth2_ofst: offset to start of Ethernet-II/802.3 header
Ghanim Fodi2c8ba072017-01-12 15:14:15 +0200273 * @user_deleted: is the header deleted by the user?
Amir Levy9659e592016-10-27 18:08:27 +0300274 */
275struct ipa3_hdr_entry {
276 struct list_head link;
277 u8 hdr[IPA_HDR_MAX_SIZE];
278 u32 hdr_len;
279 char name[IPA_RESOURCE_NAME_MAX];
280 enum ipa_hdr_l2_type type;
281 u8 is_partial;
282 bool is_hdr_proc_ctx;
283 dma_addr_t phys_base;
284 struct ipa3_hdr_proc_ctx_entry *proc_ctx;
285 struct ipa_hdr_offset_entry *offset_entry;
286 u32 cookie;
287 u32 ref_cnt;
288 int id;
289 u8 is_eth2_ofst_valid;
290 u16 eth2_ofst;
Ghanim Fodi2c8ba072017-01-12 15:14:15 +0200291 bool user_deleted;
Amir Levy9659e592016-10-27 18:08:27 +0300292};
293
294/**
295 * struct ipa3_hdr_tbl - IPA header table
296 * @head_hdr_entry_list: header entries list
297 * @head_offset_list: header offset list
298 * @head_free_offset_list: header free offset list
299 * @hdr_cnt: number of headers
300 * @end: the last header index
301 */
302struct ipa3_hdr_tbl {
303 struct list_head head_hdr_entry_list;
304 struct list_head head_offset_list[IPA_HDR_BIN_MAX];
305 struct list_head head_free_offset_list[IPA_HDR_BIN_MAX];
306 u32 hdr_cnt;
307 u32 end;
308};
309
310/**
311 * struct ipa3_hdr_offset_entry - IPA header offset entry
312 * @link: entry's link in global processing context header offset entries list
313 * @offset: the offset
314 * @bin: bin
315 */
316struct ipa3_hdr_proc_ctx_offset_entry {
317 struct list_head link;
318 u32 offset;
319 u32 bin;
320};
321
322/**
323 * struct ipa3_hdr_proc_ctx_entry - IPA processing context header table entry
324 * @link: entry's link in global header table entries list
Skylar Chang7fa22712017-04-03 18:29:21 -0700325 * @type: header processing context type
326 * @l2tp_params: L2TP parameters
Amir Levy9659e592016-10-27 18:08:27 +0300327 * @offset_entry: entry's offset
328 * @hdr: the header
329 * @cookie: cookie used for validity check
330 * @ref_cnt: reference counter of routing table
331 * @id: processing context header entry id
Ghanim Fodi2c8ba072017-01-12 15:14:15 +0200332 * @user_deleted: is the hdr processing context deleted by the user?
Amir Levy9659e592016-10-27 18:08:27 +0300333 */
334struct ipa3_hdr_proc_ctx_entry {
335 struct list_head link;
336 enum ipa_hdr_proc_type type;
Skylar Chang7fa22712017-04-03 18:29:21 -0700337 union ipa_l2tp_hdr_proc_ctx_params l2tp_params;
Amir Levy9659e592016-10-27 18:08:27 +0300338 struct ipa3_hdr_proc_ctx_offset_entry *offset_entry;
339 struct ipa3_hdr_entry *hdr;
340 u32 cookie;
341 u32 ref_cnt;
342 int id;
Ghanim Fodi2c8ba072017-01-12 15:14:15 +0200343 bool user_deleted;
Amir Levy9659e592016-10-27 18:08:27 +0300344};
345
346/**
347 * struct ipa3_hdr_proc_ctx_tbl - IPA processing context header table
348 * @head_proc_ctx_entry_list: header entries list
349 * @head_offset_list: header offset list
350 * @head_free_offset_list: header free offset list
351 * @proc_ctx_cnt: number of processing context headers
352 * @end: the last processing context header index
353 * @start_offset: offset in words of processing context header table
354 */
355struct ipa3_hdr_proc_ctx_tbl {
356 struct list_head head_proc_ctx_entry_list;
357 struct list_head head_offset_list[IPA_HDR_PROC_CTX_BIN_MAX];
358 struct list_head head_free_offset_list[IPA_HDR_PROC_CTX_BIN_MAX];
359 u32 proc_ctx_cnt;
360 u32 end;
361 u32 start_offset;
362};
363
364/**
365 * struct ipa3_flt_tbl - IPA filter table
366 * @head_flt_rule_list: filter rules list
367 * @rule_cnt: number of filter rules
368 * @in_sys: flag indicating if filter table is located in system memory
369 * @sz: the size of the filter tables
370 * @end: the last header index
371 * @curr_mem: current filter tables block in sys memory
372 * @prev_mem: previous filter table block in sys memory
373 * @rule_ids: idr structure that holds the rule_id for each rule
374 */
375struct ipa3_flt_tbl {
376 struct list_head head_flt_rule_list;
377 u32 rule_cnt;
378 bool in_sys[IPA_RULE_TYPE_MAX];
379 u32 sz[IPA_RULE_TYPE_MAX];
380 struct ipa_mem_buffer curr_mem[IPA_RULE_TYPE_MAX];
381 struct ipa_mem_buffer prev_mem[IPA_RULE_TYPE_MAX];
382 bool sticky_rear;
383 struct idr rule_ids;
384};
385
386/**
387 * struct ipa3_rt_entry - IPA routing table entry
388 * @link: entry's link in global routing table entries list
389 * @rule: routing rule
390 * @cookie: cookie used for validity check
391 * @tbl: routing table
392 * @hdr: header table
393 * @proc_ctx: processing context table
394 * @hw_len: the length of the table
395 * @id: rule handle - globaly unique
396 * @prio: rule 10bit priority which defines the order of the rule
397 * among other rules at the integrated same table
398 * @rule_id: rule 10bit ID to be returned in packet status
399 */
400struct ipa3_rt_entry {
401 struct list_head link;
402 struct ipa_rt_rule rule;
403 u32 cookie;
404 struct ipa3_rt_tbl *tbl;
405 struct ipa3_hdr_entry *hdr;
406 struct ipa3_hdr_proc_ctx_entry *proc_ctx;
407 u32 hw_len;
408 int id;
409 u16 prio;
410 u16 rule_id;
411};
412
413/**
414 * struct ipa3_rt_tbl_set - collection of routing tables
415 * @head_rt_tbl_list: collection of routing tables
416 * @tbl_cnt: number of routing tables
417 */
418struct ipa3_rt_tbl_set {
419 struct list_head head_rt_tbl_list;
420 u32 tbl_cnt;
421};
422
423/**
424 * struct ipa3_wlan_stats - Wlan stats for each wlan endpoint
425 * @rx_pkts_rcvd: Packets sent by wlan driver
426 * @rx_pkts_status_rcvd: Status packets received from ipa hw
427 * @rx_hd_processed: Data Descriptors processed by IPA Driver
428 * @rx_hd_reply: Data Descriptors recycled by wlan driver
429 * @rx_hd_rcvd: Data Descriptors sent by wlan driver
430 * @rx_pkt_leak: Packet count that are not recycled
431 * @rx_dp_fail: Packets failed to transfer to IPA HW
432 * @tx_pkts_rcvd: SKB Buffers received from ipa hw
433 * @tx_pkts_sent: SKB Buffers sent to wlan driver
434 * @tx_pkts_dropped: Dropped packets count
435 */
436struct ipa3_wlan_stats {
437 u32 rx_pkts_rcvd;
438 u32 rx_pkts_status_rcvd;
439 u32 rx_hd_processed;
440 u32 rx_hd_reply;
441 u32 rx_hd_rcvd;
442 u32 rx_pkt_leak;
443 u32 rx_dp_fail;
444 u32 tx_pkts_rcvd;
445 u32 tx_pkts_sent;
446 u32 tx_pkts_dropped;
447};
448
449/**
450 * struct ipa3_wlan_comm_memb - Wlan comm members
451 * @wlan_spinlock: protects wlan comm buff list and its size
452 * @ipa_tx_mul_spinlock: protects tx dp mul transfer
453 * @wlan_comm_total_cnt: wlan common skb buffers allocated count
454 * @wlan_comm_free_cnt: wlan common skb buffer free count
455 * @total_tx_pkts_freed: Recycled Buffer count
456 * @wlan_comm_desc_list: wlan common skb buffer list
457 */
458struct ipa3_wlan_comm_memb {
459 spinlock_t wlan_spinlock;
460 spinlock_t ipa_tx_mul_spinlock;
461 u32 wlan_comm_total_cnt;
462 u32 wlan_comm_free_cnt;
463 u32 total_tx_pkts_freed;
464 struct list_head wlan_comm_desc_list;
465 atomic_t active_clnt_cnt;
466};
467
468struct ipa_gsi_ep_mem_info {
469 u16 evt_ring_len;
470 u64 evt_ring_base_addr;
471 void *evt_ring_base_vaddr;
472 u16 chan_ring_len;
473 u64 chan_ring_base_addr;
474 void *chan_ring_base_vaddr;
475};
476
477struct ipa3_status_stats {
478 struct ipahal_pkt_status status[IPA_MAX_STATUS_STAT_NUM];
Gidon Studinski3021a6f2016-11-10 12:48:48 +0200479 unsigned int curr;
Amir Levy9659e592016-10-27 18:08:27 +0300480};
481
482/**
483 * struct ipa3_ep_context - IPA end point context
484 * @valid: flag indicating id EP context is valid
485 * @client: EP client type
Amir Levy9659e592016-10-27 18:08:27 +0300486 * @gsi_chan_hdl: EP's GSI channel handle
487 * @gsi_evt_ring_hdl: EP's GSI channel event ring handle
488 * @gsi_mem_info: EP's GSI channel rings info
489 * @chan_scratch: EP's GSI channel scratch info
490 * @cfg: EP cionfiguration
491 * @dst_pipe_index: destination pipe index
492 * @rt_tbl_idx: routing table index
Amir Levy9659e592016-10-27 18:08:27 +0300493 * @priv: user provided information which will forwarded once the user is
494 * notified for new data avail
495 * @client_notify: user provided CB for EP events notification, the event is
496 * data revived.
Amir Levy9659e592016-10-27 18:08:27 +0300497 * @skip_ep_cfg: boolean field that determines if EP should be configured
498 * by IPA driver
499 * @keep_ipa_awake: when true, IPA will not be clock gated
500 * @disconnect_in_progress: Indicates client disconnect in progress.
501 * @qmi_request_sent: Indicates whether QMI request to enable clear data path
502 * request is sent or not.
503 * @napi_enabled: when true, IPA call client callback to start polling
504 */
505struct ipa3_ep_context {
506 int valid;
507 enum ipa_client_type client;
Amir Levy9659e592016-10-27 18:08:27 +0300508 unsigned long gsi_chan_hdl;
509 unsigned long gsi_evt_ring_hdl;
510 struct ipa_gsi_ep_mem_info gsi_mem_info;
511 union __packed gsi_channel_scratch chan_scratch;
512 bool bytes_xfered_valid;
513 u16 bytes_xfered;
514 dma_addr_t phys_base;
515 struct ipa_ep_cfg cfg;
516 struct ipa_ep_cfg_holb holb;
517 struct ipahal_reg_ep_cfg_status status;
518 u32 dst_pipe_index;
519 u32 rt_tbl_idx;
Amir Levy9659e592016-10-27 18:08:27 +0300520 void *priv;
521 void (*client_notify)(void *priv, enum ipa_dp_evt_type evt,
522 unsigned long data);
Amir Levy9659e592016-10-27 18:08:27 +0300523 atomic_t avail_fifo_desc;
524 u32 dflt_flt4_rule_hdl;
525 u32 dflt_flt6_rule_hdl;
526 bool skip_ep_cfg;
527 bool keep_ipa_awake;
528 struct ipa3_wlan_stats wstats;
529 u32 uc_offload_state;
530 bool disconnect_in_progress;
531 u32 qmi_request_sent;
532 bool napi_enabled;
Amir Levy9659e592016-10-27 18:08:27 +0300533 u32 eot_in_poll_err;
534
535 /* sys MUST be the last element of this struct */
536 struct ipa3_sys_context *sys;
537};
538
539/**
540 * ipa_usb_xdci_chan_params - xDCI channel related properties
541 *
542 * @ipa_ep_cfg: IPA EP configuration
543 * @client: type of "client"
544 * @priv: callback cookie
545 * @notify: callback
546 * priv - callback cookie evt - type of event data - data relevant
547 * to event. May not be valid. See event_type enum for valid
548 * cases.
549 * @skip_ep_cfg: boolean field that determines if EP should be
550 * configured by IPA driver
551 * @keep_ipa_awake: when true, IPA will not be clock gated
552 * @evt_ring_params: parameters for the channel's event ring
553 * @evt_scratch: parameters for the channel's event ring scratch
554 * @chan_params: parameters for the channel
555 * @chan_scratch: parameters for the channel's scratch
556 *
557 */
558struct ipa_request_gsi_channel_params {
559 struct ipa_ep_cfg ipa_ep_cfg;
560 enum ipa_client_type client;
561 void *priv;
562 ipa_notify_cb notify;
563 bool skip_ep_cfg;
564 bool keep_ipa_awake;
565 struct gsi_evt_ring_props evt_ring_params;
566 union __packed gsi_evt_scratch evt_scratch;
567 struct gsi_chan_props chan_params;
568 union __packed gsi_channel_scratch chan_scratch;
569};
570
571enum ipa3_sys_pipe_policy {
572 IPA_POLICY_INTR_MODE,
573 IPA_POLICY_NOINTR_MODE,
574 IPA_POLICY_INTR_POLL_MODE,
575};
576
577struct ipa3_repl_ctx {
578 struct ipa3_rx_pkt_wrapper **cache;
579 atomic_t head_idx;
580 atomic_t tail_idx;
581 u32 capacity;
582};
583
584/**
Amir Levya59ed3f2017-03-05 17:30:55 +0200585 * struct ipa3_sys_context - IPA GPI pipes context
Amir Levy9659e592016-10-27 18:08:27 +0300586 * @head_desc_list: header descriptors list
587 * @len: the size of the above list
588 * @spinlock: protects the list and its size
Amir Levy9659e592016-10-27 18:08:27 +0300589 * @ep: IPA EP context
590 *
Amir Levya59ed3f2017-03-05 17:30:55 +0200591 * IPA context specific to the GPI pipes a.k.a LAN IN/OUT and WAN
Amir Levy9659e592016-10-27 18:08:27 +0300592 */
593struct ipa3_sys_context {
594 u32 len;
Skylar Changd407e592017-03-30 11:25:30 -0700595 u32 len_pending_xfer;
Amir Levy9659e592016-10-27 18:08:27 +0300596 atomic_t curr_polling_state;
597 struct delayed_work switch_to_intr_work;
598 enum ipa3_sys_pipe_policy policy;
Skylar Changd407e592017-03-30 11:25:30 -0700599 bool use_comm_evt_ring;
Amir Levy9659e592016-10-27 18:08:27 +0300600 int (*pyld_hdlr)(struct sk_buff *skb, struct ipa3_sys_context *sys);
601 struct sk_buff * (*get_skb)(unsigned int len, gfp_t flags);
602 void (*free_skb)(struct sk_buff *skb);
603 void (*free_rx_wrapper)(struct ipa3_rx_pkt_wrapper *rk_pkt);
604 u32 rx_buff_sz;
605 u32 rx_pool_sz;
606 struct sk_buff *prev_skb;
607 unsigned int len_rem;
608 unsigned int len_pad;
609 unsigned int len_partial;
610 bool drop_packet;
611 struct work_struct work;
Amir Levy9659e592016-10-27 18:08:27 +0300612 struct delayed_work replenish_rx_work;
613 struct work_struct repl_work;
614 void (*repl_hdlr)(struct ipa3_sys_context *sys);
615 struct ipa3_repl_ctx repl;
616
617 /* ordering is important - mutable fields go above */
618 struct ipa3_ep_context *ep;
619 struct list_head head_desc_list;
620 struct list_head rcycl_list;
621 spinlock_t spinlock;
Skylar Changd407e592017-03-30 11:25:30 -0700622 struct hrtimer db_timer;
Amir Levy9659e592016-10-27 18:08:27 +0300623 struct workqueue_struct *wq;
624 struct workqueue_struct *repl_wq;
625 struct ipa3_status_stats *status_stat;
626 /* ordering is important - other immutable fields go below */
627};
628
629/**
630 * enum ipa3_desc_type - IPA decriptors type
631 *
632 * IPA decriptors type, IPA supports DD and ICD but no CD
633 */
634enum ipa3_desc_type {
635 IPA_DATA_DESC,
636 IPA_DATA_DESC_SKB,
637 IPA_DATA_DESC_SKB_PAGED,
638 IPA_IMM_CMD_DESC,
639};
640
641/**
642 * struct ipa3_tx_pkt_wrapper - IPA Tx packet wrapper
643 * @type: specify if this packet is for the skb or immediate command
644 * @mem: memory buffer used by this Tx packet
645 * @work: work struct for current Tx packet
646 * @link: linked to the wrappers on that pipe
647 * @callback: IPA client provided callback
648 * @user1: cookie1 for above callback
649 * @user2: cookie2 for above callback
650 * @sys: corresponding IPA sys context
Amir Levy9659e592016-10-27 18:08:27 +0300651 * @cnt: 1 for single transfers,
652 * >1 and <0xFFFF for first of a "multiple" transfer,
653 * 0xFFFF for last desc, 0 for rest of "multiple' transfer
654 * @bounce: va of bounce buffer
655 * @unmap_dma: in case this is true, the buffer will not be dma unmapped
656 *
657 * This struct can wrap both data packet and immediate command packet.
658 */
659struct ipa3_tx_pkt_wrapper {
660 enum ipa3_desc_type type;
661 struct ipa_mem_buffer mem;
662 struct work_struct work;
663 struct list_head link;
664 void (*callback)(void *user1, int user2);
665 void *user1;
666 int user2;
667 struct ipa3_sys_context *sys;
Amir Levy9659e592016-10-27 18:08:27 +0300668 u32 cnt;
669 void *bounce;
670 bool no_unmap_dma;
671};
672
673/**
674 * struct ipa3_dma_xfer_wrapper - IPADMA transfer descr wrapper
675 * @phys_addr_src: physical address of the source data to copy
676 * @phys_addr_dest: physical address to store the copied data
677 * @len: len in bytes to copy
678 * @link: linked to the wrappers list on the proper(sync/async) cons pipe
679 * @xfer_done: completion object for sync_memcpy completion
680 * @callback: IPADMA client provided completion callback
681 * @user1: cookie1 for above callback
682 *
683 * This struct can wrap both sync and async memcpy transfers descriptors.
684 */
685struct ipa3_dma_xfer_wrapper {
686 u64 phys_addr_src;
687 u64 phys_addr_dest;
688 u16 len;
689 struct list_head link;
690 struct completion xfer_done;
691 void (*callback)(void *user1);
692 void *user1;
693};
694
695/**
696 * struct ipa3_desc - IPA descriptor
697 * @type: skb or immediate command or plain old data
698 * @pyld: points to skb
699 * @frag: points to paged fragment
700 * or kmalloc'ed immediate command parameters/plain old data
701 * @dma_address: dma mapped address of pyld
702 * @dma_address_valid: valid field for dma_address
Michael Adisumartab5d170f2017-05-17 14:34:11 -0700703 * @is_tag_status: flag for IP_PACKET_TAG_STATUS imd cmd
Amir Levy9659e592016-10-27 18:08:27 +0300704 * @len: length of the pyld
705 * @opcode: for immediate commands
706 * @callback: IPA client provided completion callback
707 * @user1: cookie1 for above callback
708 * @user2: cookie2 for above callback
709 * @xfer_done: completion object for sync completion
Skylar Changd407e592017-03-30 11:25:30 -0700710 * @skip_db_ring: specifies whether GSI doorbell should not be rang
Amir Levy9659e592016-10-27 18:08:27 +0300711 */
712struct ipa3_desc {
713 enum ipa3_desc_type type;
714 void *pyld;
715 skb_frag_t *frag;
716 dma_addr_t dma_address;
717 bool dma_address_valid;
Michael Adisumartab5d170f2017-05-17 14:34:11 -0700718 bool is_tag_status;
Amir Levy9659e592016-10-27 18:08:27 +0300719 u16 len;
720 u16 opcode;
721 void (*callback)(void *user1, int user2);
722 void *user1;
723 int user2;
724 struct completion xfer_done;
Skylar Changd407e592017-03-30 11:25:30 -0700725 bool skip_db_ring;
Amir Levy9659e592016-10-27 18:08:27 +0300726};
727
728/**
729 * struct ipa3_rx_pkt_wrapper - IPA Rx packet wrapper
730 * @skb: skb
731 * @dma_address: DMA address of this Rx packet
732 * @link: linked to the Rx packets on that pipe
733 * @len: how many bytes are copied into skb's flat buffer
734 */
735struct ipa3_rx_pkt_wrapper {
736 struct list_head link;
737 struct ipa_rx_data data;
738 u32 len;
739 struct work_struct work;
740 struct ipa3_sys_context *sys;
741};
742
743/**
Amir Levy05fccd02017-06-13 16:25:45 +0300744* struct ipa_pdn_entry - IPA PDN config table entry
745* @public_ip: the PDN's public ip
746* @src_metadata: the PDN's metadata to be replaced for source NAT
747* @dst_metadata: the PDN's metadata to be replaced for destination NAT
748* @resrvd: reserved field
749*/
750struct ipa_pdn_entry {
751 u32 public_ip;
752 u32 src_metadata;
753 u32 dst_metadata;
754 u32 resrvd;
755};
756/**
Amir Levy9659e592016-10-27 18:08:27 +0300757 * struct ipa3_nat_mem - IPA NAT memory description
758 * @class: pointer to the struct class
759 * @dev: the dev_t of the device
760 * @cdev: cdev of the device
761 * @dev_num: device number
762 * @vaddr: virtual address
763 * @dma_handle: DMA handle
764 * @size: NAT memory size
765 * @is_mapped: flag indicating if NAT memory is mapped
766 * @is_sys_mem: flag indicating if NAT memory is sys memory
767 * @is_dev_init: flag indicating if NAT device is initialized
768 * @lock: NAT memory mutex
769 * @nat_base_address: nat table virutal address
770 * @ipv4_rules_addr: base nat table address
771 * @ipv4_expansion_rules_addr: expansion table address
772 * @index_table_addr: index table address
773 * @index_table_expansion_addr: index expansion table address
774 * @size_base_tables: base table size
775 * @size_expansion_tables: expansion table size
776 * @public_ip_addr: ip address of nat table
Amir Levy05fccd02017-06-13 16:25:45 +0300777 * @pdn_mem: pdn config table SW cache memory structure
Amir Levy9659e592016-10-27 18:08:27 +0300778 */
779struct ipa3_nat_mem {
780 struct class *class;
781 struct device *dev;
782 struct cdev cdev;
783 dev_t dev_num;
784 void *vaddr;
785 dma_addr_t dma_handle;
786 size_t size;
787 bool is_mapped;
788 bool is_sys_mem;
789 bool is_dev_init;
790 bool is_dev;
791 struct mutex lock;
792 void *nat_base_address;
793 char *ipv4_rules_addr;
794 char *ipv4_expansion_rules_addr;
795 char *index_table_addr;
796 char *index_table_expansion_addr;
797 u32 size_base_tables;
798 u32 size_expansion_tables;
799 u32 public_ip_addr;
800 void *tmp_vaddr;
801 dma_addr_t tmp_dma_handle;
802 bool is_tmp_mem;
Amir Levy05fccd02017-06-13 16:25:45 +0300803 struct ipa_mem_buffer pdn_mem;
Amir Levy9659e592016-10-27 18:08:27 +0300804};
805
806/**
807 * enum ipa3_hw_mode - IPA hardware mode
808 * @IPA_HW_Normal: Regular IPA hardware
809 * @IPA_HW_Virtual: IPA hardware supporting virtual memory allocation
810 * @IPA_HW_PCIE: IPA hardware supporting memory allocation over PCIE Bridge
811 */
812enum ipa3_hw_mode {
813 IPA_HW_MODE_NORMAL = 0,
814 IPA_HW_MODE_VIRTUAL = 1,
815 IPA_HW_MODE_PCIE = 2
816};
817
818enum ipa3_config_this_ep {
819 IPA_CONFIGURE_THIS_EP,
820 IPA_DO_NOT_CONFIGURE_THIS_EP,
821};
822
823struct ipa3_stats {
824 u32 tx_sw_pkts;
825 u32 tx_hw_pkts;
826 u32 rx_pkts;
827 u32 rx_excp_pkts[IPAHAL_PKT_STATUS_EXCEPTION_MAX];
828 u32 rx_repl_repost;
829 u32 tx_pkts_compl;
830 u32 rx_q_len;
831 u32 msg_w[IPA_EVENT_MAX_NUM];
832 u32 msg_r[IPA_EVENT_MAX_NUM];
833 u32 stat_compl;
834 u32 aggr_close;
835 u32 wan_aggr_close;
836 u32 wan_rx_empty;
837 u32 wan_repl_rx_empty;
838 u32 lan_rx_empty;
839 u32 lan_repl_rx_empty;
840 u32 flow_enable;
841 u32 flow_disable;
842 u32 tx_non_linear;
843};
844
845struct ipa3_active_clients {
846 struct mutex mutex;
847 spinlock_t spinlock;
848 bool mutex_locked;
849 int cnt;
850};
851
852struct ipa3_wakelock_ref_cnt {
853 spinlock_t spinlock;
854 int cnt;
855};
856
857struct ipa3_tag_completion {
858 struct completion comp;
859 atomic_t cnt;
860};
861
862struct ipa3_controller;
863
864/**
865 * struct ipa3_uc_hdlrs - IPA uC callback functions
866 * @ipa_uc_loaded_hdlr: Function handler when uC is loaded
867 * @ipa_uc_event_hdlr: Event handler function
868 * @ipa3_uc_response_hdlr: Response handler function
869 * @ipa_uc_event_log_info_hdlr: Log event handler function
870 */
871struct ipa3_uc_hdlrs {
872 void (*ipa_uc_loaded_hdlr)(void);
873
874 void (*ipa_uc_event_hdlr)
875 (struct IpaHwSharedMemCommonMapping_t *uc_sram_mmio);
876
877 int (*ipa3_uc_response_hdlr)
878 (struct IpaHwSharedMemCommonMapping_t *uc_sram_mmio,
879 u32 *uc_status);
880
881 void (*ipa_uc_event_log_info_hdlr)
882 (struct IpaHwEventLogInfoData_t *uc_event_top_mmio);
883};
884
885/**
886 * enum ipa3_hw_flags - flags which defines the behavior of HW
887 *
888 * @IPA_HW_FLAG_HALT_SYSTEM_ON_ASSERT_FAILURE: Halt system in case of assert
889 * failure.
890 * @IPA_HW_FLAG_NO_REPORT_MHI_CHANNEL_ERORR: Channel error would be reported
891 * in the event ring only. No event to CPU.
892 * @IPA_HW_FLAG_NO_REPORT_MHI_CHANNEL_WAKE_UP: No need to report event
893 * IPA_HW_2_CPU_EVENT_MHI_WAKE_UP_REQUEST
894 * @IPA_HW_FLAG_WORK_OVER_DDR: Perform all transaction to external addresses by
895 * QMB (avoid memcpy)
896 * @IPA_HW_FLAG_NO_REPORT_OOB: If set do not report that the device is OOB in
897 * IN Channel
898 * @IPA_HW_FLAG_NO_REPORT_DB_MODE: If set, do not report that the device is
899 * entering a mode where it expects a doorbell to be rung for OUT Channel
900 * @IPA_HW_FLAG_NO_START_OOB_TIMER
901 */
902enum ipa3_hw_flags {
903 IPA_HW_FLAG_HALT_SYSTEM_ON_ASSERT_FAILURE = 0x01,
904 IPA_HW_FLAG_NO_REPORT_MHI_CHANNEL_ERORR = 0x02,
905 IPA_HW_FLAG_NO_REPORT_MHI_CHANNEL_WAKE_UP = 0x04,
906 IPA_HW_FLAG_WORK_OVER_DDR = 0x08,
907 IPA_HW_FLAG_NO_REPORT_OOB = 0x10,
908 IPA_HW_FLAG_NO_REPORT_DB_MODE = 0x20,
909 IPA_HW_FLAG_NO_START_OOB_TIMER = 0x40
910};
911
912/**
913 * struct ipa3_uc_ctx - IPA uC context
914 * @uc_inited: Indicates if uC interface has been initialized
915 * @uc_loaded: Indicates if uC has loaded
916 * @uc_failed: Indicates if uC has failed / returned an error
917 * @uc_lock: uC interface lock to allow only one uC interaction at a time
918 * @uc_spinlock: same as uc_lock but for irq contexts
919 * @uc_completation: Completion mechanism to wait for uC commands
920 * @uc_sram_mmio: Pointer to uC mapped memory
921 * @pending_cmd: The last command sent waiting to be ACKed
922 * @uc_status: The last status provided by the uC
923 * @uc_error_type: error type from uC error event
924 * @uc_error_timestamp: tag timer sampled after uC crashed
925 */
926struct ipa3_uc_ctx {
927 bool uc_inited;
928 bool uc_loaded;
929 bool uc_failed;
930 struct mutex uc_lock;
931 spinlock_t uc_spinlock;
932 struct completion uc_completion;
933 struct IpaHwSharedMemCommonMapping_t *uc_sram_mmio;
934 struct IpaHwEventLogInfoData_t *uc_event_top_mmio;
935 u32 uc_event_top_ofst;
936 u32 pending_cmd;
937 u32 uc_status;
938 u32 uc_error_type;
939 u32 uc_error_timestamp;
940 phys_addr_t rdy_ring_base_pa;
941 phys_addr_t rdy_ring_rp_pa;
942 u32 rdy_ring_size;
943 phys_addr_t rdy_comp_ring_base_pa;
944 phys_addr_t rdy_comp_ring_wp_pa;
945 u32 rdy_comp_ring_size;
946 u32 *rdy_ring_rp_va;
947 u32 *rdy_comp_ring_wp_va;
948};
949
950/**
951 * struct ipa3_uc_wdi_ctx
952 * @wdi_uc_top_ofst:
953 * @wdi_uc_top_mmio:
954 * @wdi_uc_stats_ofst:
955 * @wdi_uc_stats_mmio:
956 */
957struct ipa3_uc_wdi_ctx {
958 /* WDI specific fields */
959 u32 wdi_uc_stats_ofst;
960 struct IpaHwStatsWDIInfoData_t *wdi_uc_stats_mmio;
961 void *priv;
962 ipa_uc_ready_cb uc_ready_cb;
Skylar Chang6b41f8d2016-11-01 12:50:11 -0700963 /* for AP+STA stats update */
964#ifdef IPA_WAN_MSG_IPv6_ADDR_GW_LEN
965 ipa_wdi_meter_notifier_cb stats_notify;
966#endif
Amir Levy9659e592016-10-27 18:08:27 +0300967};
968
969/**
970 * struct ipa3_transport_pm - transport power management related members
Sridhar Ancha99b505b2016-04-21 23:11:10 +0530971 * @transport_pm_mutex: Mutex to protect the transport_pm functionality.
Amir Levy9659e592016-10-27 18:08:27 +0300972 */
973struct ipa3_transport_pm {
Amir Levy9659e592016-10-27 18:08:27 +0300974 atomic_t dec_clients;
975 atomic_t eot_activity;
Sridhar Ancha99b505b2016-04-21 23:11:10 +0530976 struct mutex transport_pm_mutex;
Amir Levy9659e592016-10-27 18:08:27 +0300977};
978
979/**
980 * struct ipa3cm_client_info - the client-info indicated from IPACM
981 * @ipacm_client_enum: the enum to indicate tether-client
982 * @ipacm_client_uplink: the bool to indicate pipe for uplink
983 */
984struct ipa3cm_client_info {
985 enum ipacm_client_enum client_enum;
986 bool uplink;
987};
988
989struct ipa3_smp2p_info {
990 u32 out_base_id;
991 u32 in_base_id;
Skylar Change1209942017-02-02 14:26:38 -0800992 bool ipa_clk_on;
Amir Levy9659e592016-10-27 18:08:27 +0300993 bool res_sent;
994};
995
996/**
997 * struct ipa3_ready_cb_info - A list of all the registrations
998 * for an indication of IPA driver readiness
999 *
1000 * @link: linked list link
1001 * @ready_cb: callback
1002 * @user_data: User data
1003 *
1004 */
1005struct ipa3_ready_cb_info {
1006 struct list_head link;
1007 ipa_ready_cb ready_cb;
1008 void *user_data;
1009};
1010
Gidon Studinski3021a6f2016-11-10 12:48:48 +02001011struct ipa_tz_unlock_reg_info {
1012 u64 reg_addr;
1013 u32 size;
1014};
1015
Skylar Chang6c4bec92017-04-21 16:10:14 -07001016struct ipa_dma_task_info {
1017 struct ipa_mem_buffer mem;
1018 struct ipahal_imm_cmd_pyld *cmd_pyld;
1019};
1020
Amir Levy9659e592016-10-27 18:08:27 +03001021/**
1022 * struct ipa3_context - IPA context
1023 * @class: pointer to the struct class
1024 * @dev_num: device number
1025 * @dev: the dev_t of the device
1026 * @cdev: cdev of the device
Amir Levy9659e592016-10-27 18:08:27 +03001027 * @ep: list of all end points
1028 * @skip_ep_cfg_shadow: state to update filter table correctly across
1029 power-save
1030 * @ep_flt_bitmap: End-points supporting filtering bitmap
1031 * @ep_flt_num: End-points supporting filtering number
Amir Levya59ed3f2017-03-05 17:30:55 +02001032 * @resume_on_connect: resume ep on ipa connect
Amir Levy9659e592016-10-27 18:08:27 +03001033 * @flt_tbl: list of all IPA filter tables
1034 * @mode: IPA operating mode
1035 * @mmio: iomem
1036 * @ipa_wrapper_base: IPA wrapper base address
1037 * @hdr_tbl: IPA header table
1038 * @hdr_proc_ctx_tbl: IPA processing context table
1039 * @rt_tbl_set: list of routing tables each of which is a list of rules
1040 * @reap_rt_tbl_set: list of sys mem routing tables waiting to be reaped
1041 * @flt_rule_cache: filter rule cache
1042 * @rt_rule_cache: routing rule cache
1043 * @hdr_cache: header cache
1044 * @hdr_offset_cache: header offset cache
1045 * @hdr_proc_ctx_cache: processing context cache
1046 * @hdr_proc_ctx_offset_cache: processing context offset cache
1047 * @rt_tbl_cache: routing table cache
1048 * @tx_pkt_wrapper_cache: Tx packets cache
1049 * @rx_pkt_wrapper_cache: Rx packets cache
1050 * @rt_idx_bitmap: routing table index bitmap
1051 * @lock: this does NOT protect the linked lists within ipa3_sys_context
1052 * @smem_sz: shared memory size available for SW use starting
1053 * from non-restricted bytes
1054 * @smem_restricted_bytes: the bytes that SW should not use in the shared mem
1055 * @nat_mem: NAT memory
1056 * @excp_hdr_hdl: exception header handle
1057 * @dflt_v4_rt_rule_hdl: default v4 routing rule handle
1058 * @dflt_v6_rt_rule_hdl: default v6 routing rule handle
1059 * @aggregation_type: aggregation type used on USB client endpoint
1060 * @aggregation_byte_limit: aggregation byte limit used on USB client endpoint
1061 * @aggregation_time_limit: aggregation time limit used on USB client endpoint
1062 * @hdr_tbl_lcl: where hdr tbl resides 1-local, 0-system
1063 * @hdr_proc_ctx_tbl_lcl: where proc_ctx tbl resides true-local, false-system
1064 * @hdr_mem: header memory
1065 * @hdr_proc_ctx_mem: processing context memory
1066 * @ip4_rt_tbl_lcl: where ip4 rt tables reside 1-local; 0-system
1067 * @ip6_rt_tbl_lcl: where ip6 rt tables reside 1-local; 0-system
1068 * @ip4_flt_tbl_lcl: where ip4 flt tables reside 1-local; 0-system
1069 * @ip6_flt_tbl_lcl: where ip6 flt tables reside 1-local; 0-system
1070 * @power_mgmt_wq: workqueue for power management
1071 * @transport_power_mgmt_wq: workqueue transport related power management
1072 * @tag_process_before_gating: indicates whether to start tag process before
1073 * gating IPA clocks
1074 * @transport_pm: transport power management related information
1075 * @disconnect_lock: protects LAN_CONS packet receive notification CB
Amir Levy9659e592016-10-27 18:08:27 +03001076 * @ipa3_active_clients: structure for reference counting connected IPA clients
1077 * @ipa_hw_type: type of IPA HW type (e.g. IPA 1.0, IPA 1.1 etc')
1078 * @ipa3_hw_mode: mode of IPA HW mode (e.g. Normal, Virtual or over PCIe)
1079 * @use_ipa_teth_bridge: use tethering bridge driver
Amir Levy9659e592016-10-27 18:08:27 +03001080 * @modem_cfg_emb_pipe_flt: modem configure embedded pipe filtering rules
1081 * @logbuf: ipc log buffer for high priority messages
1082 * @logbuf_low: ipc log buffer for low priority messages
1083 * @ipa_wdi2: using wdi-2.0
1084 * @use_64_bit_dma_mask: using 64bits dma mask
1085 * @ipa_bus_hdl: msm driver handle for the data path bus
1086 * @ctrl: holds the core specific operations based on
1087 * core version (vtable like)
Michael Adisumartab5d170f2017-05-17 14:34:11 -07001088 * @pkt_init_imm_opcode: opcode for IP_PACKET_INIT imm cmd
Amir Levy9659e592016-10-27 18:08:27 +03001089 * @enable_clock_scaling: clock scaling is enabled ?
Ghanim Fodi6a831342017-03-07 18:19:15 +02001090 * @curr_ipa_clk_rate: IPA current clock rate
Amir Levy9659e592016-10-27 18:08:27 +03001091 * @wcstats: wlan common buffer stats
1092 * @uc_ctx: uC interface context
1093 * @uc_wdi_ctx: WDI specific fields for uC interface
1094 * @ipa_num_pipes: The number of pipes used by IPA HW
1095 * @skip_uc_pipe_reset: Indicates whether pipe reset via uC needs to be avoided
1096 * @ipa_client_apps_wan_cons_agg_gro: RMNET_IOCTL_INGRESS_FORMAT_AGG_DATA
1097 * @apply_rg10_wa: Indicates whether to use register group 10 workaround
1098 * @gsi_ch20_wa: Indicates whether to apply GSI physical channel 20 workaround
1099 * @w_lock: Indicates the wakeup source.
1100 * @wakelock_ref_cnt: Indicates the number of times wakelock is acquired
1101 * @ipa_initialization_complete: Indicates that IPA is fully initialized
1102 * @ipa_ready_cb_list: A list of all the clients who require a CB when IPA
1103 * driver is ready/initialized.
1104 * @init_completion_obj: Completion object to be used in case IPA driver hasn't
1105 * finished initializing. Example of use - IOCTLs to /dev/ipa
1106 * IPA context - holds all relevant info about IPA driver and its state
1107 */
1108struct ipa3_context {
1109 struct class *class;
1110 dev_t dev_num;
1111 struct device *dev;
1112 struct cdev cdev;
Amir Levy9659e592016-10-27 18:08:27 +03001113 struct ipa3_ep_context ep[IPA3_MAX_NUM_PIPES];
1114 bool skip_ep_cfg_shadow[IPA3_MAX_NUM_PIPES];
1115 u32 ep_flt_bitmap;
1116 u32 ep_flt_num;
1117 bool resume_on_connect[IPA_CLIENT_MAX];
1118 struct ipa3_flt_tbl flt_tbl[IPA3_MAX_NUM_PIPES][IPA_IP_MAX];
1119 void __iomem *mmio;
1120 u32 ipa_wrapper_base;
1121 u32 ipa_wrapper_size;
1122 struct ipa3_hdr_tbl hdr_tbl;
1123 struct ipa3_hdr_proc_ctx_tbl hdr_proc_ctx_tbl;
1124 struct ipa3_rt_tbl_set rt_tbl_set[IPA_IP_MAX];
1125 struct ipa3_rt_tbl_set reap_rt_tbl_set[IPA_IP_MAX];
1126 struct kmem_cache *flt_rule_cache;
1127 struct kmem_cache *rt_rule_cache;
1128 struct kmem_cache *hdr_cache;
1129 struct kmem_cache *hdr_offset_cache;
1130 struct kmem_cache *hdr_proc_ctx_cache;
1131 struct kmem_cache *hdr_proc_ctx_offset_cache;
1132 struct kmem_cache *rt_tbl_cache;
1133 struct kmem_cache *tx_pkt_wrapper_cache;
1134 struct kmem_cache *rx_pkt_wrapper_cache;
1135 unsigned long rt_idx_bitmap[IPA_IP_MAX];
1136 struct mutex lock;
1137 u16 smem_sz;
1138 u16 smem_restricted_bytes;
1139 u16 smem_reqd_sz;
1140 struct ipa3_nat_mem nat_mem;
1141 u32 excp_hdr_hdl;
1142 u32 dflt_v4_rt_rule_hdl;
1143 u32 dflt_v6_rt_rule_hdl;
1144 uint aggregation_type;
1145 uint aggregation_byte_limit;
1146 uint aggregation_time_limit;
1147 bool hdr_tbl_lcl;
1148 bool hdr_proc_ctx_tbl_lcl;
1149 struct ipa_mem_buffer hdr_mem;
1150 struct ipa_mem_buffer hdr_proc_ctx_mem;
1151 bool ip4_rt_tbl_hash_lcl;
1152 bool ip4_rt_tbl_nhash_lcl;
1153 bool ip6_rt_tbl_hash_lcl;
1154 bool ip6_rt_tbl_nhash_lcl;
1155 bool ip4_flt_tbl_hash_lcl;
1156 bool ip4_flt_tbl_nhash_lcl;
1157 bool ip6_flt_tbl_hash_lcl;
1158 bool ip6_flt_tbl_nhash_lcl;
Amir Levy9659e592016-10-27 18:08:27 +03001159 struct ipa3_active_clients ipa3_active_clients;
1160 struct ipa3_active_clients_log_ctx ipa3_active_clients_logging;
1161 struct workqueue_struct *power_mgmt_wq;
1162 struct workqueue_struct *transport_power_mgmt_wq;
1163 bool tag_process_before_gating;
1164 struct ipa3_transport_pm transport_pm;
Skylar Changd407e592017-03-30 11:25:30 -07001165 unsigned long gsi_evt_comm_hdl;
1166 u32 gsi_evt_comm_ring_rem;
Amir Levy9659e592016-10-27 18:08:27 +03001167 u32 clnt_hdl_cmd;
1168 u32 clnt_hdl_data_in;
1169 u32 clnt_hdl_data_out;
1170 spinlock_t disconnect_lock;
1171 u8 a5_pipe_index;
1172 struct list_head intf_list;
1173 struct list_head msg_list;
1174 struct list_head pull_msg_list;
1175 struct mutex msg_lock;
1176 wait_queue_head_t msg_waitq;
1177 enum ipa_hw_type ipa_hw_type;
1178 enum ipa3_hw_mode ipa3_hw_mode;
Amir Levy54fe4d32017-03-16 11:21:49 +02001179 bool ipa_config_is_mhi;
Amir Levy9659e592016-10-27 18:08:27 +03001180 bool use_ipa_teth_bridge;
Amir Levy9659e592016-10-27 18:08:27 +03001181 bool modem_cfg_emb_pipe_flt;
1182 bool ipa_wdi2;
1183 bool use_64_bit_dma_mask;
1184 /* featurize if memory footprint becomes a concern */
1185 struct ipa3_stats stats;
1186 void *smem_pipe_mem;
1187 void *logbuf;
1188 void *logbuf_low;
1189 u32 ipa_bus_hdl;
1190 struct ipa3_controller *ctrl;
1191 struct idr ipa_idr;
1192 struct device *pdev;
1193 struct device *uc_pdev;
1194 spinlock_t idr_lock;
1195 u32 enable_clock_scaling;
1196 u32 curr_ipa_clk_rate;
1197 bool q6_proxy_clk_vote_valid;
1198 u32 ipa_num_pipes;
Skylar Changcd3902d2017-03-27 18:08:27 -07001199 dma_addr_t pkt_init_imm[IPA3_MAX_NUM_PIPES];
Michael Adisumartab5d170f2017-05-17 14:34:11 -07001200 u32 pkt_init_imm_opcode;
Amir Levy9659e592016-10-27 18:08:27 +03001201
1202 struct ipa3_wlan_comm_memb wc_memb;
1203
1204 struct ipa3_uc_ctx uc_ctx;
1205
1206 struct ipa3_uc_wdi_ctx uc_wdi_ctx;
1207 struct ipa3_uc_ntn_ctx uc_ntn_ctx;
1208 u32 wan_rx_ring_size;
1209 u32 lan_rx_ring_size;
1210 bool skip_uc_pipe_reset;
Amir Levy9659e592016-10-27 18:08:27 +03001211 unsigned long gsi_dev_hdl;
1212 u32 ee;
1213 bool apply_rg10_wa;
1214 bool gsi_ch20_wa;
1215 bool smmu_present;
1216 bool smmu_s1_bypass;
Amir Levy9659e592016-10-27 18:08:27 +03001217 u32 wdi_map_cnt;
1218 struct wakeup_source w_lock;
1219 struct ipa3_wakelock_ref_cnt wakelock_ref_cnt;
1220 /* RMNET_IOCTL_INGRESS_FORMAT_AGG_DATA */
1221 bool ipa_client_apps_wan_cons_agg_gro;
1222 /* M-release support to know client pipes */
1223 struct ipa3cm_client_info ipacm_client[IPA3_MAX_NUM_PIPES];
1224 bool tethered_flow_control;
1225 bool ipa_initialization_complete;
1226 struct list_head ipa_ready_cb_list;
1227 struct completion init_completion_obj;
Skylar Chang0c17c7d2016-10-31 09:57:54 -07001228 struct completion uc_loaded_completion_obj;
Amir Levy9659e592016-10-27 18:08:27 +03001229 struct ipa3_smp2p_info smp2p_info;
Gidon Studinski3021a6f2016-11-10 12:48:48 +02001230 u32 ipa_tz_unlock_reg_num;
1231 struct ipa_tz_unlock_reg_info *ipa_tz_unlock_reg;
Skylar Chang6c4bec92017-04-21 16:10:14 -07001232 struct ipa_dma_task_info dma_task_info;
Amir Levy9659e592016-10-27 18:08:27 +03001233};
1234
Amir Levy9659e592016-10-27 18:08:27 +03001235struct ipa3_plat_drv_res {
1236 bool use_ipa_teth_bridge;
1237 u32 ipa_mem_base;
1238 u32 ipa_mem_size;
1239 u32 transport_mem_base;
1240 u32 transport_mem_size;
1241 u32 ipa_irq;
1242 u32 transport_irq;
1243 u32 ipa_pipe_mem_start_ofst;
1244 u32 ipa_pipe_mem_size;
1245 enum ipa_hw_type ipa_hw_type;
1246 enum ipa3_hw_mode ipa3_hw_mode;
1247 u32 ee;
Amir Levy9659e592016-10-27 18:08:27 +03001248 bool modem_cfg_emb_pipe_flt;
1249 bool ipa_wdi2;
1250 bool use_64_bit_dma_mask;
Ghanim Fodi6a831342017-03-07 18:19:15 +02001251 bool use_bw_vote;
Amir Levy9659e592016-10-27 18:08:27 +03001252 u32 wan_rx_ring_size;
1253 u32 lan_rx_ring_size;
1254 bool skip_uc_pipe_reset;
Amir Levy9659e592016-10-27 18:08:27 +03001255 bool apply_rg10_wa;
1256 bool gsi_ch20_wa;
1257 bool tethered_flow_control;
Gidon Studinski3021a6f2016-11-10 12:48:48 +02001258 u32 ipa_tz_unlock_reg_num;
1259 struct ipa_tz_unlock_reg_info *ipa_tz_unlock_reg;
Amir Levy9659e592016-10-27 18:08:27 +03001260};
1261
1262/**
1263 * struct ipa3_mem_partition - represents IPA RAM Map as read from DTS
1264 * Order and type of members should not be changed without a suitable change
1265 * to DTS file or the code that reads it.
1266 *
Amir Levy7e7a1342017-04-27 15:46:30 +03001267 * IPA SRAM memory layout:
1268 * +-------------------------+
1269 * | UC MEM |
Amir Levy9659e592016-10-27 18:08:27 +03001270 * +-------------------------+
1271 * | UC INFO |
1272 * +-------------------------+
1273 * | CANARY |
1274 * +-------------------------+
1275 * | CANARY |
1276 * +-------------------------+
1277 * | V4 FLT HDR HASHABLE |
1278 * +-------------------------+
1279 * | CANARY |
1280 * +-------------------------+
1281 * | CANARY |
1282 * +-------------------------+
1283 * | V4 FLT HDR NON-HASHABLE |
1284 * +-------------------------+
1285 * | CANARY |
1286 * +-------------------------+
1287 * | CANARY |
1288 * +-------------------------+
1289 * | V6 FLT HDR HASHABLE |
1290 * +-------------------------+
1291 * | CANARY |
1292 * +-------------------------+
1293 * | CANARY |
1294 * +-------------------------+
1295 * | V6 FLT HDR NON-HASHABLE |
1296 * +-------------------------+
1297 * | CANARY |
1298 * +-------------------------+
1299 * | CANARY |
1300 * +-------------------------+
1301 * | V4 RT HDR HASHABLE |
1302 * +-------------------------+
1303 * | CANARY |
1304 * +-------------------------+
1305 * | CANARY |
1306 * +-------------------------+
1307 * | V4 RT HDR NON-HASHABLE |
1308 * +-------------------------+
1309 * | CANARY |
1310 * +-------------------------+
1311 * | CANARY |
1312 * +-------------------------+
1313 * | V6 RT HDR HASHABLE |
1314 * +-------------------------+
1315 * | CANARY |
1316 * +-------------------------+
1317 * | CANARY |
1318 * +-------------------------+
1319 * | V6 RT HDR NON-HASHABLE |
1320 * +-------------------------+
1321 * | CANARY |
1322 * +-------------------------+
1323 * | CANARY |
1324 * +-------------------------+
1325 * | MODEM HDR |
1326 * +-------------------------+
1327 * | CANARY |
1328 * +-------------------------+
1329 * | CANARY |
1330 * +-------------------------+
1331 * | MODEM PROC CTX |
1332 * +-------------------------+
1333 * | APPS PROC CTX |
1334 * +-------------------------+
1335 * | CANARY |
1336 * +-------------------------+
Amir Levy7e7a1342017-04-27 15:46:30 +03001337 * | CANARY |
1338 * +-------------------------+
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07001339 * | PDN CONFIG |
1340 * +-------------------------+
1341 * | CANARY |
1342 * +-------------------------+
1343 * | CANARY |
1344 * +-------------------------+
Amir Levy9659e592016-10-27 18:08:27 +03001345 * | MODEM MEM |
1346 * +-------------------------+
1347 * | CANARY |
1348 * +-------------------------+
Amir Levy7e7a1342017-04-27 15:46:30 +03001349 * | UC EVENT RING | From IPA 3.5
1350 * +-------------------------+
Amir Levy9659e592016-10-27 18:08:27 +03001351 */
1352struct ipa3_mem_partition {
1353 u32 ofst_start;
1354 u32 nat_ofst;
1355 u32 nat_size;
1356 u32 v4_flt_hash_ofst;
1357 u32 v4_flt_hash_size;
1358 u32 v4_flt_hash_size_ddr;
1359 u32 v4_flt_nhash_ofst;
1360 u32 v4_flt_nhash_size;
1361 u32 v4_flt_nhash_size_ddr;
1362 u32 v6_flt_hash_ofst;
1363 u32 v6_flt_hash_size;
1364 u32 v6_flt_hash_size_ddr;
1365 u32 v6_flt_nhash_ofst;
1366 u32 v6_flt_nhash_size;
1367 u32 v6_flt_nhash_size_ddr;
1368 u32 v4_rt_num_index;
1369 u32 v4_modem_rt_index_lo;
1370 u32 v4_modem_rt_index_hi;
1371 u32 v4_apps_rt_index_lo;
1372 u32 v4_apps_rt_index_hi;
1373 u32 v4_rt_hash_ofst;
1374 u32 v4_rt_hash_size;
1375 u32 v4_rt_hash_size_ddr;
1376 u32 v4_rt_nhash_ofst;
1377 u32 v4_rt_nhash_size;
1378 u32 v4_rt_nhash_size_ddr;
1379 u32 v6_rt_num_index;
1380 u32 v6_modem_rt_index_lo;
1381 u32 v6_modem_rt_index_hi;
1382 u32 v6_apps_rt_index_lo;
1383 u32 v6_apps_rt_index_hi;
1384 u32 v6_rt_hash_ofst;
1385 u32 v6_rt_hash_size;
1386 u32 v6_rt_hash_size_ddr;
1387 u32 v6_rt_nhash_ofst;
1388 u32 v6_rt_nhash_size;
1389 u32 v6_rt_nhash_size_ddr;
1390 u32 modem_hdr_ofst;
1391 u32 modem_hdr_size;
1392 u32 apps_hdr_ofst;
1393 u32 apps_hdr_size;
1394 u32 apps_hdr_size_ddr;
1395 u32 modem_hdr_proc_ctx_ofst;
1396 u32 modem_hdr_proc_ctx_size;
1397 u32 apps_hdr_proc_ctx_ofst;
1398 u32 apps_hdr_proc_ctx_size;
1399 u32 apps_hdr_proc_ctx_size_ddr;
1400 u32 modem_comp_decomp_ofst;
1401 u32 modem_comp_decomp_size;
1402 u32 modem_ofst;
1403 u32 modem_size;
1404 u32 apps_v4_flt_hash_ofst;
1405 u32 apps_v4_flt_hash_size;
1406 u32 apps_v4_flt_nhash_ofst;
1407 u32 apps_v4_flt_nhash_size;
1408 u32 apps_v6_flt_hash_ofst;
1409 u32 apps_v6_flt_hash_size;
1410 u32 apps_v6_flt_nhash_ofst;
1411 u32 apps_v6_flt_nhash_size;
1412 u32 uc_info_ofst;
1413 u32 uc_info_size;
1414 u32 end_ofst;
1415 u32 apps_v4_rt_hash_ofst;
1416 u32 apps_v4_rt_hash_size;
1417 u32 apps_v4_rt_nhash_ofst;
1418 u32 apps_v4_rt_nhash_size;
1419 u32 apps_v6_rt_hash_ofst;
1420 u32 apps_v6_rt_hash_size;
1421 u32 apps_v6_rt_nhash_ofst;
1422 u32 apps_v6_rt_nhash_size;
Amir Levy9fadeca2017-04-25 10:18:32 +03001423 u32 uc_event_ring_ofst;
1424 u32 uc_event_ring_size;
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07001425 u32 pdn_config_ofst;
1426 u32 pdn_config_size;
Amir Levy9659e592016-10-27 18:08:27 +03001427};
1428
1429struct ipa3_controller {
1430 struct ipa3_mem_partition mem_partition;
1431 u32 ipa_clk_rate_turbo;
1432 u32 ipa_clk_rate_nominal;
1433 u32 ipa_clk_rate_svs;
1434 u32 clock_scaling_bw_threshold_turbo;
1435 u32 clock_scaling_bw_threshold_nominal;
1436 u32 ipa_reg_base_ofst;
1437 u32 max_holb_tmr_val;
1438 void (*ipa_sram_read_settings)(void);
1439 int (*ipa_init_sram)(void);
1440 int (*ipa_init_hdr)(void);
1441 int (*ipa_init_rt4)(void);
1442 int (*ipa_init_rt6)(void);
1443 int (*ipa_init_flt4)(void);
1444 int (*ipa_init_flt6)(void);
1445 int (*ipa3_read_ep_reg)(char *buff, int max_len, int pipe);
1446 int (*ipa3_commit_flt)(enum ipa_ip_type ip);
1447 int (*ipa3_commit_rt)(enum ipa_ip_type ip);
1448 int (*ipa3_commit_hdr)(void);
1449 void (*ipa3_enable_clks)(void);
1450 void (*ipa3_disable_clks)(void);
1451 struct msm_bus_scale_pdata *msm_bus_data_ptr;
1452};
1453
1454extern struct ipa3_context *ipa3_ctx;
1455
1456/* public APIs */
Amir Levy9659e592016-10-27 18:08:27 +03001457/* Generic GSI channels functions */
1458int ipa3_request_gsi_channel(struct ipa_request_gsi_channel_params *params,
1459 struct ipa_req_chan_out_params *out_params);
1460
1461int ipa3_release_gsi_channel(u32 clnt_hdl);
1462
1463int ipa3_start_gsi_channel(u32 clnt_hdl);
1464
1465int ipa3_stop_gsi_channel(u32 clnt_hdl);
1466
1467int ipa3_reset_gsi_channel(u32 clnt_hdl);
1468
1469int ipa3_reset_gsi_event_ring(u32 clnt_hdl);
1470
1471/* Specific xDCI channels functions */
1472int ipa3_set_usb_max_packet_size(
1473 enum ipa_usb_max_usb_packet_size usb_max_packet_size);
1474
Ghanim Fodi93a61112016-10-05 11:59:18 +03001475int ipa3_xdci_start(u32 clnt_hdl, u8 xferrscidx, bool xferrscidx_valid);
1476
1477int ipa3_xdci_connect(u32 clnt_hdl);
Amir Levy9659e592016-10-27 18:08:27 +03001478
1479int ipa3_xdci_disconnect(u32 clnt_hdl, bool should_force_clear, u32 qmi_req_id);
1480
1481int ipa3_xdci_suspend(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
1482 bool should_force_clear, u32 qmi_req_id, bool is_dpl);
1483
1484int ipa3_xdci_resume(u32 ul_clnt_hdl, u32 dl_clnt_hdl, bool is_dpl);
1485
1486/*
Amir Levy9659e592016-10-27 18:08:27 +03001487 * Remove ep delay
1488 */
1489int ipa3_clear_endpoint_delay(u32 clnt_hdl);
1490
1491/*
1492 * Configuration
1493 */
1494int ipa3_cfg_ep(u32 clnt_hdl, const struct ipa_ep_cfg *ipa_ep_cfg);
1495
1496int ipa3_cfg_ep_nat(u32 clnt_hdl, const struct ipa_ep_cfg_nat *ipa_ep_cfg);
1497
Amir Levydc65f4c2017-07-06 09:49:50 +03001498int ipa3_cfg_ep_conn_track(u32 clnt_hdl,
1499 const struct ipa_ep_cfg_conn_track *ep_conn_track);
1500
Amir Levy9659e592016-10-27 18:08:27 +03001501int ipa3_cfg_ep_hdr(u32 clnt_hdl, const struct ipa_ep_cfg_hdr *ipa_ep_cfg);
1502
1503int ipa3_cfg_ep_hdr_ext(u32 clnt_hdl,
1504 const struct ipa_ep_cfg_hdr_ext *ipa_ep_cfg);
1505
1506int ipa3_cfg_ep_mode(u32 clnt_hdl, const struct ipa_ep_cfg_mode *ipa_ep_cfg);
1507
1508int ipa3_cfg_ep_aggr(u32 clnt_hdl, const struct ipa_ep_cfg_aggr *ipa_ep_cfg);
1509
1510int ipa3_cfg_ep_deaggr(u32 clnt_hdl,
1511 const struct ipa_ep_cfg_deaggr *ipa_ep_cfg);
1512
1513int ipa3_cfg_ep_route(u32 clnt_hdl, const struct ipa_ep_cfg_route *ipa_ep_cfg);
1514
1515int ipa3_cfg_ep_holb(u32 clnt_hdl, const struct ipa_ep_cfg_holb *ipa_ep_cfg);
1516
1517int ipa3_cfg_ep_cfg(u32 clnt_hdl, const struct ipa_ep_cfg_cfg *ipa_ep_cfg);
1518
1519int ipa3_cfg_ep_metadata_mask(u32 clnt_hdl,
1520 const struct ipa_ep_cfg_metadata_mask *ipa_ep_cfg);
1521
1522int ipa3_cfg_ep_holb_by_client(enum ipa_client_type client,
1523 const struct ipa_ep_cfg_holb *ipa_ep_cfg);
1524
1525int ipa3_cfg_ep_ctrl(u32 clnt_hdl, const struct ipa_ep_cfg_ctrl *ep_ctrl);
1526
1527/*
1528 * Header removal / addition
1529 */
1530int ipa3_add_hdr(struct ipa_ioc_add_hdr *hdrs);
1531
1532int ipa3_del_hdr(struct ipa_ioc_del_hdr *hdls);
1533
Ghanim Fodi2c8ba072017-01-12 15:14:15 +02001534int ipa3_del_hdr_by_user(struct ipa_ioc_del_hdr *hdls, bool by_user);
1535
Amir Levy9659e592016-10-27 18:08:27 +03001536int ipa3_commit_hdr(void);
1537
1538int ipa3_reset_hdr(void);
1539
1540int ipa3_get_hdr(struct ipa_ioc_get_hdr *lookup);
1541
1542int ipa3_put_hdr(u32 hdr_hdl);
1543
1544int ipa3_copy_hdr(struct ipa_ioc_copy_hdr *copy);
1545
1546/*
1547 * Header Processing Context
1548 */
1549int ipa3_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs);
1550
1551int ipa3_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls);
1552
Ghanim Fodi2c8ba072017-01-12 15:14:15 +02001553int ipa3_del_hdr_proc_ctx_by_user(struct ipa_ioc_del_hdr_proc_ctx *hdls,
1554 bool by_user);
1555
Amir Levy9659e592016-10-27 18:08:27 +03001556/*
1557 * Routing
1558 */
1559int ipa3_add_rt_rule(struct ipa_ioc_add_rt_rule *rules);
1560
1561int ipa3_add_rt_rule_after(struct ipa_ioc_add_rt_rule_after *rules);
1562
1563int ipa3_del_rt_rule(struct ipa_ioc_del_rt_rule *hdls);
1564
1565int ipa3_commit_rt(enum ipa_ip_type ip);
1566
1567int ipa3_reset_rt(enum ipa_ip_type ip);
1568
1569int ipa3_get_rt_tbl(struct ipa_ioc_get_rt_tbl *lookup);
1570
1571int ipa3_put_rt_tbl(u32 rt_tbl_hdl);
1572
1573int ipa3_query_rt_index(struct ipa_ioc_get_rt_tbl_indx *in);
1574
1575int ipa3_mdfy_rt_rule(struct ipa_ioc_mdfy_rt_rule *rules);
1576
1577/*
1578 * Filtering
1579 */
1580int ipa3_add_flt_rule(struct ipa_ioc_add_flt_rule *rules);
1581
1582int ipa3_add_flt_rule_after(struct ipa_ioc_add_flt_rule_after *rules);
1583
1584int ipa3_del_flt_rule(struct ipa_ioc_del_flt_rule *hdls);
1585
1586int ipa3_mdfy_flt_rule(struct ipa_ioc_mdfy_flt_rule *rules);
1587
1588int ipa3_commit_flt(enum ipa_ip_type ip);
1589
1590int ipa3_reset_flt(enum ipa_ip_type ip);
1591
1592/*
1593 * NAT
1594 */
1595int ipa3_allocate_nat_device(struct ipa_ioc_nat_alloc_mem *mem);
1596
1597int ipa3_nat_init_cmd(struct ipa_ioc_v4_nat_init *init);
1598
1599int ipa3_nat_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma);
1600
1601int ipa3_nat_del_cmd(struct ipa_ioc_v4_nat_del *del);
1602
Amir Levydc65f4c2017-07-06 09:49:50 +03001603int ipa3_nat_mdfy_pdn(struct ipa_ioc_nat_pdn_entry *mdfy_pdn);
Amir Levy05fccd02017-06-13 16:25:45 +03001604
Amir Levy9659e592016-10-27 18:08:27 +03001605/*
1606 * Messaging
1607 */
1608int ipa3_send_msg(struct ipa_msg_meta *meta, void *buff,
1609 ipa_msg_free_fn callback);
1610int ipa3_register_pull_msg(struct ipa_msg_meta *meta, ipa_msg_pull_fn callback);
1611int ipa3_deregister_pull_msg(struct ipa_msg_meta *meta);
1612
1613/*
1614 * Interface
1615 */
1616int ipa3_register_intf(const char *name, const struct ipa_tx_intf *tx,
1617 const struct ipa_rx_intf *rx);
1618int ipa3_register_intf_ext(const char *name, const struct ipa_tx_intf *tx,
1619 const struct ipa_rx_intf *rx,
1620 const struct ipa_ext_intf *ext);
1621int ipa3_deregister_intf(const char *name);
1622
1623/*
1624 * Aggregation
1625 */
1626int ipa3_set_aggr_mode(enum ipa_aggr_mode mode);
1627
1628int ipa3_set_qcncm_ndp_sig(char sig[3]);
1629
1630int ipa3_set_single_ndp_per_mbim(bool enable);
1631
1632/*
1633 * Data path
1634 */
1635int ipa3_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
1636 struct ipa_tx_meta *metadata);
1637
1638/*
1639 * To transfer multiple data packets
1640 * While passing the data descriptor list, the anchor node
1641 * should be of type struct ipa_tx_data_desc not list_head
1642*/
1643int ipa3_tx_dp_mul(enum ipa_client_type dst,
1644 struct ipa_tx_data_desc *data_desc);
1645
1646void ipa3_free_skb(struct ipa_rx_data *);
1647
1648/*
1649 * System pipes
1650 */
1651int ipa3_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl);
1652
1653int ipa3_teardown_sys_pipe(u32 clnt_hdl);
1654
1655int ipa3_sys_setup(struct ipa_sys_connect_params *sys_in,
Amir Levya59ed3f2017-03-05 17:30:55 +02001656 unsigned long *ipa_transport_hdl,
Amir Levy9659e592016-10-27 18:08:27 +03001657 u32 *ipa_pipe_num, u32 *clnt_hdl, bool en_status);
1658
1659int ipa3_sys_teardown(u32 clnt_hdl);
1660
1661int ipa3_sys_update_gsi_hdls(u32 clnt_hdl, unsigned long gsi_ch_hdl,
1662 unsigned long gsi_ev_hdl);
1663
1664int ipa3_connect_wdi_pipe(struct ipa_wdi_in_params *in,
1665 struct ipa_wdi_out_params *out);
1666int ipa3_disconnect_wdi_pipe(u32 clnt_hdl);
1667int ipa3_enable_wdi_pipe(u32 clnt_hdl);
1668int ipa3_disable_wdi_pipe(u32 clnt_hdl);
1669int ipa3_resume_wdi_pipe(u32 clnt_hdl);
1670int ipa3_suspend_wdi_pipe(u32 clnt_hdl);
1671int ipa3_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats);
1672u16 ipa3_get_smem_restr_bytes(void);
Skylar Chang6b41f8d2016-11-01 12:50:11 -07001673int ipa3_broadcast_wdi_quota_reach_ind(uint32_t fid, uint64_t num_bytes);
Amir Levy9659e592016-10-27 18:08:27 +03001674int ipa3_setup_uc_ntn_pipes(struct ipa_ntn_conn_in_params *in,
1675 ipa_notify_cb notify, void *priv, u8 hdr_len,
1676 struct ipa_ntn_conn_out_params *outp);
1677int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul, int ipa_ep_idx_dl);
1678
1679/*
1680 * To retrieve doorbell physical address of
1681 * wlan pipes
1682 */
1683int ipa3_uc_wdi_get_dbpa(struct ipa_wdi_db_params *out);
1684
1685/*
1686 * To register uC ready callback if uC not ready
1687 * and also check uC readiness
1688 * if uC not ready only, register callback
1689 */
1690int ipa3_uc_reg_rdyCB(struct ipa_wdi_uc_ready_params *param);
1691/*
1692 * To de-register uC ready callback
1693 */
1694int ipa3_uc_dereg_rdyCB(void);
1695
1696/*
1697 * Tethering bridge (Rmnet / MBIM)
1698 */
1699int ipa3_teth_bridge_init(struct teth_bridge_init_params *params);
1700
1701int ipa3_teth_bridge_disconnect(enum ipa_client_type client);
1702
1703int ipa3_teth_bridge_connect(struct teth_bridge_connect_params *connect_params);
1704
1705/*
1706 * Tethering client info
1707 */
1708void ipa3_set_client(int index, enum ipacm_client_enum client, bool uplink);
1709
1710enum ipacm_client_enum ipa3_get_client(int pipe_idx);
1711
1712bool ipa3_get_client_uplink(int pipe_idx);
1713
Skylar Chang6b41f8d2016-11-01 12:50:11 -07001714int ipa3_get_wlan_stats(struct ipa_get_wdi_sap_stats *wdi_sap_stats);
1715
1716int ipa3_set_wlan_quota(struct ipa_set_wifi_quota *wdi_quota);
Amir Levy9659e592016-10-27 18:08:27 +03001717/*
1718 * IPADMA
1719 */
1720int ipa3_dma_init(void);
1721
1722int ipa3_dma_enable(void);
1723
1724int ipa3_dma_disable(void);
1725
1726int ipa3_dma_sync_memcpy(u64 dest, u64 src, int len);
1727
1728int ipa3_dma_async_memcpy(u64 dest, u64 src, int len,
1729 void (*user_cb)(void *user1), void *user_param);
1730
1731int ipa3_dma_uc_memcpy(phys_addr_t dest, phys_addr_t src, int len);
1732
1733void ipa3_dma_destroy(void);
1734
1735/*
1736 * MHI
1737 */
1738
1739int ipa3_mhi_init_engine(struct ipa_mhi_init_engine *params);
1740
1741int ipa3_connect_mhi_pipe(
1742 struct ipa_mhi_connect_params_internal *in,
1743 u32 *clnt_hdl);
1744
1745int ipa3_disconnect_mhi_pipe(u32 clnt_hdl);
1746
1747bool ipa3_mhi_stop_gsi_channel(enum ipa_client_type client);
1748
1749int ipa3_mhi_reset_channel_internal(enum ipa_client_type client);
1750
1751int ipa3_mhi_start_channel_internal(enum ipa_client_type client);
1752
1753bool ipa3_has_open_aggr_frame(enum ipa_client_type client);
1754
1755int ipa3_mhi_resume_channels_internal(enum ipa_client_type client,
1756 bool LPTransitionRejected, bool brstmode_enabled,
1757 union __packed gsi_channel_scratch ch_scratch, u8 index);
1758
1759int ipa3_mhi_destroy_channel(enum ipa_client_type client);
1760
1761/*
1762 * mux id
1763 */
1764int ipa3_write_qmap_id(struct ipa_ioc_write_qmapid *param_in);
1765
1766/*
1767 * interrupts
1768 */
1769int ipa3_add_interrupt_handler(enum ipa_irq_type interrupt,
1770 ipa_irq_handler_t handler,
1771 bool deferred_flag,
1772 void *private_data);
1773
1774int ipa3_remove_interrupt_handler(enum ipa_irq_type interrupt);
1775
1776/*
1777 * Miscellaneous
1778 */
Amir Levy9659e592016-10-27 18:08:27 +03001779int ipa3_get_ep_mapping(enum ipa_client_type client);
1780
1781bool ipa3_is_ready(void);
1782
1783void ipa3_proxy_clk_vote(void);
1784void ipa3_proxy_clk_unvote(void);
1785
1786bool ipa3_is_client_handle_valid(u32 clnt_hdl);
1787
1788enum ipa_client_type ipa3_get_client_mapping(int pipe_idx);
1789
1790void ipa_init_ep_flt_bitmap(void);
1791
1792bool ipa_is_ep_support_flt(int pipe_idx);
1793
1794enum ipa_rm_resource_name ipa3_get_rm_resource_from_ep(int pipe_idx);
1795
1796bool ipa3_get_modem_cfg_emb_pipe_flt(void);
1797
1798u8 ipa3_get_qmb_master_sel(enum ipa_client_type client);
1799
1800/* internal functions */
1801
1802int ipa3_bind_api_controller(enum ipa_hw_type ipa_hw_type,
1803 struct ipa_api_controller *api_ctrl);
1804
1805bool ipa_is_modem_pipe(int pipe_idx);
1806
1807int ipa3_send_one(struct ipa3_sys_context *sys, struct ipa3_desc *desc,
1808 bool in_atomic);
1809int ipa3_send(struct ipa3_sys_context *sys,
1810 u32 num_desc,
1811 struct ipa3_desc *desc,
1812 bool in_atomic);
1813int ipa3_get_ep_mapping(enum ipa_client_type client);
1814int ipa_get_ep_group(enum ipa_client_type client);
1815
1816int ipa3_generate_hw_rule(enum ipa_ip_type ip,
1817 const struct ipa_rule_attrib *attrib,
1818 u8 **buf,
1819 u16 *en_rule);
1820int ipa3_init_hw(void);
1821struct ipa3_rt_tbl *__ipa3_find_rt_tbl(enum ipa_ip_type ip, const char *name);
1822int ipa3_set_single_ndp_per_mbim(bool);
1823void ipa3_debugfs_init(void);
1824void ipa3_debugfs_remove(void);
1825
1826void ipa3_dump_buff_internal(void *base, dma_addr_t phy_base, u32 size);
1827#ifdef IPA_DEBUG
1828#define IPA_DUMP_BUFF(base, phy_base, size) \
1829 ipa3_dump_buff_internal(base, phy_base, size)
1830#else
1831#define IPA_DUMP_BUFF(base, phy_base, size)
1832#endif
1833int ipa3_init_mem_partition(struct device_node *dev_node);
1834int ipa3_controller_static_bind(struct ipa3_controller *controller,
1835 enum ipa_hw_type ipa_hw_type);
1836int ipa3_cfg_route(struct ipahal_reg_route *route);
Gidon Studinski3021a6f2016-11-10 12:48:48 +02001837int ipa3_send_cmd_timeout(u16 num_desc, struct ipa3_desc *descr, u32 timeout);
Amir Levy9659e592016-10-27 18:08:27 +03001838int ipa3_send_cmd(u16 num_desc, struct ipa3_desc *descr);
1839int ipa3_cfg_filter(u32 disable);
Amir Levy9659e592016-10-27 18:08:27 +03001840int ipa3_straddle_boundary(u32 start, u32 end, u32 boundary);
1841struct ipa3_context *ipa3_get_ctx(void);
1842void ipa3_enable_clks(void);
1843void ipa3_disable_clks(void);
1844void ipa3_inc_client_enable_clks(struct ipa_active_client_logging_info *id);
1845int ipa3_inc_client_enable_clks_no_block(struct ipa_active_client_logging_info
1846 *id);
1847void ipa3_dec_client_disable_clks(struct ipa_active_client_logging_info *id);
1848void ipa3_active_clients_log_dec(struct ipa_active_client_logging_info *id,
1849 bool int_ctx);
1850void ipa3_active_clients_log_inc(struct ipa_active_client_logging_info *id,
1851 bool int_ctx);
1852int ipa3_active_clients_log_print_buffer(char *buf, int size);
1853int ipa3_active_clients_log_print_table(char *buf, int size);
1854void ipa3_active_clients_log_clear(void);
1855int ipa3_interrupts_init(u32 ipa_irq, u32 ee, struct device *ipa_dev);
1856int __ipa3_del_rt_rule(u32 rule_hdl);
Ghanim Fodi2c8ba072017-01-12 15:14:15 +02001857int __ipa3_del_hdr(u32 hdr_hdl, bool by_user);
Amir Levy9659e592016-10-27 18:08:27 +03001858int __ipa3_release_hdr(u32 hdr_hdl);
1859int __ipa3_release_hdr_proc_ctx(u32 proc_ctx_hdl);
1860int _ipa_read_ep_reg_v3_0(char *buf, int max_len, int pipe);
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07001861int _ipa_read_ep_reg_v4_0(char *buf, int max_len, int pipe);
Amir Levy9659e592016-10-27 18:08:27 +03001862void _ipa_enable_clks_v3_0(void);
1863void _ipa_disable_clks_v3_0(void);
1864struct device *ipa3_get_dma_dev(void);
1865void ipa3_suspend_active_aggr_wa(u32 clnt_hdl);
1866void ipa3_suspend_handler(enum ipa_irq_type interrupt,
1867 void *private_data,
1868 void *interrupt_data);
1869
1870
1871int ipa_bridge_init(void);
1872void ipa_bridge_cleanup(void);
1873
1874ssize_t ipa3_read(struct file *filp, char __user *buf, size_t count,
1875 loff_t *f_pos);
1876int ipa3_pull_msg(struct ipa_msg_meta *meta, char *buff, size_t count);
1877int ipa3_query_intf(struct ipa_ioc_query_intf *lookup);
1878int ipa3_query_intf_tx_props(struct ipa_ioc_query_intf_tx_props *tx);
1879int ipa3_query_intf_rx_props(struct ipa_ioc_query_intf_rx_props *rx);
1880int ipa3_query_intf_ext_props(struct ipa_ioc_query_intf_ext_props *ext);
1881
1882void wwan_cleanup(void);
1883
1884int ipa3_teth_bridge_driver_init(void);
1885void ipa3_lan_rx_cb(void *priv, enum ipa_dp_evt_type evt, unsigned long data);
1886
Amir Levy9fadeca2017-04-25 10:18:32 +03001887int _ipa_init_sram_v3(void);
Amir Levy9659e592016-10-27 18:08:27 +03001888int _ipa_init_hdr_v3_0(void);
1889int _ipa_init_rt4_v3(void);
1890int _ipa_init_rt6_v3(void);
1891int _ipa_init_flt4_v3(void);
1892int _ipa_init_flt6_v3(void);
1893
1894int __ipa_commit_flt_v3(enum ipa_ip_type ip);
1895int __ipa_commit_rt_v3(enum ipa_ip_type ip);
1896
1897int __ipa_commit_hdr_v3_0(void);
1898void ipa3_skb_recycle(struct sk_buff *skb);
1899void ipa3_install_dflt_flt_rules(u32 ipa_ep_idx);
1900void ipa3_delete_dflt_flt_rules(u32 ipa_ep_idx);
1901
1902int ipa3_enable_data_path(u32 clnt_hdl);
1903int ipa3_disable_data_path(u32 clnt_hdl);
1904int ipa3_alloc_rule_id(struct idr *rule_ids);
1905int ipa3_id_alloc(void *ptr);
1906void *ipa3_id_find(u32 id);
1907void ipa3_id_remove(u32 id);
Skylar Change834a9e612016-12-22 14:20:32 -08001908int ipa3_enable_force_clear(u32 request_id, bool throttle_source,
1909 u32 source_pipe_bitmask);
1910int ipa3_disable_force_clear(u32 request_id);
Amir Levy9659e592016-10-27 18:08:27 +03001911
1912int ipa3_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
1913 u32 bandwidth_mbps);
1914
1915int ipa3_cfg_ep_status(u32 clnt_hdl,
1916 const struct ipahal_reg_ep_cfg_status *ipa_ep_cfg);
1917
1918int ipa3_suspend_resource_no_block(enum ipa_rm_resource_name name);
1919int ipa3_suspend_resource_sync(enum ipa_rm_resource_name name);
1920int ipa3_resume_resource(enum ipa_rm_resource_name name);
1921bool ipa3_should_pipe_be_suspended(enum ipa_client_type client);
1922int ipa3_tag_aggr_force_close(int pipe_num);
1923
1924void ipa3_active_clients_lock(void);
1925int ipa3_active_clients_trylock(unsigned long *flags);
1926void ipa3_active_clients_unlock(void);
1927void ipa3_active_clients_trylock_unlock(unsigned long *flags);
1928int ipa3_wdi_init(void);
1929int ipa3_write_qmapid_wdi_pipe(u32 clnt_hdl, u8 qmap_id);
1930int ipa3_tag_process(struct ipa3_desc *desc, int num_descs,
1931 unsigned long timeout);
1932
1933void ipa3_q6_pre_shutdown_cleanup(void);
1934void ipa3_q6_post_shutdown_cleanup(void);
1935int ipa3_init_q6_smem(void);
1936
Amir Levy9659e592016-10-27 18:08:27 +03001937int ipa3_mhi_handle_ipa_config_req(struct ipa_config_req_msg_v01 *config_req);
1938int ipa3_mhi_query_ch_info(enum ipa_client_type client,
1939 struct gsi_chan_info *ch_info);
1940
1941int ipa3_uc_interface_init(void);
Amir Levy9659e592016-10-27 18:08:27 +03001942int ipa3_uc_is_gsi_channel_empty(enum ipa_client_type ipa_client);
1943int ipa3_uc_state_check(void);
1944int ipa3_uc_loaded_check(void);
1945void ipa3_uc_load_notify(void);
1946int ipa3_uc_send_cmd(u32 cmd, u32 opcode, u32 expected_status,
1947 bool polling_mode, unsigned long timeout_jiffies);
1948void ipa3_uc_register_handlers(enum ipa3_hw_features feature,
1949 struct ipa3_uc_hdlrs *hdlrs);
1950int ipa3_create_nat_device(void);
1951int ipa3_uc_notify_clk_state(bool enabled);
1952void ipa3_dma_async_memcpy_notify_cb(void *priv,
1953 enum ipa_dp_evt_type evt, unsigned long data);
1954
1955int ipa3_uc_update_hw_flags(u32 flags);
1956
1957int ipa3_uc_mhi_init(void (*ready_cb)(void), void (*wakeup_request_cb)(void));
1958void ipa3_uc_mhi_cleanup(void);
1959int ipa3_uc_mhi_send_dl_ul_sync_info(union IpaHwMhiDlUlSyncCmdData_t *cmd);
1960int ipa3_uc_mhi_init_engine(struct ipa_mhi_msi_info *msi, u32 mmio_addr,
1961 u32 host_ctrl_addr, u32 host_data_addr, u32 first_ch_idx,
1962 u32 first_evt_idx);
1963int ipa3_uc_mhi_init_channel(int ipa_ep_idx, int channelHandle,
1964 int contexArrayIndex, int channelDirection);
1965int ipa3_uc_mhi_reset_channel(int channelHandle);
1966int ipa3_uc_mhi_suspend_channel(int channelHandle);
1967int ipa3_uc_mhi_resume_channel(int channelHandle, bool LPTransitionRejected);
1968int ipa3_uc_mhi_stop_event_update_channel(int channelHandle);
1969int ipa3_uc_mhi_print_stats(char *dbg_buff, int size);
1970int ipa3_uc_memcpy(phys_addr_t dest, phys_addr_t src, int len);
1971void ipa3_tag_destroy_imm(void *user1, int user2);
Amir Levy3be373c2017-03-05 16:31:30 +02001972const struct ipa_gsi_ep_config *ipa3_get_gsi_ep_info
1973 (enum ipa_client_type client);
Amir Levy9659e592016-10-27 18:08:27 +03001974void ipa3_uc_rg10_write_reg(enum ipahal_reg_name reg, u32 n, u32 val);
1975
1976u32 ipa3_get_num_pipes(void);
1977struct ipa_smmu_cb_ctx *ipa3_get_smmu_ctx(void);
1978struct ipa_smmu_cb_ctx *ipa3_get_wlan_smmu_ctx(void);
1979struct ipa_smmu_cb_ctx *ipa3_get_uc_smmu_ctx(void);
1980struct iommu_domain *ipa3_get_smmu_domain(void);
1981struct iommu_domain *ipa3_get_uc_smmu_domain(void);
1982struct iommu_domain *ipa3_get_wlan_smmu_domain(void);
1983int ipa3_iommu_map(struct iommu_domain *domain, unsigned long iova,
1984 phys_addr_t paddr, size_t size, int prot);
1985int ipa3_ap_suspend(struct device *dev);
1986int ipa3_ap_resume(struct device *dev);
1987int ipa3_init_interrupts(void);
1988struct iommu_domain *ipa3_get_smmu_domain(void);
1989int ipa3_release_wdi_mapping(u32 num_buffers, struct ipa_wdi_buffer_info *info);
1990int ipa3_create_wdi_mapping(u32 num_buffers, struct ipa_wdi_buffer_info *info);
1991int ipa3_set_flt_tuple_mask(int pipe_idx, struct ipahal_reg_hash_tuple *tuple);
1992int ipa3_set_rt_tuple_mask(int tbl_idx, struct ipahal_reg_hash_tuple *tuple);
1993void ipa3_set_resorce_groups_min_max_limits(void);
1994void ipa3_suspend_apps_pipes(bool suspend);
Amir Levy9659e592016-10-27 18:08:27 +03001995int ipa3_flt_read_tbl_from_hw(u32 pipe_idx,
1996 enum ipa_ip_type ip_type,
1997 bool hashable,
1998 struct ipahal_flt_rule_entry entry[],
1999 int *num_entry);
2000int ipa3_rt_read_tbl_from_hw(u32 tbl_idx,
2001 enum ipa_ip_type ip_type,
2002 bool hashable,
2003 struct ipahal_rt_rule_entry entry[],
2004 int *num_entry);
2005int ipa3_restore_suspend_handler(void);
2006int ipa3_inject_dma_task_for_gsi(void);
2007int ipa3_uc_panic_notifier(struct notifier_block *this,
2008 unsigned long event, void *ptr);
2009void ipa3_inc_acquire_wakelock(void);
2010void ipa3_dec_release_wakelock(void);
Ghanim Fodi37b64952017-01-24 15:42:30 +02002011int ipa3_load_fws(const struct firmware *firmware, phys_addr_t gsi_mem_base);
Amir Levy9659e592016-10-27 18:08:27 +03002012int ipa3_register_ipa_ready_cb(void (*ipa_ready_cb)(void *), void *user_data);
2013const char *ipa_hw_error_str(enum ipa3_hw_errors err_type);
2014int ipa_gsi_ch20_wa(void);
2015int ipa3_rx_poll(u32 clnt_hdl, int budget);
2016void ipa3_recycle_wan_skb(struct sk_buff *skb);
2017int ipa3_smmu_map_peer_reg(phys_addr_t phys_addr, bool map);
2018int ipa3_smmu_map_peer_buff(u64 iova, phys_addr_t phys_addr,
2019 u32 size, bool map);
Skylar Change1209942017-02-02 14:26:38 -08002020void ipa3_reset_freeze_vote(void);
Amir Levy9659e592016-10-27 18:08:27 +03002021int ipa3_ntn_init(void);
2022int ipa3_get_ntn_stats(struct Ipa3HwStatsNTNInfoData_t *stats);
2023struct dentry *ipa_debugfs_get_root(void);
2024bool ipa3_is_msm_device(void);
Amir Levyc4222c92016-11-07 16:14:54 +02002025struct device *ipa3_get_pdev(void);
Amir Levy12ef0912016-08-30 09:27:34 +03002026void ipa3_enable_dcd(void);
Amir Levy3afd94a2017-01-05 10:19:13 +02002027void ipa3_disable_prefetch(enum ipa_client_type client);
Skylar Changd407e592017-03-30 11:25:30 -07002028int ipa3_alloc_common_event_ring(void);
Skylar Chang6c4bec92017-04-21 16:10:14 -07002029int ipa3_allocate_dma_task_for_gsi(void);
2030void ipa3_free_dma_task_for_gsi(void);
Amir Levy9659e592016-10-27 18:08:27 +03002031#endif /* _IPA3_I_H_ */