start_info.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /* SPDX-License-Identifier: MIT */
  2. /*
  3. * Copyright (c) 2016, Citrix Systems, Inc.
  4. */
  5. #ifndef __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__
  6. #define __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__
  7. /*
  8. * Start of day structure passed to PVH guests and to HVM guests in %ebx.
  9. *
  10. * NOTE: nothing will be loaded at physical address 0, so a 0 value in any
  11. * of the address fields should be treated as not present.
  12. *
  13. * 0 +----------------+
  14. * | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE
  15. * | | ("xEn3" with the 0x80 bit of the "E" set).
  16. * 4 +----------------+
  17. * | version | Version of this structure. Current version is 1. New
  18. * | | versions are guaranteed to be backwards-compatible.
  19. * 8 +----------------+
  20. * | flags | SIF_xxx flags.
  21. * 12 +----------------+
  22. * | nr_modules | Number of modules passed to the kernel.
  23. * 16 +----------------+
  24. * | modlist_paddr | Physical address of an array of modules
  25. * | | (layout of the structure below).
  26. * 24 +----------------+
  27. * | cmdline_paddr | Physical address of the command line,
  28. * | | a zero-terminated ASCII string.
  29. * 32 +----------------+
  30. * | rsdp_paddr | Physical address of the RSDP ACPI data structure.
  31. * 40 +----------------+
  32. * | memmap_paddr | Physical address of the (optional) memory map. Only
  33. * | | present in version 1 and newer of the structure.
  34. * 48 +----------------+
  35. * | memmap_entries | Number of entries in the memory map table. Zero
  36. * | | if there is no memory map being provided. Only
  37. * | | present in version 1 and newer of the structure.
  38. * 52 +----------------+
  39. * | reserved | Version 1 and newer only.
  40. * 56 +----------------+
  41. *
  42. * The layout of each entry in the module structure is the following:
  43. *
  44. * 0 +----------------+
  45. * | paddr | Physical address of the module.
  46. * 8 +----------------+
  47. * | size | Size of the module in bytes.
  48. * 16 +----------------+
  49. * | cmdline_paddr | Physical address of the command line,
  50. * | | a zero-terminated ASCII string.
  51. * 24 +----------------+
  52. * | reserved |
  53. * 32 +----------------+
  54. *
  55. * The layout of each entry in the memory map table is as follows:
  56. *
  57. * 0 +----------------+
  58. * | addr | Base address
  59. * 8 +----------------+
  60. * | size | Size of mapping in bytes
  61. * 16 +----------------+
  62. * | type | Type of mapping as defined between the hypervisor
  63. * | | and guest. See XEN_HVM_MEMMAP_TYPE_* values below.
  64. * 20 +----------------|
  65. * | reserved |
  66. * 24 +----------------+
  67. *
  68. * The address and sizes are always a 64bit little endian unsigned integer.
  69. *
  70. * NB: Xen on x86 will always try to place all the data below the 4GiB
  71. * boundary.
  72. *
  73. * Version numbers of the hvm_start_info structure have evolved like this:
  74. *
  75. * Version 0: Initial implementation.
  76. *
  77. * Version 1: Added the memmap_paddr/memmap_entries fields (plus 4 bytes of
  78. * padding) to the end of the hvm_start_info struct. These new
  79. * fields can be used to pass a memory map to the guest. The
  80. * memory map is optional and so guests that understand version 1
  81. * of the structure must check that memmap_entries is non-zero
  82. * before trying to read the memory map.
  83. */
  84. #define XEN_HVM_START_MAGIC_VALUE 0x336ec578
  85. /*
  86. * The values used in the type field of the memory map table entries are
  87. * defined below and match the Address Range Types as defined in the "System
  88. * Address Map Interfaces" section of the ACPI Specification. Please refer to
  89. * section 15 in version 6.2 of the ACPI spec: http://uefi.org/specifications
  90. */
  91. #define XEN_HVM_MEMMAP_TYPE_RAM 1
  92. #define XEN_HVM_MEMMAP_TYPE_RESERVED 2
  93. #define XEN_HVM_MEMMAP_TYPE_ACPI 3
  94. #define XEN_HVM_MEMMAP_TYPE_NVS 4
  95. #define XEN_HVM_MEMMAP_TYPE_UNUSABLE 5
  96. #define XEN_HVM_MEMMAP_TYPE_DISABLED 6
  97. #define XEN_HVM_MEMMAP_TYPE_PMEM 7
  98. /*
  99. * C representation of the x86/HVM start info layout.
  100. *
  101. * The canonical definition of this layout is above, this is just a way to
  102. * represent the layout described there using C types.
  103. */
  104. struct hvm_start_info {
  105. uint32_t magic; /* Contains the magic value 0x336ec578 */
  106. /* ("xEn3" with the 0x80 bit of the "E" set).*/
  107. uint32_t version; /* Version of this structure. */
  108. uint32_t flags; /* SIF_xxx flags. */
  109. uint32_t nr_modules; /* Number of modules passed to the kernel. */
  110. uint64_t modlist_paddr; /* Physical address of an array of */
  111. /* hvm_modlist_entry. */
  112. uint64_t cmdline_paddr; /* Physical address of the command line. */
  113. uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */
  114. /* structure. */
  115. /* All following fields only present in version 1 and newer */
  116. uint64_t memmap_paddr; /* Physical address of an array of */
  117. /* hvm_memmap_table_entry. */
  118. uint32_t memmap_entries; /* Number of entries in the memmap table. */
  119. /* Value will be zero if there is no memory */
  120. /* map being provided. */
  121. uint32_t reserved; /* Must be zero. */
  122. };
  123. struct hvm_modlist_entry {
  124. uint64_t paddr; /* Physical address of the module. */
  125. uint64_t size; /* Size of the module in bytes. */
  126. uint64_t cmdline_paddr; /* Physical address of the command line. */
  127. uint64_t reserved;
  128. };
  129. struct hvm_memmap_table_entry {
  130. uint64_t addr; /* Base address of the memory region */
  131. uint64_t size; /* Size of the memory region in bytes */
  132. uint32_t type; /* Mapping type */
  133. uint32_t reserved; /* Must be zero for Version 1. */
  134. };
  135. #endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */