rsinfo.c 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*******************************************************************************
  2. *
  3. * Module Name: rsinfo - Dispatch and Info tables
  4. *
  5. ******************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2006, 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. #include <acpi/acpi.h>
  43. #include <acpi/acresrc.h>
  44. #define _COMPONENT ACPI_RESOURCES
  45. ACPI_MODULE_NAME("rsinfo")
  46. /*
  47. * Resource dispatch and information tables. Any new resource types (either
  48. * Large or Small) must be reflected in each of these tables, so they are here
  49. * in one place.
  50. *
  51. * The tables for Large descriptors are indexed by bits 6:0 of the AML
  52. * descriptor type byte. The tables for Small descriptors are indexed by
  53. * bits 6:3 of the descriptor byte. The tables for internal resource
  54. * descriptors are indexed by the acpi_resource_type field.
  55. */
  56. /* Dispatch table for resource-to-AML (Set Resource) conversion functions */
  57. struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = {
  58. acpi_rs_set_irq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */
  59. acpi_rs_convert_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */
  60. acpi_rs_set_start_dpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */
  61. acpi_rs_convert_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */
  62. acpi_rs_convert_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */
  63. acpi_rs_convert_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */
  64. acpi_rs_set_vendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */
  65. acpi_rs_convert_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */
  66. acpi_rs_convert_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */
  67. acpi_rs_convert_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */
  68. acpi_rs_convert_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
  69. acpi_rs_convert_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */
  70. acpi_rs_convert_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */
  71. acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */
  72. acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
  73. acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
  74. acpi_rs_convert_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
  75. };
  76. /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */
  77. struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[] = {
  78. /* Small descriptors */
  79. NULL, /* 0x00, Reserved */
  80. NULL, /* 0x01, Reserved */
  81. NULL, /* 0x02, Reserved */
  82. NULL, /* 0x03, Reserved */
  83. acpi_rs_get_irq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */
  84. acpi_rs_convert_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */
  85. acpi_rs_get_start_dpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
  86. acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
  87. acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */
  88. acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */
  89. NULL, /* 0x0A, Reserved */
  90. NULL, /* 0x0B, Reserved */
  91. NULL, /* 0x0C, Reserved */
  92. NULL, /* 0x0D, Reserved */
  93. acpi_rs_get_vendor_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */
  94. acpi_rs_convert_end_tag, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */
  95. /* Large descriptors */
  96. NULL, /* 0x00, Reserved */
  97. acpi_rs_convert_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */
  98. acpi_rs_convert_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
  99. NULL, /* 0x03, Reserved */
  100. acpi_rs_get_vendor_large, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */
  101. acpi_rs_convert_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */
  102. acpi_rs_convert_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */
  103. acpi_rs_convert_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */
  104. acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */
  105. acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */
  106. acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */
  107. acpi_rs_convert_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */
  108. };
  109. #ifdef ACPI_FUTURE_USAGE
  110. #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
  111. /* Dispatch table for resource dump functions */
  112. struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = {
  113. acpi_rs_dump_irq, /* ACPI_RESOURCE_TYPE_IRQ */
  114. acpi_rs_dump_dma, /* ACPI_RESOURCE_TYPE_DMA */
  115. acpi_rs_dump_start_dpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */
  116. acpi_rs_dump_end_dpf, /* ACPI_RESOURCE_TYPE_END_DEPENDENT */
  117. acpi_rs_dump_io, /* ACPI_RESOURCE_TYPE_IO */
  118. acpi_rs_dump_fixed_io, /* ACPI_RESOURCE_TYPE_FIXED_IO */
  119. acpi_rs_dump_vendor, /* ACPI_RESOURCE_TYPE_VENDOR */
  120. acpi_rs_dump_end_tag, /* ACPI_RESOURCE_TYPE_END_TAG */
  121. acpi_rs_dump_memory24, /* ACPI_RESOURCE_TYPE_MEMORY24 */
  122. acpi_rs_dump_memory32, /* ACPI_RESOURCE_TYPE_MEMORY32 */
  123. acpi_rs_dump_fixed_memory32, /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
  124. acpi_rs_dump_address16, /* ACPI_RESOURCE_TYPE_ADDRESS16 */
  125. acpi_rs_dump_address32, /* ACPI_RESOURCE_TYPE_ADDRESS32 */
  126. acpi_rs_dump_address64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */
  127. acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
  128. acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
  129. acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
  130. };
  131. #endif
  132. #endif /* ACPI_FUTURE_USAGE */
  133. /*
  134. * Base sizes for external AML resource descriptors, indexed by internal type.
  135. * Includes size of the descriptor header (1 byte for small descriptors,
  136. * 3 bytes for large descriptors)
  137. */
  138. const u8 acpi_gbl_aml_resource_sizes[] = {
  139. sizeof(struct aml_resource_irq), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */
  140. sizeof(struct aml_resource_dma), /* ACPI_RESOURCE_TYPE_DMA */
  141. sizeof(struct aml_resource_start_dependent), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */
  142. sizeof(struct aml_resource_end_dependent), /* ACPI_RESOURCE_TYPE_END_DEPENDENT */
  143. sizeof(struct aml_resource_io), /* ACPI_RESOURCE_TYPE_IO */
  144. sizeof(struct aml_resource_fixed_io), /* ACPI_RESOURCE_TYPE_FIXED_IO */
  145. sizeof(struct aml_resource_vendor_small), /* ACPI_RESOURCE_TYPE_VENDOR */
  146. sizeof(struct aml_resource_end_tag), /* ACPI_RESOURCE_TYPE_END_TAG */
  147. sizeof(struct aml_resource_memory24), /* ACPI_RESOURCE_TYPE_MEMORY24 */
  148. sizeof(struct aml_resource_memory32), /* ACPI_RESOURCE_TYPE_MEMORY32 */
  149. sizeof(struct aml_resource_fixed_memory32), /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
  150. sizeof(struct aml_resource_address16), /* ACPI_RESOURCE_TYPE_ADDRESS16 */
  151. sizeof(struct aml_resource_address32), /* ACPI_RESOURCE_TYPE_ADDRESS32 */
  152. sizeof(struct aml_resource_address64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */
  153. sizeof(struct aml_resource_extended_address64), /*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
  154. sizeof(struct aml_resource_extended_irq), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
  155. sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
  156. };
  157. const u8 acpi_gbl_resource_struct_sizes[] = {
  158. /* Small descriptors */
  159. 0,
  160. 0,
  161. 0,
  162. 0,
  163. ACPI_RS_SIZE(struct acpi_resource_irq),
  164. ACPI_RS_SIZE(struct acpi_resource_dma),
  165. ACPI_RS_SIZE(struct acpi_resource_start_dependent),
  166. ACPI_RS_SIZE_MIN,
  167. ACPI_RS_SIZE(struct acpi_resource_io),
  168. ACPI_RS_SIZE(struct acpi_resource_fixed_io),
  169. 0,
  170. 0,
  171. 0,
  172. 0,
  173. ACPI_RS_SIZE(struct acpi_resource_vendor),
  174. ACPI_RS_SIZE_MIN,
  175. /* Large descriptors */
  176. 0,
  177. ACPI_RS_SIZE(struct acpi_resource_memory24),
  178. ACPI_RS_SIZE(struct acpi_resource_generic_register),
  179. 0,
  180. ACPI_RS_SIZE(struct acpi_resource_vendor),
  181. ACPI_RS_SIZE(struct acpi_resource_memory32),
  182. ACPI_RS_SIZE(struct acpi_resource_fixed_memory32),
  183. ACPI_RS_SIZE(struct acpi_resource_address32),
  184. ACPI_RS_SIZE(struct acpi_resource_address16),
  185. ACPI_RS_SIZE(struct acpi_resource_extended_irq),
  186. ACPI_RS_SIZE(struct acpi_resource_address64),
  187. ACPI_RS_SIZE(struct acpi_resource_extended_address64)
  188. };