xref: /openbmc/linux/include/uapi/linux/scif_ioctl.h (revision a44f2630)
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 /**
110a44f2630SSudeep Dutt  * struct scifioctl_reg - used for SCIF_REG IOCTL
111a44f2630SSudeep Dutt  * @addr:	starting virtual address
112a44f2630SSudeep Dutt  * @len:	length of range
113a44f2630SSudeep Dutt  * @offset:	offset of window
114a44f2630SSudeep Dutt  * @prot:	read/write protection
115a44f2630SSudeep Dutt  * @flags:	flags
116a44f2630SSudeep Dutt  * @out_offset:	offset returned
117a44f2630SSudeep Dutt  */
118a44f2630SSudeep Dutt struct scifioctl_reg {
119a44f2630SSudeep Dutt 	__u64		addr;
120a44f2630SSudeep Dutt 	__u64		len;
121a44f2630SSudeep Dutt 	__s64		offset;
122a44f2630SSudeep Dutt 	__s32		prot;
123a44f2630SSudeep Dutt 	__s32		flags;
124a44f2630SSudeep Dutt 	__s64		out_offset;
125a44f2630SSudeep Dutt };
126a44f2630SSudeep Dutt 
127a44f2630SSudeep Dutt /**
128a44f2630SSudeep Dutt  * struct scifioctl_unreg - used for SCIF_UNREG IOCTL
129a44f2630SSudeep Dutt  * @offset:	start of range to unregister
130a44f2630SSudeep Dutt  * @len:	length of range to unregister
131a44f2630SSudeep Dutt  */
132a44f2630SSudeep Dutt struct scifioctl_unreg {
133a44f2630SSudeep Dutt 	__s64		offset;
134a44f2630SSudeep Dutt 	__u64		len;
135a44f2630SSudeep Dutt };
136a44f2630SSudeep Dutt 
137a44f2630SSudeep Dutt /**
138a44f2630SSudeep Dutt  * struct scifioctl_copy - used for SCIF DMA copy IOCTLs
139a44f2630SSudeep Dutt  *
140a44f2630SSudeep Dutt  * @loffset:	offset in local registered address space to/from
141a44f2630SSudeep Dutt  *		which to copy
142a44f2630SSudeep Dutt  * @len:	length of range to copy
143a44f2630SSudeep Dutt  * @roffset:	offset in remote registered address space to/from
144a44f2630SSudeep Dutt  *		which to copy
145a44f2630SSudeep Dutt  * @addr:	user virtual address to/from which to copy
146a44f2630SSudeep Dutt  * @flags:	flags
147a44f2630SSudeep Dutt  *
148a44f2630SSudeep Dutt  * This structure is used for SCIF_READFROM, SCIF_WRITETO, SCIF_VREADFROM
149a44f2630SSudeep Dutt  * and SCIF_VREADFROM IOCTL's.
150a44f2630SSudeep Dutt  */
151a44f2630SSudeep Dutt struct scifioctl_copy {
152a44f2630SSudeep Dutt 	__s64		loffset;
153a44f2630SSudeep Dutt 	__u64		len;
154a44f2630SSudeep Dutt 	__s64		roffset;
155a44f2630SSudeep Dutt 	__u64		addr;
156a44f2630SSudeep Dutt 	__s32		flags;
157a44f2630SSudeep Dutt };
158a44f2630SSudeep Dutt 
159a44f2630SSudeep Dutt /**
160a44f2630SSudeep Dutt  * struct scifioctl_fence_mark  - used for SCIF_FENCE_MARK IOCTL
161a44f2630SSudeep Dutt  * @flags:	flags
162a44f2630SSudeep Dutt  * @mark:	fence handle which is a pointer to a __s32
163a44f2630SSudeep Dutt  */
164a44f2630SSudeep Dutt struct scifioctl_fence_mark {
165a44f2630SSudeep Dutt 	__s32	flags;
166a44f2630SSudeep Dutt 	__u64	mark;
167a44f2630SSudeep Dutt };
168a44f2630SSudeep Dutt 
169a44f2630SSudeep Dutt /**
170a44f2630SSudeep Dutt  * struct scifioctl_fence_signal - used for SCIF_FENCE_SIGNAL IOCTL
171a44f2630SSudeep Dutt  * @loff:	local offset
172a44f2630SSudeep Dutt  * @lval:	value to write to loffset
173a44f2630SSudeep Dutt  * @roff:	remote offset
174a44f2630SSudeep Dutt  * @rval:	value to write to roffset
175a44f2630SSudeep Dutt  * @flags:	flags
176a44f2630SSudeep Dutt  */
177a44f2630SSudeep Dutt struct scifioctl_fence_signal {
178a44f2630SSudeep Dutt 	__s64		loff;
179a44f2630SSudeep Dutt 	__u64		lval;
180a44f2630SSudeep Dutt 	__s64		roff;
181a44f2630SSudeep Dutt 	__u64		rval;
182a44f2630SSudeep Dutt 	__s32		flags;
183a44f2630SSudeep Dutt };
184a44f2630SSudeep Dutt 
185a44f2630SSudeep Dutt /**
1867df20f2dSSudeep Dutt  * struct scifioctl_node_ids - used for SCIF_GET_NODEIDS IOCTL
1877df20f2dSSudeep Dutt  * @nodes:	pointer to an array of node_ids
1887df20f2dSSudeep Dutt  * @self:	ID of the current node
1897df20f2dSSudeep Dutt  * @len:	length of array
1907df20f2dSSudeep Dutt  */
1917df20f2dSSudeep Dutt struct scifioctl_node_ids {
1927df20f2dSSudeep Dutt 	__u64	nodes;
1937df20f2dSSudeep Dutt 	__u64	self;
1947df20f2dSSudeep Dutt 	__s32	len;
1957df20f2dSSudeep Dutt };
1967df20f2dSSudeep Dutt 
1977df20f2dSSudeep Dutt #define SCIF_BIND		_IOWR('s', 1, __u64)
1987df20f2dSSudeep Dutt #define SCIF_LISTEN		_IOW('s', 2, __s32)
1997df20f2dSSudeep Dutt #define SCIF_CONNECT		_IOWR('s', 3, struct scifioctl_connect)
2007df20f2dSSudeep Dutt #define SCIF_ACCEPTREQ		_IOWR('s', 4, struct scifioctl_accept)
2017df20f2dSSudeep Dutt #define SCIF_ACCEPTREG		_IOWR('s', 5, __u64)
2027df20f2dSSudeep Dutt #define SCIF_SEND		_IOWR('s', 6, struct scifioctl_msg)
2037df20f2dSSudeep Dutt #define SCIF_RECV		_IOWR('s', 7, struct scifioctl_msg)
204a44f2630SSudeep Dutt #define SCIF_REG		_IOWR('s', 8, struct scifioctl_reg)
205a44f2630SSudeep Dutt #define SCIF_UNREG		_IOWR('s', 9, struct scifioctl_unreg)
206a44f2630SSudeep Dutt #define SCIF_READFROM		_IOWR('s', 10, struct scifioctl_copy)
207a44f2630SSudeep Dutt #define SCIF_WRITETO		_IOWR('s', 11, struct scifioctl_copy)
208a44f2630SSudeep Dutt #define SCIF_VREADFROM		_IOWR('s', 12, struct scifioctl_copy)
209a44f2630SSudeep Dutt #define SCIF_VWRITETO		_IOWR('s', 13, struct scifioctl_copy)
2107df20f2dSSudeep Dutt #define SCIF_GET_NODEIDS	_IOWR('s', 14, struct scifioctl_node_ids)
211a44f2630SSudeep Dutt #define SCIF_FENCE_MARK		_IOWR('s', 15, struct scifioctl_fence_mark)
212a44f2630SSudeep Dutt #define SCIF_FENCE_WAIT		_IOWR('s', 16, __s32)
213a44f2630SSudeep Dutt #define SCIF_FENCE_SIGNAL	_IOWR('s', 17, struct scifioctl_fence_signal)
2147df20f2dSSudeep Dutt 
2157df20f2dSSudeep Dutt #endif /* SCIF_IOCTL_H */
216