1
2
3
4
5
6
7#ifndef __FSL_DPAA2_IO_H
8#define __FSL_DPAA2_IO_H
9
10#include <linux/types.h>
11#include <linux/cpumask.h>
12#include <linux/irqreturn.h>
13
14#include "dpaa2-fd.h"
15#include "dpaa2-global.h"
16
17struct dpaa2_io;
18struct dpaa2_io_store;
19struct device;
20
21
22
23
24
25
26
27
28
29
30
31
32#define DPAA2_IO_ANY_CPU -1
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50struct dpaa2_io_desc {
51 int receives_notifications;
52 int has_8prio;
53 int cpu;
54 void *regs_cena;
55 void __iomem *regs_cinh;
56 int dpio_id;
57 u32 qman_version;
58};
59
60struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
61 struct device *dev);
62
63void dpaa2_io_down(struct dpaa2_io *d);
64
65irqreturn_t dpaa2_io_irq(struct dpaa2_io *obj);
66
67struct dpaa2_io *dpaa2_io_service_select(int cpu);
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83struct dpaa2_io_notification_ctx {
84 void (*cb)(struct dpaa2_io_notification_ctx *ctx);
85 int is_cdan;
86 u32 id;
87 int desired_cpu;
88 int dpio_id;
89 u64 qman64;
90 struct list_head node;
91 void *dpio_private;
92};
93
94int dpaa2_io_get_cpu(struct dpaa2_io *d);
95
96int dpaa2_io_service_register(struct dpaa2_io *service,
97 struct dpaa2_io_notification_ctx *ctx,
98 struct device *dev);
99void dpaa2_io_service_deregister(struct dpaa2_io *service,
100 struct dpaa2_io_notification_ctx *ctx,
101 struct device *dev);
102int dpaa2_io_service_rearm(struct dpaa2_io *service,
103 struct dpaa2_io_notification_ctx *ctx);
104
105int dpaa2_io_service_pull_fq(struct dpaa2_io *d, u32 fqid,
106 struct dpaa2_io_store *s);
107int dpaa2_io_service_pull_channel(struct dpaa2_io *d, u32 channelid,
108 struct dpaa2_io_store *s);
109
110int dpaa2_io_service_enqueue_fq(struct dpaa2_io *d, u32 fqid,
111 const struct dpaa2_fd *fd);
112int dpaa2_io_service_enqueue_multiple_fq(struct dpaa2_io *d, u32 fqid,
113 const struct dpaa2_fd *fd, int number_of_frame);
114int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d, u32 *fqid,
115 const struct dpaa2_fd *fd, int number_of_frame);
116int dpaa2_io_service_enqueue_qd(struct dpaa2_io *d, u32 qdid, u8 prio,
117 u16 qdbin, const struct dpaa2_fd *fd);
118int dpaa2_io_service_release(struct dpaa2_io *d, u16 bpid,
119 const u64 *buffers, unsigned int num_buffers);
120int dpaa2_io_service_acquire(struct dpaa2_io *d, u16 bpid,
121 u64 *buffers, unsigned int num_buffers);
122
123struct dpaa2_io_store *dpaa2_io_store_create(unsigned int max_frames,
124 struct device *dev);
125void dpaa2_io_store_destroy(struct dpaa2_io_store *s);
126struct dpaa2_dq *dpaa2_io_store_next(struct dpaa2_io_store *s, int *is_last);
127
128int dpaa2_io_query_fq_count(struct dpaa2_io *d, u32 fqid,
129 u32 *fcnt, u32 *bcnt);
130int dpaa2_io_query_bp_count(struct dpaa2_io *d, u16 bpid,
131 u32 *num);
132#endif
133