| 1 | /* |
| 2 | * Copyright 2010-2017 Intel Corporation. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License, version 2, |
| 6 | * as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | * General Public License for more details. |
| 12 | * |
| 13 | * Disclaimer: The codes contained in these modules may be specific to |
| 14 | * the Intel Software Development Platform codenamed Knights Ferry, |
| 15 | * and the Intel product codenamed Knights Corner, and are not backward |
| 16 | * compatible with other Intel products. Additionally, Intel will NOT |
| 17 | * support the codes or instruction set in future products. |
| 18 | * |
| 19 | * Intel offers no warranty of any kind regarding the code. This code is |
| 20 | * licensed on an "AS IS" basis and Intel is not obligated to provide |
| 21 | * any support, assistance, installation, training, or other services |
| 22 | * of any kind. Intel is also not obligated to provide any updates, |
| 23 | * enhancements or extensions. Intel specifically disclaims any warranty |
| 24 | * of merchantability, non-infringement, fitness for any particular |
| 25 | * purpose, and any other warranty. |
| 26 | * |
| 27 | * Further, Intel disclaims all liability of any kind, including but |
| 28 | * not limited to liability for infringement of any proprietary rights, |
| 29 | * relating to the use of the code, even if Intel is notified of the |
| 30 | * possibility of such liability. Except as expressly stated in an Intel |
| 31 | * license agreement provided with this code and agreed upon with Intel, |
| 32 | * no license, express or implied, by estoppel or otherwise, to any |
| 33 | * intellectual property rights is granted herein. |
| 34 | */ |
| 35 | |
| 36 | /* |
| 37 | * ----------------------------------------- |
| 38 | * SCIF IOCTL interface information |
| 39 | * ----------------------------------------- |
| 40 | */ |
| 41 | #if defined(_WIN32) && !defined(_WIN64) |
| 42 | #define ptr64_t __ptr64 |
| 43 | #else |
| 44 | #define ptr64_t |
| 45 | #endif |
| 46 | |
| 47 | /** |
| 48 | * The purpose of SCIF_VERSION is to check for compatibility between host and |
| 49 | * card SCIF modules and also between SCIF driver and libscif. This version |
| 50 | * should be incremented whenever a change is made to SCIF that affects the |
| 51 | * interface between SCIF driver and libscif or between the card and host SCIF |
| 52 | * driver components. |
| 53 | */ |
| 54 | #define SCIF_VERSION 1 |
| 55 | |
| 56 | /** |
| 57 | * struct scifioctl_connect: |
| 58 | * |
| 59 | * \param self used to read back the assigned portID |
| 60 | * \param peer destination node and port to connect to |
| 61 | * |
| 62 | * This structure is used for CONNECT IOCTL. |
| 63 | */ |
| 64 | struct scifioctl_connect { |
| 65 | struct scif_portID self; |
| 66 | struct scif_portID peer; |
| 67 | }; |
| 68 | |
| 69 | |
| 70 | /** |
| 71 | * struct scifioctl_accept: |
| 72 | * |
| 73 | * \param flags flags |
| 74 | * \param peer global id of peer endpoint |
| 75 | * \param newepd new connected endpoint descriptor |
| 76 | * |
| 77 | * This structure is used for SCIF_ACCEPTREQ IOCTL. |
| 78 | */ |
| 79 | struct scifioctl_accept { |
| 80 | int flags; |
| 81 | struct scif_portID peer; |
| 82 | void * ptr64_t endpt; |
| 83 | }; |
| 84 | |
| 85 | /** |
| 86 | * struct scifioctl_msg: |
| 87 | * |
| 88 | * \param msg message buffer address |
| 89 | * \param len message length |
| 90 | * \param flags flags |
| 91 | * \param out_len Number of bytes sent/received. |
| 92 | * |
| 93 | * This structure is used for SCIF_SEND/SCIF_RECV IOCTL. |
| 94 | */ |
| 95 | struct scifioctl_msg { |
| 96 | void * ptr64_t msg; |
| 97 | int len; |
| 98 | int flags; |
| 99 | int out_len; |
| 100 | }; |
| 101 | |
| 102 | /** |
| 103 | * struct scifioctl_reg: |
| 104 | * |
| 105 | * \param addr starting virtual address |
| 106 | * \param len length of range |
| 107 | * \param offset offset of window |
| 108 | * \param prot read/write protection |
| 109 | * \param flags flags |
| 110 | * \param out_len offset returned. |
| 111 | * |
| 112 | * This structure is used for SCIF_REG IOCTL. |
| 113 | */ |
| 114 | struct scifioctl_reg { |
| 115 | void * ptr64_t addr; |
| 116 | uint64_t len; |
| 117 | off_t offset; |
| 118 | int prot; |
| 119 | int flags; |
| 120 | off_t out_offset; |
| 121 | }; |
| 122 | |
| 123 | /** |
| 124 | * struct scifioctl_unreg: |
| 125 | * |
| 126 | * \param offset start of range to unregister |
| 127 | * \param len length of range to unregister |
| 128 | * |
| 129 | * This structure is used for SCIF_UNREG IOCTL. |
| 130 | */ |
| 131 | struct scifioctl_unreg { |
| 132 | off_t offset; |
| 133 | uint64_t len; |
| 134 | }; |
| 135 | |
| 136 | /** |
| 137 | * struct scifioctl_copy: |
| 138 | * |
| 139 | * \param loffset offset in local registered address space to/from |
| 140 | which to copy |
| 141 | * \param len length of range to copy |
| 142 | * \param roffset offset in remote registered address space to/from |
| 143 | which to copy |
| 144 | * \param addr user virtual address to/from which to copy |
| 145 | * \param flags flags |
| 146 | * |
| 147 | * This structure is used for SCIF_READFROM, SCIF_WRITETO, SCIF_VREADFROM |
| 148 | and |
| 149 | * SCIF_VREADFROM IOCTL's. |
| 150 | */ |
| 151 | struct scifioctl_copy { |
| 152 | off_t loffset; |
| 153 | uint64_t len; |
| 154 | off_t roffset; |
| 155 | uint8_t * ptr64_t addr; |
| 156 | int flags; |
| 157 | }; |
| 158 | |
| 159 | /** |
| 160 | * struct scifioctl_fence_mark: |
| 161 | * |
| 162 | * \param flags flags |
| 163 | * \param mark Fence handle returned by reference. |
| 164 | * |
| 165 | * This structure is used from SCIF_FENCE_MARK IOCTL. |
| 166 | */ |
| 167 | struct scifioctl_fence_mark { |
| 168 | int flags; |
| 169 | int *mark; |
| 170 | }; |
| 171 | |
| 172 | /** |
| 173 | * struct scifioctl_fence_signal: |
| 174 | * |
| 175 | * \param loff local offset |
| 176 | * \param lval local value to write to loffset |
| 177 | * \param roff remote offset |
| 178 | * \param rval remote value to write to roffset |
| 179 | * \param flags flags |
| 180 | * |
| 181 | * This structure is used for SCIF_FENCE_SIGNAL IOCTL. |
| 182 | */ |
| 183 | struct scifioctl_fence_signal { |
| 184 | off_t loff; |
| 185 | uint64_t lval; |
| 186 | off_t roff; |
| 187 | uint64_t rval; |
| 188 | int flags; |
| 189 | }; |
| 190 | |
| 191 | /** |
| 192 | * struct scifioctl_nodeIDs: |
| 193 | * |
| 194 | * \param nodes pointer to an array of nodeIDs |
| 195 | * \param len length of array |
| 196 | * \param self ID of the current node |
| 197 | * |
| 198 | * This structure is used for the SCIF_GET_NODEIDS ioctl |
| 199 | */ |
| 200 | struct scifioctl_nodeIDs { |
| 201 | uint16_t * ptr64_t nodes; |
| 202 | int len; |
| 203 | uint16_t * ptr64_t self; |
| 204 | }; |
| 205 | |
| 206 | |
| 207 | #define SCIF_BIND _IOWR('s', 1, int *) |
| 208 | #define SCIF_LISTEN _IOW('s', 2, int) |
| 209 | #define SCIF_CONNECT _IOWR('s', 3, struct scifioctl_connect *) |
| 210 | #define SCIF_ACCEPTREQ _IOWR('s', 4, struct scifioctl_accept *) |
| 211 | #define SCIF_ACCEPTREG _IOWR('s', 5, void *) |
| 212 | #define SCIF_SEND _IOWR('s', 6, struct scifioctl_msg *) |
| 213 | #define SCIF_RECV _IOWR('s', 7, struct scifioctl_msg *) |
| 214 | #define SCIF_REG _IOWR('s', 8, struct scifioctl_reg *) |
| 215 | #define SCIF_UNREG _IOWR('s', 9, struct scifioctl_unreg *) |
| 216 | #define SCIF_READFROM _IOWR('s', 10, struct scifioctl_copy *) |
| 217 | #define SCIF_WRITETO _IOWR('s', 11, struct scifioctl_copy *) |
| 218 | #define SCIF_VREADFROM _IOWR('s', 12, struct scifioctl_copy *) |
| 219 | #define SCIF_VWRITETO _IOWR('s', 13, struct scifioctl_copy *) |
| 220 | #define SCIF_GET_NODEIDS _IOWR('s', 14, struct scifioctl_nodeIDs *) |
| 221 | #define SCIF_FENCE_MARK _IOWR('s', 15, struct scifioctl_fence_mark *) |
| 222 | #define SCIF_FENCE_WAIT _IOWR('s', 16, int) |
| 223 | #define SCIF_FENCE_SIGNAL _IOWR('s', 17, struct scifioctl_fence_signal *) |
| 224 | |
| 225 | #define SCIF_GET_VERSION _IO('s', 23) |