acrestyp.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. /******************************************************************************
  2. *
  3. * Name: acrestyp.h - Defines, types, and structures for resource descriptors
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2008, Intel Corp.
  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 __ACRESTYP_H__
  43. #define __ACRESTYP_H__
  44. /*
  45. * Definitions for Resource Attributes
  46. */
  47. typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
  48. typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
  49. /*
  50. * Memory Attributes
  51. */
  52. #define ACPI_READ_ONLY_MEMORY (u8) 0x00
  53. #define ACPI_READ_WRITE_MEMORY (u8) 0x01
  54. #define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
  55. #define ACPI_CACHABLE_MEMORY (u8) 0x01
  56. #define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
  57. #define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
  58. /*
  59. * IO Attributes
  60. * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
  61. * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
  62. */
  63. #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
  64. #define ACPI_ISA_ONLY_RANGES (u8) 0x02
  65. #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
  66. /* Type of translation - 1=Sparse, 0=Dense */
  67. #define ACPI_SPARSE_TRANSLATION (u8) 0x01
  68. /*
  69. * IO Port Descriptor Decode
  70. */
  71. #define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
  72. #define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
  73. /*
  74. * IRQ Attributes
  75. */
  76. #define ACPI_LEVEL_SENSITIVE (u8) 0x00
  77. #define ACPI_EDGE_SENSITIVE (u8) 0x01
  78. #define ACPI_ACTIVE_HIGH (u8) 0x00
  79. #define ACPI_ACTIVE_LOW (u8) 0x01
  80. #define ACPI_EXCLUSIVE (u8) 0x00
  81. #define ACPI_SHARED (u8) 0x01
  82. /*
  83. * DMA Attributes
  84. */
  85. #define ACPI_COMPATIBILITY (u8) 0x00
  86. #define ACPI_TYPE_A (u8) 0x01
  87. #define ACPI_TYPE_B (u8) 0x02
  88. #define ACPI_TYPE_F (u8) 0x03
  89. #define ACPI_NOT_BUS_MASTER (u8) 0x00
  90. #define ACPI_BUS_MASTER (u8) 0x01
  91. #define ACPI_TRANSFER_8 (u8) 0x00
  92. #define ACPI_TRANSFER_8_16 (u8) 0x01
  93. #define ACPI_TRANSFER_16 (u8) 0x02
  94. /*
  95. * Start Dependent Functions Priority definitions
  96. */
  97. #define ACPI_GOOD_CONFIGURATION (u8) 0x00
  98. #define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
  99. #define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
  100. /*
  101. * 16, 32 and 64-bit Address Descriptor resource types
  102. */
  103. #define ACPI_MEMORY_RANGE (u8) 0x00
  104. #define ACPI_IO_RANGE (u8) 0x01
  105. #define ACPI_BUS_NUMBER_RANGE (u8) 0x02
  106. #define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
  107. #define ACPI_ADDRESS_FIXED (u8) 0x01
  108. #define ACPI_POS_DECODE (u8) 0x00
  109. #define ACPI_SUB_DECODE (u8) 0x01
  110. #define ACPI_PRODUCER (u8) 0x00
  111. #define ACPI_CONSUMER (u8) 0x01
  112. /*
  113. * If possible, pack the following structures to byte alignment
  114. */
  115. #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
  116. #pragma pack(1)
  117. #endif
  118. /* UUID data structures for use in vendor-defined resource descriptors */
  119. struct acpi_uuid {
  120. u8 data[ACPI_UUID_LENGTH];
  121. };
  122. struct acpi_vendor_uuid {
  123. u8 subtype;
  124. u8 data[ACPI_UUID_LENGTH];
  125. };
  126. /*
  127. * Structures used to describe device resources
  128. */
  129. struct acpi_resource_irq {
  130. u8 descriptor_length;
  131. u8 triggering;
  132. u8 polarity;
  133. u8 sharable;
  134. u8 interrupt_count;
  135. u8 interrupts[1];
  136. };
  137. struct acpi_resource_dma {
  138. u8 type;
  139. u8 bus_master;
  140. u8 transfer;
  141. u8 channel_count;
  142. u8 channels[1];
  143. };
  144. struct acpi_resource_start_dependent {
  145. u8 descriptor_length;
  146. u8 compatibility_priority;
  147. u8 performance_robustness;
  148. };
  149. /*
  150. * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
  151. * needed because it has no fields
  152. */
  153. struct acpi_resource_io {
  154. u8 io_decode;
  155. u8 alignment;
  156. u8 address_length;
  157. u16 minimum;
  158. u16 maximum;
  159. };
  160. struct acpi_resource_fixed_io {
  161. u16 address;
  162. u8 address_length;
  163. };
  164. struct acpi_resource_vendor {
  165. u16 byte_length;
  166. u8 byte_data[1];
  167. };
  168. /* Vendor resource with UUID info (introduced in ACPI 3.0) */
  169. struct acpi_resource_vendor_typed {
  170. u16 byte_length;
  171. u8 uuid_subtype;
  172. u8 uuid[ACPI_UUID_LENGTH];
  173. u8 byte_data[1];
  174. };
  175. struct acpi_resource_end_tag {
  176. u8 checksum;
  177. };
  178. struct acpi_resource_memory24 {
  179. u8 write_protect;
  180. u16 minimum;
  181. u16 maximum;
  182. u16 alignment;
  183. u16 address_length;
  184. };
  185. struct acpi_resource_memory32 {
  186. u8 write_protect;
  187. u32 minimum;
  188. u32 maximum;
  189. u32 alignment;
  190. u32 address_length;
  191. };
  192. struct acpi_resource_fixed_memory32 {
  193. u8 write_protect;
  194. u32 address;
  195. u32 address_length;
  196. };
  197. struct acpi_memory_attribute {
  198. u8 write_protect;
  199. u8 caching;
  200. u8 range_type;
  201. u8 translation;
  202. };
  203. struct acpi_io_attribute {
  204. u8 range_type;
  205. u8 translation;
  206. u8 translation_type;
  207. u8 reserved1;
  208. };
  209. union acpi_resource_attribute {
  210. struct acpi_memory_attribute mem;
  211. struct acpi_io_attribute io;
  212. /* Used for the *word_space macros */
  213. u8 type_specific;
  214. };
  215. struct acpi_resource_source {
  216. u8 index;
  217. u16 string_length;
  218. char *string_ptr;
  219. };
  220. /* Fields common to all address descriptors, 16/32/64 bit */
  221. #define ACPI_RESOURCE_ADDRESS_COMMON \
  222. u8 resource_type; \
  223. u8 producer_consumer; \
  224. u8 decode; \
  225. u8 min_address_fixed; \
  226. u8 max_address_fixed; \
  227. union acpi_resource_attribute info;
  228. struct acpi_resource_address {
  229. ACPI_RESOURCE_ADDRESS_COMMON};
  230. struct acpi_resource_address16 {
  231. ACPI_RESOURCE_ADDRESS_COMMON u16 granularity;
  232. u16 minimum;
  233. u16 maximum;
  234. u16 translation_offset;
  235. u16 address_length;
  236. struct acpi_resource_source resource_source;
  237. };
  238. struct acpi_resource_address32 {
  239. ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
  240. u32 minimum;
  241. u32 maximum;
  242. u32 translation_offset;
  243. u32 address_length;
  244. struct acpi_resource_source resource_source;
  245. };
  246. struct acpi_resource_address64 {
  247. ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
  248. u64 minimum;
  249. u64 maximum;
  250. u64 translation_offset;
  251. u64 address_length;
  252. struct acpi_resource_source resource_source;
  253. };
  254. struct acpi_resource_extended_address64 {
  255. ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD;
  256. u64 granularity;
  257. u64 minimum;
  258. u64 maximum;
  259. u64 translation_offset;
  260. u64 address_length;
  261. u64 type_specific;
  262. };
  263. struct acpi_resource_extended_irq {
  264. u8 producer_consumer;
  265. u8 triggering;
  266. u8 polarity;
  267. u8 sharable;
  268. u8 interrupt_count;
  269. struct acpi_resource_source resource_source;
  270. u32 interrupts[1];
  271. };
  272. struct acpi_resource_generic_register {
  273. u8 space_id;
  274. u8 bit_width;
  275. u8 bit_offset;
  276. u8 access_size;
  277. u64 address;
  278. };
  279. /* ACPI_RESOURCE_TYPEs */
  280. #define ACPI_RESOURCE_TYPE_IRQ 0
  281. #define ACPI_RESOURCE_TYPE_DMA 1
  282. #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
  283. #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
  284. #define ACPI_RESOURCE_TYPE_IO 4
  285. #define ACPI_RESOURCE_TYPE_FIXED_IO 5
  286. #define ACPI_RESOURCE_TYPE_VENDOR 6
  287. #define ACPI_RESOURCE_TYPE_END_TAG 7
  288. #define ACPI_RESOURCE_TYPE_MEMORY24 8
  289. #define ACPI_RESOURCE_TYPE_MEMORY32 9
  290. #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
  291. #define ACPI_RESOURCE_TYPE_ADDRESS16 11
  292. #define ACPI_RESOURCE_TYPE_ADDRESS32 12
  293. #define ACPI_RESOURCE_TYPE_ADDRESS64 13
  294. #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
  295. #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
  296. #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
  297. #define ACPI_RESOURCE_TYPE_MAX 16
  298. /* Master union for resource descriptors */
  299. union acpi_resource_data {
  300. struct acpi_resource_irq irq;
  301. struct acpi_resource_dma dma;
  302. struct acpi_resource_start_dependent start_dpf;
  303. struct acpi_resource_io io;
  304. struct acpi_resource_fixed_io fixed_io;
  305. struct acpi_resource_vendor vendor;
  306. struct acpi_resource_vendor_typed vendor_typed;
  307. struct acpi_resource_end_tag end_tag;
  308. struct acpi_resource_memory24 memory24;
  309. struct acpi_resource_memory32 memory32;
  310. struct acpi_resource_fixed_memory32 fixed_memory32;
  311. struct acpi_resource_address16 address16;
  312. struct acpi_resource_address32 address32;
  313. struct acpi_resource_address64 address64;
  314. struct acpi_resource_extended_address64 ext_address64;
  315. struct acpi_resource_extended_irq extended_irq;
  316. struct acpi_resource_generic_register generic_reg;
  317. /* Common fields */
  318. struct acpi_resource_address address; /* Common 16/32/64 address fields */
  319. };
  320. /* Common resource header */
  321. struct acpi_resource {
  322. u32 type;
  323. u32 length;
  324. union acpi_resource_data data;
  325. };
  326. /* restore default alignment */
  327. #pragma pack()
  328. #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
  329. #define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
  330. #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
  331. #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
  332. struct acpi_pci_routing_table {
  333. u32 length;
  334. u32 pin;
  335. acpi_integer address; /* here for 64-bit alignment */
  336. u32 source_index;
  337. char source[4]; /* pad to 64 bits so sizeof() works in all cases */
  338. };
  339. #endif /* __ACRESTYP_H__ */