Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[deliverable/linux.git] / arch / tile / gxio / iorpc_mpipe.c
1 /*
2 * Copyright 2012 Tilera Corporation. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
12 * more details.
13 */
14
15 /* This file is machine-generated; DO NOT EDIT! */
16 #include "gxio/iorpc_mpipe.h"
17
18 struct alloc_buffer_stacks_param {
19 unsigned int count;
20 unsigned int first;
21 unsigned int flags;
22 };
23
24 int gxio_mpipe_alloc_buffer_stacks(gxio_mpipe_context_t *context,
25 unsigned int count, unsigned int first,
26 unsigned int flags)
27 {
28 struct alloc_buffer_stacks_param temp;
29 struct alloc_buffer_stacks_param *params = &temp;
30
31 params->count = count;
32 params->first = first;
33 params->flags = flags;
34
35 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
36 sizeof(*params),
37 GXIO_MPIPE_OP_ALLOC_BUFFER_STACKS);
38 }
39
40 EXPORT_SYMBOL(gxio_mpipe_alloc_buffer_stacks);
41
42 struct init_buffer_stack_aux_param {
43 union iorpc_mem_buffer buffer;
44 unsigned int stack;
45 unsigned int buffer_size_enum;
46 };
47
48 int gxio_mpipe_init_buffer_stack_aux(gxio_mpipe_context_t *context,
49 void *mem_va, size_t mem_size,
50 unsigned int mem_flags, unsigned int stack,
51 unsigned int buffer_size_enum)
52 {
53 int __result;
54 unsigned long long __cpa;
55 pte_t __pte;
56 struct init_buffer_stack_aux_param temp;
57 struct init_buffer_stack_aux_param *params = &temp;
58
59 __result = va_to_cpa_and_pte(mem_va, &__cpa, &__pte);
60 if (__result != 0)
61 return __result;
62 params->buffer.kernel.cpa = __cpa;
63 params->buffer.kernel.size = mem_size;
64 params->buffer.kernel.pte = __pte;
65 params->buffer.kernel.flags = mem_flags;
66 params->stack = stack;
67 params->buffer_size_enum = buffer_size_enum;
68
69 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
70 sizeof(*params),
71 GXIO_MPIPE_OP_INIT_BUFFER_STACK_AUX);
72 }
73
74 EXPORT_SYMBOL(gxio_mpipe_init_buffer_stack_aux);
75
76
77 struct alloc_notif_rings_param {
78 unsigned int count;
79 unsigned int first;
80 unsigned int flags;
81 };
82
83 int gxio_mpipe_alloc_notif_rings(gxio_mpipe_context_t *context,
84 unsigned int count, unsigned int first,
85 unsigned int flags)
86 {
87 struct alloc_notif_rings_param temp;
88 struct alloc_notif_rings_param *params = &temp;
89
90 params->count = count;
91 params->first = first;
92 params->flags = flags;
93
94 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
95 sizeof(*params), GXIO_MPIPE_OP_ALLOC_NOTIF_RINGS);
96 }
97
98 EXPORT_SYMBOL(gxio_mpipe_alloc_notif_rings);
99
100 struct init_notif_ring_aux_param {
101 union iorpc_mem_buffer buffer;
102 unsigned int ring;
103 };
104
105 int gxio_mpipe_init_notif_ring_aux(gxio_mpipe_context_t *context, void *mem_va,
106 size_t mem_size, unsigned int mem_flags,
107 unsigned int ring)
108 {
109 int __result;
110 unsigned long long __cpa;
111 pte_t __pte;
112 struct init_notif_ring_aux_param temp;
113 struct init_notif_ring_aux_param *params = &temp;
114
115 __result = va_to_cpa_and_pte(mem_va, &__cpa, &__pte);
116 if (__result != 0)
117 return __result;
118 params->buffer.kernel.cpa = __cpa;
119 params->buffer.kernel.size = mem_size;
120 params->buffer.kernel.pte = __pte;
121 params->buffer.kernel.flags = mem_flags;
122 params->ring = ring;
123
124 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
125 sizeof(*params),
126 GXIO_MPIPE_OP_INIT_NOTIF_RING_AUX);
127 }
128
129 EXPORT_SYMBOL(gxio_mpipe_init_notif_ring_aux);
130
131 struct request_notif_ring_interrupt_param {
132 union iorpc_interrupt interrupt;
133 unsigned int ring;
134 };
135
136 int gxio_mpipe_request_notif_ring_interrupt(gxio_mpipe_context_t *context,
137 int inter_x, int inter_y,
138 int inter_ipi, int inter_event,
139 unsigned int ring)
140 {
141 struct request_notif_ring_interrupt_param temp;
142 struct request_notif_ring_interrupt_param *params = &temp;
143
144 params->interrupt.kernel.x = inter_x;
145 params->interrupt.kernel.y = inter_y;
146 params->interrupt.kernel.ipi = inter_ipi;
147 params->interrupt.kernel.event = inter_event;
148 params->ring = ring;
149
150 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
151 sizeof(*params),
152 GXIO_MPIPE_OP_REQUEST_NOTIF_RING_INTERRUPT);
153 }
154
155 EXPORT_SYMBOL(gxio_mpipe_request_notif_ring_interrupt);
156
157 struct enable_notif_ring_interrupt_param {
158 unsigned int ring;
159 };
160
161 int gxio_mpipe_enable_notif_ring_interrupt(gxio_mpipe_context_t *context,
162 unsigned int ring)
163 {
164 struct enable_notif_ring_interrupt_param temp;
165 struct enable_notif_ring_interrupt_param *params = &temp;
166
167 params->ring = ring;
168
169 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
170 sizeof(*params),
171 GXIO_MPIPE_OP_ENABLE_NOTIF_RING_INTERRUPT);
172 }
173
174 EXPORT_SYMBOL(gxio_mpipe_enable_notif_ring_interrupt);
175
176 struct alloc_notif_groups_param {
177 unsigned int count;
178 unsigned int first;
179 unsigned int flags;
180 };
181
182 int gxio_mpipe_alloc_notif_groups(gxio_mpipe_context_t *context,
183 unsigned int count, unsigned int first,
184 unsigned int flags)
185 {
186 struct alloc_notif_groups_param temp;
187 struct alloc_notif_groups_param *params = &temp;
188
189 params->count = count;
190 params->first = first;
191 params->flags = flags;
192
193 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
194 sizeof(*params), GXIO_MPIPE_OP_ALLOC_NOTIF_GROUPS);
195 }
196
197 EXPORT_SYMBOL(gxio_mpipe_alloc_notif_groups);
198
199 struct init_notif_group_param {
200 unsigned int group;
201 gxio_mpipe_notif_group_bits_t bits;
202 };
203
204 int gxio_mpipe_init_notif_group(gxio_mpipe_context_t *context,
205 unsigned int group,
206 gxio_mpipe_notif_group_bits_t bits)
207 {
208 struct init_notif_group_param temp;
209 struct init_notif_group_param *params = &temp;
210
211 params->group = group;
212 params->bits = bits;
213
214 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
215 sizeof(*params), GXIO_MPIPE_OP_INIT_NOTIF_GROUP);
216 }
217
218 EXPORT_SYMBOL(gxio_mpipe_init_notif_group);
219
220 struct alloc_buckets_param {
221 unsigned int count;
222 unsigned int first;
223 unsigned int flags;
224 };
225
226 int gxio_mpipe_alloc_buckets(gxio_mpipe_context_t *context, unsigned int count,
227 unsigned int first, unsigned int flags)
228 {
229 struct alloc_buckets_param temp;
230 struct alloc_buckets_param *params = &temp;
231
232 params->count = count;
233 params->first = first;
234 params->flags = flags;
235
236 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
237 sizeof(*params), GXIO_MPIPE_OP_ALLOC_BUCKETS);
238 }
239
240 EXPORT_SYMBOL(gxio_mpipe_alloc_buckets);
241
242 struct init_bucket_param {
243 unsigned int bucket;
244 MPIPE_LBL_INIT_DAT_BSTS_TBL_t bucket_info;
245 };
246
247 int gxio_mpipe_init_bucket(gxio_mpipe_context_t *context, unsigned int bucket,
248 MPIPE_LBL_INIT_DAT_BSTS_TBL_t bucket_info)
249 {
250 struct init_bucket_param temp;
251 struct init_bucket_param *params = &temp;
252
253 params->bucket = bucket;
254 params->bucket_info = bucket_info;
255
256 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
257 sizeof(*params), GXIO_MPIPE_OP_INIT_BUCKET);
258 }
259
260 EXPORT_SYMBOL(gxio_mpipe_init_bucket);
261
262 struct alloc_edma_rings_param {
263 unsigned int count;
264 unsigned int first;
265 unsigned int flags;
266 };
267
268 int gxio_mpipe_alloc_edma_rings(gxio_mpipe_context_t *context,
269 unsigned int count, unsigned int first,
270 unsigned int flags)
271 {
272 struct alloc_edma_rings_param temp;
273 struct alloc_edma_rings_param *params = &temp;
274
275 params->count = count;
276 params->first = first;
277 params->flags = flags;
278
279 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
280 sizeof(*params), GXIO_MPIPE_OP_ALLOC_EDMA_RINGS);
281 }
282
283 EXPORT_SYMBOL(gxio_mpipe_alloc_edma_rings);
284
285 struct init_edma_ring_aux_param {
286 union iorpc_mem_buffer buffer;
287 unsigned int ring;
288 unsigned int channel;
289 };
290
291 int gxio_mpipe_init_edma_ring_aux(gxio_mpipe_context_t *context, void *mem_va,
292 size_t mem_size, unsigned int mem_flags,
293 unsigned int ring, unsigned int channel)
294 {
295 int __result;
296 unsigned long long __cpa;
297 pte_t __pte;
298 struct init_edma_ring_aux_param temp;
299 struct init_edma_ring_aux_param *params = &temp;
300
301 __result = va_to_cpa_and_pte(mem_va, &__cpa, &__pte);
302 if (__result != 0)
303 return __result;
304 params->buffer.kernel.cpa = __cpa;
305 params->buffer.kernel.size = mem_size;
306 params->buffer.kernel.pte = __pte;
307 params->buffer.kernel.flags = mem_flags;
308 params->ring = ring;
309 params->channel = channel;
310
311 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
312 sizeof(*params), GXIO_MPIPE_OP_INIT_EDMA_RING_AUX);
313 }
314
315 EXPORT_SYMBOL(gxio_mpipe_init_edma_ring_aux);
316
317
318 int gxio_mpipe_commit_rules(gxio_mpipe_context_t *context, const void *blob,
319 size_t blob_size)
320 {
321 const void *params = blob;
322
323 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params, blob_size,
324 GXIO_MPIPE_OP_COMMIT_RULES);
325 }
326
327 EXPORT_SYMBOL(gxio_mpipe_commit_rules);
328
329 struct register_client_memory_param {
330 unsigned int iotlb;
331 HV_PTE pte;
332 unsigned int flags;
333 };
334
335 int gxio_mpipe_register_client_memory(gxio_mpipe_context_t *context,
336 unsigned int iotlb, HV_PTE pte,
337 unsigned int flags)
338 {
339 struct register_client_memory_param temp;
340 struct register_client_memory_param *params = &temp;
341
342 params->iotlb = iotlb;
343 params->pte = pte;
344 params->flags = flags;
345
346 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
347 sizeof(*params),
348 GXIO_MPIPE_OP_REGISTER_CLIENT_MEMORY);
349 }
350
351 EXPORT_SYMBOL(gxio_mpipe_register_client_memory);
352
353 struct link_open_aux_param {
354 _gxio_mpipe_link_name_t name;
355 unsigned int flags;
356 };
357
358 int gxio_mpipe_link_open_aux(gxio_mpipe_context_t *context,
359 _gxio_mpipe_link_name_t name, unsigned int flags)
360 {
361 struct link_open_aux_param temp;
362 struct link_open_aux_param *params = &temp;
363
364 params->name = name;
365 params->flags = flags;
366
367 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
368 sizeof(*params), GXIO_MPIPE_OP_LINK_OPEN_AUX);
369 }
370
371 EXPORT_SYMBOL(gxio_mpipe_link_open_aux);
372
373 struct link_close_aux_param {
374 int mac;
375 };
376
377 int gxio_mpipe_link_close_aux(gxio_mpipe_context_t *context, int mac)
378 {
379 struct link_close_aux_param temp;
380 struct link_close_aux_param *params = &temp;
381
382 params->mac = mac;
383
384 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
385 sizeof(*params), GXIO_MPIPE_OP_LINK_CLOSE_AUX);
386 }
387
388 EXPORT_SYMBOL(gxio_mpipe_link_close_aux);
389
390 struct link_set_attr_aux_param {
391 int mac;
392 uint32_t attr;
393 int64_t val;
394 };
395
396 int gxio_mpipe_link_set_attr_aux(gxio_mpipe_context_t *context, int mac,
397 uint32_t attr, int64_t val)
398 {
399 struct link_set_attr_aux_param temp;
400 struct link_set_attr_aux_param *params = &temp;
401
402 params->mac = mac;
403 params->attr = attr;
404 params->val = val;
405
406 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
407 sizeof(*params), GXIO_MPIPE_OP_LINK_SET_ATTR_AUX);
408 }
409
410 EXPORT_SYMBOL(gxio_mpipe_link_set_attr_aux);
411
412 struct get_timestamp_aux_param {
413 uint64_t sec;
414 uint64_t nsec;
415 uint64_t cycles;
416 };
417
418 int gxio_mpipe_get_timestamp_aux(gxio_mpipe_context_t *context, uint64_t *sec,
419 uint64_t *nsec, uint64_t *cycles)
420 {
421 int __result;
422 struct get_timestamp_aux_param temp;
423 struct get_timestamp_aux_param *params = &temp;
424
425 __result =
426 hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
427 GXIO_MPIPE_OP_GET_TIMESTAMP_AUX);
428 *sec = params->sec;
429 *nsec = params->nsec;
430 *cycles = params->cycles;
431
432 return __result;
433 }
434
435 EXPORT_SYMBOL(gxio_mpipe_get_timestamp_aux);
436
437 struct set_timestamp_aux_param {
438 uint64_t sec;
439 uint64_t nsec;
440 uint64_t cycles;
441 };
442
443 int gxio_mpipe_set_timestamp_aux(gxio_mpipe_context_t *context, uint64_t sec,
444 uint64_t nsec, uint64_t cycles)
445 {
446 struct set_timestamp_aux_param temp;
447 struct set_timestamp_aux_param *params = &temp;
448
449 params->sec = sec;
450 params->nsec = nsec;
451 params->cycles = cycles;
452
453 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
454 sizeof(*params), GXIO_MPIPE_OP_SET_TIMESTAMP_AUX);
455 }
456
457 EXPORT_SYMBOL(gxio_mpipe_set_timestamp_aux);
458
459 struct adjust_timestamp_aux_param {
460 int64_t nsec;
461 };
462
463 int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t *context, int64_t nsec)
464 {
465 struct adjust_timestamp_aux_param temp;
466 struct adjust_timestamp_aux_param *params = &temp;
467
468 params->nsec = nsec;
469
470 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
471 sizeof(*params),
472 GXIO_MPIPE_OP_ADJUST_TIMESTAMP_AUX);
473 }
474
475 EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_aux);
476
477 struct config_edma_ring_blks_param {
478 unsigned int ering;
479 unsigned int max_blks;
480 unsigned int min_snf_blks;
481 unsigned int db;
482 };
483
484 int gxio_mpipe_config_edma_ring_blks(gxio_mpipe_context_t *context,
485 unsigned int ering, unsigned int max_blks,
486 unsigned int min_snf_blks, unsigned int db)
487 {
488 struct config_edma_ring_blks_param temp;
489 struct config_edma_ring_blks_param *params = &temp;
490
491 params->ering = ering;
492 params->max_blks = max_blks;
493 params->min_snf_blks = min_snf_blks;
494 params->db = db;
495
496 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
497 sizeof(*params),
498 GXIO_MPIPE_OP_CONFIG_EDMA_RING_BLKS);
499 }
500
501 EXPORT_SYMBOL(gxio_mpipe_config_edma_ring_blks);
502
503 struct adjust_timestamp_freq_param {
504 int32_t ppb;
505 };
506
507 int gxio_mpipe_adjust_timestamp_freq(gxio_mpipe_context_t *context, int32_t ppb)
508 {
509 struct adjust_timestamp_freq_param temp;
510 struct adjust_timestamp_freq_param *params = &temp;
511
512 params->ppb = ppb;
513
514 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
515 sizeof(*params),
516 GXIO_MPIPE_OP_ADJUST_TIMESTAMP_FREQ);
517 }
518
519 EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_freq);
520
521 struct arm_pollfd_param {
522 union iorpc_pollfd pollfd;
523 };
524
525 int gxio_mpipe_arm_pollfd(gxio_mpipe_context_t *context, int pollfd_cookie)
526 {
527 struct arm_pollfd_param temp;
528 struct arm_pollfd_param *params = &temp;
529
530 params->pollfd.kernel.cookie = pollfd_cookie;
531
532 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
533 sizeof(*params), GXIO_MPIPE_OP_ARM_POLLFD);
534 }
535
536 EXPORT_SYMBOL(gxio_mpipe_arm_pollfd);
537
538 struct close_pollfd_param {
539 union iorpc_pollfd pollfd;
540 };
541
542 int gxio_mpipe_close_pollfd(gxio_mpipe_context_t *context, int pollfd_cookie)
543 {
544 struct close_pollfd_param temp;
545 struct close_pollfd_param *params = &temp;
546
547 params->pollfd.kernel.cookie = pollfd_cookie;
548
549 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
550 sizeof(*params), GXIO_MPIPE_OP_CLOSE_POLLFD);
551 }
552
553 EXPORT_SYMBOL(gxio_mpipe_close_pollfd);
554
555 struct get_mmio_base_param {
556 HV_PTE base;
557 };
558
559 int gxio_mpipe_get_mmio_base(gxio_mpipe_context_t *context, HV_PTE *base)
560 {
561 int __result;
562 struct get_mmio_base_param temp;
563 struct get_mmio_base_param *params = &temp;
564
565 __result =
566 hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
567 GXIO_MPIPE_OP_GET_MMIO_BASE);
568 *base = params->base;
569
570 return __result;
571 }
572
573 EXPORT_SYMBOL(gxio_mpipe_get_mmio_base);
574
575 struct check_mmio_offset_param {
576 unsigned long offset;
577 unsigned long size;
578 };
579
580 int gxio_mpipe_check_mmio_offset(gxio_mpipe_context_t *context,
581 unsigned long offset, unsigned long size)
582 {
583 struct check_mmio_offset_param temp;
584 struct check_mmio_offset_param *params = &temp;
585
586 params->offset = offset;
587 params->size = size;
588
589 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
590 sizeof(*params), GXIO_MPIPE_OP_CHECK_MMIO_OFFSET);
591 }
592
593 EXPORT_SYMBOL(gxio_mpipe_check_mmio_offset);
This page took 0.043354 seconds and 5 git commands to generate.