[ACPICA]
[reactos.git] / reactos / drivers / bus / acpi / acpica / utilities / utglobal.c
1 /******************************************************************************
2 *
3 * Module Name: utglobal - Global variables for the ACPI subsystem
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2016, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44 #define EXPORT_ACPI_INTERFACES
45 #define DEFINE_ACPI_GLOBALS
46
47 #include "acpi.h"
48 #include "accommon.h"
49
50 #define _COMPONENT ACPI_UTILITIES
51 ACPI_MODULE_NAME ("utglobal")
52
53
54 /*******************************************************************************
55 *
56 * Static global variable initialization.
57 *
58 ******************************************************************************/
59
60 /* Various state name strings */
61
62 const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] =
63 {
64 "\\_S0_",
65 "\\_S1_",
66 "\\_S2_",
67 "\\_S3_",
68 "\\_S4_",
69 "\\_S5_"
70 };
71
72 const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS] =
73 {
74 "_S0W",
75 "_S1W",
76 "_S2W",
77 "_S3W",
78 "_S4W"
79 };
80
81 const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] =
82 {
83 "_S1D",
84 "_S2D",
85 "_S3D",
86 "_S4D"
87 };
88
89
90 /* Hex-to-ascii */
91
92 const char AcpiGbl_LowerHexDigits[] = "0123456789abcdef";
93 const char AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF";
94
95
96 /*******************************************************************************
97 *
98 * Namespace globals
99 *
100 ******************************************************************************/
101
102 /*
103 * Predefined ACPI Names (Built-in to the Interpreter)
104 *
105 * NOTES:
106 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
107 * during the initialization sequence.
108 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
109 * perform a Notify() operation on it. 09/2010: Changed to type Device.
110 * This still allows notifies, but does not confuse host code that
111 * searches for valid ThermalZone objects.
112 */
113 const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
114 {
115 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
116 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
117 {"_SB_", ACPI_TYPE_DEVICE, NULL},
118 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
119 {"_TZ_", ACPI_TYPE_DEVICE, NULL},
120 /*
121 * March, 2015:
122 * The _REV object is in the process of being deprecated, because
123 * other ACPI implementations permanently return 2. Thus, it
124 * has little or no value. Return 2 for compatibility with
125 * other ACPI implementations.
126 */
127 {"_REV", ACPI_TYPE_INTEGER, ACPI_CAST_PTR (char, 2)},
128 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
129 {"_GL_", ACPI_TYPE_MUTEX, ACPI_CAST_PTR (char, 1)},
130
131 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
132 {"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR (char, 1)},
133 #endif
134
135 /* Table terminator */
136
137 {NULL, ACPI_TYPE_ANY, NULL}
138 };
139
140
141 #if (!ACPI_REDUCED_HARDWARE)
142 /******************************************************************************
143 *
144 * Event and Hardware globals
145 *
146 ******************************************************************************/
147
148 ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] =
149 {
150 /* Name Parent Register Register Bit Position Register Bit Mask */
151
152 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_TIMER_STATUS, ACPI_BITMASK_TIMER_STATUS},
153 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_BUS_MASTER_STATUS, ACPI_BITMASK_BUS_MASTER_STATUS},
154 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_STATUS},
155 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_STATUS},
156 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_STATUS},
157 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_STATUS},
158 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_WAKE_STATUS, ACPI_BITMASK_WAKE_STATUS},
159 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, ACPI_BITMASK_PCIEXP_WAKE_STATUS},
160
161 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_TIMER_ENABLE, ACPI_BITMASK_TIMER_ENABLE},
162 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
163 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_ENABLE},
164 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
165 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE},
166 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
167
168 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE},
169 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD},
170 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
171 /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE, ACPI_BITMASK_SLEEP_TYPE},
172 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_ENABLE, ACPI_BITMASK_SLEEP_ENABLE},
173
174 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, ACPI_BITPOSITION_ARB_DISABLE, ACPI_BITMASK_ARB_DISABLE}
175 };
176
177
178 ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
179 {
180 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, ACPI_BITREG_TIMER_ENABLE, ACPI_BITMASK_TIMER_STATUS, ACPI_BITMASK_TIMER_ENABLE},
181 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, ACPI_BITREG_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
182 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE},
183 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
184 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE},
185 };
186 #endif /* !ACPI_REDUCED_HARDWARE */
187
188
189 #if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
190
191 /* ToPld macro: compile/disassemble strings */
192
193 const char *AcpiGbl_PldPanelList[] =
194 {
195 "TOP",
196 "BOTTOM",
197 "LEFT",
198 "RIGHT",
199 "FRONT",
200 "BACK",
201 "UNKNOWN",
202 NULL
203 };
204
205 const char *AcpiGbl_PldVerticalPositionList[] =
206 {
207 "UPPER",
208 "CENTER",
209 "LOWER",
210 NULL
211 };
212
213 const char *AcpiGbl_PldHorizontalPositionList[] =
214 {
215 "LEFT",
216 "CENTER",
217 "RIGHT",
218 NULL
219 };
220
221 const char *AcpiGbl_PldShapeList[] =
222 {
223 "ROUND",
224 "OVAL",
225 "SQUARE",
226 "VERTICALRECTANGLE",
227 "HORIZONTALRECTANGLE",
228 "VERTICALTRAPEZOID",
229 "HORIZONTALTRAPEZOID",
230 "UNKNOWN",
231 "CHAMFERED",
232 NULL
233 };
234 #endif
235
236
237 /* Public globals */
238
239 ACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
240 ACPI_EXPORT_SYMBOL (AcpiDbgLevel)
241 ACPI_EXPORT_SYMBOL (AcpiDbgLayer)
242 ACPI_EXPORT_SYMBOL (AcpiGpeCount)
243 ACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount)