rsmemory.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /*******************************************************************************
  2. *
  3. * Module Name: rsmem24 - Memory resource descriptors
  4. *
  5. ******************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2015, 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("rsmemory")
  47. /*******************************************************************************
  48. *
  49. * acpi_rs_convert_memory24
  50. *
  51. ******************************************************************************/
  52. struct acpi_rsconvert_info acpi_rs_convert_memory24[4] = {
  53. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24,
  54. ACPI_RS_SIZE(struct acpi_resource_memory24),
  55. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory24)},
  56. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24,
  57. sizeof(struct aml_resource_memory24),
  58. 0},
  59. /* Read/Write bit */
  60. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect),
  61. AML_OFFSET(memory24.flags),
  62. 0},
  63. /*
  64. * These fields are contiguous in both the source and destination:
  65. * Minimum Base Address
  66. * Maximum Base Address
  67. * Address Base Alignment
  68. * Range Length
  69. */
  70. {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum),
  71. AML_OFFSET(memory24.minimum),
  72. 4}
  73. };
  74. /*******************************************************************************
  75. *
  76. * acpi_rs_convert_memory32
  77. *
  78. ******************************************************************************/
  79. struct acpi_rsconvert_info acpi_rs_convert_memory32[4] = {
  80. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32,
  81. ACPI_RS_SIZE(struct acpi_resource_memory32),
  82. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory32)},
  83. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32,
  84. sizeof(struct aml_resource_memory32),
  85. 0},
  86. /* Read/Write bit */
  87. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect),
  88. AML_OFFSET(memory32.flags),
  89. 0},
  90. /*
  91. * These fields are contiguous in both the source and destination:
  92. * Minimum Base Address
  93. * Maximum Base Address
  94. * Address Base Alignment
  95. * Range Length
  96. */
  97. {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum),
  98. AML_OFFSET(memory32.minimum),
  99. 4}
  100. };
  101. /*******************************************************************************
  102. *
  103. * acpi_rs_convert_fixed_memory32
  104. *
  105. ******************************************************************************/
  106. struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[4] = {
  107. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32,
  108. ACPI_RS_SIZE(struct acpi_resource_fixed_memory32),
  109. ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_memory32)},
  110. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32,
  111. sizeof(struct aml_resource_fixed_memory32),
  112. 0},
  113. /* Read/Write bit */
  114. {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect),
  115. AML_OFFSET(fixed_memory32.flags),
  116. 0},
  117. /*
  118. * These fields are contiguous in both the source and destination:
  119. * Base Address
  120. * Range Length
  121. */
  122. {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address),
  123. AML_OFFSET(fixed_memory32.address),
  124. 2}
  125. };
  126. /*******************************************************************************
  127. *
  128. * acpi_rs_get_vendor_small
  129. *
  130. ******************************************************************************/
  131. struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = {
  132. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
  133. ACPI_RS_SIZE(struct acpi_resource_vendor),
  134. ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_small)},
  135. /* Length of the vendor data (byte count) */
  136. {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
  137. 0,
  138. sizeof(u8)},
  139. /* Vendor data */
  140. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
  141. sizeof(struct aml_resource_small_header),
  142. 0}
  143. };
  144. /*******************************************************************************
  145. *
  146. * acpi_rs_get_vendor_large
  147. *
  148. ******************************************************************************/
  149. struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = {
  150. {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
  151. ACPI_RS_SIZE(struct acpi_resource_vendor),
  152. ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large)},
  153. /* Length of the vendor data (byte count) */
  154. {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
  155. 0,
  156. sizeof(u8)},
  157. /* Vendor data */
  158. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
  159. sizeof(struct aml_resource_large_header),
  160. 0}
  161. };
  162. /*******************************************************************************
  163. *
  164. * acpi_rs_set_vendor
  165. *
  166. ******************************************************************************/
  167. struct acpi_rsconvert_info acpi_rs_set_vendor[7] = {
  168. /* Default is a small vendor descriptor */
  169. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL,
  170. sizeof(struct aml_resource_small_header),
  171. ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)},
  172. /* Get the length and copy the data */
  173. {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
  174. 0,
  175. 0},
  176. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
  177. sizeof(struct aml_resource_small_header),
  178. 0},
  179. /*
  180. * All done if the Vendor byte length is 7 or less, meaning that it will
  181. * fit within a small descriptor
  182. */
  183. {ACPI_RSC_EXIT_LE, 0, 0, 7},
  184. /* Must create a large vendor descriptor */
  185. {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE,
  186. sizeof(struct aml_resource_large_header),
  187. 0},
  188. {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
  189. 0,
  190. 0},
  191. {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
  192. sizeof(struct aml_resource_large_header),
  193. 0}
  194. };