iorpc_mpipe.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  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 link_set_attr_aux_param {
  309. int mac;
  310. uint32_t attr;
  311. int64_t val;
  312. };
  313. int gxio_mpipe_link_set_attr_aux(gxio_mpipe_context_t *context, int mac,
  314. uint32_t attr, int64_t val)
  315. {
  316. struct link_set_attr_aux_param temp;
  317. struct link_set_attr_aux_param *params = &temp;
  318. params->mac = mac;
  319. params->attr = attr;
  320. params->val = val;
  321. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  322. sizeof(*params), GXIO_MPIPE_OP_LINK_SET_ATTR_AUX);
  323. }
  324. EXPORT_SYMBOL(gxio_mpipe_link_set_attr_aux);
  325. struct get_timestamp_aux_param {
  326. uint64_t sec;
  327. uint64_t nsec;
  328. uint64_t cycles;
  329. };
  330. int gxio_mpipe_get_timestamp_aux(gxio_mpipe_context_t *context, uint64_t *sec,
  331. uint64_t *nsec, uint64_t *cycles)
  332. {
  333. int __result;
  334. struct get_timestamp_aux_param temp;
  335. struct get_timestamp_aux_param *params = &temp;
  336. __result =
  337. hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
  338. GXIO_MPIPE_OP_GET_TIMESTAMP_AUX);
  339. *sec = params->sec;
  340. *nsec = params->nsec;
  341. *cycles = params->cycles;
  342. return __result;
  343. }
  344. EXPORT_SYMBOL(gxio_mpipe_get_timestamp_aux);
  345. struct set_timestamp_aux_param {
  346. uint64_t sec;
  347. uint64_t nsec;
  348. uint64_t cycles;
  349. };
  350. int gxio_mpipe_set_timestamp_aux(gxio_mpipe_context_t *context, uint64_t sec,
  351. uint64_t nsec, uint64_t cycles)
  352. {
  353. struct set_timestamp_aux_param temp;
  354. struct set_timestamp_aux_param *params = &temp;
  355. params->sec = sec;
  356. params->nsec = nsec;
  357. params->cycles = cycles;
  358. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  359. sizeof(*params), GXIO_MPIPE_OP_SET_TIMESTAMP_AUX);
  360. }
  361. EXPORT_SYMBOL(gxio_mpipe_set_timestamp_aux);
  362. struct adjust_timestamp_aux_param {
  363. int64_t nsec;
  364. };
  365. int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t *context, int64_t nsec)
  366. {
  367. struct adjust_timestamp_aux_param temp;
  368. struct adjust_timestamp_aux_param *params = &temp;
  369. params->nsec = nsec;
  370. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  371. sizeof(*params),
  372. GXIO_MPIPE_OP_ADJUST_TIMESTAMP_AUX);
  373. }
  374. EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_aux);
  375. struct config_edma_ring_blks_param {
  376. unsigned int ering;
  377. unsigned int max_blks;
  378. unsigned int min_snf_blks;
  379. unsigned int db;
  380. };
  381. int gxio_mpipe_config_edma_ring_blks(gxio_mpipe_context_t *context,
  382. unsigned int ering, unsigned int max_blks,
  383. unsigned int min_snf_blks, unsigned int db)
  384. {
  385. struct config_edma_ring_blks_param temp;
  386. struct config_edma_ring_blks_param *params = &temp;
  387. params->ering = ering;
  388. params->max_blks = max_blks;
  389. params->min_snf_blks = min_snf_blks;
  390. params->db = db;
  391. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  392. sizeof(*params),
  393. GXIO_MPIPE_OP_CONFIG_EDMA_RING_BLKS);
  394. }
  395. EXPORT_SYMBOL(gxio_mpipe_config_edma_ring_blks);
  396. struct adjust_timestamp_freq_param {
  397. int32_t ppb;
  398. };
  399. int gxio_mpipe_adjust_timestamp_freq(gxio_mpipe_context_t *context, int32_t ppb)
  400. {
  401. struct adjust_timestamp_freq_param temp;
  402. struct adjust_timestamp_freq_param *params = &temp;
  403. params->ppb = ppb;
  404. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  405. sizeof(*params),
  406. GXIO_MPIPE_OP_ADJUST_TIMESTAMP_FREQ);
  407. }
  408. EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_freq);
  409. struct arm_pollfd_param {
  410. union iorpc_pollfd pollfd;
  411. };
  412. int gxio_mpipe_arm_pollfd(gxio_mpipe_context_t *context, int pollfd_cookie)
  413. {
  414. struct arm_pollfd_param temp;
  415. struct arm_pollfd_param *params = &temp;
  416. params->pollfd.kernel.cookie = pollfd_cookie;
  417. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  418. sizeof(*params), GXIO_MPIPE_OP_ARM_POLLFD);
  419. }
  420. EXPORT_SYMBOL(gxio_mpipe_arm_pollfd);
  421. struct close_pollfd_param {
  422. union iorpc_pollfd pollfd;
  423. };
  424. int gxio_mpipe_close_pollfd(gxio_mpipe_context_t *context, int pollfd_cookie)
  425. {
  426. struct close_pollfd_param temp;
  427. struct close_pollfd_param *params = &temp;
  428. params->pollfd.kernel.cookie = pollfd_cookie;
  429. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  430. sizeof(*params), GXIO_MPIPE_OP_CLOSE_POLLFD);
  431. }
  432. EXPORT_SYMBOL(gxio_mpipe_close_pollfd);
  433. struct get_mmio_base_param {
  434. HV_PTE base;
  435. };
  436. int gxio_mpipe_get_mmio_base(gxio_mpipe_context_t *context, HV_PTE *base)
  437. {
  438. int __result;
  439. struct get_mmio_base_param temp;
  440. struct get_mmio_base_param *params = &temp;
  441. __result =
  442. hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
  443. GXIO_MPIPE_OP_GET_MMIO_BASE);
  444. *base = params->base;
  445. return __result;
  446. }
  447. EXPORT_SYMBOL(gxio_mpipe_get_mmio_base);
  448. struct check_mmio_offset_param {
  449. unsigned long offset;
  450. unsigned long size;
  451. };
  452. int gxio_mpipe_check_mmio_offset(gxio_mpipe_context_t *context,
  453. unsigned long offset, unsigned long size)
  454. {
  455. struct check_mmio_offset_param temp;
  456. struct check_mmio_offset_param *params = &temp;
  457. params->offset = offset;
  458. params->size = size;
  459. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  460. sizeof(*params), GXIO_MPIPE_OP_CHECK_MMIO_OFFSET);
  461. }
  462. EXPORT_SYMBOL(gxio_mpipe_check_mmio_offset);