1 /******************************************************************************
3 * Module Name: utglobal - Global variables for the ACPI subsystem
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2011, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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 <acpi/acpi.h>
49 #define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME("utglobal")
52 /*******************************************************************************
54 * Static global variable initialization.
56 ******************************************************************************/
58 * We want the debug switches statically initialized so they
59 * are already set when the debugger is entered.
61 /* Debug switch - level and trace mask */
62 u32 acpi_dbg_level
= ACPI_DEBUG_DEFAULT
;
64 /* Debug switch - layer (component) mask */
66 u32 acpi_dbg_layer
= 0;
67 u32 acpi_gbl_nesting_level
= 0;
69 /* Debugger globals */
71 u8 acpi_gbl_db_terminate_threads
= FALSE
;
72 u8 acpi_gbl_abort_method
= FALSE
;
73 u8 acpi_gbl_method_executing
= FALSE
;
77 u32 acpi_gbl_startup_flags
= 0;
79 /* System starts uninitialized */
81 u8 acpi_gbl_shutdown
= TRUE
;
83 const char *acpi_gbl_sleep_state_names
[ACPI_S_STATE_COUNT
] = {
92 const char *acpi_gbl_lowest_dstate_names
[ACPI_NUM_sx_w_METHODS
] = {
100 const char *acpi_gbl_highest_dstate_names
[ACPI_NUM_sx_d_METHODS
] = {
107 /*******************************************************************************
111 ******************************************************************************/
113 * Predefined ACPI Names (Built-in to the Interpreter)
116 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
117 * during the initialization sequence.
118 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
119 * perform a Notify() operation on it. 09/2010: Changed to type Device.
120 * This still allows notifies, but does not confuse host code that
121 * searches for valid thermal_zone objects.
123 const struct acpi_predefined_names acpi_gbl_pre_defined_names
[] = {
124 {"_GPE", ACPI_TYPE_LOCAL_SCOPE
, NULL
},
125 {"_PR_", ACPI_TYPE_LOCAL_SCOPE
, NULL
},
126 {"_SB_", ACPI_TYPE_DEVICE
, NULL
},
127 {"_SI_", ACPI_TYPE_LOCAL_SCOPE
, NULL
},
128 {"_TZ_", ACPI_TYPE_DEVICE
, NULL
},
129 {"_REV", ACPI_TYPE_INTEGER
, (char *)ACPI_CA_SUPPORT_LEVEL
},
130 {"_OS_", ACPI_TYPE_STRING
, ACPI_OS_NAME
},
131 {"_GL_", ACPI_TYPE_MUTEX
, (char *)1},
133 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
134 {"_OSI", ACPI_TYPE_METHOD
, (char *)1},
137 /* Table terminator */
139 {NULL
, ACPI_TYPE_ANY
, NULL
}
142 /******************************************************************************
144 * Event and Hardware globals
146 ******************************************************************************/
148 struct acpi_bit_register_info acpi_gbl_bit_register_info
[ACPI_NUM_BITREG
] = {
149 /* Name Parent Register Register Bit Position Register Bit Mask */
151 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS
,
152 ACPI_BITPOSITION_TIMER_STATUS
,
153 ACPI_BITMASK_TIMER_STATUS
},
154 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS
,
155 ACPI_BITPOSITION_BUS_MASTER_STATUS
,
156 ACPI_BITMASK_BUS_MASTER_STATUS
},
157 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS
,
158 ACPI_BITPOSITION_GLOBAL_LOCK_STATUS
,
159 ACPI_BITMASK_GLOBAL_LOCK_STATUS
},
160 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS
,
161 ACPI_BITPOSITION_POWER_BUTTON_STATUS
,
162 ACPI_BITMASK_POWER_BUTTON_STATUS
},
163 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS
,
164 ACPI_BITPOSITION_SLEEP_BUTTON_STATUS
,
165 ACPI_BITMASK_SLEEP_BUTTON_STATUS
},
166 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS
,
167 ACPI_BITPOSITION_RT_CLOCK_STATUS
,
168 ACPI_BITMASK_RT_CLOCK_STATUS
},
169 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS
,
170 ACPI_BITPOSITION_WAKE_STATUS
,
171 ACPI_BITMASK_WAKE_STATUS
},
172 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS
,
173 ACPI_BITPOSITION_PCIEXP_WAKE_STATUS
,
174 ACPI_BITMASK_PCIEXP_WAKE_STATUS
},
176 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE
,
177 ACPI_BITPOSITION_TIMER_ENABLE
,
178 ACPI_BITMASK_TIMER_ENABLE
},
179 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE
,
180 ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE
,
181 ACPI_BITMASK_GLOBAL_LOCK_ENABLE
},
182 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE
,
183 ACPI_BITPOSITION_POWER_BUTTON_ENABLE
,
184 ACPI_BITMASK_POWER_BUTTON_ENABLE
},
185 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE
,
186 ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE
,
187 ACPI_BITMASK_SLEEP_BUTTON_ENABLE
},
188 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE
,
189 ACPI_BITPOSITION_RT_CLOCK_ENABLE
,
190 ACPI_BITMASK_RT_CLOCK_ENABLE
},
191 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE
,
192 ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE
,
193 ACPI_BITMASK_PCIEXP_WAKE_DISABLE
},
195 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL
,
196 ACPI_BITPOSITION_SCI_ENABLE
,
197 ACPI_BITMASK_SCI_ENABLE
},
198 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL
,
199 ACPI_BITPOSITION_BUS_MASTER_RLD
,
200 ACPI_BITMASK_BUS_MASTER_RLD
},
201 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL
,
202 ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE
,
203 ACPI_BITMASK_GLOBAL_LOCK_RELEASE
},
204 /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL
,
205 ACPI_BITPOSITION_SLEEP_TYPE
,
206 ACPI_BITMASK_SLEEP_TYPE
},
207 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL
,
208 ACPI_BITPOSITION_SLEEP_ENABLE
,
209 ACPI_BITMASK_SLEEP_ENABLE
},
211 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL
,
212 ACPI_BITPOSITION_ARB_DISABLE
,
213 ACPI_BITMASK_ARB_DISABLE
}
216 struct acpi_fixed_event_info acpi_gbl_fixed_event_info
[ACPI_NUM_FIXED_EVENTS
] = {
217 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS
,
218 ACPI_BITREG_TIMER_ENABLE
,
219 ACPI_BITMASK_TIMER_STATUS
,
220 ACPI_BITMASK_TIMER_ENABLE
},
221 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS
,
222 ACPI_BITREG_GLOBAL_LOCK_ENABLE
,
223 ACPI_BITMASK_GLOBAL_LOCK_STATUS
,
224 ACPI_BITMASK_GLOBAL_LOCK_ENABLE
},
225 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS
,
226 ACPI_BITREG_POWER_BUTTON_ENABLE
,
227 ACPI_BITMASK_POWER_BUTTON_STATUS
,
228 ACPI_BITMASK_POWER_BUTTON_ENABLE
},
229 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS
,
230 ACPI_BITREG_SLEEP_BUTTON_ENABLE
,
231 ACPI_BITMASK_SLEEP_BUTTON_STATUS
,
232 ACPI_BITMASK_SLEEP_BUTTON_ENABLE
},
233 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS
,
234 ACPI_BITREG_RT_CLOCK_ENABLE
,
235 ACPI_BITMASK_RT_CLOCK_STATUS
,
236 ACPI_BITMASK_RT_CLOCK_ENABLE
},
239 /*******************************************************************************
241 * FUNCTION: acpi_ut_init_globals
247 * DESCRIPTION: Init library globals. All globals that require specific
248 * initialization should be initialized here!
250 ******************************************************************************/
252 acpi_status
acpi_ut_init_globals(void)
257 ACPI_FUNCTION_TRACE(ut_init_globals
);
259 /* Create all memory caches */
261 status
= acpi_ut_create_caches();
262 if (ACPI_FAILURE(status
)) {
263 return_ACPI_STATUS(status
);
266 /* Mutex locked flags */
268 for (i
= 0; i
< ACPI_NUM_MUTEX
; i
++) {
269 acpi_gbl_mutex_info
[i
].mutex
= NULL
;
270 acpi_gbl_mutex_info
[i
].thread_id
= ACPI_MUTEX_NOT_ACQUIRED
;
271 acpi_gbl_mutex_info
[i
].use_count
= 0;
274 for (i
= 0; i
< ACPI_NUM_OWNERID_MASKS
; i
++) {
275 acpi_gbl_owner_id_mask
[i
] = 0;
278 /* Last owner_iD is never valid */
280 acpi_gbl_owner_id_mask
[ACPI_NUM_OWNERID_MASKS
- 1] = 0x80000000;
284 acpi_gbl_gpe_xrupt_list_head
= NULL
;
285 acpi_gbl_gpe_fadt_blocks
[0] = NULL
;
286 acpi_gbl_gpe_fadt_blocks
[1] = NULL
;
287 acpi_current_gpe_count
= 0;
288 acpi_gbl_all_gpes_initialized
= FALSE
;
290 /* Global handlers */
292 acpi_gbl_system_notify
.handler
= NULL
;
293 acpi_gbl_device_notify
.handler
= NULL
;
294 acpi_gbl_exception_handler
= NULL
;
295 acpi_gbl_init_handler
= NULL
;
296 acpi_gbl_table_handler
= NULL
;
297 acpi_gbl_interface_handler
= NULL
;
298 acpi_gbl_global_event_handler
= NULL
;
300 /* Global Lock support */
302 acpi_gbl_global_lock_semaphore
= NULL
;
303 acpi_gbl_global_lock_mutex
= NULL
;
304 acpi_gbl_global_lock_acquired
= FALSE
;
305 acpi_gbl_global_lock_handle
= 0;
306 acpi_gbl_global_lock_present
= FALSE
;
308 /* Miscellaneous variables */
310 acpi_gbl_DSDT
= NULL
;
311 acpi_gbl_cm_single_step
= FALSE
;
312 acpi_gbl_db_terminate_threads
= FALSE
;
313 acpi_gbl_shutdown
= FALSE
;
314 acpi_gbl_ns_lookup_count
= 0;
315 acpi_gbl_ps_find_count
= 0;
316 acpi_gbl_acpi_hardware_present
= TRUE
;
317 acpi_gbl_last_owner_id_index
= 0;
318 acpi_gbl_next_owner_id_offset
= 0;
319 acpi_gbl_trace_method_name
= 0;
320 acpi_gbl_trace_dbg_level
= 0;
321 acpi_gbl_trace_dbg_layer
= 0;
322 acpi_gbl_debugger_configuration
= DEBUGGER_THREADING
;
323 acpi_gbl_db_output_flags
= ACPI_DB_CONSOLE_OUTPUT
;
324 acpi_gbl_osi_data
= 0;
325 acpi_gbl_osi_mutex
= NULL
;
326 acpi_gbl_reg_methods_executed
= FALSE
;
328 /* Hardware oriented */
330 acpi_gbl_events_initialized
= FALSE
;
331 acpi_gbl_system_awake_and_running
= TRUE
;
335 acpi_gbl_module_code_list
= NULL
;
336 acpi_gbl_root_node
= NULL
;
337 acpi_gbl_root_node_struct
.name
.integer
= ACPI_ROOT_NAME
;
338 acpi_gbl_root_node_struct
.descriptor_type
= ACPI_DESC_TYPE_NAMED
;
339 acpi_gbl_root_node_struct
.type
= ACPI_TYPE_DEVICE
;
340 acpi_gbl_root_node_struct
.parent
= NULL
;
341 acpi_gbl_root_node_struct
.child
= NULL
;
342 acpi_gbl_root_node_struct
.peer
= NULL
;
343 acpi_gbl_root_node_struct
.object
= NULL
;
345 #ifdef ACPI_DEBUG_OUTPUT
346 acpi_gbl_lowest_stack_pointer
= ACPI_CAST_PTR(acpi_size
, ACPI_SIZE_MAX
);
349 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
350 acpi_gbl_display_final_mem_stats
= FALSE
;
353 return_ACPI_STATUS(AE_OK
);
356 ACPI_EXPORT_SYMBOL(acpi_gbl_FADT
)
357 ACPI_EXPORT_SYMBOL(acpi_dbg_level
)
358 ACPI_EXPORT_SYMBOL(acpi_dbg_layer
)
359 ACPI_EXPORT_SYMBOL(acpi_current_gpe_count
)