rsinfo.c 9.3 KB

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