xref: /netbsd-src/sys/arch/xen/include/xenio3.h (revision 25d3b9e7cbaca1403601fd183d24e28ebfab52f1)
1 /* $NetBSD: xenio3.h,v 1.4 2015/09/07 03:49:46 dholland Exp $ */
2 /******************************************************************************
3  * evtchn.h
4  *
5  * Interface to /dev/xen/evtchn.
6  *
7  * Copyright (c) 2003-2005, K A Fraser
8  *
9  * This file may be distributed separately from the Linux kernel, or
10  * incorporated into other software packages, subject to the following license:
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a copy
13  * of this source file (the "Software"), to deal in the Software without
14  * restriction, including without limitation the rights to use, copy, modify,
15  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
16  * and to permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included in
20  * all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28  * IN THE SOFTWARE.
29  */
30 
31 #ifndef __XEN_XENIO3_H__
32 #define __XEN_XENIO3_H__
33 
34 #include <sys/ioccom.h>
35 
36 /*
37  * Bind a fresh port to VIRQ @virq.
38  * Return allocated port.
39  */
40 #define IOCTL_EVTCHN_BIND_VIRQ				\
41 	_IOWR('E', 4, struct ioctl_evtchn_bind_virq)
42 struct ioctl_evtchn_bind_virq {
43 	unsigned int virq;
44 	unsigned int port;
45 };
46 
47 /*
48  * Bind a fresh port to remote <@remote_domain, @remote_port>.
49  * Return allocated port.
50  */
51 #define IOCTL_EVTCHN_BIND_INTERDOMAIN			\
52 	_IOWR('E', 5, struct ioctl_evtchn_bind_interdomain)
53 struct ioctl_evtchn_bind_interdomain {
54 	unsigned int remote_domain, remote_port;
55 	unsigned int port;
56 };
57 
58 /*
59  * Allocate a fresh port for binding to @remote_domain.
60  * Return allocated port.
61  */
62 #define IOCTL_EVTCHN_BIND_UNBOUND_PORT			\
63 	_IOWR('E', 6, struct ioctl_evtchn_bind_unbound_port)
64 struct ioctl_evtchn_bind_unbound_port {
65 	unsigned int remote_domain;
66 	unsigned int port;
67 };
68 
69 /*
70  * Unbind previously allocated @port.
71  */
72 #define IOCTL_EVTCHN_UNBIND				\
73 	_IOW('E', 7, struct ioctl_evtchn_unbind)
74 struct ioctl_evtchn_unbind {
75 	unsigned int port;
76 };
77 
78 /*
79  * Send event to previously allocated @port.
80  */
81 #define IOCTL_EVTCHN_NOTIFY				\
82 	_IOW('E', 8, struct ioctl_evtchn_notify)
83 struct ioctl_evtchn_notify {
84 	unsigned int port;
85 };
86 
87 /* Clear and reinitialise the event buffer. Clear error condition. */
88 #define IOCTL_EVTCHN_RESET				\
89 	_IO('E', 9)
90 
91 #endif /* __XEN_XENIO3_H__ */
92