iorpc_trio.c 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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_trio.h"
  16. struct alloc_asids_param {
  17. unsigned int count;
  18. unsigned int first;
  19. unsigned int flags;
  20. };
  21. int gxio_trio_alloc_asids(gxio_trio_context_t *context, unsigned int count,
  22. unsigned int first, unsigned int flags)
  23. {
  24. struct alloc_asids_param temp;
  25. struct alloc_asids_param *params = &temp;
  26. params->count = count;
  27. params->first = first;
  28. params->flags = flags;
  29. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  30. sizeof(*params), GXIO_TRIO_OP_ALLOC_ASIDS);
  31. }
  32. EXPORT_SYMBOL(gxio_trio_alloc_asids);
  33. struct alloc_memory_maps_param {
  34. unsigned int count;
  35. unsigned int first;
  36. unsigned int flags;
  37. };
  38. int gxio_trio_alloc_memory_maps(gxio_trio_context_t *context,
  39. unsigned int count, unsigned int first,
  40. unsigned int flags)
  41. {
  42. struct alloc_memory_maps_param temp;
  43. struct alloc_memory_maps_param *params = &temp;
  44. params->count = count;
  45. params->first = first;
  46. params->flags = flags;
  47. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  48. sizeof(*params), GXIO_TRIO_OP_ALLOC_MEMORY_MAPS);
  49. }
  50. EXPORT_SYMBOL(gxio_trio_alloc_memory_maps);
  51. struct alloc_scatter_queues_param {
  52. unsigned int count;
  53. unsigned int first;
  54. unsigned int flags;
  55. };
  56. int gxio_trio_alloc_scatter_queues(gxio_trio_context_t *context,
  57. unsigned int count, unsigned int first,
  58. unsigned int flags)
  59. {
  60. struct alloc_scatter_queues_param temp;
  61. struct alloc_scatter_queues_param *params = &temp;
  62. params->count = count;
  63. params->first = first;
  64. params->flags = flags;
  65. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  66. sizeof(*params),
  67. GXIO_TRIO_OP_ALLOC_SCATTER_QUEUES);
  68. }
  69. EXPORT_SYMBOL(gxio_trio_alloc_scatter_queues);
  70. struct alloc_pio_regions_param {
  71. unsigned int count;
  72. unsigned int first;
  73. unsigned int flags;
  74. };
  75. int gxio_trio_alloc_pio_regions(gxio_trio_context_t *context,
  76. unsigned int count, unsigned int first,
  77. unsigned int flags)
  78. {
  79. struct alloc_pio_regions_param temp;
  80. struct alloc_pio_regions_param *params = &temp;
  81. params->count = count;
  82. params->first = first;
  83. params->flags = flags;
  84. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  85. sizeof(*params), GXIO_TRIO_OP_ALLOC_PIO_REGIONS);
  86. }
  87. EXPORT_SYMBOL(gxio_trio_alloc_pio_regions);
  88. struct init_pio_region_aux_param {
  89. unsigned int pio_region;
  90. unsigned int mac;
  91. uint32_t bus_address_hi;
  92. unsigned int flags;
  93. };
  94. int gxio_trio_init_pio_region_aux(gxio_trio_context_t *context,
  95. unsigned int pio_region, unsigned int mac,
  96. uint32_t bus_address_hi, unsigned int flags)
  97. {
  98. struct init_pio_region_aux_param temp;
  99. struct init_pio_region_aux_param *params = &temp;
  100. params->pio_region = pio_region;
  101. params->mac = mac;
  102. params->bus_address_hi = bus_address_hi;
  103. params->flags = flags;
  104. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  105. sizeof(*params), GXIO_TRIO_OP_INIT_PIO_REGION_AUX);
  106. }
  107. EXPORT_SYMBOL(gxio_trio_init_pio_region_aux);
  108. struct init_memory_map_mmu_aux_param {
  109. unsigned int map;
  110. unsigned long va;
  111. uint64_t size;
  112. unsigned int asid;
  113. unsigned int mac;
  114. uint64_t bus_address;
  115. unsigned int node;
  116. unsigned int order_mode;
  117. };
  118. int gxio_trio_init_memory_map_mmu_aux(gxio_trio_context_t *context,
  119. unsigned int map, unsigned long va,
  120. uint64_t size, unsigned int asid,
  121. unsigned int mac, uint64_t bus_address,
  122. unsigned int node,
  123. unsigned int order_mode)
  124. {
  125. struct init_memory_map_mmu_aux_param temp;
  126. struct init_memory_map_mmu_aux_param *params = &temp;
  127. params->map = map;
  128. params->va = va;
  129. params->size = size;
  130. params->asid = asid;
  131. params->mac = mac;
  132. params->bus_address = bus_address;
  133. params->node = node;
  134. params->order_mode = order_mode;
  135. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  136. sizeof(*params),
  137. GXIO_TRIO_OP_INIT_MEMORY_MAP_MMU_AUX);
  138. }
  139. EXPORT_SYMBOL(gxio_trio_init_memory_map_mmu_aux);
  140. struct get_port_property_param {
  141. struct pcie_trio_ports_property trio_ports;
  142. };
  143. int gxio_trio_get_port_property(gxio_trio_context_t *context,
  144. struct pcie_trio_ports_property *trio_ports)
  145. {
  146. int __result;
  147. struct get_port_property_param temp;
  148. struct get_port_property_param *params = &temp;
  149. __result =
  150. hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
  151. GXIO_TRIO_OP_GET_PORT_PROPERTY);
  152. *trio_ports = params->trio_ports;
  153. return __result;
  154. }
  155. EXPORT_SYMBOL(gxio_trio_get_port_property);
  156. struct config_legacy_intr_param {
  157. union iorpc_interrupt interrupt;
  158. unsigned int mac;
  159. unsigned int intx;
  160. };
  161. int gxio_trio_config_legacy_intr(gxio_trio_context_t *context, int inter_x,
  162. int inter_y, int inter_ipi, int inter_event,
  163. unsigned int mac, unsigned int intx)
  164. {
  165. struct config_legacy_intr_param temp;
  166. struct config_legacy_intr_param *params = &temp;
  167. params->interrupt.kernel.x = inter_x;
  168. params->interrupt.kernel.y = inter_y;
  169. params->interrupt.kernel.ipi = inter_ipi;
  170. params->interrupt.kernel.event = inter_event;
  171. params->mac = mac;
  172. params->intx = intx;
  173. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  174. sizeof(*params), GXIO_TRIO_OP_CONFIG_LEGACY_INTR);
  175. }
  176. EXPORT_SYMBOL(gxio_trio_config_legacy_intr);
  177. struct config_msi_intr_param {
  178. union iorpc_interrupt interrupt;
  179. unsigned int mac;
  180. unsigned int mem_map;
  181. uint64_t mem_map_base;
  182. uint64_t mem_map_limit;
  183. unsigned int asid;
  184. };
  185. int gxio_trio_config_msi_intr(gxio_trio_context_t *context, int inter_x,
  186. int inter_y, int inter_ipi, int inter_event,
  187. unsigned int mac, unsigned int mem_map,
  188. uint64_t mem_map_base, uint64_t mem_map_limit,
  189. unsigned int asid)
  190. {
  191. struct config_msi_intr_param temp;
  192. struct config_msi_intr_param *params = &temp;
  193. params->interrupt.kernel.x = inter_x;
  194. params->interrupt.kernel.y = inter_y;
  195. params->interrupt.kernel.ipi = inter_ipi;
  196. params->interrupt.kernel.event = inter_event;
  197. params->mac = mac;
  198. params->mem_map = mem_map;
  199. params->mem_map_base = mem_map_base;
  200. params->mem_map_limit = mem_map_limit;
  201. params->asid = asid;
  202. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  203. sizeof(*params), GXIO_TRIO_OP_CONFIG_MSI_INTR);
  204. }
  205. EXPORT_SYMBOL(gxio_trio_config_msi_intr);
  206. struct set_mps_mrs_param {
  207. uint16_t mps;
  208. uint16_t mrs;
  209. unsigned int mac;
  210. };
  211. int gxio_trio_set_mps_mrs(gxio_trio_context_t *context, uint16_t mps,
  212. uint16_t mrs, unsigned int mac)
  213. {
  214. struct set_mps_mrs_param temp;
  215. struct set_mps_mrs_param *params = &temp;
  216. params->mps = mps;
  217. params->mrs = mrs;
  218. params->mac = mac;
  219. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  220. sizeof(*params), GXIO_TRIO_OP_SET_MPS_MRS);
  221. }
  222. EXPORT_SYMBOL(gxio_trio_set_mps_mrs);
  223. struct force_rc_link_up_param {
  224. unsigned int mac;
  225. };
  226. int gxio_trio_force_rc_link_up(gxio_trio_context_t *context, unsigned int mac)
  227. {
  228. struct force_rc_link_up_param temp;
  229. struct force_rc_link_up_param *params = &temp;
  230. params->mac = mac;
  231. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  232. sizeof(*params), GXIO_TRIO_OP_FORCE_RC_LINK_UP);
  233. }
  234. EXPORT_SYMBOL(gxio_trio_force_rc_link_up);
  235. struct force_ep_link_up_param {
  236. unsigned int mac;
  237. };
  238. int gxio_trio_force_ep_link_up(gxio_trio_context_t *context, unsigned int mac)
  239. {
  240. struct force_ep_link_up_param temp;
  241. struct force_ep_link_up_param *params = &temp;
  242. params->mac = mac;
  243. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  244. sizeof(*params), GXIO_TRIO_OP_FORCE_EP_LINK_UP);
  245. }
  246. EXPORT_SYMBOL(gxio_trio_force_ep_link_up);
  247. struct get_mmio_base_param {
  248. HV_PTE base;
  249. };
  250. int gxio_trio_get_mmio_base(gxio_trio_context_t *context, HV_PTE *base)
  251. {
  252. int __result;
  253. struct get_mmio_base_param temp;
  254. struct get_mmio_base_param *params = &temp;
  255. __result =
  256. hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
  257. GXIO_TRIO_OP_GET_MMIO_BASE);
  258. *base = params->base;
  259. return __result;
  260. }
  261. EXPORT_SYMBOL(gxio_trio_get_mmio_base);
  262. struct check_mmio_offset_param {
  263. unsigned long offset;
  264. unsigned long size;
  265. };
  266. int gxio_trio_check_mmio_offset(gxio_trio_context_t *context,
  267. unsigned long offset, unsigned long size)
  268. {
  269. struct check_mmio_offset_param temp;
  270. struct check_mmio_offset_param *params = &temp;
  271. params->offset = offset;
  272. params->size = size;
  273. return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
  274. sizeof(*params), GXIO_TRIO_OP_CHECK_MMIO_OFFSET);
  275. }
  276. EXPORT_SYMBOL(gxio_trio_check_mmio_offset);