xref: /openbmc/linux/include/uapi/linux/scif_ioctl.h (revision 7df20f2d)
17df20f2dSSudeep Dutt /*
27df20f2dSSudeep Dutt  * Intel MIC Platform Software Stack (MPSS)
37df20f2dSSudeep Dutt  *
47df20f2dSSudeep Dutt  * This file is provided under a dual BSD/GPLv2 license.  When using or
57df20f2dSSudeep Dutt  * redistributing this file, you may do so under either license.
67df20f2dSSudeep Dutt  *
77df20f2dSSudeep Dutt  * GPL LICENSE SUMMARY
87df20f2dSSudeep Dutt  *
97df20f2dSSudeep Dutt  * Copyright(c) 2014 Intel Corporation.
107df20f2dSSudeep Dutt  *
117df20f2dSSudeep Dutt  * This program is free software; you can redistribute it and/or modify
127df20f2dSSudeep Dutt  * it under the terms of version 2 of the GNU General Public License as
137df20f2dSSudeep Dutt  * published by the Free Software Foundation.
147df20f2dSSudeep Dutt  *
157df20f2dSSudeep Dutt  * This program is distributed in the hope that it will be useful, but
167df20f2dSSudeep Dutt  * WITHOUT ANY WARRANTY; without even the implied warranty of
177df20f2dSSudeep Dutt  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
187df20f2dSSudeep Dutt  * General Public License for more details.
197df20f2dSSudeep Dutt  *
207df20f2dSSudeep Dutt  * BSD LICENSE
217df20f2dSSudeep Dutt  *
227df20f2dSSudeep Dutt  * Copyright(c) 2014 Intel Corporation.
237df20f2dSSudeep Dutt  *
247df20f2dSSudeep Dutt  * Redistribution and use in source and binary forms, with or without
257df20f2dSSudeep Dutt  * modification, are permitted provided that the following conditions
267df20f2dSSudeep Dutt  * are met:
277df20f2dSSudeep Dutt  *
287df20f2dSSudeep Dutt  * * Redistributions of source code must retain the above copyright
297df20f2dSSudeep Dutt  *   notice, this list of conditions and the following disclaimer.
307df20f2dSSudeep Dutt  * * Redistributions in binary form must reproduce the above copyright
317df20f2dSSudeep Dutt  *   notice, this list of conditions and the following disclaimer in
327df20f2dSSudeep Dutt  *   the documentation and/or other materials provided with the
337df20f2dSSudeep Dutt  *   distribution.
347df20f2dSSudeep Dutt  * * Neither the name of Intel Corporation nor the names of its
357df20f2dSSudeep Dutt  *   contributors may be used to endorse or promote products derived
367df20f2dSSudeep Dutt  *   from this software without specific prior written permission.
377df20f2dSSudeep Dutt  *
387df20f2dSSudeep Dutt  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
397df20f2dSSudeep Dutt  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
407df20f2dSSudeep Dutt  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
417df20f2dSSudeep Dutt  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
427df20f2dSSudeep Dutt  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
437df20f2dSSudeep Dutt  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
447df20f2dSSudeep Dutt  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
457df20f2dSSudeep Dutt  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
467df20f2dSSudeep Dutt  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
477df20f2dSSudeep Dutt  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
487df20f2dSSudeep Dutt  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
497df20f2dSSudeep Dutt  *
507df20f2dSSudeep Dutt  * Intel SCIF driver.
517df20f2dSSudeep Dutt  *
527df20f2dSSudeep Dutt  */
537df20f2dSSudeep Dutt /*
547df20f2dSSudeep Dutt  * -----------------------------------------
557df20f2dSSudeep Dutt  * SCIF IOCTL interface information
567df20f2dSSudeep Dutt  * -----------------------------------------
577df20f2dSSudeep Dutt  */
587df20f2dSSudeep Dutt #ifndef SCIF_IOCTL_H
597df20f2dSSudeep Dutt #define SCIF_IOCTL_H
607df20f2dSSudeep Dutt 
617df20f2dSSudeep Dutt #include <linux/types.h>
627df20f2dSSudeep Dutt 
637df20f2dSSudeep Dutt /**
647df20f2dSSudeep Dutt  * struct scif_port_id - SCIF port information
657df20f2dSSudeep Dutt  * @node:	node on which port resides
667df20f2dSSudeep Dutt  * @port:	local port number
677df20f2dSSudeep Dutt  */
687df20f2dSSudeep Dutt struct scif_port_id {
697df20f2dSSudeep Dutt 	__u16 node;
707df20f2dSSudeep Dutt 	__u16 port;
717df20f2dSSudeep Dutt };
727df20f2dSSudeep Dutt 
737df20f2dSSudeep Dutt /**
747df20f2dSSudeep Dutt  * struct scifioctl_connect - used for SCIF_CONNECT IOCTL
757df20f2dSSudeep Dutt  * @self:	used to read back the assigned port_id
767df20f2dSSudeep Dutt  * @peer:	destination node and port to connect to
777df20f2dSSudeep Dutt  */
787df20f2dSSudeep Dutt struct scifioctl_connect {
797df20f2dSSudeep Dutt 	struct scif_port_id	self;
807df20f2dSSudeep Dutt 	struct scif_port_id	peer;
817df20f2dSSudeep Dutt };
827df20f2dSSudeep Dutt 
837df20f2dSSudeep Dutt /**
847df20f2dSSudeep Dutt  * struct scifioctl_accept - used for SCIF_ACCEPTREQ IOCTL
857df20f2dSSudeep Dutt  * @flags:	flags
867df20f2dSSudeep Dutt  * @peer:	global id of peer endpoint
877df20f2dSSudeep Dutt  * @endpt:	new connected endpoint descriptor
887df20f2dSSudeep Dutt  */
897df20f2dSSudeep Dutt struct scifioctl_accept {
907df20f2dSSudeep Dutt 	__s32			flags;
917df20f2dSSudeep Dutt 	struct scif_port_id	peer;
927df20f2dSSudeep Dutt 	__u64			endpt;
937df20f2dSSudeep Dutt };
947df20f2dSSudeep Dutt 
957df20f2dSSudeep Dutt /**
967df20f2dSSudeep Dutt  * struct scifioctl_msg - used for SCIF_SEND/SCIF_RECV IOCTL
977df20f2dSSudeep Dutt  * @msg:	message buffer address
987df20f2dSSudeep Dutt  * @len:	message length
997df20f2dSSudeep Dutt  * @flags:	flags
1007df20f2dSSudeep Dutt  * @out_len:	number of bytes sent/received
1017df20f2dSSudeep Dutt  */
1027df20f2dSSudeep Dutt struct scifioctl_msg {
1037df20f2dSSudeep Dutt 	__u64	msg;
1047df20f2dSSudeep Dutt 	__s32	len;
1057df20f2dSSudeep Dutt 	__s32	flags;
1067df20f2dSSudeep Dutt 	__s32	out_len;
1077df20f2dSSudeep Dutt };
1087df20f2dSSudeep Dutt 
1097df20f2dSSudeep Dutt /**
1107df20f2dSSudeep Dutt  * struct scifioctl_node_ids - used for SCIF_GET_NODEIDS IOCTL
1117df20f2dSSudeep Dutt  * @nodes:	pointer to an array of node_ids
1127df20f2dSSudeep Dutt  * @self:	ID of the current node
1137df20f2dSSudeep Dutt  * @len:	length of array
1147df20f2dSSudeep Dutt  */
1157df20f2dSSudeep Dutt struct scifioctl_node_ids {
1167df20f2dSSudeep Dutt 	__u64	nodes;
1177df20f2dSSudeep Dutt 	__u64	self;
1187df20f2dSSudeep Dutt 	__s32	len;
1197df20f2dSSudeep Dutt };
1207df20f2dSSudeep Dutt 
1217df20f2dSSudeep Dutt #define SCIF_BIND		_IOWR('s', 1, __u64)
1227df20f2dSSudeep Dutt #define SCIF_LISTEN		_IOW('s', 2, __s32)
1237df20f2dSSudeep Dutt #define SCIF_CONNECT		_IOWR('s', 3, struct scifioctl_connect)
1247df20f2dSSudeep Dutt #define SCIF_ACCEPTREQ		_IOWR('s', 4, struct scifioctl_accept)
1257df20f2dSSudeep Dutt #define SCIF_ACCEPTREG		_IOWR('s', 5, __u64)
1267df20f2dSSudeep Dutt #define SCIF_SEND		_IOWR('s', 6, struct scifioctl_msg)
1277df20f2dSSudeep Dutt #define SCIF_RECV		_IOWR('s', 7, struct scifioctl_msg)
1287df20f2dSSudeep Dutt #define SCIF_GET_NODEIDS	_IOWR('s', 14, struct scifioctl_node_ids)
1297df20f2dSSudeep Dutt 
1307df20f2dSSudeep Dutt #endif /* SCIF_IOCTL_H */
131