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 <xen/interface/event_channel.h>
49 /** Submit a port notification for delivery to a userland evtchn consumer */
50 void evtchn_device_upcall(evtchn_port_t port);
53 * Disable signal delivery for an event channel port, returning its
54 * previous mask state.
56 * \param port The event channel port to query and mask.
58 * \returns 1 if event delivery was previously disabled. Otherwise 0.
61 evtchn_test_and_set_mask(evtchn_port_t port)
63 shared_info_t *s = HYPERVISOR_shared_info;
64 return synch_test_and_set_bit(port, s->evtchn_mask);
68 * Clear any pending event for the given event channel port.
70 * \param port The event channel port to clear.
73 evtchn_clear_port(evtchn_port_t port)
75 shared_info_t *s = HYPERVISOR_shared_info;
76 synch_clear_bit(port, &s->evtchn_pending[0]);
80 * Disable signal delivery for an event channel port.
82 * \param port The event channel port to mask.
85 evtchn_mask_port(evtchn_port_t port)
87 shared_info_t *s = HYPERVISOR_shared_info;
89 synch_set_bit(port, &s->evtchn_mask[0]);
93 * Enable signal delivery for an event channel port.
95 * \param port The event channel port to enable.
98 evtchn_unmask_port(evtchn_port_t port)
100 evtchn_unmask_t op = { .port = port };
102 HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &op);
105 #endif /* __XEN_EVTCHN_EVTCHNVAR_H__ */