10
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
12
/* Define Xen interface version before including any Xen header files */
13
#define __XEN_INTERFACE_VERSION__ 0x00040400
16
#include <ipxe/bitops.h>
17
#include <ipxe/uaccess.h>
19
#include <xen/event_channel.h>
21
/* Memory barrier macros used by ring.h */
23
#define xen_rmb() rmb()
24
#define xen_wmb() wmb()
28
/** A Xen grant table */
30
/** Grant table entries */
31
struct grant_entry_v1 *table;
32
/** Total grant table length */
34
/** Entry size shift (for later version tables) */
36
/** Number of grant table entries in use */
38
/** Most recently used grant reference */
44
/** XenStore domain interface */
45
struct xenstore_domain_interface *intf;
50
/** A Xen hypervisor */
51
struct xen_hypervisor {
52
/** Hypercall table */
53
struct xen_hypercall *hypercall;
54
/** Shared info page */
55
struct shared_info *shared;
57
struct xen_grant grant;
59
struct xen_store store;
63
* Test and clear pending event
65
* @v xen Xen hypervisor
66
* @v port Event channel port
67
* @ret pending Event was pending
69
static inline __attribute__ (( always_inline )) int
70
xenevent_pending ( struct xen_hypervisor *xen, evtchn_port_t port ) {
72
return test_and_clear_bit ( port, xen->shared->evtchn_pending );
78
* Convert a Xen status code to an iPXE status code
80
* @v xenrc Xen status code (negated)
81
* @ret rc iPXE status code (before negation)
83
* Xen status codes are defined in the file include/xen/errno.h in the
84
* Xen repository. They happen to match the Linux error codes, some
85
* of which can be found in our include/ipxe/errno/linux.h.
87
#define EXEN( xenrc ) EPLATFORM ( EINFO_EPLATFORM, -(xenrc) )
89
#endif /* _IPXE_XEN_H */