amlresrc.h 12 KB

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