You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xen.h 1.6KB

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