iorpc_mpipe.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  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. /* This file is machine-generated; DO NOT EDIT! */
  15. #include "gxio/iorpc_mpipe.h"
  16. struct alloc_buffer_stacks_param {
  17. unsigned int count;
  18. unsigned int first;
  19. unsigned int flags;
  20. };
  21. int gxio_mpipe_alloc_buffer_stacks(gxio_mpipe_context_t * context,
  22. unsigned int count, unsigned int first,
  23. unsigned int flags)
  24. {
  25. struct alloc_buffer_stacks_param temp;
  26. struct alloc_buffer_stacks_param *params = &temp;
  27. params->count = count;
  28. params->first = first;
  29. params->flags = flags;
  30. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  31. sizeof(*params),
  32. GXIO_MPIPE_OP_ALLOC_BUFFER_STACKS);
  33. }
  34. EXPORT_SYMBOL(gxio_mpipe_alloc_buffer_stacks);
  35. struct init_buffer_stack_aux_param {
  36. union iorpc_mem_buffer buffer;
  37. unsigned int stack;
  38. unsigned int buffer_size_enum;
  39. };
  40. int gxio_mpipe_init_buffer_stack_aux(gxio_mpipe_context_t * context,
  41. void *mem_va, size_t mem_size,
  42. unsigned int mem_flags, unsigned int stack,
  43. unsigned int buffer_size_enum)
  44. {
  45. int __result;
  46. unsigned long long __cpa;
  47. pte_t __pte;
  48. struct init_buffer_stack_aux_param temp;
  49. struct init_buffer_stack_aux_param *params = &temp;
  50. __result = va_to_cpa_and_pte(mem_va, &__cpa, &__pte);
  51. if (__result != 0)
  52. return __result;
  53. params->buffer.kernel.cpa = __cpa;
  54. params->buffer.kernel.size = mem_size;
  55. params->buffer.kernel.pte = __pte;
  56. params->buffer.kernel.flags = mem_flags;
  57. params->stack = stack;
  58. params->buffer_size_enum = buffer_size_enum;
  59. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  60. sizeof(*params),
  61. GXIO_MPIPE_OP_INIT_BUFFER_STACK_AUX);
  62. }
  63. EXPORT_SYMBOL(gxio_mpipe_init_buffer_stack_aux);
  64. struct alloc_notif_rings_param {
  65. unsigned int count;
  66. unsigned int first;
  67. unsigned int flags;
  68. };
  69. int gxio_mpipe_alloc_notif_rings(gxio_mpipe_context_t * context,
  70. unsigned int count, unsigned int first,
  71. unsigned int flags)
  72. {
  73. struct alloc_notif_rings_param temp;
  74. struct alloc_notif_rings_param *params = &temp;
  75. params->count = count;
  76. params->first = first;
  77. params->flags = flags;
  78. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  79. sizeof(*params), GXIO_MPIPE_OP_ALLOC_NOTIF_RINGS);
  80. }
  81. EXPORT_SYMBOL(gxio_mpipe_alloc_notif_rings);
  82. struct init_notif_ring_aux_param {
  83. union iorpc_mem_buffer buffer;
  84. unsigned int ring;
  85. };
  86. int gxio_mpipe_init_notif_ring_aux(gxio_mpipe_context_t * context, void *mem_va,
  87. size_t mem_size, unsigned int mem_flags,
  88. unsigned int ring)
  89. {
  90. int __result;
  91. unsigned long long __cpa;
  92. pte_t __pte;
  93. struct init_notif_ring_aux_param temp;
  94. struct init_notif_ring_aux_param *params = &temp;
  95. __result = va_to_cpa_and_pte(mem_va, &__cpa, &__pte);
  96. if (__result != 0)
  97. return __result;
  98. params->buffer.kernel.cpa = __cpa;
  99. params->buffer.kernel.size = mem_size;
  100. params->buffer.kernel.pte = __pte;
  101. params->buffer.kernel.flags = mem_flags;
  102. params->ring = ring;
  103. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  104. sizeof(*params),
  105. GXIO_MPIPE_OP_INIT_NOTIF_RING_AUX);
  106. }
  107. EXPORT_SYMBOL(gxio_mpipe_init_notif_ring_aux);
  108. struct request_notif_ring_interrupt_param {
  109. union iorpc_interrupt interrupt;
  110. unsigned int ring;
  111. };
  112. int gxio_mpipe_request_notif_ring_interrupt(gxio_mpipe_context_t * context,
  113. int inter_x, int inter_y,
  114. int inter_ipi, int inter_event,
  115. unsigned int ring)
  116. {
  117. struct request_notif_ring_interrupt_param temp;
  118. struct request_notif_ring_interrupt_param *params = &temp;
  119. params->interrupt.kernel.x = inter_x;
  120. params->interrupt.kernel.y = inter_y;
  121. params->interrupt.kernel.ipi = inter_ipi;
  122. params->interrupt.kernel.event = inter_event;
  123. params->ring = ring;
  124. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  125. sizeof(*params),
  126. GXIO_MPIPE_OP_REQUEST_NOTIF_RING_INTERRUPT);
  127. }
  128. EXPORT_SYMBOL(gxio_mpipe_request_notif_ring_interrupt);
  129. struct enable_notif_ring_interrupt_param {
  130. unsigned int ring;
  131. };
  132. int gxio_mpipe_enable_notif_ring_interrupt(gxio_mpipe_context_t * context,
  133. unsigned int ring)
  134. {
  135. struct enable_notif_ring_interrupt_param temp;
  136. struct enable_notif_ring_interrupt_param *params = &temp;
  137. params->ring = ring;
  138. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  139. sizeof(*params),
  140. GXIO_MPIPE_OP_ENABLE_NOTIF_RING_INTERRUPT);
  141. }
  142. EXPORT_SYMBOL(gxio_mpipe_enable_notif_ring_interrupt);
  143. struct alloc_notif_groups_param {
  144. unsigned int count;
  145. unsigned int first;
  146. unsigned int flags;
  147. };
  148. int gxio_mpipe_alloc_notif_groups(gxio_mpipe_context_t * context,
  149. unsigned int count, unsigned int first,
  150. unsigned int flags)
  151. {
  152. struct alloc_notif_groups_param temp;
  153. struct alloc_notif_groups_param *params = &temp;
  154. params->count = count;
  155. params->first = first;
  156. params->flags = flags;
  157. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  158. sizeof(*params), GXIO_MPIPE_OP_ALLOC_NOTIF_GROUPS);
  159. }
  160. EXPORT_SYMBOL(gxio_mpipe_alloc_notif_groups);
  161. struct init_notif_group_param {
  162. unsigned int group;
  163. gxio_mpipe_notif_group_bits_t bits;
  164. };
  165. int gxio_mpipe_init_notif_group(gxio_mpipe_context_t * context,
  166. unsigned int group,
  167. gxio_mpipe_notif_group_bits_t bits)
  168. {
  169. struct init_notif_group_param temp;
  170. struct init_notif_group_param *params = &temp;
  171. params->group = group;
  172. params->bits = bits;
  173. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  174. sizeof(*params), GXIO_MPIPE_OP_INIT_NOTIF_GROUP);
  175. }
  176. EXPORT_SYMBOL(gxio_mpipe_init_notif_group);
  177. struct alloc_buckets_param {
  178. unsigned int count;
  179. unsigned int first;
  180. unsigned int flags;
  181. };
  182. int gxio_mpipe_alloc_buckets(gxio_mpipe_context_t * context, unsigned int count,
  183. unsigned int first, unsigned int flags)
  184. {
  185. struct alloc_buckets_param temp;
  186. struct alloc_buckets_param *params = &temp;
  187. params->count = count;
  188. params->first = first;
  189. params->flags = flags;
  190. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  191. sizeof(*params), GXIO_MPIPE_OP_ALLOC_BUCKETS);
  192. }
  193. EXPORT_SYMBOL(gxio_mpipe_alloc_buckets);
  194. struct init_bucket_param {
  195. unsigned int bucket;
  196. MPIPE_LBL_INIT_DAT_BSTS_TBL_t bucket_info;
  197. };
  198. int gxio_mpipe_init_bucket(gxio_mpipe_context_t * context, unsigned int bucket,
  199. MPIPE_LBL_INIT_DAT_BSTS_TBL_t bucket_info)
  200. {
  201. struct init_bucket_param temp;
  202. struct init_bucket_param *params = &temp;
  203. params->bucket = bucket;
  204. params->bucket_info = bucket_info;
  205. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  206. sizeof(*params), GXIO_MPIPE_OP_INIT_BUCKET);
  207. }
  208. EXPORT_SYMBOL(gxio_mpipe_init_bucket);
  209. struct alloc_edma_rings_param {
  210. unsigned int count;
  211. unsigned int first;
  212. unsigned int flags;
  213. };
  214. int gxio_mpipe_alloc_edma_rings(gxio_mpipe_context_t * context,
  215. unsigned int count, unsigned int first,
  216. unsigned int flags)
  217. {
  218. struct alloc_edma_rings_param temp;
  219. struct alloc_edma_rings_param *params = &temp;
  220. params->count = count;
  221. params->first = first;
  222. params->flags = flags;
  223. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  224. sizeof(*params), GXIO_MPIPE_OP_ALLOC_EDMA_RINGS);
  225. }
  226. EXPORT_SYMBOL(gxio_mpipe_alloc_edma_rings);
  227. struct init_edma_ring_aux_param {
  228. union iorpc_mem_buffer buffer;
  229. unsigned int ring;
  230. unsigned int channel;
  231. };
  232. int gxio_mpipe_init_edma_ring_aux(gxio_mpipe_context_t * context, void *mem_va,
  233. size_t mem_size, unsigned int mem_flags,
  234. unsigned int ring, unsigned int channel)
  235. {
  236. int __result;
  237. unsigned long long __cpa;
  238. pte_t __pte;
  239. struct init_edma_ring_aux_param temp;
  240. struct init_edma_ring_aux_param *params = &temp;
  241. __result = va_to_cpa_and_pte(mem_va, &__cpa, &__pte);
  242. if (__result != 0)
  243. return __result;
  244. params->buffer.kernel.cpa = __cpa;
  245. params->buffer.kernel.size = mem_size;
  246. params->buffer.kernel.pte = __pte;
  247. params->buffer.kernel.flags = mem_flags;
  248. params->ring = ring;
  249. params->channel = channel;
  250. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  251. sizeof(*params), GXIO_MPIPE_OP_INIT_EDMA_RING_AUX);
  252. }
  253. EXPORT_SYMBOL(gxio_mpipe_init_edma_ring_aux);
  254. int gxio_mpipe_commit_rules(gxio_mpipe_context_t * context, const void *blob,
  255. size_t blob_size)
  256. {
  257. const void *params = blob;
  258. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params, blob_size,
  259. GXIO_MPIPE_OP_COMMIT_RULES);
  260. }
  261. EXPORT_SYMBOL(gxio_mpipe_commit_rules);
  262. struct register_client_memory_param {
  263. unsigned int iotlb;
  264. HV_PTE pte;
  265. unsigned int flags;
  266. };
  267. int gxio_mpipe_register_client_memory(gxio_mpipe_context_t * context,
  268. unsigned int iotlb, HV_PTE pte,
  269. unsigned int flags)
  270. {
  271. struct register_client_memory_param temp;
  272. struct register_client_memory_param *params = &temp;
  273. params->iotlb = iotlb;
  274. params->pte = pte;
  275. params->flags = flags;
  276. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  277. sizeof(*params),
  278. GXIO_MPIPE_OP_REGISTER_CLIENT_MEMORY);
  279. }
  280. EXPORT_SYMBOL(gxio_mpipe_register_client_memory);
  281. struct link_open_aux_param {
  282. _gxio_mpipe_link_name_t name;
  283. unsigned int flags;
  284. };
  285. int gxio_mpipe_link_open_aux(gxio_mpipe_context_t * context,
  286. _gxio_mpipe_link_name_t name, unsigned int flags)
  287. {
  288. struct link_open_aux_param temp;
  289. struct link_open_aux_param *params = &temp;
  290. params->name = name;
  291. params->flags = flags;
  292. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  293. sizeof(*params), GXIO_MPIPE_OP_LINK_OPEN_AUX);
  294. }
  295. EXPORT_SYMBOL(gxio_mpipe_link_open_aux);
  296. struct link_close_aux_param {
  297. int mac;
  298. };
  299. int gxio_mpipe_link_close_aux(gxio_mpipe_context_t * context, int mac)
  300. {
  301. struct link_close_aux_param temp;
  302. struct link_close_aux_param *params = &temp;
  303. params->mac = mac;
  304. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  305. sizeof(*params), GXIO_MPIPE_OP_LINK_CLOSE_AUX);
  306. }
  307. EXPORT_SYMBOL(gxio_mpipe_link_close_aux);
  308. struct get_timestamp_aux_param {
  309. uint64_t sec;
  310. uint64_t nsec;
  311. uint64_t cycles;
  312. };
  313. int gxio_mpipe_get_timestamp_aux(gxio_mpipe_context_t * context, uint64_t * sec,
  314. uint64_t * nsec, uint64_t * cycles)
  315. {
  316. int __result;
  317. struct get_timestamp_aux_param temp;
  318. struct get_timestamp_aux_param *params = &temp;
  319. __result =
  320. hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
  321. GXIO_MPIPE_OP_GET_TIMESTAMP_AUX);
  322. *sec = params->sec;
  323. *nsec = params->nsec;
  324. *cycles = params->cycles;
  325. return __result;
  326. }
  327. EXPORT_SYMBOL(gxio_mpipe_get_timestamp_aux);
  328. struct set_timestamp_aux_param {
  329. uint64_t sec;
  330. uint64_t nsec;
  331. uint64_t cycles;
  332. };
  333. int gxio_mpipe_set_timestamp_aux(gxio_mpipe_context_t * context, uint64_t sec,
  334. uint64_t nsec, uint64_t cycles)
  335. {
  336. struct set_timestamp_aux_param temp;
  337. struct set_timestamp_aux_param *params = &temp;
  338. params->sec = sec;
  339. params->nsec = nsec;
  340. params->cycles = cycles;
  341. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  342. sizeof(*params), GXIO_MPIPE_OP_SET_TIMESTAMP_AUX);
  343. }
  344. EXPORT_SYMBOL(gxio_mpipe_set_timestamp_aux);
  345. struct adjust_timestamp_aux_param {
  346. int64_t nsec;
  347. };
  348. int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t * context,
  349. int64_t nsec)
  350. {
  351. struct adjust_timestamp_aux_param temp;
  352. struct adjust_timestamp_aux_param *params = &temp;
  353. params->nsec = nsec;
  354. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  355. sizeof(*params),
  356. GXIO_MPIPE_OP_ADJUST_TIMESTAMP_AUX);
  357. }
  358. EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_aux);
  359. struct arm_pollfd_param {
  360. union iorpc_pollfd pollfd;
  361. };
  362. int gxio_mpipe_arm_pollfd(gxio_mpipe_context_t * context, int pollfd_cookie)
  363. {
  364. struct arm_pollfd_param temp;
  365. struct arm_pollfd_param *params = &temp;
  366. params->pollfd.kernel.cookie = pollfd_cookie;
  367. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  368. sizeof(*params), GXIO_MPIPE_OP_ARM_POLLFD);
  369. }
  370. EXPORT_SYMBOL(gxio_mpipe_arm_pollfd);
  371. struct close_pollfd_param {
  372. union iorpc_pollfd pollfd;
  373. };
  374. int gxio_mpipe_close_pollfd(gxio_mpipe_context_t * context, int pollfd_cookie)
  375. {
  376. struct close_pollfd_param temp;
  377. struct close_pollfd_param *params = &temp;
  378. params->pollfd.kernel.cookie = pollfd_cookie;
  379. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  380. sizeof(*params), GXIO_MPIPE_OP_CLOSE_POLLFD);
  381. }
  382. EXPORT_SYMBOL(gxio_mpipe_close_pollfd);
  383. struct get_mmio_base_param {
  384. HV_PTE base;
  385. };
  386. int gxio_mpipe_get_mmio_base(gxio_mpipe_context_t * context, HV_PTE *base)
  387. {
  388. int __result;
  389. struct get_mmio_base_param temp;
  390. struct get_mmio_base_param *params = &temp;
  391. __result =
  392. hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
  393. GXIO_MPIPE_OP_GET_MMIO_BASE);
  394. *base = params->base;
  395. return __result;
  396. }
  397. EXPORT_SYMBOL(gxio_mpipe_get_mmio_base);
  398. struct check_mmio_offset_param {
  399. unsigned long offset;
  400. unsigned long size;
  401. };
  402. int gxio_mpipe_check_mmio_offset(gxio_mpipe_context_t * context,
  403. unsigned long offset, unsigned long size)
  404. {
  405. struct check_mmio_offset_param temp;
  406. struct check_mmio_offset_param *params = &temp;
  407. params->offset = offset;
  408. params->size = size;
  409. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  410. sizeof(*params), GXIO_MPIPE_OP_CHECK_MMIO_OFFSET);
  411. }
  412. EXPORT_SYMBOL(gxio_mpipe_check_mmio_offset);