Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /****************************************************************************** |
2 | * | |
3 | * Module Name: utglobal - Global variables for the ACPI subsystem | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | /* | |
77848130 | 8 | * Copyright (C) 2000 - 2012, Intel Corp. |
1da177e4 LT |
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 DEFINE_ACPI_GLOBALS | |
45 | ||
214f2c90 | 46 | #include <linux/export.h> |
1da177e4 | 47 | #include <acpi/acpi.h> |
e2f7a777 | 48 | #include "accommon.h" |
1da177e4 LT |
49 | |
50 | #define _COMPONENT ACPI_UTILITIES | |
e97d6bf1 | 51 | ACPI_MODULE_NAME("utglobal") |
1da177e4 | 52 | |
44f6c012 | 53 | /******************************************************************************* |
1da177e4 LT |
54 | * |
55 | * Static global variable initialization. | |
56 | * | |
57 | ******************************************************************************/ | |
1da177e4 LT |
58 | /* |
59 | * We want the debug switches statically initialized so they | |
60 | * are already set when the debugger is entered. | |
61 | */ | |
1da177e4 | 62 | /* Debug switch - level and trace mask */ |
4be44fcd | 63 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; |
1da177e4 LT |
64 | |
65 | /* Debug switch - layer (component) mask */ | |
66 | ||
e76f4276 | 67 | u32 acpi_dbg_layer = 0; |
4be44fcd | 68 | u32 acpi_gbl_nesting_level = 0; |
1da177e4 LT |
69 | |
70 | /* Debugger globals */ | |
71 | ||
4be44fcd LB |
72 | u8 acpi_gbl_db_terminate_threads = FALSE; |
73 | u8 acpi_gbl_abort_method = FALSE; | |
74 | u8 acpi_gbl_method_executing = FALSE; | |
1da177e4 LT |
75 | |
76 | /* System flags */ | |
77 | ||
4be44fcd | 78 | u32 acpi_gbl_startup_flags = 0; |
1da177e4 LT |
79 | |
80 | /* System starts uninitialized */ | |
81 | ||
4be44fcd | 82 | u8 acpi_gbl_shutdown = TRUE; |
1da177e4 | 83 | |
4be44fcd | 84 | const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { |
1da177e4 LT |
85 | "\\_S0_", |
86 | "\\_S1_", | |
87 | "\\_S2_", | |
88 | "\\_S3_", | |
89 | "\\_S4_", | |
90 | "\\_S5_" | |
91 | }; | |
92 | ||
15b8dd53 BM |
93 | const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = { |
94 | "_S0W", | |
95 | "_S1W", | |
96 | "_S2W", | |
97 | "_S3W", | |
98 | "_S4W" | |
99 | }; | |
100 | ||
101 | const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = { | |
1da177e4 LT |
102 | "_S1D", |
103 | "_S2D", | |
104 | "_S3D", | |
105 | "_S4D" | |
106 | }; | |
107 | ||
84fb2c97 BM |
108 | /******************************************************************************* |
109 | * | |
110 | * Namespace globals | |
111 | * | |
112 | ******************************************************************************/ | |
1da177e4 LT |
113 | /* |
114 | * Predefined ACPI Names (Built-in to the Interpreter) | |
115 | * | |
116 | * NOTES: | |
117 | * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run | |
118 | * during the initialization sequence. | |
119 | * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to | |
81256669 BM |
120 | * perform a Notify() operation on it. 09/2010: Changed to type Device. |
121 | * This still allows notifies, but does not confuse host code that | |
122 | * searches for valid thermal_zone objects. | |
1da177e4 | 123 | */ |
0897831b BM |
124 | const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { |
125 | {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, | |
126 | {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, | |
127 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, | |
128 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, | |
81256669 | 129 | {"_TZ_", ACPI_TYPE_DEVICE, NULL}, |
0897831b BM |
130 | {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, |
131 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, | |
132 | {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, | |
1da177e4 LT |
133 | |
134 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) | |
0897831b | 135 | {"_OSI", ACPI_TYPE_METHOD, (char *)1}, |
1da177e4 | 136 | #endif |
1da177e4 | 137 | |
44f6c012 RM |
138 | /* Table terminator */ |
139 | ||
0897831b | 140 | {NULL, ACPI_TYPE_ANY, NULL} |
44f6c012 | 141 | }; |
1da177e4 | 142 | |
33620c54 | 143 | #if (!ACPI_REDUCED_HARDWARE) |
1da177e4 LT |
144 | /****************************************************************************** |
145 | * | |
146 | * Event and Hardware globals | |
147 | * | |
148 | ******************************************************************************/ | |
149 | ||
4be44fcd | 150 | struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = { |
1da177e4 LT |
151 | /* Name Parent Register Register Bit Position Register Bit Mask */ |
152 | ||
4be44fcd LB |
153 | /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, |
154 | ACPI_BITPOSITION_TIMER_STATUS, | |
155 | ACPI_BITMASK_TIMER_STATUS}, | |
156 | /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, | |
157 | ACPI_BITPOSITION_BUS_MASTER_STATUS, | |
158 | ACPI_BITMASK_BUS_MASTER_STATUS}, | |
159 | /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, | |
160 | ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, | |
161 | ACPI_BITMASK_GLOBAL_LOCK_STATUS}, | |
162 | /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, | |
163 | ACPI_BITPOSITION_POWER_BUTTON_STATUS, | |
164 | ACPI_BITMASK_POWER_BUTTON_STATUS}, | |
165 | /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, | |
166 | ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, | |
167 | ACPI_BITMASK_SLEEP_BUTTON_STATUS}, | |
168 | /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, | |
169 | ACPI_BITPOSITION_RT_CLOCK_STATUS, | |
170 | ACPI_BITMASK_RT_CLOCK_STATUS}, | |
171 | /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, | |
172 | ACPI_BITPOSITION_WAKE_STATUS, | |
173 | ACPI_BITMASK_WAKE_STATUS}, | |
174 | /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, | |
175 | ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, | |
176 | ACPI_BITMASK_PCIEXP_WAKE_STATUS}, | |
177 | ||
178 | /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, | |
179 | ACPI_BITPOSITION_TIMER_ENABLE, | |
180 | ACPI_BITMASK_TIMER_ENABLE}, | |
181 | /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, | |
182 | ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, | |
183 | ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, | |
184 | /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, | |
185 | ACPI_BITPOSITION_POWER_BUTTON_ENABLE, | |
186 | ACPI_BITMASK_POWER_BUTTON_ENABLE}, | |
187 | /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, | |
188 | ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, | |
189 | ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, | |
190 | /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, | |
191 | ACPI_BITPOSITION_RT_CLOCK_ENABLE, | |
192 | ACPI_BITMASK_RT_CLOCK_ENABLE}, | |
4be44fcd LB |
193 | /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, |
194 | ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, | |
195 | ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, | |
196 | ||
197 | /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, | |
198 | ACPI_BITPOSITION_SCI_ENABLE, | |
199 | ACPI_BITMASK_SCI_ENABLE}, | |
200 | /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, | |
201 | ACPI_BITPOSITION_BUS_MASTER_RLD, | |
202 | ACPI_BITMASK_BUS_MASTER_RLD}, | |
203 | /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, | |
204 | ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, | |
205 | ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, | |
82d79b86 BM |
206 | /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL, |
207 | ACPI_BITPOSITION_SLEEP_TYPE, | |
208 | ACPI_BITMASK_SLEEP_TYPE}, | |
4be44fcd LB |
209 | /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, |
210 | ACPI_BITPOSITION_SLEEP_ENABLE, | |
211 | ACPI_BITMASK_SLEEP_ENABLE}, | |
212 | ||
213 | /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, | |
214 | ACPI_BITPOSITION_ARB_DISABLE, | |
215 | ACPI_BITMASK_ARB_DISABLE} | |
1da177e4 LT |
216 | }; |
217 | ||
4be44fcd LB |
218 | struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = { |
219 | /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, | |
220 | ACPI_BITREG_TIMER_ENABLE, | |
221 | ACPI_BITMASK_TIMER_STATUS, | |
222 | ACPI_BITMASK_TIMER_ENABLE}, | |
223 | /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, | |
224 | ACPI_BITREG_GLOBAL_LOCK_ENABLE, | |
225 | ACPI_BITMASK_GLOBAL_LOCK_STATUS, | |
226 | ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, | |
227 | /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, | |
228 | ACPI_BITREG_POWER_BUTTON_ENABLE, | |
229 | ACPI_BITMASK_POWER_BUTTON_STATUS, | |
230 | ACPI_BITMASK_POWER_BUTTON_ENABLE}, | |
231 | /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, | |
232 | ACPI_BITREG_SLEEP_BUTTON_ENABLE, | |
233 | ACPI_BITMASK_SLEEP_BUTTON_STATUS, | |
234 | ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, | |
235 | /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, | |
236 | ACPI_BITREG_RT_CLOCK_ENABLE, | |
237 | ACPI_BITMASK_RT_CLOCK_STATUS, | |
238 | ACPI_BITMASK_RT_CLOCK_ENABLE}, | |
1da177e4 | 239 | }; |
33620c54 | 240 | #endif /* !ACPI_REDUCED_HARDWARE */ |
1da177e4 | 241 | |
44f6c012 | 242 | /******************************************************************************* |
1da177e4 LT |
243 | * |
244 | * FUNCTION: acpi_ut_init_globals | |
245 | * | |
44f6c012 RM |
246 | * PARAMETERS: None |
247 | * | |
b417d40b | 248 | * RETURN: Status |
1da177e4 | 249 | * |
cf48958e BM |
250 | * DESCRIPTION: Initialize ACPICA globals. All globals that require specific |
251 | * initialization should be initialized here. This allows for | |
252 | * a warm restart. | |
1da177e4 | 253 | * |
44f6c012 | 254 | ******************************************************************************/ |
1da177e4 | 255 | |
b417d40b | 256 | acpi_status acpi_ut_init_globals(void) |
1da177e4 | 257 | { |
4be44fcd LB |
258 | acpi_status status; |
259 | u32 i; | |
1da177e4 | 260 | |
b229cf92 | 261 | ACPI_FUNCTION_TRACE(ut_init_globals); |
1da177e4 | 262 | |
73459f73 RM |
263 | /* Create all memory caches */ |
264 | ||
4be44fcd LB |
265 | status = acpi_ut_create_caches(); |
266 | if (ACPI_FAILURE(status)) { | |
b417d40b | 267 | return_ACPI_STATUS(status); |
73459f73 | 268 | } |
1da177e4 | 269 | |
f654c0fe LM |
270 | /* Address Range lists */ |
271 | ||
272 | for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) { | |
273 | acpi_gbl_address_range_list[i] = NULL; | |
274 | } | |
275 | ||
1da177e4 LT |
276 | /* Mutex locked flags */ |
277 | ||
4c90ece2 | 278 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
4be44fcd LB |
279 | acpi_gbl_mutex_info[i].mutex = NULL; |
280 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; | |
281 | acpi_gbl_mutex_info[i].use_count = 0; | |
1da177e4 LT |
282 | } |
283 | ||
28f55ebc BM |
284 | for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) { |
285 | acpi_gbl_owner_id_mask[i] = 0; | |
286 | } | |
ec41f193 | 287 | |
ba494bee | 288 | /* Last owner_ID is never valid */ |
ec41f193 BM |
289 | |
290 | acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; | |
28f55ebc | 291 | |
33620c54 BM |
292 | #if (!ACPI_REDUCED_HARDWARE) |
293 | ||
1da177e4 LT |
294 | /* GPE support */ |
295 | ||
4be44fcd LB |
296 | acpi_gbl_gpe_xrupt_list_head = NULL; |
297 | acpi_gbl_gpe_fadt_blocks[0] = NULL; | |
298 | acpi_gbl_gpe_fadt_blocks[1] = NULL; | |
e97d6bf1 | 299 | acpi_current_gpe_count = 0; |
3a37898d | 300 | acpi_gbl_all_gpes_initialized = FALSE; |
1da177e4 | 301 | |
33620c54 BM |
302 | acpi_gbl_global_event_handler = NULL; |
303 | ||
304 | #endif /* !ACPI_REDUCED_HARDWARE */ | |
305 | ||
3e08e2d2 | 306 | /* Global handlers */ |
1da177e4 | 307 | |
86ed4bc8 BM |
308 | acpi_gbl_global_notify[0].handler = NULL; |
309 | acpi_gbl_global_notify[1].handler = NULL; | |
4be44fcd LB |
310 | acpi_gbl_exception_handler = NULL; |
311 | acpi_gbl_init_handler = NULL; | |
3e08e2d2 | 312 | acpi_gbl_table_handler = NULL; |
b0ed7a91 | 313 | acpi_gbl_interface_handler = NULL; |
1da177e4 | 314 | |
1da177e4 LT |
315 | /* Global Lock support */ |
316 | ||
967440e3 | 317 | acpi_gbl_global_lock_semaphore = NULL; |
c81da666 | 318 | acpi_gbl_global_lock_mutex = NULL; |
4be44fcd | 319 | acpi_gbl_global_lock_acquired = FALSE; |
4be44fcd | 320 | acpi_gbl_global_lock_handle = 0; |
009c4cbe | 321 | acpi_gbl_global_lock_present = FALSE; |
1da177e4 LT |
322 | |
323 | /* Miscellaneous variables */ | |
324 | ||
43323cb4 | 325 | acpi_gbl_DSDT = NULL; |
4be44fcd LB |
326 | acpi_gbl_cm_single_step = FALSE; |
327 | acpi_gbl_db_terminate_threads = FALSE; | |
328 | acpi_gbl_shutdown = FALSE; | |
329 | acpi_gbl_ns_lookup_count = 0; | |
330 | acpi_gbl_ps_find_count = 0; | |
331 | acpi_gbl_acpi_hardware_present = TRUE; | |
28f55ebc BM |
332 | acpi_gbl_last_owner_id_index = 0; |
333 | acpi_gbl_next_owner_id_offset = 0; | |
50eca3eb BM |
334 | acpi_gbl_trace_method_name = 0; |
335 | acpi_gbl_trace_dbg_level = 0; | |
336 | acpi_gbl_trace_dbg_layer = 0; | |
4be44fcd LB |
337 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; |
338 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; | |
7f071903 | 339 | acpi_gbl_osi_data = 0; |
b0ed7a91 | 340 | acpi_gbl_osi_mutex = NULL; |
ef09c4f5 | 341 | acpi_gbl_reg_methods_executed = FALSE; |
1da177e4 LT |
342 | |
343 | /* Hardware oriented */ | |
344 | ||
4be44fcd LB |
345 | acpi_gbl_events_initialized = FALSE; |
346 | acpi_gbl_system_awake_and_running = TRUE; | |
1da177e4 LT |
347 | |
348 | /* Namespace */ | |
349 | ||
7f0c826a | 350 | acpi_gbl_module_code_list = NULL; |
4be44fcd | 351 | acpi_gbl_root_node = NULL; |
1da177e4 | 352 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; |
61686124 | 353 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; |
4be44fcd | 354 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; |
c45b5c09 | 355 | acpi_gbl_root_node_struct.parent = NULL; |
4be44fcd LB |
356 | acpi_gbl_root_node_struct.child = NULL; |
357 | acpi_gbl_root_node_struct.peer = NULL; | |
358 | acpi_gbl_root_node_struct.object = NULL; | |
1da177e4 LT |
359 | |
360 | #ifdef ACPI_DEBUG_OUTPUT | |
1d18c058 | 361 | acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); |
1da177e4 LT |
362 | #endif |
363 | ||
d41eb99b BM |
364 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
365 | acpi_gbl_display_final_mem_stats = FALSE; | |
366 | #endif | |
367 | ||
b417d40b | 368 | return_ACPI_STATUS(AE_OK); |
1da177e4 | 369 | } |
8313524a | 370 | |
e97d6bf1 | 371 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) |
8313524a | 372 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
1044f1f6 | 373 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |
e97d6bf1 | 374 | ACPI_EXPORT_SYMBOL(acpi_current_gpe_count) |