diff options
| author | Michael Brown | 2014-07-29 00:38:30 +0200 |
|---|---|---|
| committer | Michael Brown | 2014-07-29 16:57:44 +0200 |
| commit | 036af27a4523c4e15e28d30a1513a3f6d9671774 (patch) | |
| tree | bf284637f91e2258906d736f07a54b1f98dfd68d /src/include/ipxe/xen.h | |
| parent | [xen] Import selected public headers (diff) | |
| download | ipxe-036af27a4523c4e15e28d30a1513a3f6d9671774.tar.gz ipxe-036af27a4523c4e15e28d30a1513a3f6d9671774.tar.xz ipxe-036af27a4523c4e15e28d30a1513a3f6d9671774.zip | |
[xen] Add basic support for PV-HVM domains
Add basic support for Xen PV-HVM domains (detected via the Xen
platform PCI device with IDs 5853:0001), including support for
accessing configuration via XenStore and enumerating devices via
XenBus.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/xen.h')
| -rw-r--r-- | src/include/ipxe/xen.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/include/ipxe/xen.h b/src/include/ipxe/xen.h new file mode 100644 index 000000000..546b0c348 --- /dev/null +++ b/src/include/ipxe/xen.h @@ -0,0 +1,73 @@ +#ifndef _IPXE_XEN_H +#define _IPXE_XEN_H + +/** @file + * + * Xen interface + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/* Define Xen interface version before including any Xen header files */ +#define __XEN_INTERFACE_VERSION__ 0x00040400 + +#include <stdint.h> +#include <ipxe/uaccess.h> +#include <xen/xen.h> +#include <xen/event_channel.h> + +/* Memory barrier macros used by ring.h */ +#define xen_mb() mb() +#define xen_rmb() rmb() +#define xen_wmb() wmb() + +struct xen_hypercall; + +/** A Xen grant table */ +struct xen_grant { + /** Grant table entries */ + union grant_entry_v2 *table; + /** Number of grant table entries (must be a power of two) */ + unsigned int count; + /** Number of grant table entries in use */ + unsigned int used; + /** Most recently used grant reference */ + unsigned int ref; +}; + +/** A XenStore */ +struct xen_store { + /** XenStore domain interface */ + struct xenstore_domain_interface *intf; + /** Event channel */ + evtchn_port_t port; +}; + +/** A Xen hypervisor */ +struct xen_hypervisor { + /** Hypercall table */ + struct xen_hypercall *hypercall; + /** Shared info page */ + struct shared_info *shared; + /** Grant table */ + struct xen_grant grant; + /** XenStore */ + struct xen_store store; +}; + +#include <bits/xen.h> + +/** + * Convert a Xen status code to an iPXE status code + * + * @v xenrc Xen status code (negated) + * @ret rc iPXE status code (before negation) + * + * Xen status codes are defined in the file include/xen/errno.h in the + * Xen repository. They happen to match the Linux error codes, some + * of which can be found in our include/ipxe/errno/linux.h. + */ +#define EXEN( xenrc ) EPLATFORM ( EINFO_EPLATFORM, -(xenrc) ) + +#endif /* _IPXE_XEN_H */ |
