blob: 7c59c2b0d953cb77ae585d8fb5251879c6f1e3cf [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
2 *
3 * Module Name: utglobal - Global variables for the ACPI subsystem
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
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
46#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#include <acpi/acpi.h>
48#include <acpi/acnamesp.h>
49
50#define _COMPONENT ACPI_UTILITIES
Len Brown4be44fc2005-08-05 00:44:28 -040051ACPI_MODULE_NAME("utglobal")
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Robert Moore44f6c012005-04-18 22:49:35 -040053/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 *
55 * FUNCTION: acpi_format_exception
56 *
57 * PARAMETERS: Status - The acpi_status code to be formatted
58 *
Robert Moore44f6c012005-04-18 22:49:35 -040059 * RETURN: A string containing the exception text. A valid pointer is
60 * always returned.
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 *
62 * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
63 *
64 ******************************************************************************/
Len Brown4be44fc2005-08-05 00:44:28 -040065const char *acpi_format_exception(acpi_status status)
Linus Torvalds1da177e2005-04-16 15:20:36 -070066{
Len Brown4be44fc2005-08-05 00:44:28 -040067 acpi_status sub_status;
68 const char *exception = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
Len Brown4be44fc2005-08-05 00:44:28 -040070 ACPI_FUNCTION_NAME("format_exception");
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
72 sub_status = (status & ~AE_CODE_MASK);
73
74 switch (status & AE_CODE_MASK) {
75 case AE_CODE_ENVIRONMENTAL:
76
77 if (sub_status <= AE_CODE_ENV_MAX) {
Len Brown4be44fc2005-08-05 00:44:28 -040078 exception = acpi_gbl_exception_names_env[sub_status];
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 }
Robert Moore44f6c012005-04-18 22:49:35 -040080 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
82 case AE_CODE_PROGRAMMER:
83
84 if (sub_status <= AE_CODE_PGM_MAX) {
Len Brown4be44fc2005-08-05 00:44:28 -040085 exception =
86 acpi_gbl_exception_names_pgm[sub_status - 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 }
Robert Moore44f6c012005-04-18 22:49:35 -040088 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
90 case AE_CODE_ACPI_TABLES:
91
92 if (sub_status <= AE_CODE_TBL_MAX) {
Len Brown4be44fc2005-08-05 00:44:28 -040093 exception =
94 acpi_gbl_exception_names_tbl[sub_status - 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 }
Robert Moore44f6c012005-04-18 22:49:35 -040096 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070097
98 case AE_CODE_AML:
99
100 if (sub_status <= AE_CODE_AML_MAX) {
Len Brown4be44fc2005-08-05 00:44:28 -0400101 exception =
102 acpi_gbl_exception_names_aml[sub_status - 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 }
Robert Moore44f6c012005-04-18 22:49:35 -0400104 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
106 case AE_CODE_CONTROL:
107
108 if (sub_status <= AE_CODE_CTRL_MAX) {
Len Brown4be44fc2005-08-05 00:44:28 -0400109 exception =
110 acpi_gbl_exception_names_ctrl[sub_status - 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 }
Robert Moore44f6c012005-04-18 22:49:35 -0400112 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113
114 default:
Robert Moore44f6c012005-04-18 22:49:35 -0400115 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 }
117
Robert Moore44f6c012005-04-18 22:49:35 -0400118 if (!exception) {
119 /* Exception code was not recognized */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120
Len Brown4be44fc2005-08-05 00:44:28 -0400121 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
122 "Unknown exception code: 0x%8.8X\n", status));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123
Len Brown4be44fc2005-08-05 00:44:28 -0400124 return ((const char *)"UNKNOWN_STATUS_CODE");
Robert Moore44f6c012005-04-18 22:49:35 -0400125 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126
Len Brown4be44fc2005-08-05 00:44:28 -0400127 return ((const char *)exception);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128}
129
Robert Moore44f6c012005-04-18 22:49:35 -0400130/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 *
132 * Static global variable initialization.
133 *
134 ******************************************************************************/
135
136/*
137 * We want the debug switches statically initialized so they
138 * are already set when the debugger is entered.
139 */
140
141/* Debug switch - level and trace mask */
Len Brown4be44fc2005-08-05 00:44:28 -0400142u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143EXPORT_SYMBOL(acpi_dbg_level);
144
145/* Debug switch - layer (component) mask */
146
Len Brown4be44fc2005-08-05 00:44:28 -0400147u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148EXPORT_SYMBOL(acpi_dbg_layer);
Len Brown4be44fc2005-08-05 00:44:28 -0400149u32 acpi_gbl_nesting_level = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150
151/* Debugger globals */
152
Len Brown4be44fc2005-08-05 00:44:28 -0400153u8 acpi_gbl_db_terminate_threads = FALSE;
154u8 acpi_gbl_abort_method = FALSE;
155u8 acpi_gbl_method_executing = FALSE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156
157/* System flags */
158
Len Brown4be44fc2005-08-05 00:44:28 -0400159u32 acpi_gbl_startup_flags = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160
161/* System starts uninitialized */
162
Len Brown4be44fc2005-08-05 00:44:28 -0400163u8 acpi_gbl_shutdown = TRUE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
Len Brown4be44fc2005-08-05 00:44:28 -0400165const u8 acpi_gbl_decode_to8bit[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166
Len Brown4be44fc2005-08-05 00:44:28 -0400167const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168 "\\_S0_",
169 "\\_S1_",
170 "\\_S2_",
171 "\\_S3_",
172 "\\_S4_",
173 "\\_S5_"
174};
175
Len Brown4be44fc2005-08-05 00:44:28 -0400176const char *acpi_gbl_highest_dstate_names[4] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 "_S1D",
178 "_S2D",
179 "_S3D",
180 "_S4D"
181};
182
183/*
184 * Strings supported by the _OSI predefined (internal) method.
185 * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS.
186 */
Len Brown4be44fc2005-08-05 00:44:28 -0400187const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 /* Operating System Vendor Strings */
189
190 "Linux",
191 "Windows 2000",
192 "Windows 2001",
193 "Windows 2001.1",
194 "Windows 2001 SP0",
195 "Windows 2001 SP1",
196 "Windows 2001 SP2",
197 "Windows 2001 SP3",
198 "Windows 2001 SP4",
199
200 /* Feature Group Strings */
201
202 "Extended Address Space Descriptor"
203};
204
Robert Moore44f6c012005-04-18 22:49:35 -0400205/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 *
207 * Namespace globals
208 *
209 ******************************************************************************/
210
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211/*
212 * Predefined ACPI Names (Built-in to the Interpreter)
213 *
214 * NOTES:
215 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
216 * during the initialization sequence.
217 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
218 * perform a Notify() operation on it.
219 */
Bob Moore08978312005-10-21 00:00:00 -0400220const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
221 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
222 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
223 {"_SB_", ACPI_TYPE_DEVICE, NULL},
224 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
225 {"_TZ_", ACPI_TYPE_THERMAL, NULL},
226 {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
227 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
228 {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229
230#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
Bob Moore08978312005-10-21 00:00:00 -0400231 {"_OSI", ACPI_TYPE_METHOD, (char *)1},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233
Robert Moore44f6c012005-04-18 22:49:35 -0400234 /* Table terminator */
235
Bob Moore08978312005-10-21 00:00:00 -0400236 {NULL, ACPI_TYPE_ANY, NULL}
Robert Moore44f6c012005-04-18 22:49:35 -0400237};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238
239/*
240 * Properties of the ACPI Object Types, both internal and external.
241 * The table is indexed by values of acpi_object_type
242 */
Len Brown4be44fc2005-08-05 00:44:28 -0400243const u8 acpi_gbl_ns_properties[] = {
244 ACPI_NS_NORMAL, /* 00 Any */
245 ACPI_NS_NORMAL, /* 01 Number */
246 ACPI_NS_NORMAL, /* 02 String */
247 ACPI_NS_NORMAL, /* 03 Buffer */
248 ACPI_NS_NORMAL, /* 04 Package */
249 ACPI_NS_NORMAL, /* 05 field_unit */
250 ACPI_NS_NEWSCOPE, /* 06 Device */
251 ACPI_NS_NORMAL, /* 07 Event */
252 ACPI_NS_NEWSCOPE, /* 08 Method */
253 ACPI_NS_NORMAL, /* 09 Mutex */
254 ACPI_NS_NORMAL, /* 10 Region */
255 ACPI_NS_NEWSCOPE, /* 11 Power */
256 ACPI_NS_NEWSCOPE, /* 12 Processor */
257 ACPI_NS_NEWSCOPE, /* 13 Thermal */
258 ACPI_NS_NORMAL, /* 14 buffer_field */
259 ACPI_NS_NORMAL, /* 15 ddb_handle */
260 ACPI_NS_NORMAL, /* 16 Debug Object */
261 ACPI_NS_NORMAL, /* 17 def_field */
262 ACPI_NS_NORMAL, /* 18 bank_field */
263 ACPI_NS_NORMAL, /* 19 index_field */
264 ACPI_NS_NORMAL, /* 20 Reference */
265 ACPI_NS_NORMAL, /* 21 Alias */
266 ACPI_NS_NORMAL, /* 22 method_alias */
267 ACPI_NS_NORMAL, /* 23 Notify */
268 ACPI_NS_NORMAL, /* 24 Address Handler */
269 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */
270 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */
271 ACPI_NS_NEWSCOPE, /* 27 Scope */
272 ACPI_NS_NORMAL, /* 28 Extra */
273 ACPI_NS_NORMAL, /* 29 Data */
274 ACPI_NS_NORMAL /* 30 Invalid */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275};
276
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277/* Hex to ASCII conversion table */
278
Len Brown4be44fc2005-08-05 00:44:28 -0400279static const char acpi_gbl_hex_to_ascii[] = {
280 '0', '1', '2', '3', '4', '5', '6', '7',
281 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
Robert Moore44f6c012005-04-18 22:49:35 -0400282};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283
Robert Moore44f6c012005-04-18 22:49:35 -0400284/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 *
286 * FUNCTION: acpi_ut_hex_to_ascii_char
287 *
288 * PARAMETERS: Integer - Contains the hex digit
289 * Position - bit position of the digit within the
Robert Moore44f6c012005-04-18 22:49:35 -0400290 * integer (multiple of 4)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291 *
Robert Moore44f6c012005-04-18 22:49:35 -0400292 * RETURN: The converted Ascii character
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293 *
Robert Moore44f6c012005-04-18 22:49:35 -0400294 * DESCRIPTION: Convert a hex digit to an Ascii character
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 *
Robert Moore44f6c012005-04-18 22:49:35 -0400296 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297
Len Brown4be44fc2005-08-05 00:44:28 -0400298char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299{
300
301 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
302}
303
Robert Moore44f6c012005-04-18 22:49:35 -0400304/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305 *
306 * Table name globals
307 *
308 * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
309 * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
310 * that are not used by the subsystem are simply ignored.
311 *
312 * Do NOT add any table to this list that is not consumed directly by this
Robert Moore44f6c012005-04-18 22:49:35 -0400313 * subsystem (No MADT, ECDT, SBST, etc.)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314 *
315 ******************************************************************************/
316
Len Brown4be44fc2005-08-05 00:44:28 -0400317struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318
Len Brown4be44fc2005-08-05 00:44:28 -0400319struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320 /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
321
Len Brown4be44fc2005-08-05 00:44:28 -0400322 /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1,
323 ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}
324 ,
325 /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *)&acpi_gbl_DSDT,
326 sizeof(DSDT_SIG) - 1,
327 ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE |
328 ACPI_TABLE_EXECUTABLE}
329 ,
330 /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *)&acpi_gbl_FADT,
331 sizeof(FADT_SIG) - 1,
332 ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE}
333 ,
334 /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *)&acpi_gbl_FACS,
335 sizeof(FACS_SIG) - 1,
336 ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE}
337 ,
338 /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof(PSDT_SIG) - 1,
339 ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE |
340 ACPI_TABLE_EXECUTABLE}
341 ,
342 /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof(SSDT_SIG) - 1,
343 ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE |
344 ACPI_TABLE_EXECUTABLE}
345 ,
346 /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof(RSDT_SIG) - 1,
347 ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}
348 ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349};
350
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351/******************************************************************************
352 *
353 * Event and Hardware globals
354 *
355 ******************************************************************************/
356
Len Brown4be44fc2005-08-05 00:44:28 -0400357struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 /* Name Parent Register Register Bit Position Register Bit Mask */
359
Len Brown4be44fc2005-08-05 00:44:28 -0400360 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
361 ACPI_BITPOSITION_TIMER_STATUS,
362 ACPI_BITMASK_TIMER_STATUS},
363 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
364 ACPI_BITPOSITION_BUS_MASTER_STATUS,
365 ACPI_BITMASK_BUS_MASTER_STATUS},
366 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
367 ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
368 ACPI_BITMASK_GLOBAL_LOCK_STATUS},
369 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
370 ACPI_BITPOSITION_POWER_BUTTON_STATUS,
371 ACPI_BITMASK_POWER_BUTTON_STATUS},
372 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
373 ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
374 ACPI_BITMASK_SLEEP_BUTTON_STATUS},
375 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
376 ACPI_BITPOSITION_RT_CLOCK_STATUS,
377 ACPI_BITMASK_RT_CLOCK_STATUS},
378 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
379 ACPI_BITPOSITION_WAKE_STATUS,
380 ACPI_BITMASK_WAKE_STATUS},
381 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
382 ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
383 ACPI_BITMASK_PCIEXP_WAKE_STATUS},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384
Len Brown4be44fc2005-08-05 00:44:28 -0400385 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
386 ACPI_BITPOSITION_TIMER_ENABLE,
387 ACPI_BITMASK_TIMER_ENABLE},
388 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
389 ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
390 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
391 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
392 ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
393 ACPI_BITMASK_POWER_BUTTON_ENABLE},
394 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
395 ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
396 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
397 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
398 ACPI_BITPOSITION_RT_CLOCK_ENABLE,
399 ACPI_BITMASK_RT_CLOCK_ENABLE},
400 /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
401 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE,
402 ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
403 ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404
Len Brown4be44fc2005-08-05 00:44:28 -0400405 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
406 ACPI_BITPOSITION_SCI_ENABLE,
407 ACPI_BITMASK_SCI_ENABLE},
408 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL,
409 ACPI_BITPOSITION_BUS_MASTER_RLD,
410 ACPI_BITMASK_BUS_MASTER_RLD},
411 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
412 ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
413 ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
414 /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL,
415 ACPI_BITPOSITION_SLEEP_TYPE_X,
416 ACPI_BITMASK_SLEEP_TYPE_X},
417 /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL,
418 ACPI_BITPOSITION_SLEEP_TYPE_X,
419 ACPI_BITMASK_SLEEP_TYPE_X},
420 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
421 ACPI_BITPOSITION_SLEEP_ENABLE,
422 ACPI_BITMASK_SLEEP_ENABLE},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423
Len Brown4be44fc2005-08-05 00:44:28 -0400424 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL,
425 ACPI_BITPOSITION_ARB_DISABLE,
426 ACPI_BITMASK_ARB_DISABLE}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427};
428
Len Brown4be44fc2005-08-05 00:44:28 -0400429struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
430 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS,
431 ACPI_BITREG_TIMER_ENABLE,
432 ACPI_BITMASK_TIMER_STATUS,
433 ACPI_BITMASK_TIMER_ENABLE},
434 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
435 ACPI_BITREG_GLOBAL_LOCK_ENABLE,
436 ACPI_BITMASK_GLOBAL_LOCK_STATUS,
437 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
438 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS,
439 ACPI_BITREG_POWER_BUTTON_ENABLE,
440 ACPI_BITMASK_POWER_BUTTON_STATUS,
441 ACPI_BITMASK_POWER_BUTTON_ENABLE},
442 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
443 ACPI_BITREG_SLEEP_BUTTON_ENABLE,
444 ACPI_BITMASK_SLEEP_BUTTON_STATUS,
445 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
446 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS,
447 ACPI_BITREG_RT_CLOCK_ENABLE,
448 ACPI_BITMASK_RT_CLOCK_STATUS,
449 ACPI_BITMASK_RT_CLOCK_ENABLE},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450};
451
Robert Moore44f6c012005-04-18 22:49:35 -0400452/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453 *
454 * FUNCTION: acpi_ut_get_region_name
455 *
456 * PARAMETERS: None.
457 *
458 * RETURN: Status
459 *
460 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
461 *
Robert Moore44f6c012005-04-18 22:49:35 -0400462 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463
464/* Region type decoding */
465
Len Brown4be44fc2005-08-05 00:44:28 -0400466const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
468 "SystemMemory",
469 "SystemIO",
470 "PCI_Config",
471 "EmbeddedControl",
472 "SMBus",
473 "CMOS",
474 "PCIBARTarget",
475 "DataTable"
476/*! [End] no source code translation !*/
477};
478
Len Brown4be44fc2005-08-05 00:44:28 -0400479char *acpi_ut_get_region_name(u8 space_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480{
481
Len Brown4be44fc2005-08-05 00:44:28 -0400482 if (space_id >= ACPI_USER_REGION_BEGIN) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 return ("user_defined_region");
Len Brown4be44fc2005-08-05 00:44:28 -0400484 } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485 return ("invalid_space_id");
486 }
487
Bob Mooredefba1d2005-12-16 17:05:00 -0500488 return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489}
490
Robert Moore44f6c012005-04-18 22:49:35 -0400491/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492 *
493 * FUNCTION: acpi_ut_get_event_name
494 *
495 * PARAMETERS: None.
496 *
497 * RETURN: Status
498 *
499 * DESCRIPTION: Translate a Event ID into a name string (Debug only)
500 *
Robert Moore44f6c012005-04-18 22:49:35 -0400501 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502
503/* Event type decoding */
504
Len Brown4be44fc2005-08-05 00:44:28 -0400505static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
Bob Moore08978312005-10-21 00:00:00 -0400506/*! [Begin] no source code translation (keep these strings as-is) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 "PM_Timer",
Bob Moore08978312005-10-21 00:00:00 -0400508 "GlobalLock",
509 "PowerButton",
510 "SleepButton",
511 "RealTimeClock",
512/*! [End] no source code translation !*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513};
514
Len Brown4be44fc2005-08-05 00:44:28 -0400515char *acpi_ut_get_event_name(u32 event_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516{
517
Len Brown4be44fc2005-08-05 00:44:28 -0400518 if (event_id > ACPI_EVENT_MAX) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700519 return ("invalid_event_iD");
520 }
521
Len Brown4be44fc2005-08-05 00:44:28 -0400522 return ((char *)acpi_gbl_event_types[event_id]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523}
524
Robert Moore44f6c012005-04-18 22:49:35 -0400525/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700526 *
527 * FUNCTION: acpi_ut_get_type_name
528 *
529 * PARAMETERS: None.
530 *
531 * RETURN: Status
532 *
533 * DESCRIPTION: Translate a Type ID into a name string (Debug only)
534 *
Robert Moore44f6c012005-04-18 22:49:35 -0400535 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536
537/*
538 * Elements of acpi_gbl_ns_type_names below must match
539 * one-to-one with values of acpi_object_type
540 *
Robert Moore44f6c012005-04-18 22:49:35 -0400541 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
542 * when stored in a table it really means that we have thus far seen no
543 * evidence to indicate what type is actually going to be stored for this entry.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 */
Len Brown4be44fc2005-08-05 00:44:28 -0400545static const char acpi_gbl_bad_type[] = "UNDEFINED";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700546
Robert Moore44f6c012005-04-18 22:49:35 -0400547/* Printable names of the ACPI object types */
548
Len Brown4be44fc2005-08-05 00:44:28 -0400549static const char *acpi_gbl_ns_type_names[] = {
Bob Moore08978312005-10-21 00:00:00 -0400550/*! [Begin] no source code translation (keep these strings as-is) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551 /* 00 */ "Untyped",
552 /* 01 */ "Integer",
553 /* 02 */ "String",
554 /* 03 */ "Buffer",
555 /* 04 */ "Package",
Bob Moore08978312005-10-21 00:00:00 -0400556 /* 05 */ "FieldUnit",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557 /* 06 */ "Device",
558 /* 07 */ "Event",
559 /* 08 */ "Method",
560 /* 09 */ "Mutex",
561 /* 10 */ "Region",
562 /* 11 */ "Power",
563 /* 12 */ "Processor",
564 /* 13 */ "Thermal",
Bob Moore08978312005-10-21 00:00:00 -0400565 /* 14 */ "BufferField",
566 /* 15 */ "DdbHandle",
567 /* 16 */ "DebugObject",
568 /* 17 */ "RegionField",
569 /* 18 */ "BankField",
570 /* 19 */ "IndexField",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571 /* 20 */ "Reference",
572 /* 21 */ "Alias",
Bob Moore08978312005-10-21 00:00:00 -0400573 /* 22 */ "MethodAlias",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574 /* 23 */ "Notify",
Bob Moore08978312005-10-21 00:00:00 -0400575 /* 24 */ "AddrHandler",
576 /* 25 */ "ResourceDesc",
577 /* 26 */ "ResourceFld",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700578 /* 27 */ "Scope",
579 /* 28 */ "Extra",
580 /* 29 */ "Data",
581 /* 30 */ "Invalid"
Bob Moore08978312005-10-21 00:00:00 -0400582/*! [End] no source code translation !*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583};
584
Len Brown4be44fc2005-08-05 00:44:28 -0400585char *acpi_ut_get_type_name(acpi_object_type type)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586{
587
Len Brown4be44fc2005-08-05 00:44:28 -0400588 if (type > ACPI_TYPE_INVALID) {
589 return ((char *)acpi_gbl_bad_type);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 }
591
Len Brown4be44fc2005-08-05 00:44:28 -0400592 return ((char *)acpi_gbl_ns_type_names[type]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593}
594
Len Brown4be44fc2005-08-05 00:44:28 -0400595char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700596{
597
Len Brown4be44fc2005-08-05 00:44:28 -0400598 if (!obj_desc) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 return ("[NULL Object Descriptor]");
600 }
601
Len Brown4be44fc2005-08-05 00:44:28 -0400602 return (acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603}
604
Robert Moore44f6c012005-04-18 22:49:35 -0400605/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606 *
607 * FUNCTION: acpi_ut_get_node_name
608 *
609 * PARAMETERS: Object - A namespace node
610 *
611 * RETURN: Pointer to a string
612 *
613 * DESCRIPTION: Validate the node and return the node's ACPI name.
614 *
Robert Moore44f6c012005-04-18 22:49:35 -0400615 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616
Len Brown4be44fc2005-08-05 00:44:28 -0400617char *acpi_ut_get_node_name(void *object)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618{
Len Brown4be44fc2005-08-05 00:44:28 -0400619 struct acpi_namespace_node *node = (struct acpi_namespace_node *)object;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620
621 /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
622
Len Brown4be44fc2005-08-05 00:44:28 -0400623 if (!object) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 return ("NULL");
625 }
626
627 /* Check for Root node */
628
Len Brown4be44fc2005-08-05 00:44:28 -0400629 if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700630 return ("\"\\\" ");
631 }
632
633 /* Descriptor must be a namespace node */
634
Len Brown4be44fc2005-08-05 00:44:28 -0400635 if (node->descriptor != ACPI_DESC_TYPE_NAMED) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636 return ("####");
637 }
638
639 /* Name must be a valid ACPI name */
640
Bob Moorec51a4de2005-11-17 13:07:00 -0500641 if (!acpi_ut_valid_acpi_name(node->name.integer)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 return ("????");
643 }
644
645 /* Return the name */
646
647 return (node->name.ascii);
648}
649
Robert Moore44f6c012005-04-18 22:49:35 -0400650/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 *
652 * FUNCTION: acpi_ut_get_descriptor_name
653 *
654 * PARAMETERS: Object - An ACPI object
655 *
656 * RETURN: Pointer to a string
657 *
658 * DESCRIPTION: Validate object and return the descriptor type
659 *
Robert Moore44f6c012005-04-18 22:49:35 -0400660 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661
Robert Moore44f6c012005-04-18 22:49:35 -0400662/* Printable names of object descriptor types */
663
Len Brown4be44fc2005-08-05 00:44:28 -0400664static const char *acpi_gbl_desc_type_names[] = {
Bob Moore08978312005-10-21 00:00:00 -0400665/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 /* 00 */ "Invalid",
667 /* 01 */ "Cached",
668 /* 02 */ "State-Generic",
669 /* 03 */ "State-Update",
670 /* 04 */ "State-Package",
671 /* 05 */ "State-Control",
Bob Moore08978312005-10-21 00:00:00 -0400672 /* 06 */ "State-RootParseScope",
673 /* 07 */ "State-ParseScope",
674 /* 08 */ "State-WalkScope",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675 /* 09 */ "State-Result",
676 /* 10 */ "State-Notify",
677 /* 11 */ "State-Thread",
678 /* 12 */ "Walk",
679 /* 13 */ "Parser",
680 /* 14 */ "Operand",
681 /* 15 */ "Node"
Bob Moore08978312005-10-21 00:00:00 -0400682/*! [End] no source code translation !*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683};
684
Len Brown4be44fc2005-08-05 00:44:28 -0400685char *acpi_ut_get_descriptor_name(void *object)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686{
687
Len Brown4be44fc2005-08-05 00:44:28 -0400688 if (!object) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 return ("NULL OBJECT");
690 }
691
Len Brown4be44fc2005-08-05 00:44:28 -0400692 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
Bob Mooredefba1d2005-12-16 17:05:00 -0500693 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 }
695
Bob Mooredefba1d2005-12-16 17:05:00 -0500696 return (ACPI_CAST_PTR(char,
697 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE
698 (object)]));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699
700}
701
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
703/*
704 * Strings and procedures used for debug only
705 */
706
Robert Moore44f6c012005-04-18 22:49:35 -0400707/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708 *
709 * FUNCTION: acpi_ut_get_mutex_name
710 *
Robert Moore44f6c012005-04-18 22:49:35 -0400711 * PARAMETERS: mutex_id - The predefined ID for this mutex.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712 *
Robert Moore44f6c012005-04-18 22:49:35 -0400713 * RETURN: String containing the name of the mutex. Always returns a valid
714 * pointer.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 *
716 * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
717 *
Robert Moore44f6c012005-04-18 22:49:35 -0400718 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700719
Len Brown4be44fc2005-08-05 00:44:28 -0400720char *acpi_ut_get_mutex_name(u32 mutex_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721{
722
Len Brown4be44fc2005-08-05 00:44:28 -0400723 if (mutex_id > MAX_MUTEX) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700724 return ("Invalid Mutex ID");
725 }
726
727 return (acpi_gbl_mutex_names[mutex_id]);
728}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700729#endif
730
Robert Moore44f6c012005-04-18 22:49:35 -0400731/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732 *
733 * FUNCTION: acpi_ut_valid_object_type
734 *
735 * PARAMETERS: Type - Object type to be validated
736 *
Robert Moore44f6c012005-04-18 22:49:35 -0400737 * RETURN: TRUE if valid object type, FALSE otherwise
Linus Torvalds1da177e2005-04-16 15:20:36 -0700738 *
739 * DESCRIPTION: Validate an object type
740 *
Robert Moore44f6c012005-04-18 22:49:35 -0400741 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742
Len Brown4be44fc2005-08-05 00:44:28 -0400743u8 acpi_ut_valid_object_type(acpi_object_type type)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700744{
745
Len Brown4be44fc2005-08-05 00:44:28 -0400746 if (type > ACPI_TYPE_LOCAL_MAX) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747 /* Note: Assumes all TYPEs are contiguous (external/local) */
748
749 return (FALSE);
750 }
751
752 return (TRUE);
753}
754
Robert Moore44f6c012005-04-18 22:49:35 -0400755/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700757 * FUNCTION: acpi_ut_init_globals
758 *
Robert Moore44f6c012005-04-18 22:49:35 -0400759 * PARAMETERS: None
760 *
761 * RETURN: None
Linus Torvalds1da177e2005-04-16 15:20:36 -0700762 *
763 * DESCRIPTION: Init library globals. All globals that require specific
764 * initialization should be initialized here!
765 *
Robert Moore44f6c012005-04-18 22:49:35 -0400766 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767
Len Brown4be44fc2005-08-05 00:44:28 -0400768void acpi_ut_init_globals(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700769{
Len Brown4be44fc2005-08-05 00:44:28 -0400770 acpi_status status;
771 u32 i;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772
Len Brown4be44fc2005-08-05 00:44:28 -0400773 ACPI_FUNCTION_TRACE("ut_init_globals");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774
Robert Moore73459f72005-06-24 00:00:00 -0400775 /* Create all memory caches */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776
Len Brown4be44fc2005-08-05 00:44:28 -0400777 status = acpi_ut_create_caches();
778 if (ACPI_FAILURE(status)) {
Robert Moore73459f72005-06-24 00:00:00 -0400779 return;
780 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700781
782 /* ACPI table structure */
783
Len Brown4be44fc2005-08-05 00:44:28 -0400784 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) {
785 acpi_gbl_table_lists[i].next = NULL;
786 acpi_gbl_table_lists[i].count = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787 }
788
789 /* Mutex locked flags */
790
Len Brown4be44fc2005-08-05 00:44:28 -0400791 for (i = 0; i < NUM_MUTEX; i++) {
792 acpi_gbl_mutex_info[i].mutex = NULL;
793 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
794 acpi_gbl_mutex_info[i].use_count = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795 }
796
Bob Moore28f55eb2005-12-02 18:27:00 -0500797 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
798 acpi_gbl_owner_id_mask[i] = 0;
799 }
800 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
801
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802 /* GPE support */
803
Len Brown4be44fc2005-08-05 00:44:28 -0400804 acpi_gbl_gpe_xrupt_list_head = NULL;
805 acpi_gbl_gpe_fadt_blocks[0] = NULL;
806 acpi_gbl_gpe_fadt_blocks[1] = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807
808 /* Global notify handlers */
809
Len Brown4be44fc2005-08-05 00:44:28 -0400810 acpi_gbl_system_notify.handler = NULL;
811 acpi_gbl_device_notify.handler = NULL;
812 acpi_gbl_exception_handler = NULL;
813 acpi_gbl_init_handler = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814
815 /* Global "typed" ACPI table pointers */
816
Len Brown4be44fc2005-08-05 00:44:28 -0400817 acpi_gbl_RSDP = NULL;
818 acpi_gbl_XSDT = NULL;
819 acpi_gbl_FACS = NULL;
820 acpi_gbl_FADT = NULL;
821 acpi_gbl_DSDT = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700822
823 /* Global Lock support */
824
Len Brown4be44fc2005-08-05 00:44:28 -0400825 acpi_gbl_global_lock_acquired = FALSE;
826 acpi_gbl_global_lock_thread_count = 0;
827 acpi_gbl_global_lock_handle = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700828
829 /* Miscellaneous variables */
830
Len Brown4be44fc2005-08-05 00:44:28 -0400831 acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER;
832 acpi_gbl_rsdp_original_location = 0;
833 acpi_gbl_cm_single_step = FALSE;
834 acpi_gbl_db_terminate_threads = FALSE;
835 acpi_gbl_shutdown = FALSE;
836 acpi_gbl_ns_lookup_count = 0;
837 acpi_gbl_ps_find_count = 0;
838 acpi_gbl_acpi_hardware_present = TRUE;
Bob Moore28f55eb2005-12-02 18:27:00 -0500839 acpi_gbl_last_owner_id_index = 0;
840 acpi_gbl_next_owner_id_offset = 0;
Bob Moore50eca3e2005-09-30 19:03:00 -0400841 acpi_gbl_trace_method_name = 0;
842 acpi_gbl_trace_dbg_level = 0;
843 acpi_gbl_trace_dbg_layer = 0;
Len Brown4be44fc2005-08-05 00:44:28 -0400844 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
845 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846
847 /* Hardware oriented */
848
Len Brown4be44fc2005-08-05 00:44:28 -0400849 acpi_gbl_events_initialized = FALSE;
850 acpi_gbl_system_awake_and_running = TRUE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700851
852 /* Namespace */
853
Len Brown4be44fc2005-08-05 00:44:28 -0400854 acpi_gbl_root_node = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700855 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
856 acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
Len Brown4be44fc2005-08-05 00:44:28 -0400857 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
858 acpi_gbl_root_node_struct.child = NULL;
859 acpi_gbl_root_node_struct.peer = NULL;
860 acpi_gbl_root_node_struct.object = NULL;
861 acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700862
863#ifdef ACPI_DEBUG_OUTPUT
Len Brown4be44fc2005-08-05 00:44:28 -0400864 acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700865#endif
866
867 return_VOID;
868}