1 /******************************************************************************
4 * Data structures and definitions private to the FreeBSD implementation
5 * of the Xen event channel API.
7 * Copyright (c) 2004, K A Fraser
8 * Copyright (c) 2012, Spectra Logic Corporation
10 * This file may be distributed separately from the Linux kernel, or
11 * incorporated into other software packages, subject to the following license:
13 * Permission is hereby granted, free of charge, to any person obtaining a copy
14 * of this source file (the "Software"), to deal in the Software without
15 * restriction, including without limitation the rights to use, copy, modify,
16 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
17 * and to permit persons to whom the Software is furnished to do so, subject to
18 * the following conditions:
20 * The above copyright notice and this permission notice shall be included in
21 * all copies or substantial portions of the Software.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
34 #ifndef __XEN_EVTCHN_EVTCHNVAR_H__
35 #define __XEN_EVTCHN_EVTCHNVAR_H__
37 #include <xen/hypervisor.h>
38 #include <contrib/xen/event_channel.h>
48 /** Submit a port notification for delivery to a userland evtchn consumer */
49 void evtchn_device_upcall(evtchn_port_t port);
52 * Disable signal delivery for an event channel port, returning its
53 * previous mask state.
55 * \param port The event channel port to query and mask.
57 * \returns 1 if event delivery was previously disabled. Otherwise 0.
60 evtchn_test_and_set_mask(evtchn_port_t port)
62 shared_info_t *s = HYPERVISOR_shared_info;
63 return synch_test_and_set_bit(port, s->evtchn_mask);
67 * Clear any pending event for the given event channel port.
69 * \param port The event channel port to clear.
72 evtchn_clear_port(evtchn_port_t port)
74 shared_info_t *s = HYPERVISOR_shared_info;
75 synch_clear_bit(port, &s->evtchn_pending[0]);
79 * Disable signal delivery for an event channel port.
81 * \param port The event channel port to mask.
84 evtchn_mask_port(evtchn_port_t port)
86 shared_info_t *s = HYPERVISOR_shared_info;
88 synch_set_bit(port, &s->evtchn_mask[0]);
92 * Enable signal delivery for an event channel port.
94 * \param port The event channel port to enable.
97 evtchn_unmask_port(evtchn_port_t port)
99 evtchn_unmask_t op = { .port = port };
101 HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &op);
104 #endif /* __XEN_EVTCHN_EVTCHNVAR_H__ */