utglobal.c 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /******************************************************************************
  2. *
  3. * Module Name: utglobal - Global variables for the ACPI subsystem
  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. #define EXPORT_ACPI_INTERFACES
  43. #define DEFINE_ACPI_GLOBALS
  44. #include <acpi/acpi.h>
  45. #include "accommon.h"
  46. #define _COMPONENT ACPI_UTILITIES
  47. ACPI_MODULE_NAME("utglobal")
  48. /*******************************************************************************
  49. *
  50. * Static global variable initialization.
  51. *
  52. ******************************************************************************/
  53. /* Various state name strings */
  54. const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
  55. "\\_S0_",
  56. "\\_S1_",
  57. "\\_S2_",
  58. "\\_S3_",
  59. "\\_S4_",
  60. "\\_S5_"
  61. };
  62. const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = {
  63. "_S0W",
  64. "_S1W",
  65. "_S2W",
  66. "_S3W",
  67. "_S4W"
  68. };
  69. const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
  70. "_S1D",
  71. "_S2D",
  72. "_S3D",
  73. "_S4D"
  74. };
  75. /*******************************************************************************
  76. *
  77. * Namespace globals
  78. *
  79. ******************************************************************************/
  80. /*
  81. * Predefined ACPI Names (Built-in to the Interpreter)
  82. *
  83. * NOTES:
  84. * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
  85. * during the initialization sequence.
  86. * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
  87. * perform a Notify() operation on it. 09/2010: Changed to type Device.
  88. * This still allows notifies, but does not confuse host code that
  89. * searches for valid thermal_zone objects.
  90. */
  91. const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
  92. {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
  93. {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
  94. {"_SB_", ACPI_TYPE_DEVICE, NULL},
  95. {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
  96. {"_TZ_", ACPI_TYPE_DEVICE, NULL},
  97. /*
  98. * March, 2015:
  99. * The _REV object is in the process of being deprecated, because
  100. * other ACPI implementations permanently return 2. Thus, it
  101. * has little or no value. Return 2 for compatibility with
  102. * other ACPI implementations.
  103. */
  104. {"_REV", ACPI_TYPE_INTEGER, ACPI_CAST_PTR(char, 2)},
  105. {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
  106. {"_GL_", ACPI_TYPE_MUTEX, ACPI_CAST_PTR(char, 1)},
  107. #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
  108. {"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR(char, 1)},
  109. #endif
  110. /* Table terminator */
  111. {NULL, ACPI_TYPE_ANY, NULL}
  112. };
  113. #if (!ACPI_REDUCED_HARDWARE)
  114. /******************************************************************************
  115. *
  116. * Event and Hardware globals
  117. *
  118. ******************************************************************************/
  119. struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
  120. /* Name Parent Register Register Bit Position Register Bit Mask */
  121. /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
  122. ACPI_BITPOSITION_TIMER_STATUS,
  123. ACPI_BITMASK_TIMER_STATUS},
  124. /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
  125. ACPI_BITPOSITION_BUS_MASTER_STATUS,
  126. ACPI_BITMASK_BUS_MASTER_STATUS},
  127. /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
  128. ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
  129. ACPI_BITMASK_GLOBAL_LOCK_STATUS},
  130. /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
  131. ACPI_BITPOSITION_POWER_BUTTON_STATUS,
  132. ACPI_BITMASK_POWER_BUTTON_STATUS},
  133. /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
  134. ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
  135. ACPI_BITMASK_SLEEP_BUTTON_STATUS},
  136. /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
  137. ACPI_BITPOSITION_RT_CLOCK_STATUS,
  138. ACPI_BITMASK_RT_CLOCK_STATUS},
  139. /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
  140. ACPI_BITPOSITION_WAKE_STATUS,
  141. ACPI_BITMASK_WAKE_STATUS},
  142. /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
  143. ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
  144. ACPI_BITMASK_PCIEXP_WAKE_STATUS},
  145. /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
  146. ACPI_BITPOSITION_TIMER_ENABLE,
  147. ACPI_BITMASK_TIMER_ENABLE},
  148. /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
  149. ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
  150. ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
  151. /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
  152. ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
  153. ACPI_BITMASK_POWER_BUTTON_ENABLE},
  154. /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
  155. ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
  156. ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
  157. /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
  158. ACPI_BITPOSITION_RT_CLOCK_ENABLE,
  159. ACPI_BITMASK_RT_CLOCK_ENABLE},
  160. /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE,
  161. ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
  162. ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
  163. /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
  164. ACPI_BITPOSITION_SCI_ENABLE,
  165. ACPI_BITMASK_SCI_ENABLE},
  166. /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL,
  167. ACPI_BITPOSITION_BUS_MASTER_RLD,
  168. ACPI_BITMASK_BUS_MASTER_RLD},
  169. /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
  170. ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
  171. ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
  172. /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL,
  173. ACPI_BITPOSITION_SLEEP_TYPE,
  174. ACPI_BITMASK_SLEEP_TYPE},
  175. /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
  176. ACPI_BITPOSITION_SLEEP_ENABLE,
  177. ACPI_BITMASK_SLEEP_ENABLE},
  178. /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL,
  179. ACPI_BITPOSITION_ARB_DISABLE,
  180. ACPI_BITMASK_ARB_DISABLE}
  181. };
  182. struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
  183. /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS,
  184. ACPI_BITREG_TIMER_ENABLE,
  185. ACPI_BITMASK_TIMER_STATUS,
  186. ACPI_BITMASK_TIMER_ENABLE},
  187. /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
  188. ACPI_BITREG_GLOBAL_LOCK_ENABLE,
  189. ACPI_BITMASK_GLOBAL_LOCK_STATUS,
  190. ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
  191. /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS,
  192. ACPI_BITREG_POWER_BUTTON_ENABLE,
  193. ACPI_BITMASK_POWER_BUTTON_STATUS,
  194. ACPI_BITMASK_POWER_BUTTON_ENABLE},
  195. /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
  196. ACPI_BITREG_SLEEP_BUTTON_ENABLE,
  197. ACPI_BITMASK_SLEEP_BUTTON_STATUS,
  198. ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
  199. /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS,
  200. ACPI_BITREG_RT_CLOCK_ENABLE,
  201. ACPI_BITMASK_RT_CLOCK_STATUS,
  202. ACPI_BITMASK_RT_CLOCK_ENABLE},
  203. };
  204. #endif /* !ACPI_REDUCED_HARDWARE */
  205. /* Public globals */
  206. ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
  207. ACPI_EXPORT_SYMBOL(acpi_dbg_level)
  208. ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
  209. ACPI_EXPORT_SYMBOL(acpi_gpe_count)
  210. ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)