Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / xen.h
1 #ifndef _IPXE_XEN_H
2 #define _IPXE_XEN_H
3
4 /** @file
5  *
6  * Xen interface
7  *
8  */
9
10 FILE_LICENCE ( GPL2_OR_LATER );
11
12 /* Define Xen interface version before including any Xen header files */
13 #define __XEN_INTERFACE_VERSION__ 0x00040400
14
15 #include <stdint.h>
16 #include <ipxe/uaccess.h>
17 #include <xen/xen.h>
18 #include <xen/event_channel.h>
19
20 /* Memory barrier macros used by ring.h */
21 #define xen_mb() mb()
22 #define xen_rmb() rmb()
23 #define xen_wmb() wmb()
24
25 struct xen_hypercall;
26
27 /** A Xen grant table */
28 struct xen_grant {
29         /** Grant table entries */
30         struct grant_entry_v1 *table;
31         /** Total grant table length */
32         size_t len;
33         /** Entry size shift (for later version tables) */
34         unsigned int shift;
35         /** Number of grant table entries in use */
36         unsigned int used;
37         /** Most recently used grant reference */
38         unsigned int ref;
39 };
40
41 /** A XenStore */
42 struct xen_store {
43         /** XenStore domain interface */
44         struct xenstore_domain_interface *intf;
45         /** Event channel */
46         evtchn_port_t port;
47 };
48
49 /** A Xen hypervisor */
50 struct xen_hypervisor {
51         /** Hypercall table */
52         struct xen_hypercall *hypercall;
53         /** Shared info page */
54         struct shared_info *shared;
55         /** Grant table */
56         struct xen_grant grant;
57         /** XenStore */
58         struct xen_store store;
59 };
60
61 #include <bits/xen.h>
62
63 /**
64  * Convert a Xen status code to an iPXE status code
65  *
66  * @v xenrc             Xen status code (negated)
67  * @ret rc              iPXE status code (before negation)
68  *
69  * Xen status codes are defined in the file include/xen/errno.h in the
70  * Xen repository.  They happen to match the Linux error codes, some
71  * of which can be found in our include/ipxe/errno/linux.h.
72  */
73 #define EXEN( xenrc ) EPLATFORM ( EINFO_EPLATFORM, -(xenrc) )
74
75 #endif /* _IPXE_XEN_H */