summaryrefslogtreecommitdiffstats
path: root/qemu/roms/ipxe/src/include/ipxe/xenevent.h
blob: f0bd3465ef5913dd23231f4c6b5c0a6f670f0ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef _IPXE_XENEVENT_H
#define _IPXE_XENEVENT_H

/** @file
 *
 * Xen events
 *
 */

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#include <ipxe/xen.h>
#include <xen/event_channel.h>

/**
 * Close event channel
 *
 * @v xen		Xen hypervisor
 * @v close		Event descriptor
 * @ret xenrc		Xen status code
 */
static inline __attribute__ (( always_inline )) int
xenevent_close ( struct xen_hypervisor *xen, struct evtchn_close *close ) {

	return xen_hypercall_2 ( xen, __HYPERVISOR_event_channel_op,
				 EVTCHNOP_close, virt_to_phys ( close ) );
}

/**
 * Send event
 *
 * @v xen		Xen hypervisor
 * @v send		Event descriptor
 * @ret xenrc		Xen status code
 */
static inline __attribute__ (( always_inline )) int
xenevent_send ( struct xen_hypervisor *xen, struct evtchn_send *send ) {

	return xen_hypercall_2 ( xen, __HYPERVISOR_event_channel_op,
				 EVTCHNOP_send, virt_to_phys ( send ) );
}

/**
 * Allocate an unbound event channel
 *
 * @v xen		Xen hypervisor
 * @v alloc_unbound	Event descriptor
 * @ret xenrc		Xen status code
 */
static inline __attribute__ (( always_inline )) int
xenevent_alloc_unbound ( struct xen_hypervisor *xen,
			 struct evtchn_alloc_unbound *alloc_unbound ) {

	return xen_hypercall_2 ( xen, __HYPERVISOR_event_channel_op,
				 EVTCHNOP_alloc_unbound,
				 virt_to_phys ( alloc_unbound ) );
}

#endif /* _IPXE_XENEVENT_H */