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