1 /* $NetBSD: evtchn.h,v 1.1.1.1 2007/06/14 19:39:45 bouyer 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 __NetBSD_EVTCHN_H__
32 #define __NetBSD_EVTCHN_H__
33 
34 /*
35  * Bind a fresh port to VIRQ @virq.
36  */
37 #define IOCTL_EVTCHN_BIND_VIRQ				\
38 	_IOWR('E', 4, struct ioctl_evtchn_bind_virq)
39 struct ioctl_evtchn_bind_virq {
40 	unsigned int virq;
41 	unsigned int port;
42 };
43 
44 /*
45  * Bind a fresh port to remote <@remote_domain, @remote_port>.
46  */
47 #define IOCTL_EVTCHN_BIND_INTERDOMAIN			\
48 	_IOWR('E', 5, struct ioctl_evtchn_bind_interdomain)
49 struct ioctl_evtchn_bind_interdomain {
50 	unsigned int remote_domain, remote_port;
51 	unsigned int port;
52 };
53 
54 /*
55  * Allocate a fresh port for binding to @remote_domain.
56  */
57 #define IOCTL_EVTCHN_BIND_UNBOUND_PORT			\
58 	_IOWR('E', 6, struct ioctl_evtchn_bind_unbound_port)
59 struct ioctl_evtchn_bind_unbound_port {
60 	unsigned int remote_domain;
61 	unsigned int port;
62 };
63 
64 /*
65  * Unbind previously allocated @port.
66  */
67 #define IOCTL_EVTCHN_UNBIND				\
68 	_IOW('E', 7, struct ioctl_evtchn_unbind)
69 struct ioctl_evtchn_unbind {
70 	unsigned int port;
71 };
72 
73 /*
74  * Send event to previously allocated @port.
75  */
76 #define IOCTL_EVTCHN_NOTIFY				\
77 	_IOW('E', 8, struct ioctl_evtchn_notify)
78 struct ioctl_evtchn_notify {
79 	unsigned int port;
80 };
81 
82 /* Clear and reinitialise the event buffer. Clear error condition. */
83 #define IOCTL_EVTCHN_RESET				\
84 	_IO('E', 9)
85 
86 #endif /* __NetBSD_EVTCHN_H__ */
87