amlresrc.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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 AML byte stream.
  92. */
  93. #pragma pack(1)
  94. struct asl_irq_format_desc {
  95. u8 descriptor_type;
  96. u16 irq_mask;
  97. u8 flags;
  98. };
  99. struct asl_irq_noflags_desc {
  100. u8 descriptor_type;
  101. u16 irq_mask;
  102. };
  103. struct asl_dma_format_desc {
  104. u8 descriptor_type;
  105. u8 dma_channel_mask;
  106. u8 flags;
  107. };
  108. struct asl_start_dependent_desc {
  109. u8 descriptor_type;
  110. u8 flags;
  111. };
  112. struct asl_start_dependent_noprio_desc {
  113. u8 descriptor_type;
  114. };
  115. struct asl_end_dependent_desc {
  116. u8 descriptor_type;
  117. };
  118. struct asl_io_port_desc {
  119. u8 descriptor_type;
  120. u8 information;
  121. u16 address_min;
  122. u16 address_max;
  123. u8 alignment;
  124. u8 length;
  125. };
  126. struct asl_fixed_io_port_desc {
  127. u8 descriptor_type;
  128. u16 base_address;
  129. u8 length;
  130. };
  131. struct asl_small_vendor_desc {
  132. u8 descriptor_type;
  133. u8 vendor_defined[7];
  134. };
  135. struct asl_end_tag_desc {
  136. u8 descriptor_type;
  137. u8 checksum;
  138. };
  139. /* LARGE descriptors */
  140. struct asl_memory_24_desc {
  141. u8 descriptor_type;
  142. u16 length;
  143. u8 information;
  144. u16 address_min;
  145. u16 address_max;
  146. u16 alignment;
  147. u16 range_length;
  148. };
  149. struct asl_large_vendor_desc {
  150. u8 descriptor_type;
  151. u16 length;
  152. u8 vendor_defined[1];
  153. };
  154. struct asl_memory_32_desc {
  155. u8 descriptor_type;
  156. u16 length;
  157. u8 information;
  158. u32 address_min;
  159. u32 address_max;
  160. u32 alignment;
  161. u32 range_length;
  162. };
  163. struct asl_fixed_memory_32_desc {
  164. u8 descriptor_type;
  165. u16 length;
  166. u8 information;
  167. u32 base_address;
  168. u32 range_length;
  169. };
  170. struct asl_extended_address_desc {
  171. u8 descriptor_type;
  172. u16 length;
  173. u8 resource_type;
  174. u8 flags;
  175. u8 specific_flags;
  176. u8 revision_iD;
  177. u8 reserved;
  178. u64 granularity;
  179. u64 address_min;
  180. u64 address_max;
  181. u64 translation_offset;
  182. u64 address_length;
  183. u64 type_specific_attributes;
  184. u8 optional_fields[2]; /* Used for length calculation only */
  185. };
  186. #define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */
  187. struct asl_qword_address_desc {
  188. u8 descriptor_type;
  189. u16 length;
  190. u8 resource_type;
  191. u8 flags;
  192. u8 specific_flags;
  193. u64 granularity;
  194. u64 address_min;
  195. u64 address_max;
  196. u64 translation_offset;
  197. u64 address_length;
  198. u8 optional_fields[2];
  199. };
  200. struct asl_dword_address_desc {
  201. u8 descriptor_type;
  202. u16 length;
  203. u8 resource_type;
  204. u8 flags;
  205. u8 specific_flags;
  206. u32 granularity;
  207. u32 address_min;
  208. u32 address_max;
  209. u32 translation_offset;
  210. u32 address_length;
  211. u8 optional_fields[2];
  212. };
  213. struct asl_word_address_desc {
  214. u8 descriptor_type;
  215. u16 length;
  216. u8 resource_type;
  217. u8 flags;
  218. u8 specific_flags;
  219. u16 granularity;
  220. u16 address_min;
  221. u16 address_max;
  222. u16 translation_offset;
  223. u16 address_length;
  224. u8 optional_fields[2];
  225. };
  226. struct asl_extended_xrupt_desc {
  227. u8 descriptor_type;
  228. u16 length;
  229. u8 flags;
  230. u8 table_length;
  231. u32 interrupt_number[1];
  232. /* res_source_index, res_source optional fields follow */
  233. };
  234. struct asl_general_register_desc {
  235. u8 descriptor_type;
  236. u16 length;
  237. u8 address_space_id;
  238. u8 bit_width;
  239. u8 bit_offset;
  240. u8 access_size; /* ACPI 3.0, was Reserved */
  241. u64 address;
  242. };
  243. /* restore default alignment */
  244. #pragma pack()
  245. /* Union of all resource descriptors, so we can allocate the worst case */
  246. union asl_resource_desc {
  247. struct asl_irq_format_desc irq;
  248. struct asl_dma_format_desc dma;
  249. struct asl_start_dependent_desc std;
  250. struct asl_end_dependent_desc end;
  251. struct asl_io_port_desc iop;
  252. struct asl_fixed_io_port_desc fio;
  253. struct asl_small_vendor_desc smv;
  254. struct asl_end_tag_desc et;
  255. struct asl_memory_24_desc M24;
  256. struct asl_large_vendor_desc lgv;
  257. struct asl_memory_32_desc M32;
  258. struct asl_fixed_memory_32_desc F32;
  259. struct asl_qword_address_desc qas;
  260. struct asl_dword_address_desc das;
  261. struct asl_word_address_desc was;
  262. struct asl_extended_address_desc eas;
  263. struct asl_extended_xrupt_desc exx;
  264. struct asl_general_register_desc grg;
  265. u32 u32_item;
  266. u16 u16_item;
  267. u8 U8item;
  268. };
  269. #endif