Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
0002 /*
0003  * Intel MIC Platform Software Stack (MPSS)
0004  *
0005  * This file is provided under a dual BSD/GPLv2 license.  When using or
0006  * redistributing this file, you may do so under either license.
0007  *
0008  * GPL LICENSE SUMMARY
0009  *
0010  * Copyright(c) 2014 Intel Corporation.
0011  *
0012  * This program is free software; you can redistribute it and/or modify
0013  * it under the terms of version 2 of the GNU General Public License as
0014  * published by the Free Software Foundation.
0015  *
0016  * This program is distributed in the hope that it will be useful, but
0017  * WITHOUT ANY WARRANTY; without even the implied warranty of
0018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0019  * General Public License for more details.
0020  *
0021  * BSD LICENSE
0022  *
0023  * Copyright(c) 2014 Intel Corporation.
0024  *
0025  * Redistribution and use in source and binary forms, with or without
0026  * modification, are permitted provided that the following conditions
0027  * are met:
0028  *
0029  * * Redistributions of source code must retain the above copyright
0030  *   notice, this list of conditions and the following disclaimer.
0031  * * Redistributions in binary form must reproduce the above copyright
0032  *   notice, this list of conditions and the following disclaimer in
0033  *   the documentation and/or other materials provided with the
0034  *   distribution.
0035  * * Neither the name of Intel Corporation nor the names of its
0036  *   contributors may be used to endorse or promote products derived
0037  *   from this software without specific prior written permission.
0038  *
0039  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0040  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0041  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0042  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0043  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0044  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0045  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0046  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0047  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0048  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0049  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0050  *
0051  * Intel SCIF driver.
0052  *
0053  */
0054 /*
0055  * -----------------------------------------
0056  * SCIF IOCTL interface information
0057  * -----------------------------------------
0058  */
0059 #ifndef SCIF_IOCTL_H
0060 #define SCIF_IOCTL_H
0061 
0062 #include <linux/types.h>
0063 
0064 /**
0065  * struct scif_port_id - SCIF port information
0066  * @node:   node on which port resides
0067  * @port:   local port number
0068  */
0069 struct scif_port_id {
0070     __u16 node;
0071     __u16 port;
0072 };
0073 
0074 /**
0075  * struct scifioctl_connect - used for SCIF_CONNECT IOCTL
0076  * @self:   used to read back the assigned port_id
0077  * @peer:   destination node and port to connect to
0078  */
0079 struct scifioctl_connect {
0080     struct scif_port_id self;
0081     struct scif_port_id peer;
0082 };
0083 
0084 /**
0085  * struct scifioctl_accept - used for SCIF_ACCEPTREQ IOCTL
0086  * @flags:  flags
0087  * @peer:   global id of peer endpoint
0088  * @endpt:  new connected endpoint descriptor
0089  */
0090 struct scifioctl_accept {
0091     __s32           flags;
0092     struct scif_port_id peer;
0093     __u64           endpt;
0094 };
0095 
0096 /**
0097  * struct scifioctl_msg - used for SCIF_SEND/SCIF_RECV IOCTL
0098  * @msg:    message buffer address
0099  * @len:    message length
0100  * @flags:  flags
0101  * @out_len:    number of bytes sent/received
0102  */
0103 struct scifioctl_msg {
0104     __u64   msg;
0105     __s32   len;
0106     __s32   flags;
0107     __s32   out_len;
0108 };
0109 
0110 /**
0111  * struct scifioctl_reg - used for SCIF_REG IOCTL
0112  * @addr:   starting virtual address
0113  * @len:    length of range
0114  * @offset: offset of window
0115  * @prot:   read/write protection
0116  * @flags:  flags
0117  * @out_offset: offset returned
0118  */
0119 struct scifioctl_reg {
0120     __u64       addr;
0121     __u64       len;
0122     __s64       offset;
0123     __s32       prot;
0124     __s32       flags;
0125     __s64       out_offset;
0126 };
0127 
0128 /**
0129  * struct scifioctl_unreg - used for SCIF_UNREG IOCTL
0130  * @offset: start of range to unregister
0131  * @len:    length of range to unregister
0132  */
0133 struct scifioctl_unreg {
0134     __s64       offset;
0135     __u64       len;
0136 };
0137 
0138 /**
0139  * struct scifioctl_copy - used for SCIF DMA copy IOCTLs
0140  *
0141  * @loffset:    offset in local registered address space to/from
0142  *      which to copy
0143  * @len:    length of range to copy
0144  * @roffset:    offset in remote registered address space to/from
0145  *      which to copy
0146  * @addr:   user virtual address to/from which to copy
0147  * @flags:  flags
0148  *
0149  * This structure is used for SCIF_READFROM, SCIF_WRITETO, SCIF_VREADFROM
0150  * and SCIF_VREADFROM IOCTL's.
0151  */
0152 struct scifioctl_copy {
0153     __s64       loffset;
0154     __u64       len;
0155     __s64       roffset;
0156     __u64       addr;
0157     __s32       flags;
0158 };
0159 
0160 /**
0161  * struct scifioctl_fence_mark  - used for SCIF_FENCE_MARK IOCTL
0162  * @flags:  flags
0163  * @mark:   fence handle which is a pointer to a __s32
0164  */
0165 struct scifioctl_fence_mark {
0166     __s32   flags;
0167     __u64   mark;
0168 };
0169 
0170 /**
0171  * struct scifioctl_fence_signal - used for SCIF_FENCE_SIGNAL IOCTL
0172  * @loff:   local offset
0173  * @lval:   value to write to loffset
0174  * @roff:   remote offset
0175  * @rval:   value to write to roffset
0176  * @flags:  flags
0177  */
0178 struct scifioctl_fence_signal {
0179     __s64       loff;
0180     __u64       lval;
0181     __s64       roff;
0182     __u64       rval;
0183     __s32       flags;
0184 };
0185 
0186 /**
0187  * struct scifioctl_node_ids - used for SCIF_GET_NODEIDS IOCTL
0188  * @nodes:  pointer to an array of node_ids
0189  * @self:   ID of the current node
0190  * @len:    length of array
0191  */
0192 struct scifioctl_node_ids {
0193     __u64   nodes;
0194     __u64   self;
0195     __s32   len;
0196 };
0197 
0198 #define SCIF_BIND       _IOWR('s', 1, __u64)
0199 #define SCIF_LISTEN     _IOW('s', 2, __s32)
0200 #define SCIF_CONNECT        _IOWR('s', 3, struct scifioctl_connect)
0201 #define SCIF_ACCEPTREQ      _IOWR('s', 4, struct scifioctl_accept)
0202 #define SCIF_ACCEPTREG      _IOWR('s', 5, __u64)
0203 #define SCIF_SEND       _IOWR('s', 6, struct scifioctl_msg)
0204 #define SCIF_RECV       _IOWR('s', 7, struct scifioctl_msg)
0205 #define SCIF_REG        _IOWR('s', 8, struct scifioctl_reg)
0206 #define SCIF_UNREG      _IOWR('s', 9, struct scifioctl_unreg)
0207 #define SCIF_READFROM       _IOWR('s', 10, struct scifioctl_copy)
0208 #define SCIF_WRITETO        _IOWR('s', 11, struct scifioctl_copy)
0209 #define SCIF_VREADFROM      _IOWR('s', 12, struct scifioctl_copy)
0210 #define SCIF_VWRITETO       _IOWR('s', 13, struct scifioctl_copy)
0211 #define SCIF_GET_NODEIDS    _IOWR('s', 14, struct scifioctl_node_ids)
0212 #define SCIF_FENCE_MARK     _IOWR('s', 15, struct scifioctl_fence_mark)
0213 #define SCIF_FENCE_WAIT     _IOWR('s', 16, __s32)
0214 #define SCIF_FENCE_SIGNAL   _IOWR('s', 17, struct scifioctl_fence_signal)
0215 
0216 #endif /* SCIF_IOCTL_H */