i2c-eg20t: change timeout value 50msec to 1000msec
[zen-stable.git] / drivers / acpi / acpica / utglobal.c
blob4153584cf526a81bb3ab99bd3f5f59a37fb19f42
1 /******************************************************************************
3 * Module Name: utglobal - Global variables for the ACPI subsystem
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
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.
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.
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.
44 #define DEFINE_ACPI_GLOBALS
46 #include <linux/export.h>
47 #include <acpi/acpi.h>
48 #include "accommon.h"
50 #define _COMPONENT ACPI_UTILITIES
51 ACPI_MODULE_NAME("utglobal")
53 /*******************************************************************************
55 * Static global variable initialization.
57 ******************************************************************************/
59 * We want the debug switches statically initialized so they
60 * are already set when the debugger is entered.
62 /* Debug switch - level and trace mask */
63 u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
65 /* Debug switch - layer (component) mask */
67 u32 acpi_dbg_layer = 0;
68 u32 acpi_gbl_nesting_level = 0;
70 /* Debugger globals */
72 u8 acpi_gbl_db_terminate_threads = FALSE;
73 u8 acpi_gbl_abort_method = FALSE;
74 u8 acpi_gbl_method_executing = FALSE;
76 /* System flags */
78 u32 acpi_gbl_startup_flags = 0;
80 /* System starts uninitialized */
82 u8 acpi_gbl_shutdown = TRUE;
84 const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
85 "\\_S0_",
86 "\\_S1_",
87 "\\_S2_",
88 "\\_S3_",
89 "\\_S4_",
90 "\\_S5_"
93 const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = {
94 "_S0W",
95 "_S1W",
96 "_S2W",
97 "_S3W",
98 "_S4W"
101 const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
102 "_S1D",
103 "_S2D",
104 "_S3D",
105 "_S4D"
108 /*******************************************************************************
110 * Namespace globals
112 ******************************************************************************/
114 * Predefined ACPI Names (Built-in to the Interpreter)
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
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.
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},
129 {"_TZ_", ACPI_TYPE_DEVICE, NULL},
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},
134 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
135 {"_OSI", ACPI_TYPE_METHOD, (char *)1},
136 #endif
138 /* Table terminator */
140 {NULL, ACPI_TYPE_ANY, NULL}
143 /******************************************************************************
145 * Event and Hardware globals
147 ******************************************************************************/
149 struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
150 /* Name Parent Register Register Bit Position Register Bit Mask */
152 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
153 ACPI_BITPOSITION_TIMER_STATUS,
154 ACPI_BITMASK_TIMER_STATUS},
155 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
156 ACPI_BITPOSITION_BUS_MASTER_STATUS,
157 ACPI_BITMASK_BUS_MASTER_STATUS},
158 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
159 ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
160 ACPI_BITMASK_GLOBAL_LOCK_STATUS},
161 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
162 ACPI_BITPOSITION_POWER_BUTTON_STATUS,
163 ACPI_BITMASK_POWER_BUTTON_STATUS},
164 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
165 ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
166 ACPI_BITMASK_SLEEP_BUTTON_STATUS},
167 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
168 ACPI_BITPOSITION_RT_CLOCK_STATUS,
169 ACPI_BITMASK_RT_CLOCK_STATUS},
170 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
171 ACPI_BITPOSITION_WAKE_STATUS,
172 ACPI_BITMASK_WAKE_STATUS},
173 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
174 ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
175 ACPI_BITMASK_PCIEXP_WAKE_STATUS},
177 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
178 ACPI_BITPOSITION_TIMER_ENABLE,
179 ACPI_BITMASK_TIMER_ENABLE},
180 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
181 ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
182 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
183 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
184 ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
185 ACPI_BITMASK_POWER_BUTTON_ENABLE},
186 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
187 ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
188 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
189 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
190 ACPI_BITPOSITION_RT_CLOCK_ENABLE,
191 ACPI_BITMASK_RT_CLOCK_ENABLE},
192 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE,
193 ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
194 ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
196 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
197 ACPI_BITPOSITION_SCI_ENABLE,
198 ACPI_BITMASK_SCI_ENABLE},
199 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL,
200 ACPI_BITPOSITION_BUS_MASTER_RLD,
201 ACPI_BITMASK_BUS_MASTER_RLD},
202 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
203 ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
204 ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
205 /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL,
206 ACPI_BITPOSITION_SLEEP_TYPE,
207 ACPI_BITMASK_SLEEP_TYPE},
208 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
209 ACPI_BITPOSITION_SLEEP_ENABLE,
210 ACPI_BITMASK_SLEEP_ENABLE},
212 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL,
213 ACPI_BITPOSITION_ARB_DISABLE,
214 ACPI_BITMASK_ARB_DISABLE}
217 struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
218 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS,
219 ACPI_BITREG_TIMER_ENABLE,
220 ACPI_BITMASK_TIMER_STATUS,
221 ACPI_BITMASK_TIMER_ENABLE},
222 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
223 ACPI_BITREG_GLOBAL_LOCK_ENABLE,
224 ACPI_BITMASK_GLOBAL_LOCK_STATUS,
225 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
226 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS,
227 ACPI_BITREG_POWER_BUTTON_ENABLE,
228 ACPI_BITMASK_POWER_BUTTON_STATUS,
229 ACPI_BITMASK_POWER_BUTTON_ENABLE},
230 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
231 ACPI_BITREG_SLEEP_BUTTON_ENABLE,
232 ACPI_BITMASK_SLEEP_BUTTON_STATUS,
233 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
234 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS,
235 ACPI_BITREG_RT_CLOCK_ENABLE,
236 ACPI_BITMASK_RT_CLOCK_STATUS,
237 ACPI_BITMASK_RT_CLOCK_ENABLE},
240 /*******************************************************************************
242 * FUNCTION: acpi_ut_init_globals
244 * PARAMETERS: None
246 * RETURN: Status
248 * DESCRIPTION: Init library globals. All globals that require specific
249 * initialization should be initialized here!
251 ******************************************************************************/
253 acpi_status acpi_ut_init_globals(void)
255 acpi_status status;
256 u32 i;
258 ACPI_FUNCTION_TRACE(ut_init_globals);
260 /* Create all memory caches */
262 status = acpi_ut_create_caches();
263 if (ACPI_FAILURE(status)) {
264 return_ACPI_STATUS(status);
267 /* Address Range lists */
269 for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
270 acpi_gbl_address_range_list[i] = NULL;
273 /* Mutex locked flags */
275 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
276 acpi_gbl_mutex_info[i].mutex = NULL;
277 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
278 acpi_gbl_mutex_info[i].use_count = 0;
281 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
282 acpi_gbl_owner_id_mask[i] = 0;
285 /* Last owner_iD is never valid */
287 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
289 /* GPE support */
291 acpi_gbl_gpe_xrupt_list_head = NULL;
292 acpi_gbl_gpe_fadt_blocks[0] = NULL;
293 acpi_gbl_gpe_fadt_blocks[1] = NULL;
294 acpi_current_gpe_count = 0;
295 acpi_gbl_all_gpes_initialized = FALSE;
297 /* Global handlers */
299 acpi_gbl_system_notify.handler = NULL;
300 acpi_gbl_device_notify.handler = NULL;
301 acpi_gbl_exception_handler = NULL;
302 acpi_gbl_init_handler = NULL;
303 acpi_gbl_table_handler = NULL;
304 acpi_gbl_interface_handler = NULL;
305 acpi_gbl_global_event_handler = NULL;
307 /* Global Lock support */
309 acpi_gbl_global_lock_semaphore = NULL;
310 acpi_gbl_global_lock_mutex = NULL;
311 acpi_gbl_global_lock_acquired = FALSE;
312 acpi_gbl_global_lock_handle = 0;
313 acpi_gbl_global_lock_present = FALSE;
315 /* Miscellaneous variables */
317 acpi_gbl_DSDT = NULL;
318 acpi_gbl_cm_single_step = FALSE;
319 acpi_gbl_db_terminate_threads = FALSE;
320 acpi_gbl_shutdown = FALSE;
321 acpi_gbl_ns_lookup_count = 0;
322 acpi_gbl_ps_find_count = 0;
323 acpi_gbl_acpi_hardware_present = TRUE;
324 acpi_gbl_last_owner_id_index = 0;
325 acpi_gbl_next_owner_id_offset = 0;
326 acpi_gbl_trace_method_name = 0;
327 acpi_gbl_trace_dbg_level = 0;
328 acpi_gbl_trace_dbg_layer = 0;
329 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
330 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
331 acpi_gbl_osi_data = 0;
332 acpi_gbl_osi_mutex = NULL;
333 acpi_gbl_reg_methods_executed = FALSE;
335 /* Hardware oriented */
337 acpi_gbl_events_initialized = FALSE;
338 acpi_gbl_system_awake_and_running = TRUE;
340 /* Namespace */
342 acpi_gbl_module_code_list = NULL;
343 acpi_gbl_root_node = NULL;
344 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
345 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
346 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
347 acpi_gbl_root_node_struct.parent = NULL;
348 acpi_gbl_root_node_struct.child = NULL;
349 acpi_gbl_root_node_struct.peer = NULL;
350 acpi_gbl_root_node_struct.object = NULL;
352 #ifdef ACPI_DEBUG_OUTPUT
353 acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
354 #endif
356 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
357 acpi_gbl_display_final_mem_stats = FALSE;
358 #endif
360 return_ACPI_STATUS(AE_OK);
363 ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
364 ACPI_EXPORT_SYMBOL(acpi_dbg_level)
365 ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
366 ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)