xref: /freebsd/sys/xen/evtchn.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
13a6d1fcfSKip Macy /******************************************************************************
23a6d1fcfSKip Macy  * evtchn.h
33a6d1fcfSKip Macy  *
4*76acc41fSJustin T. Gibbs  * Interface to /dev/xen/evtchn.
53a6d1fcfSKip Macy  *
6*76acc41fSJustin T. Gibbs  * Copyright (c) 2003-2005, K A Fraser
7*76acc41fSJustin T. Gibbs  *
8*76acc41fSJustin T. Gibbs  * This file may be distributed separately from the Linux kernel, or
9*76acc41fSJustin T. Gibbs  * incorporated into other software packages, subject to the following license:
10*76acc41fSJustin T. Gibbs  *
11*76acc41fSJustin T. Gibbs  * Permission is hereby granted, free of charge, to any person obtaining a copy
12*76acc41fSJustin T. Gibbs  * of this source file (the "Software"), to deal in the Software without
13*76acc41fSJustin T. Gibbs  * restriction, including without limitation the rights to use, copy, modify,
14*76acc41fSJustin T. Gibbs  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
15*76acc41fSJustin T. Gibbs  * and to permit persons to whom the Software is furnished to do so, subject to
16*76acc41fSJustin T. Gibbs  * the following conditions:
17*76acc41fSJustin T. Gibbs  *
18*76acc41fSJustin T. Gibbs  * The above copyright notice and this permission notice shall be included in
19*76acc41fSJustin T. Gibbs  * all copies or substantial portions of the Software.
20*76acc41fSJustin T. Gibbs  *
21*76acc41fSJustin T. Gibbs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22*76acc41fSJustin T. Gibbs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23*76acc41fSJustin T. Gibbs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24*76acc41fSJustin T. Gibbs  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25*76acc41fSJustin T. Gibbs  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26*76acc41fSJustin T. Gibbs  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27*76acc41fSJustin T. Gibbs  * IN THE SOFTWARE.
283a6d1fcfSKip Macy  */
293a6d1fcfSKip Macy 
30*76acc41fSJustin T. Gibbs #ifndef __XEN_EVTCHN_H__
31*76acc41fSJustin T. Gibbs #define __XEN_EVTCHN_H__
323a6d1fcfSKip Macy 
333a6d1fcfSKip Macy /*
34*76acc41fSJustin T. Gibbs  * Bind a fresh port to VIRQ @virq.
353a6d1fcfSKip Macy  */
36*76acc41fSJustin T. Gibbs #define IOCTL_EVTCHN_BIND_VIRQ				\
37*76acc41fSJustin T. Gibbs 	_IOWR('E', 4, struct ioctl_evtchn_bind_virq)
38*76acc41fSJustin T. Gibbs struct ioctl_evtchn_bind_virq {
39*76acc41fSJustin T. Gibbs 	unsigned int virq;
40*76acc41fSJustin T. Gibbs 	unsigned int port;
41*76acc41fSJustin T. Gibbs };
423a6d1fcfSKip Macy 
433a6d1fcfSKip Macy /*
44*76acc41fSJustin T. Gibbs  * Bind a fresh port to remote <@remote_domain, @remote_port>.
453a6d1fcfSKip Macy  */
46*76acc41fSJustin T. Gibbs #define IOCTL_EVTCHN_BIND_INTERDOMAIN			\
47*76acc41fSJustin T. Gibbs 	_IOWR('E', 5, struct ioctl_evtchn_bind_interdomain)
48*76acc41fSJustin T. Gibbs struct ioctl_evtchn_bind_interdomain {
49*76acc41fSJustin T. Gibbs 	unsigned int remote_domain, remote_port;
50*76acc41fSJustin T. Gibbs 	unsigned int port;
51*76acc41fSJustin T. Gibbs };
523a6d1fcfSKip Macy 
533a6d1fcfSKip Macy /*
54*76acc41fSJustin T. Gibbs  * Allocate a fresh port for binding to @remote_domain.
553a6d1fcfSKip Macy  */
56*76acc41fSJustin T. Gibbs #define IOCTL_EVTCHN_BIND_UNBOUND_PORT			\
57*76acc41fSJustin T. Gibbs 	_IOWR('E', 6, struct ioctl_evtchn_bind_unbound_port)
58*76acc41fSJustin T. Gibbs struct ioctl_evtchn_bind_unbound_port {
59*76acc41fSJustin T. Gibbs 	unsigned int remote_domain;
60*76acc41fSJustin T. Gibbs 	unsigned int port;
61*76acc41fSJustin T. Gibbs };
623a6d1fcfSKip Macy 
633a6d1fcfSKip Macy /*
64*76acc41fSJustin T. Gibbs  * Unbind previously allocated @port.
653a6d1fcfSKip Macy  */
66*76acc41fSJustin T. Gibbs #define IOCTL_EVTCHN_UNBIND				\
67*76acc41fSJustin T. Gibbs 	_IOW('E', 7, struct ioctl_evtchn_unbind)
68*76acc41fSJustin T. Gibbs struct ioctl_evtchn_unbind {
69*76acc41fSJustin T. Gibbs 	unsigned int port;
70*76acc41fSJustin T. Gibbs };
713a6d1fcfSKip Macy 
72*76acc41fSJustin T. Gibbs /*
73*76acc41fSJustin T. Gibbs  * Send event to previously allocated @port.
74*76acc41fSJustin T. Gibbs  */
75*76acc41fSJustin T. Gibbs #define IOCTL_EVTCHN_NOTIFY				\
76*76acc41fSJustin T. Gibbs 	_IOW('E', 8, struct ioctl_evtchn_notify)
77*76acc41fSJustin T. Gibbs struct ioctl_evtchn_notify {
78*76acc41fSJustin T. Gibbs 	unsigned int port;
79*76acc41fSJustin T. Gibbs };
803a6d1fcfSKip Macy 
81*76acc41fSJustin T. Gibbs /* Clear and reinitialise the event buffer. Clear error condition. */
82*76acc41fSJustin T. Gibbs #define IOCTL_EVTCHN_RESET				\
83*76acc41fSJustin T. Gibbs 	_IO('E', 9)
843a6d1fcfSKip Macy 
85*76acc41fSJustin T. Gibbs #endif /* __XEN_EVTCHN_H__ */
86