xen.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2013 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef GRUB_XEN_HEADER
  19. #define GRUB_XEN_HEADER 1
  20. #define __XEN_INTERFACE_VERSION__ 0x0003020a
  21. #define memset grub_memset
  22. #ifdef ASM_FILE
  23. #define __ASSEMBLY__
  24. #include <xen/xen.h>
  25. #else
  26. #include <grub/symbol.h>
  27. #include <grub/types.h>
  28. #include <grub/err.h>
  29. #ifndef GRUB_SYMBOL_GENERATOR
  30. typedef grub_int8_t int8_t;
  31. typedef grub_int16_t int16_t;
  32. typedef grub_uint8_t uint8_t;
  33. typedef grub_uint16_t uint16_t;
  34. typedef grub_uint32_t uint32_t;
  35. typedef grub_uint64_t uint64_t;
  36. #include <xen/xen.h>
  37. #include <xen/sched.h>
  38. #include <xen/grant_table.h>
  39. #include <xen/io/console.h>
  40. #include <xen/io/xs_wire.h>
  41. #include <xen/io/xenbus.h>
  42. #include <xen/io/protocols.h>
  43. #endif
  44. #include <grub/cpu/xen/hypercall.h>
  45. extern grub_size_t EXPORT_VAR (grub_xen_n_allocated_shared_pages);
  46. #define GRUB_XEN_LOG_PAGE_SIZE 12
  47. #define GRUB_XEN_PAGE_SIZE (1 << GRUB_XEN_LOG_PAGE_SIZE)
  48. extern volatile struct xencons_interface *grub_xen_xcons;
  49. extern volatile struct shared_info *EXPORT_VAR (grub_xen_shared_info);
  50. extern volatile struct xenstore_domain_interface *grub_xen_xenstore;
  51. extern volatile grant_entry_v1_t *grub_xen_grant_table;
  52. void EXPORT_FUNC (grub_xen_store_send) (const void *buf_, grub_size_t len);
  53. void EXPORT_FUNC (grub_xen_store_recv) (void *buf_, grub_size_t len);
  54. grub_err_t
  55. EXPORT_FUNC (grub_xenstore_dir) (const char *dir,
  56. int (*hook) (const char *dir,
  57. void *hook_data),
  58. void *hook_data);
  59. void *EXPORT_FUNC (grub_xenstore_get_file) (const char *dir,
  60. grub_size_t * len);
  61. grub_err_t EXPORT_FUNC (grub_xenstore_write_file) (const char *dir,
  62. const void *buf,
  63. grub_size_t len);
  64. typedef unsigned int grub_xen_grant_t;
  65. void *EXPORT_FUNC (grub_xen_alloc_shared_page) (domid_t dom,
  66. grub_xen_grant_t * grnum);
  67. void EXPORT_FUNC (grub_xen_free_shared_page) (void *ptr);
  68. #define mb() asm volatile("mfence;sfence;" : : : "memory");
  69. extern struct start_info *EXPORT_VAR (grub_xen_start_page_addr);
  70. void grub_console_init (void);
  71. void grub_xendisk_fini (void);
  72. void grub_xendisk_init (void);
  73. #ifdef __x86_64__
  74. typedef grub_uint64_t grub_xen_mfn_t;
  75. #else
  76. typedef grub_uint32_t grub_xen_mfn_t;
  77. #endif
  78. typedef unsigned int grub_xen_evtchn_t;
  79. #ifdef GRUB_MACHINE_XEN_PVH
  80. extern struct hvm_start_info *pvh_start_info;
  81. void grub_xen_setup_pvh (void);
  82. #endif
  83. #endif
  84. #endif