scif_ioctl.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. * Intel MIC Platform Software Stack (MPSS)
  3. *
  4. * This file is provided under a dual BSD/GPLv2 license. When using or
  5. * redistributing this file, you may do so under either license.
  6. *
  7. * GPL LICENSE SUMMARY
  8. *
  9. * Copyright(c) 2014 Intel Corporation.
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of version 2 of the GNU General Public License as
  13. * published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * BSD LICENSE
  21. *
  22. * Copyright(c) 2014 Intel Corporation.
  23. *
  24. * Redistribution and use in source and binary forms, with or without
  25. * modification, are permitted provided that the following conditions
  26. * are met:
  27. *
  28. * * Redistributions of source code must retain the above copyright
  29. * notice, this list of conditions and the following disclaimer.
  30. * * Redistributions in binary form must reproduce the above copyright
  31. * notice, this list of conditions and the following disclaimer in
  32. * the documentation and/or other materials provided with the
  33. * distribution.
  34. * * Neither the name of Intel Corporation nor the names of its
  35. * contributors may be used to endorse or promote products derived
  36. * from this software without specific prior written permission.
  37. *
  38. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  39. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  40. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  41. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  42. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  43. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  44. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  45. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  46. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  47. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  48. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  49. *
  50. * Intel SCIF driver.
  51. *
  52. */
  53. /*
  54. * -----------------------------------------
  55. * SCIF IOCTL interface information
  56. * -----------------------------------------
  57. */
  58. #ifndef SCIF_IOCTL_H
  59. #define SCIF_IOCTL_H
  60. #include <linux/types.h>
  61. /**
  62. * struct scif_port_id - SCIF port information
  63. * @node: node on which port resides
  64. * @port: local port number
  65. */
  66. struct scif_port_id {
  67. __u16 node;
  68. __u16 port;
  69. };
  70. /**
  71. * struct scifioctl_connect - used for SCIF_CONNECT IOCTL
  72. * @self: used to read back the assigned port_id
  73. * @peer: destination node and port to connect to
  74. */
  75. struct scifioctl_connect {
  76. struct scif_port_id self;
  77. struct scif_port_id peer;
  78. };
  79. /**
  80. * struct scifioctl_accept - used for SCIF_ACCEPTREQ IOCTL
  81. * @flags: flags
  82. * @peer: global id of peer endpoint
  83. * @endpt: new connected endpoint descriptor
  84. */
  85. struct scifioctl_accept {
  86. __s32 flags;
  87. struct scif_port_id peer;
  88. __u64 endpt;
  89. };
  90. /**
  91. * struct scifioctl_msg - used for SCIF_SEND/SCIF_RECV IOCTL
  92. * @msg: message buffer address
  93. * @len: message length
  94. * @flags: flags
  95. * @out_len: number of bytes sent/received
  96. */
  97. struct scifioctl_msg {
  98. __u64 msg;
  99. __s32 len;
  100. __s32 flags;
  101. __s32 out_len;
  102. };
  103. /**
  104. * struct scifioctl_reg - used for SCIF_REG IOCTL
  105. * @addr: starting virtual address
  106. * @len: length of range
  107. * @offset: offset of window
  108. * @prot: read/write protection
  109. * @flags: flags
  110. * @out_offset: offset returned
  111. */
  112. struct scifioctl_reg {
  113. __u64 addr;
  114. __u64 len;
  115. __s64 offset;
  116. __s32 prot;
  117. __s32 flags;
  118. __s64 out_offset;
  119. };
  120. /**
  121. * struct scifioctl_unreg - used for SCIF_UNREG IOCTL
  122. * @offset: start of range to unregister
  123. * @len: length of range to unregister
  124. */
  125. struct scifioctl_unreg {
  126. __s64 offset;
  127. __u64 len;
  128. };
  129. /**
  130. * struct scifioctl_copy - used for SCIF DMA copy IOCTLs
  131. *
  132. * @loffset: offset in local registered address space to/from
  133. * which to copy
  134. * @len: length of range to copy
  135. * @roffset: offset in remote registered address space to/from
  136. * which to copy
  137. * @addr: user virtual address to/from which to copy
  138. * @flags: flags
  139. *
  140. * This structure is used for SCIF_READFROM, SCIF_WRITETO, SCIF_VREADFROM
  141. * and SCIF_VREADFROM IOCTL's.
  142. */
  143. struct scifioctl_copy {
  144. __s64 loffset;
  145. __u64 len;
  146. __s64 roffset;
  147. __u64 addr;
  148. __s32 flags;
  149. };
  150. /**
  151. * struct scifioctl_fence_mark - used for SCIF_FENCE_MARK IOCTL
  152. * @flags: flags
  153. * @mark: fence handle which is a pointer to a __s32
  154. */
  155. struct scifioctl_fence_mark {
  156. __s32 flags;
  157. __u64 mark;
  158. };
  159. /**
  160. * struct scifioctl_fence_signal - used for SCIF_FENCE_SIGNAL IOCTL
  161. * @loff: local offset
  162. * @lval: value to write to loffset
  163. * @roff: remote offset
  164. * @rval: value to write to roffset
  165. * @flags: flags
  166. */
  167. struct scifioctl_fence_signal {
  168. __s64 loff;
  169. __u64 lval;
  170. __s64 roff;
  171. __u64 rval;
  172. __s32 flags;
  173. };
  174. /**
  175. * struct scifioctl_node_ids - used for SCIF_GET_NODEIDS IOCTL
  176. * @nodes: pointer to an array of node_ids
  177. * @self: ID of the current node
  178. * @len: length of array
  179. */
  180. struct scifioctl_node_ids {
  181. __u64 nodes;
  182. __u64 self;
  183. __s32 len;
  184. };
  185. #define SCIF_BIND _IOWR('s', 1, __u64)
  186. #define SCIF_LISTEN _IOW('s', 2, __s32)
  187. #define SCIF_CONNECT _IOWR('s', 3, struct scifioctl_connect)
  188. #define SCIF_ACCEPTREQ _IOWR('s', 4, struct scifioctl_accept)
  189. #define SCIF_ACCEPTREG _IOWR('s', 5, __u64)
  190. #define SCIF_SEND _IOWR('s', 6, struct scifioctl_msg)
  191. #define SCIF_RECV _IOWR('s', 7, struct scifioctl_msg)
  192. #define SCIF_REG _IOWR('s', 8, struct scifioctl_reg)
  193. #define SCIF_UNREG _IOWR('s', 9, struct scifioctl_unreg)
  194. #define SCIF_READFROM _IOWR('s', 10, struct scifioctl_copy)
  195. #define SCIF_WRITETO _IOWR('s', 11, struct scifioctl_copy)
  196. #define SCIF_VREADFROM _IOWR('s', 12, struct scifioctl_copy)
  197. #define SCIF_VWRITETO _IOWR('s', 13, struct scifioctl_copy)
  198. #define SCIF_GET_NODEIDS _IOWR('s', 14, struct scifioctl_node_ids)
  199. #define SCIF_FENCE_MARK _IOWR('s', 15, struct scifioctl_fence_mark)
  200. #define SCIF_FENCE_WAIT _IOWR('s', 16, __s32)
  201. #define SCIF_FENCE_SIGNAL _IOWR('s', 17, struct scifioctl_fence_signal)
  202. #endif /* SCIF_IOCTL_H */