amlresrc.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. /******************************************************************************
  2. *
  3. * Module Name: amlresrc.h - AML resource descriptors
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2005, R. Byron Moore
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #ifndef __AMLRESRC_H
  43. #define __AMLRESRC_H
  44. #define ASL_RESNAME_ADDRESS "_ADR"
  45. #define ASL_RESNAME_ALIGNMENT "_ALN"
  46. #define ASL_RESNAME_ADDRESSSPACE "_ASI"
  47. #define ASL_RESNAME_ACCESSSIZE "_ASZ"
  48. #define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT"
  49. #define ASL_RESNAME_BASEADDRESS "_BAS"
  50. #define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */
  51. #define ASL_RESNAME_DECODE "_DEC"
  52. #define ASL_RESNAME_DMA "_DMA"
  53. #define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
  54. #define ASL_RESNAME_GRANULARITY "_GRA"
  55. #define ASL_RESNAME_INTERRUPT "_INT"
  56. #define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
  57. #define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
  58. #define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
  59. #define ASL_RESNAME_LENGTH "_LEN"
  60. #define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
  61. #define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
  62. #define ASL_RESNAME_MAXADDR "_MAX"
  63. #define ASL_RESNAME_MINADDR "_MIN"
  64. #define ASL_RESNAME_MAXTYPE "_MAF"
  65. #define ASL_RESNAME_MINTYPE "_MIF"
  66. #define ASL_RESNAME_REGISTERBITOFFSET "_RBO"
  67. #define ASL_RESNAME_REGISTERBITWIDTH "_RBW"
  68. #define ASL_RESNAME_RANGETYPE "_RNG"
  69. #define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
  70. #define ASL_RESNAME_TRANSLATION "_TRA"
  71. #define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
  72. #define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */
  73. #define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */
  74. /* Default sizes for "small" resource descriptors */
  75. #define ASL_RDESC_IRQ_SIZE 0x02
  76. #define ASL_RDESC_DMA_SIZE 0x02
  77. #define ASL_RDESC_ST_DEPEND_SIZE 0x00
  78. #define ASL_RDESC_END_DEPEND_SIZE 0x00
  79. #define ASL_RDESC_IO_SIZE 0x07
  80. #define ASL_RDESC_FIXED_IO_SIZE 0x03
  81. #define ASL_RDESC_END_TAG_SIZE 0x01
  82. struct asl_resource_node {
  83. u32 buffer_length;
  84. void *buffer;
  85. struct asl_resource_node *next;
  86. };
  87. /*
  88. * Resource descriptors defined in the ACPI specification.
  89. *
  90. * Packing/alignment must be BYTE because these descriptors
  91. * are used to overlay the raw AML byte stream.
  92. */
  93. #pragma pack(1)
  94. /*
  95. * SMALL descriptors
  96. */
  97. #define AML_RESOURCE_SMALL_HEADER_COMMON \
  98. u8 descriptor_type;
  99. struct aml_resource_small_header {
  100. AML_RESOURCE_SMALL_HEADER_COMMON};
  101. struct aml_resource_irq {
  102. AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
  103. u8 flags;
  104. };
  105. struct aml_resource_irq_noflags {
  106. AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
  107. };
  108. struct aml_resource_dma {
  109. AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask;
  110. u8 flags;
  111. };
  112. struct aml_resource_start_dependent {
  113. AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
  114. };
  115. struct aml_resource_start_dependent_noprio {
  116. AML_RESOURCE_SMALL_HEADER_COMMON};
  117. struct aml_resource_end_dependent {
  118. AML_RESOURCE_SMALL_HEADER_COMMON};
  119. struct aml_resource_io {
  120. AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
  121. u16 minimum;
  122. u16 maximum;
  123. u8 alignment;
  124. u8 address_length;
  125. };
  126. struct aml_resource_fixed_io {
  127. AML_RESOURCE_SMALL_HEADER_COMMON u16 address;
  128. u8 address_length;
  129. };
  130. struct aml_resource_vendor_small {
  131. AML_RESOURCE_SMALL_HEADER_COMMON};
  132. struct aml_resource_end_tag {
  133. AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum;
  134. };
  135. /*
  136. * LARGE descriptors
  137. */
  138. #define AML_RESOURCE_LARGE_HEADER_COMMON \
  139. u8 descriptor_type;\
  140. u16 resource_length;
  141. struct aml_resource_large_header {
  142. AML_RESOURCE_LARGE_HEADER_COMMON};
  143. struct aml_resource_memory24 {
  144. AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
  145. u16 minimum;
  146. u16 maximum;
  147. u16 alignment;
  148. u16 address_length;
  149. };
  150. struct aml_resource_vendor_large {
  151. AML_RESOURCE_LARGE_HEADER_COMMON};
  152. struct aml_resource_memory32 {
  153. AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
  154. u32 minimum;
  155. u32 maximum;
  156. u32 alignment;
  157. u32 address_length;
  158. };
  159. struct aml_resource_fixed_memory32 {
  160. AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
  161. u32 address;
  162. u32 address_length;
  163. };
  164. #define AML_RESOURCE_ADDRESS_COMMON \
  165. u8 resource_type; \
  166. u8 flags; \
  167. u8 specific_flags;
  168. struct aml_resource_address {
  169. AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
  170. struct aml_resource_extended_address64 {
  171. AML_RESOURCE_LARGE_HEADER_COMMON
  172. AML_RESOURCE_ADDRESS_COMMON u8 revision_iD;
  173. u8 reserved;
  174. u64 granularity;
  175. u64 minimum;
  176. u64 maximum;
  177. u64 translation_offset;
  178. u64 address_length;
  179. u64 type_specific;
  180. };
  181. #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
  182. struct aml_resource_address64 {
  183. AML_RESOURCE_LARGE_HEADER_COMMON
  184. AML_RESOURCE_ADDRESS_COMMON u64 granularity;
  185. u64 minimum;
  186. u64 maximum;
  187. u64 translation_offset;
  188. u64 address_length;
  189. };
  190. struct aml_resource_address32 {
  191. AML_RESOURCE_LARGE_HEADER_COMMON
  192. AML_RESOURCE_ADDRESS_COMMON u32 granularity;
  193. u32 minimum;
  194. u32 maximum;
  195. u32 translation_offset;
  196. u32 address_length;
  197. };
  198. struct aml_resource_address16 {
  199. AML_RESOURCE_LARGE_HEADER_COMMON
  200. AML_RESOURCE_ADDRESS_COMMON u16 granularity;
  201. u16 minimum;
  202. u16 maximum;
  203. u16 translation_offset;
  204. u16 address_length;
  205. };
  206. struct aml_resource_extended_irq {
  207. AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
  208. u8 interrupt_count;
  209. u32 interrupts[1];
  210. /* res_source_index, res_source optional fields follow */
  211. };
  212. struct aml_resource_generic_register {
  213. AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id;
  214. u8 bit_width;
  215. u8 bit_offset;
  216. u8 access_size; /* ACPI 3.0, was previously Reserved */
  217. u64 address;
  218. };
  219. /* restore default alignment */
  220. #pragma pack()
  221. /* Union of all resource descriptors, so we can allocate the worst case */
  222. union aml_resource {
  223. /* Descriptor headers */
  224. struct aml_resource_small_header small_header;
  225. struct aml_resource_large_header large_header;
  226. /* Small resource descriptors */
  227. struct aml_resource_irq irq;
  228. struct aml_resource_dma dma;
  229. struct aml_resource_start_dependent start_dpf;
  230. struct aml_resource_end_dependent end_dpf;
  231. struct aml_resource_io io;
  232. struct aml_resource_fixed_io fixed_io;
  233. struct aml_resource_vendor_small vendor_small;
  234. struct aml_resource_end_tag end_tag;
  235. /* Large resource descriptors */
  236. struct aml_resource_memory24 memory24;
  237. struct aml_resource_generic_register generic_reg;
  238. struct aml_resource_vendor_large vendor_large;
  239. struct aml_resource_memory32 memory32;
  240. struct aml_resource_fixed_memory32 fixed_memory32;
  241. struct aml_resource_address16 address16;
  242. struct aml_resource_address32 address32;
  243. struct aml_resource_address64 address64;
  244. struct aml_resource_extended_address64 ext_address64;
  245. struct aml_resource_extended_irq extended_irq;
  246. /* Utility overlays */
  247. struct aml_resource_address address;
  248. u32 u32_item;
  249. u16 u16_item;
  250. u8 U8item;
  251. };
  252. #endif