1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 #ifndef _RIO_MPORT_CDEV_H_
41 #define _RIO_MPORT_CDEV_H_
42
43 #include <linux/ioctl.h>
44 #include <linux/types.h>
45
46 struct rio_mport_maint_io {
47 __u16 rioid;
48 __u8 hopcount;
49 __u8 pad0[5];
50 __u32 offset;
51 __u32 length;
52 __u64 buffer;
53 };
54
55
56
57
58
59
60 #define RIO_TRANSFER_MODE_MAPPED (1 << 0)
61 #define RIO_TRANSFER_MODE_TRANSFER (1 << 1)
62 #define RIO_CAP_DBL_SEND (1 << 2)
63 #define RIO_CAP_DBL_RECV (1 << 3)
64 #define RIO_CAP_PW_SEND (1 << 4)
65 #define RIO_CAP_PW_RECV (1 << 5)
66 #define RIO_CAP_MAP_OUTB (1 << 6)
67 #define RIO_CAP_MAP_INB (1 << 7)
68
69 struct rio_mport_properties {
70 __u16 hdid;
71 __u8 id;
72 __u8 index;
73 __u32 flags;
74 __u32 sys_size;
75 __u8 port_ok;
76 __u8 link_speed;
77 __u8 link_width;
78 __u8 pad0;
79 __u32 dma_max_sge;
80 __u32 dma_max_size;
81 __u32 dma_align;
82 __u32 transfer_mode;
83 __u32 cap_sys_size;
84 __u32 cap_addr_size;
85 __u32 cap_transfer_mode;
86 __u32 cap_mport;
87 };
88
89
90
91
92
93
94 #define RIO_DOORBELL (1 << 0)
95 #define RIO_PORTWRITE (1 << 1)
96
97 struct rio_doorbell {
98 __u16 rioid;
99 __u16 payload;
100 };
101
102 struct rio_doorbell_filter {
103 __u16 rioid;
104 __u16 low;
105 __u16 high;
106 __u16 pad0;
107 };
108
109
110 struct rio_portwrite {
111 __u32 payload[16];
112 };
113
114 struct rio_pw_filter {
115 __u32 mask;
116 __u32 low;
117 __u32 high;
118 __u32 pad0;
119 };
120
121
122
123
124
125 #define RIO_MAP_ANY_ADDR (__u64)(~((__u64) 0))
126
127 struct rio_mmap {
128 __u16 rioid;
129 __u16 pad0[3];
130 __u64 rio_addr;
131 __u64 length;
132 __u64 handle;
133 __u64 address;
134 };
135
136 struct rio_dma_mem {
137 __u64 length;
138 __u64 dma_handle;
139 __u64 address;
140 };
141
142 struct rio_event {
143 __u32 header;
144 union {
145 struct rio_doorbell doorbell;
146 struct rio_portwrite portwrite;
147 } u;
148 __u32 pad0;
149 };
150
151 enum rio_transfer_sync {
152 RIO_TRANSFER_SYNC,
153 RIO_TRANSFER_ASYNC,
154 RIO_TRANSFER_FAF,
155 };
156
157 enum rio_transfer_dir {
158 RIO_TRANSFER_DIR_READ,
159 RIO_TRANSFER_DIR_WRITE,
160 };
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182 enum rio_exchange {
183 RIO_EXCHANGE_DEFAULT,
184 RIO_EXCHANGE_NWRITE,
185 RIO_EXCHANGE_SWRITE,
186 RIO_EXCHANGE_NWRITE_R,
187 RIO_EXCHANGE_SWRITE_R,
188 RIO_EXCHANGE_NWRITE_R_ALL,
189 };
190
191 struct rio_transfer_io {
192 __u64 rio_addr;
193 __u64 loc_addr;
194 __u64 handle;
195 __u64 offset;
196 __u64 length;
197 __u16 rioid;
198 __u16 method;
199 __u32 completion_code;
200 };
201
202 struct rio_transaction {
203 __u64 block;
204 __u32 count;
205 __u32 transfer_mode;
206 __u16 sync;
207 __u16 dir;
208 __u32 pad0;
209 };
210
211 struct rio_async_tx_wait {
212 __u32 token;
213 __u32 timeout;
214 };
215
216 #define RIO_MAX_DEVNAME_SZ 20
217
218 struct rio_rdev_info {
219 __u16 destid;
220 __u8 hopcount;
221 __u8 pad0;
222 __u32 comptag;
223 char name[RIO_MAX_DEVNAME_SZ + 1];
224 };
225
226
227 #define RIO_MPORT_DRV_MAGIC 'm'
228
229 #define RIO_MPORT_MAINT_HDID_SET \
230 _IOW(RIO_MPORT_DRV_MAGIC, 1, __u16)
231 #define RIO_MPORT_MAINT_COMPTAG_SET \
232 _IOW(RIO_MPORT_DRV_MAGIC, 2, __u32)
233 #define RIO_MPORT_MAINT_PORT_IDX_GET \
234 _IOR(RIO_MPORT_DRV_MAGIC, 3, __u32)
235 #define RIO_MPORT_GET_PROPERTIES \
236 _IOR(RIO_MPORT_DRV_MAGIC, 4, struct rio_mport_properties)
237 #define RIO_MPORT_MAINT_READ_LOCAL \
238 _IOR(RIO_MPORT_DRV_MAGIC, 5, struct rio_mport_maint_io)
239 #define RIO_MPORT_MAINT_WRITE_LOCAL \
240 _IOW(RIO_MPORT_DRV_MAGIC, 6, struct rio_mport_maint_io)
241 #define RIO_MPORT_MAINT_READ_REMOTE \
242 _IOR(RIO_MPORT_DRV_MAGIC, 7, struct rio_mport_maint_io)
243 #define RIO_MPORT_MAINT_WRITE_REMOTE \
244 _IOW(RIO_MPORT_DRV_MAGIC, 8, struct rio_mport_maint_io)
245 #define RIO_ENABLE_DOORBELL_RANGE \
246 _IOW(RIO_MPORT_DRV_MAGIC, 9, struct rio_doorbell_filter)
247 #define RIO_DISABLE_DOORBELL_RANGE \
248 _IOW(RIO_MPORT_DRV_MAGIC, 10, struct rio_doorbell_filter)
249 #define RIO_ENABLE_PORTWRITE_RANGE \
250 _IOW(RIO_MPORT_DRV_MAGIC, 11, struct rio_pw_filter)
251 #define RIO_DISABLE_PORTWRITE_RANGE \
252 _IOW(RIO_MPORT_DRV_MAGIC, 12, struct rio_pw_filter)
253 #define RIO_SET_EVENT_MASK \
254 _IOW(RIO_MPORT_DRV_MAGIC, 13, __u32)
255 #define RIO_GET_EVENT_MASK \
256 _IOR(RIO_MPORT_DRV_MAGIC, 14, __u32)
257 #define RIO_MAP_OUTBOUND \
258 _IOWR(RIO_MPORT_DRV_MAGIC, 15, struct rio_mmap)
259 #define RIO_UNMAP_OUTBOUND \
260 _IOW(RIO_MPORT_DRV_MAGIC, 16, struct rio_mmap)
261 #define RIO_MAP_INBOUND \
262 _IOWR(RIO_MPORT_DRV_MAGIC, 17, struct rio_mmap)
263 #define RIO_UNMAP_INBOUND \
264 _IOW(RIO_MPORT_DRV_MAGIC, 18, __u64)
265 #define RIO_ALLOC_DMA \
266 _IOWR(RIO_MPORT_DRV_MAGIC, 19, struct rio_dma_mem)
267 #define RIO_FREE_DMA \
268 _IOW(RIO_MPORT_DRV_MAGIC, 20, __u64)
269 #define RIO_TRANSFER \
270 _IOWR(RIO_MPORT_DRV_MAGIC, 21, struct rio_transaction)
271 #define RIO_WAIT_FOR_ASYNC \
272 _IOW(RIO_MPORT_DRV_MAGIC, 22, struct rio_async_tx_wait)
273 #define RIO_DEV_ADD \
274 _IOW(RIO_MPORT_DRV_MAGIC, 23, struct rio_rdev_info)
275 #define RIO_DEV_DEL \
276 _IOW(RIO_MPORT_DRV_MAGIC, 24, struct rio_rdev_info)
277
278 #endif