This source file includes following definitions.
- rio_local_read_config_32
- rio_local_write_config_32
- rio_local_read_config_16
- rio_local_write_config_16
- rio_local_read_config_8
- rio_local_write_config_8
- rio_read_config_32
- rio_write_config_32
- rio_read_config_16
- rio_write_config_16
- rio_read_config_8
- rio_write_config_8
- rio_send_doorbell
- rio_init_mbox_res
- rio_init_dbell_res
- rio_add_outb_message
- rio_add_inb_buffer
- rio_get_inb_message
- rio_name
- rio_get_drvdata
- rio_set_drvdata
1
2
3
4
5
6
7
8
9 #ifndef LINUX_RIO_DRV_H
10 #define LINUX_RIO_DRV_H
11
12 #include <linux/types.h>
13 #include <linux/ioport.h>
14 #include <linux/list.h>
15 #include <linux/errno.h>
16 #include <linux/string.h>
17 #include <linux/rio.h>
18
19 extern int __rio_local_read_config_32(struct rio_mport *port, u32 offset,
20 u32 * data);
21 extern int __rio_local_write_config_32(struct rio_mport *port, u32 offset,
22 u32 data);
23 extern int __rio_local_read_config_16(struct rio_mport *port, u32 offset,
24 u16 * data);
25 extern int __rio_local_write_config_16(struct rio_mport *port, u32 offset,
26 u16 data);
27 extern int __rio_local_read_config_8(struct rio_mport *port, u32 offset,
28 u8 * data);
29 extern int __rio_local_write_config_8(struct rio_mport *port, u32 offset,
30 u8 data);
31
32 extern int rio_mport_read_config_32(struct rio_mport *port, u16 destid,
33 u8 hopcount, u32 offset, u32 * data);
34 extern int rio_mport_write_config_32(struct rio_mport *port, u16 destid,
35 u8 hopcount, u32 offset, u32 data);
36 extern int rio_mport_read_config_16(struct rio_mport *port, u16 destid,
37 u8 hopcount, u32 offset, u16 * data);
38 extern int rio_mport_write_config_16(struct rio_mport *port, u16 destid,
39 u8 hopcount, u32 offset, u16 data);
40 extern int rio_mport_read_config_8(struct rio_mport *port, u16 destid,
41 u8 hopcount, u32 offset, u8 * data);
42 extern int rio_mport_write_config_8(struct rio_mport *port, u16 destid,
43 u8 hopcount, u32 offset, u8 data);
44
45
46
47
48
49
50
51
52
53
54 static inline int rio_local_read_config_32(struct rio_mport *port, u32 offset,
55 u32 * data)
56 {
57 return __rio_local_read_config_32(port, offset, data);
58 }
59
60
61
62
63
64
65
66
67
68
69 static inline int rio_local_write_config_32(struct rio_mport *port, u32 offset,
70 u32 data)
71 {
72 return __rio_local_write_config_32(port, offset, data);
73 }
74
75
76
77
78
79
80
81
82
83
84 static inline int rio_local_read_config_16(struct rio_mport *port, u32 offset,
85 u16 * data)
86 {
87 return __rio_local_read_config_16(port, offset, data);
88 }
89
90
91
92
93
94
95
96
97
98
99
100 static inline int rio_local_write_config_16(struct rio_mport *port, u32 offset,
101 u16 data)
102 {
103 return __rio_local_write_config_16(port, offset, data);
104 }
105
106
107
108
109
110
111
112
113
114
115 static inline int rio_local_read_config_8(struct rio_mport *port, u32 offset,
116 u8 * data)
117 {
118 return __rio_local_read_config_8(port, offset, data);
119 }
120
121
122
123
124
125
126
127
128
129
130 static inline int rio_local_write_config_8(struct rio_mport *port, u32 offset,
131 u8 data)
132 {
133 return __rio_local_write_config_8(port, offset, data);
134 }
135
136
137
138
139
140
141
142
143
144
145 static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset,
146 u32 * data)
147 {
148 return rio_mport_read_config_32(rdev->net->hport, rdev->destid,
149 rdev->hopcount, offset, data);
150 };
151
152
153
154
155
156
157
158
159
160
161 static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset,
162 u32 data)
163 {
164 return rio_mport_write_config_32(rdev->net->hport, rdev->destid,
165 rdev->hopcount, offset, data);
166 };
167
168
169
170
171
172
173
174
175
176
177 static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset,
178 u16 * data)
179 {
180 return rio_mport_read_config_16(rdev->net->hport, rdev->destid,
181 rdev->hopcount, offset, data);
182 };
183
184
185
186
187
188
189
190
191
192
193 static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset,
194 u16 data)
195 {
196 return rio_mport_write_config_16(rdev->net->hport, rdev->destid,
197 rdev->hopcount, offset, data);
198 };
199
200
201
202
203
204
205
206
207
208
209 static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data)
210 {
211 return rio_mport_read_config_8(rdev->net->hport, rdev->destid,
212 rdev->hopcount, offset, data);
213 };
214
215
216
217
218
219
220
221
222
223
224 static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data)
225 {
226 return rio_mport_write_config_8(rdev->net->hport, rdev->destid,
227 rdev->hopcount, offset, data);
228 };
229
230 extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid,
231 u16 data);
232
233
234
235
236
237
238
239
240
241 static inline int rio_send_doorbell(struct rio_dev *rdev, u16 data)
242 {
243 return rio_mport_send_doorbell(rdev->net->hport, rdev->destid, data);
244 };
245
246
247
248
249
250
251
252
253
254
255
256 static inline void rio_init_mbox_res(struct resource *res, int start, int end)
257 {
258 memset(res, 0, sizeof(struct resource));
259 res->start = start;
260 res->end = end;
261 res->flags = RIO_RESOURCE_MAILBOX;
262 }
263
264
265
266
267
268
269
270
271
272
273
274 static inline void rio_init_dbell_res(struct resource *res, u16 start, u16 end)
275 {
276 memset(res, 0, sizeof(struct resource));
277 res->start = start;
278 res->end = end;
279 res->flags = RIO_RESOURCE_DOORBELL;
280 }
281
282
283
284
285
286
287
288
289
290
291 #define RIO_DEVICE(dev,ven) \
292 .did = (dev), .vid = (ven), \
293 .asm_did = RIO_ANY_ID, .asm_vid = RIO_ANY_ID
294
295
296 extern int rio_request_outb_mbox(struct rio_mport *, void *, int, int,
297 void (*)(struct rio_mport *, void *,int, int));
298 extern int rio_release_outb_mbox(struct rio_mport *, int);
299
300
301
302
303
304
305
306
307
308
309
310
311 static inline int rio_add_outb_message(struct rio_mport *mport,
312 struct rio_dev *rdev, int mbox,
313 void *buffer, size_t len)
314 {
315 return mport->ops->add_outb_message(mport, rdev, mbox,
316 buffer, len);
317 }
318
319 extern int rio_request_inb_mbox(struct rio_mport *, void *, int, int,
320 void (*)(struct rio_mport *, void *, int, int));
321 extern int rio_release_inb_mbox(struct rio_mport *, int);
322
323
324
325
326
327
328
329
330
331
332 static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
333 void *buffer)
334 {
335 return mport->ops->add_inb_buffer(mport, mbox, buffer);
336 }
337
338
339
340
341
342
343
344
345 static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox)
346 {
347 return mport->ops->get_inb_message(mport, mbox);
348 }
349
350
351 extern int rio_request_inb_dbell(struct rio_mport *, void *, u16, u16,
352 void (*)(struct rio_mport *, void *, u16, u16, u16));
353 extern int rio_release_inb_dbell(struct rio_mport *, u16, u16);
354 extern struct resource *rio_request_outb_dbell(struct rio_dev *, u16, u16);
355 extern int rio_release_outb_dbell(struct rio_dev *, struct resource *);
356
357
358 int rio_claim_resource(struct rio_dev *, int);
359 int rio_request_regions(struct rio_dev *, char *);
360 void rio_release_regions(struct rio_dev *);
361 int rio_request_region(struct rio_dev *, int, char *);
362 void rio_release_region(struct rio_dev *, int);
363
364
365 extern int rio_map_inb_region(struct rio_mport *mport, dma_addr_t local,
366 u64 rbase, u32 size, u32 rflags);
367 extern void rio_unmap_inb_region(struct rio_mport *mport, dma_addr_t lstart);
368 extern int rio_map_outb_region(struct rio_mport *mport, u16 destid, u64 rbase,
369 u32 size, u32 rflags, dma_addr_t *local);
370 extern void rio_unmap_outb_region(struct rio_mport *mport,
371 u16 destid, u64 rstart);
372
373
374 extern int rio_request_inb_pwrite(struct rio_dev *,
375 int (*)(struct rio_dev *, union rio_pw_msg*, int));
376 extern int rio_release_inb_pwrite(struct rio_dev *);
377 extern int rio_add_mport_pw_handler(struct rio_mport *mport, void *dev_id,
378 int (*pwcback)(struct rio_mport *mport, void *dev_id,
379 union rio_pw_msg *msg, int step));
380 extern int rio_del_mport_pw_handler(struct rio_mport *mport, void *dev_id,
381 int (*pwcback)(struct rio_mport *mport, void *dev_id,
382 union rio_pw_msg *msg, int step));
383 extern int rio_inb_pwrite_handler(struct rio_mport *mport,
384 union rio_pw_msg *pw_msg);
385 extern void rio_pw_enable(struct rio_mport *mport, int enable);
386
387
388 int rio_register_driver(struct rio_driver *);
389 void rio_unregister_driver(struct rio_driver *);
390 struct rio_dev *rio_dev_get(struct rio_dev *);
391 void rio_dev_put(struct rio_dev *);
392
393 #ifdef CONFIG_RAPIDIO_DMA_ENGINE
394 extern struct dma_chan *rio_request_dma(struct rio_dev *rdev);
395 extern struct dma_chan *rio_request_mport_dma(struct rio_mport *mport);
396 extern void rio_release_dma(struct dma_chan *dchan);
397 extern struct dma_async_tx_descriptor *rio_dma_prep_slave_sg(
398 struct rio_dev *rdev, struct dma_chan *dchan,
399 struct rio_dma_data *data,
400 enum dma_transfer_direction direction, unsigned long flags);
401 extern struct dma_async_tx_descriptor *rio_dma_prep_xfer(
402 struct dma_chan *dchan, u16 destid,
403 struct rio_dma_data *data,
404 enum dma_transfer_direction direction, unsigned long flags);
405 #endif
406
407
408
409
410
411
412
413
414 static inline const char *rio_name(struct rio_dev *rdev)
415 {
416 return dev_name(&rdev->dev);
417 }
418
419
420
421
422
423
424
425
426 static inline void *rio_get_drvdata(struct rio_dev *rdev)
427 {
428 return dev_get_drvdata(&rdev->dev);
429 }
430
431
432
433
434
435
436
437
438
439 static inline void rio_set_drvdata(struct rio_dev *rdev, void *data)
440 {
441 dev_set_drvdata(&rdev->dev, data);
442 }
443
444
445 extern u16 rio_local_get_device_id(struct rio_mport *port);
446 extern void rio_local_set_device_id(struct rio_mport *port, u16 did);
447 extern struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from);
448 extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did,
449 struct rio_dev *from);
450 extern int rio_init_mports(void);
451
452 #endif