blob: 767c5e44a04b013b1c14021fcc8f5e3c07403d72 [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/*
Bob Moore4a90c7e2006-01-13 16:22:00 -05008 * Copyright (C) 2000 - 2006, R. Byron Moore
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * 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
Bob Moore4a90c7e2006-01-13 16:22:00 -050070 ACPI_FUNCTION_ENTRY();
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
Bob Moore4a90c7e2006-01-13 16:22:00 -050072 /*
73 * Status is composed of two parts, a "type" and an actual code
74 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 sub_status = (status & ~AE_CODE_MASK);
76
77 switch (status & AE_CODE_MASK) {
78 case AE_CODE_ENVIRONMENTAL:
79
80 if (sub_status <= AE_CODE_ENV_MAX) {
Len Brown4be44fc2005-08-05 00:44:28 -040081 exception = acpi_gbl_exception_names_env[sub_status];
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 }
Robert Moore44f6c012005-04-18 22:49:35 -040083 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
85 case AE_CODE_PROGRAMMER:
86
87 if (sub_status <= AE_CODE_PGM_MAX) {
Len Brown4be44fc2005-08-05 00:44:28 -040088 exception =
89 acpi_gbl_exception_names_pgm[sub_status - 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 }
Robert Moore44f6c012005-04-18 22:49:35 -040091 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070092
93 case AE_CODE_ACPI_TABLES:
94
95 if (sub_status <= AE_CODE_TBL_MAX) {
Len Brown4be44fc2005-08-05 00:44:28 -040096 exception =
97 acpi_gbl_exception_names_tbl[sub_status - 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 }
Robert Moore44f6c012005-04-18 22:49:35 -040099 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100
101 case AE_CODE_AML:
102
103 if (sub_status <= AE_CODE_AML_MAX) {
Len Brown4be44fc2005-08-05 00:44:28 -0400104 exception =
105 acpi_gbl_exception_names_aml[sub_status - 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 }
Robert Moore44f6c012005-04-18 22:49:35 -0400107 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108
109 case AE_CODE_CONTROL:
110
111 if (sub_status <= AE_CODE_CTRL_MAX) {
Len Brown4be44fc2005-08-05 00:44:28 -0400112 exception =
113 acpi_gbl_exception_names_ctrl[sub_status - 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 }
Robert Moore44f6c012005-04-18 22:49:35 -0400115 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
117 default:
Robert Moore44f6c012005-04-18 22:49:35 -0400118 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 }
120
Robert Moore44f6c012005-04-18 22:49:35 -0400121 if (!exception) {
Bob Moore52fc0b02006-10-02 00:00:00 -0400122
Robert Moore44f6c012005-04-18 22:49:35 -0400123 /* Exception code was not recognized */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
Bob Mooreb8e4d892006-01-27 16:43:00 -0500125 ACPI_ERROR((AE_INFO,
126 "Unknown exception code: 0x%8.8X", status));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127
Bob Moore4a90c7e2006-01-13 16:22:00 -0500128 exception = "UNKNOWN_STATUS_CODE";
Robert Moore44f6c012005-04-18 22:49:35 -0400129 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130
Bob Moore4a90c7e2006-01-13 16:22:00 -0500131 return (ACPI_CAST_PTR(const char, exception));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132}
133
Robert Moore44f6c012005-04-18 22:49:35 -0400134/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 *
136 * Static global variable initialization.
137 *
138 ******************************************************************************/
139
140/*
141 * We want the debug switches statically initialized so they
142 * are already set when the debugger is entered.
143 */
144
145/* Debug switch - level and trace mask */
Len Brown4be44fc2005-08-05 00:44:28 -0400146u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147EXPORT_SYMBOL(acpi_dbg_level);
148
149/* Debug switch - layer (component) mask */
150
Len Brown4be44fc2005-08-05 00:44:28 -0400151u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152EXPORT_SYMBOL(acpi_dbg_layer);
Len Brown4be44fc2005-08-05 00:44:28 -0400153u32 acpi_gbl_nesting_level = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154
155/* Debugger globals */
156
Len Brown4be44fc2005-08-05 00:44:28 -0400157u8 acpi_gbl_db_terminate_threads = FALSE;
158u8 acpi_gbl_abort_method = FALSE;
159u8 acpi_gbl_method_executing = FALSE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160
161/* System flags */
162
Len Brown4be44fc2005-08-05 00:44:28 -0400163u32 acpi_gbl_startup_flags = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
165/* System starts uninitialized */
166
Len Brown4be44fc2005-08-05 00:44:28 -0400167u8 acpi_gbl_shutdown = TRUE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168
Len Brown4be44fc2005-08-05 00:44:28 -0400169const u8 acpi_gbl_decode_to8bit[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170
Len Brown4be44fc2005-08-05 00:44:28 -0400171const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 "\\_S0_",
173 "\\_S1_",
174 "\\_S2_",
175 "\\_S3_",
176 "\\_S4_",
177 "\\_S5_"
178};
179
Len Brown4be44fc2005-08-05 00:44:28 -0400180const char *acpi_gbl_highest_dstate_names[4] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 "_S1D",
182 "_S2D",
183 "_S3D",
184 "_S4D"
185};
186
187/*
188 * Strings supported by the _OSI predefined (internal) method.
189 * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS.
190 */
Len Brown4be44fc2005-08-05 00:44:28 -0400191const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 /* Operating System Vendor Strings */
193
194 "Linux",
195 "Windows 2000",
196 "Windows 2001",
197 "Windows 2001.1",
198 "Windows 2001 SP0",
199 "Windows 2001 SP1",
200 "Windows 2001 SP2",
201 "Windows 2001 SP3",
202 "Windows 2001 SP4",
203
204 /* Feature Group Strings */
205
206 "Extended Address Space Descriptor"
207};
208
Robert Moore44f6c012005-04-18 22:49:35 -0400209/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 *
211 * Namespace globals
212 *
213 ******************************************************************************/
214
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215/*
216 * Predefined ACPI Names (Built-in to the Interpreter)
217 *
218 * NOTES:
219 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
220 * during the initialization sequence.
221 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
222 * perform a Notify() operation on it.
223 */
Bob Moore08978312005-10-21 00:00:00 -0400224const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
225 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
226 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
227 {"_SB_", ACPI_TYPE_DEVICE, NULL},
228 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
229 {"_TZ_", ACPI_TYPE_THERMAL, NULL},
230 {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
231 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
232 {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233
234#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
Bob Moore08978312005-10-21 00:00:00 -0400235 {"_OSI", ACPI_TYPE_METHOD, (char *)1},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237
Robert Moore44f6c012005-04-18 22:49:35 -0400238 /* Table terminator */
239
Bob Moore08978312005-10-21 00:00:00 -0400240 {NULL, ACPI_TYPE_ANY, NULL}
Robert Moore44f6c012005-04-18 22:49:35 -0400241};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242
243/*
244 * Properties of the ACPI Object Types, both internal and external.
245 * The table is indexed by values of acpi_object_type
246 */
Len Brown4be44fc2005-08-05 00:44:28 -0400247const u8 acpi_gbl_ns_properties[] = {
248 ACPI_NS_NORMAL, /* 00 Any */
249 ACPI_NS_NORMAL, /* 01 Number */
250 ACPI_NS_NORMAL, /* 02 String */
251 ACPI_NS_NORMAL, /* 03 Buffer */
252 ACPI_NS_NORMAL, /* 04 Package */
253 ACPI_NS_NORMAL, /* 05 field_unit */
254 ACPI_NS_NEWSCOPE, /* 06 Device */
255 ACPI_NS_NORMAL, /* 07 Event */
256 ACPI_NS_NEWSCOPE, /* 08 Method */
257 ACPI_NS_NORMAL, /* 09 Mutex */
258 ACPI_NS_NORMAL, /* 10 Region */
259 ACPI_NS_NEWSCOPE, /* 11 Power */
260 ACPI_NS_NEWSCOPE, /* 12 Processor */
261 ACPI_NS_NEWSCOPE, /* 13 Thermal */
262 ACPI_NS_NORMAL, /* 14 buffer_field */
263 ACPI_NS_NORMAL, /* 15 ddb_handle */
264 ACPI_NS_NORMAL, /* 16 Debug Object */
265 ACPI_NS_NORMAL, /* 17 def_field */
266 ACPI_NS_NORMAL, /* 18 bank_field */
267 ACPI_NS_NORMAL, /* 19 index_field */
268 ACPI_NS_NORMAL, /* 20 Reference */
269 ACPI_NS_NORMAL, /* 21 Alias */
270 ACPI_NS_NORMAL, /* 22 method_alias */
271 ACPI_NS_NORMAL, /* 23 Notify */
272 ACPI_NS_NORMAL, /* 24 Address Handler */
273 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */
274 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */
275 ACPI_NS_NEWSCOPE, /* 27 Scope */
276 ACPI_NS_NORMAL, /* 28 Extra */
277 ACPI_NS_NORMAL, /* 29 Data */
278 ACPI_NS_NORMAL /* 30 Invalid */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279};
280
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281/* Hex to ASCII conversion table */
282
Len Brown4be44fc2005-08-05 00:44:28 -0400283static const char acpi_gbl_hex_to_ascii[] = {
284 '0', '1', '2', '3', '4', '5', '6', '7',
285 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
Robert Moore44f6c012005-04-18 22:49:35 -0400286};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287
Robert Moore44f6c012005-04-18 22:49:35 -0400288/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 *
290 * FUNCTION: acpi_ut_hex_to_ascii_char
291 *
292 * PARAMETERS: Integer - Contains the hex digit
293 * Position - bit position of the digit within the
Robert Moore44f6c012005-04-18 22:49:35 -0400294 * integer (multiple of 4)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 *
Robert Moore44f6c012005-04-18 22:49:35 -0400296 * RETURN: The converted Ascii character
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297 *
Robert Moore44f6c012005-04-18 22:49:35 -0400298 * DESCRIPTION: Convert a hex digit to an Ascii character
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 *
Robert Moore44f6c012005-04-18 22:49:35 -0400300 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301
Len Brown4be44fc2005-08-05 00:44:28 -0400302char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303{
304
305 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
306}
307
Robert Moore44f6c012005-04-18 22:49:35 -0400308/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309 *
310 * Table name globals
311 *
312 * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
313 * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
314 * that are not used by the subsystem are simply ignored.
315 *
316 * Do NOT add any table to this list that is not consumed directly by this
Robert Moore44f6c012005-04-18 22:49:35 -0400317 * subsystem (No MADT, ECDT, SBST, etc.)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 *
319 ******************************************************************************/
320
Len Brown4be44fc2005-08-05 00:44:28 -0400321struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322
Len Brown4be44fc2005-08-05 00:44:28 -0400323struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
325
Len Brown4be44fc2005-08-05 00:44:28 -0400326 /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1,
327 ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}
328 ,
329 /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *)&acpi_gbl_DSDT,
330 sizeof(DSDT_SIG) - 1,
331 ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE |
332 ACPI_TABLE_EXECUTABLE}
333 ,
334 /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *)&acpi_gbl_FADT,
335 sizeof(FADT_SIG) - 1,
336 ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE}
337 ,
338 /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *)&acpi_gbl_FACS,
339 sizeof(FACS_SIG) - 1,
340 ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE}
341 ,
342 /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof(PSDT_SIG) - 1,
343 ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE |
344 ACPI_TABLE_EXECUTABLE}
345 ,
346 /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof(SSDT_SIG) - 1,
347 ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE |
348 ACPI_TABLE_EXECUTABLE}
349 ,
350 /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof(RSDT_SIG) - 1,
351 ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}
352 ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353};
354
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355/******************************************************************************
356 *
357 * Event and Hardware globals
358 *
359 ******************************************************************************/
360
Len Brown4be44fc2005-08-05 00:44:28 -0400361struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362 /* Name Parent Register Register Bit Position Register Bit Mask */
363
Len Brown4be44fc2005-08-05 00:44:28 -0400364 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
365 ACPI_BITPOSITION_TIMER_STATUS,
366 ACPI_BITMASK_TIMER_STATUS},
367 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
368 ACPI_BITPOSITION_BUS_MASTER_STATUS,
369 ACPI_BITMASK_BUS_MASTER_STATUS},
370 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
371 ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
372 ACPI_BITMASK_GLOBAL_LOCK_STATUS},
373 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
374 ACPI_BITPOSITION_POWER_BUTTON_STATUS,
375 ACPI_BITMASK_POWER_BUTTON_STATUS},
376 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
377 ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
378 ACPI_BITMASK_SLEEP_BUTTON_STATUS},
379 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
380 ACPI_BITPOSITION_RT_CLOCK_STATUS,
381 ACPI_BITMASK_RT_CLOCK_STATUS},
382 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
383 ACPI_BITPOSITION_WAKE_STATUS,
384 ACPI_BITMASK_WAKE_STATUS},
385 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
386 ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
387 ACPI_BITMASK_PCIEXP_WAKE_STATUS},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388
Len Brown4be44fc2005-08-05 00:44:28 -0400389 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
390 ACPI_BITPOSITION_TIMER_ENABLE,
391 ACPI_BITMASK_TIMER_ENABLE},
392 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
393 ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
394 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
395 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
396 ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
397 ACPI_BITMASK_POWER_BUTTON_ENABLE},
398 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
399 ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
400 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
401 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
402 ACPI_BITPOSITION_RT_CLOCK_ENABLE,
403 ACPI_BITMASK_RT_CLOCK_ENABLE},
404 /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
405 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE,
406 ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
407 ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408
Len Brown4be44fc2005-08-05 00:44:28 -0400409 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
410 ACPI_BITPOSITION_SCI_ENABLE,
411 ACPI_BITMASK_SCI_ENABLE},
412 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL,
413 ACPI_BITPOSITION_BUS_MASTER_RLD,
414 ACPI_BITMASK_BUS_MASTER_RLD},
415 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
416 ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
417 ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
418 /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL,
419 ACPI_BITPOSITION_SLEEP_TYPE_X,
420 ACPI_BITMASK_SLEEP_TYPE_X},
421 /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL,
422 ACPI_BITPOSITION_SLEEP_TYPE_X,
423 ACPI_BITMASK_SLEEP_TYPE_X},
424 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
425 ACPI_BITPOSITION_SLEEP_ENABLE,
426 ACPI_BITMASK_SLEEP_ENABLE},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427
Len Brown4be44fc2005-08-05 00:44:28 -0400428 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL,
429 ACPI_BITPOSITION_ARB_DISABLE,
430 ACPI_BITMASK_ARB_DISABLE}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431};
432
Len Brown4be44fc2005-08-05 00:44:28 -0400433struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
434 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS,
435 ACPI_BITREG_TIMER_ENABLE,
436 ACPI_BITMASK_TIMER_STATUS,
437 ACPI_BITMASK_TIMER_ENABLE},
438 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
439 ACPI_BITREG_GLOBAL_LOCK_ENABLE,
440 ACPI_BITMASK_GLOBAL_LOCK_STATUS,
441 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
442 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS,
443 ACPI_BITREG_POWER_BUTTON_ENABLE,
444 ACPI_BITMASK_POWER_BUTTON_STATUS,
445 ACPI_BITMASK_POWER_BUTTON_ENABLE},
446 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
447 ACPI_BITREG_SLEEP_BUTTON_ENABLE,
448 ACPI_BITMASK_SLEEP_BUTTON_STATUS,
449 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
450 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS,
451 ACPI_BITREG_RT_CLOCK_ENABLE,
452 ACPI_BITMASK_RT_CLOCK_STATUS,
453 ACPI_BITMASK_RT_CLOCK_ENABLE},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454};
455
Robert Moore44f6c012005-04-18 22:49:35 -0400456/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 *
458 * FUNCTION: acpi_ut_get_region_name
459 *
460 * PARAMETERS: None.
461 *
462 * RETURN: Status
463 *
464 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
465 *
Robert Moore44f6c012005-04-18 22:49:35 -0400466 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467
468/* Region type decoding */
469
Len Brown4be44fc2005-08-05 00:44:28 -0400470const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
472 "SystemMemory",
473 "SystemIO",
474 "PCI_Config",
475 "EmbeddedControl",
476 "SMBus",
477 "CMOS",
478 "PCIBARTarget",
479 "DataTable"
480/*! [End] no source code translation !*/
481};
482
Len Brown4be44fc2005-08-05 00:44:28 -0400483char *acpi_ut_get_region_name(u8 space_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484{
485
Len Brown4be44fc2005-08-05 00:44:28 -0400486 if (space_id >= ACPI_USER_REGION_BEGIN) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487 return ("user_defined_region");
Len Brown4be44fc2005-08-05 00:44:28 -0400488 } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489 return ("invalid_space_id");
490 }
491
Bob Mooredefba1d2005-12-16 17:05:00 -0500492 return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493}
494
Robert Moore44f6c012005-04-18 22:49:35 -0400495/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496 *
497 * FUNCTION: acpi_ut_get_event_name
498 *
499 * PARAMETERS: None.
500 *
501 * RETURN: Status
502 *
503 * DESCRIPTION: Translate a Event ID into a name string (Debug only)
504 *
Robert Moore44f6c012005-04-18 22:49:35 -0400505 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700506
507/* Event type decoding */
508
Len Brown4be44fc2005-08-05 00:44:28 -0400509static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
Bob Moore08978312005-10-21 00:00:00 -0400510/*! [Begin] no source code translation (keep these strings as-is) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511 "PM_Timer",
Bob Moore08978312005-10-21 00:00:00 -0400512 "GlobalLock",
513 "PowerButton",
514 "SleepButton",
515 "RealTimeClock",
516/*! [End] no source code translation !*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517};
518
Len Brown4be44fc2005-08-05 00:44:28 -0400519char *acpi_ut_get_event_name(u32 event_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520{
521
Len Brown4be44fc2005-08-05 00:44:28 -0400522 if (event_id > ACPI_EVENT_MAX) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523 return ("invalid_event_iD");
524 }
525
Bob Moore4a90c7e2006-01-13 16:22:00 -0500526 return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id]));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527}
528
Robert Moore44f6c012005-04-18 22:49:35 -0400529/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700530 *
531 * FUNCTION: acpi_ut_get_type_name
532 *
533 * PARAMETERS: None.
534 *
535 * RETURN: Status
536 *
537 * DESCRIPTION: Translate a Type ID into a name string (Debug only)
538 *
Robert Moore44f6c012005-04-18 22:49:35 -0400539 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540
541/*
542 * Elements of acpi_gbl_ns_type_names below must match
543 * one-to-one with values of acpi_object_type
544 *
Robert Moore44f6c012005-04-18 22:49:35 -0400545 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
546 * when stored in a table it really means that we have thus far seen no
547 * evidence to indicate what type is actually going to be stored for this entry.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548 */
Len Brown4be44fc2005-08-05 00:44:28 -0400549static const char acpi_gbl_bad_type[] = "UNDEFINED";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550
Robert Moore44f6c012005-04-18 22:49:35 -0400551/* Printable names of the ACPI object types */
552
Len Brown4be44fc2005-08-05 00:44:28 -0400553static const char *acpi_gbl_ns_type_names[] = {
Bob Moore08978312005-10-21 00:00:00 -0400554/*! [Begin] no source code translation (keep these strings as-is) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555 /* 00 */ "Untyped",
556 /* 01 */ "Integer",
557 /* 02 */ "String",
558 /* 03 */ "Buffer",
559 /* 04 */ "Package",
Bob Moore08978312005-10-21 00:00:00 -0400560 /* 05 */ "FieldUnit",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 /* 06 */ "Device",
562 /* 07 */ "Event",
563 /* 08 */ "Method",
564 /* 09 */ "Mutex",
565 /* 10 */ "Region",
566 /* 11 */ "Power",
567 /* 12 */ "Processor",
568 /* 13 */ "Thermal",
Bob Moore08978312005-10-21 00:00:00 -0400569 /* 14 */ "BufferField",
570 /* 15 */ "DdbHandle",
571 /* 16 */ "DebugObject",
572 /* 17 */ "RegionField",
573 /* 18 */ "BankField",
574 /* 19 */ "IndexField",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575 /* 20 */ "Reference",
576 /* 21 */ "Alias",
Bob Moore08978312005-10-21 00:00:00 -0400577 /* 22 */ "MethodAlias",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700578 /* 23 */ "Notify",
Bob Moore08978312005-10-21 00:00:00 -0400579 /* 24 */ "AddrHandler",
580 /* 25 */ "ResourceDesc",
581 /* 26 */ "ResourceFld",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 /* 27 */ "Scope",
583 /* 28 */ "Extra",
584 /* 29 */ "Data",
585 /* 30 */ "Invalid"
Bob Moore08978312005-10-21 00:00:00 -0400586/*! [End] no source code translation !*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587};
588
Len Brown4be44fc2005-08-05 00:44:28 -0400589char *acpi_ut_get_type_name(acpi_object_type type)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590{
591
Len Brown4be44fc2005-08-05 00:44:28 -0400592 if (type > ACPI_TYPE_INVALID) {
Bob Moore4a90c7e2006-01-13 16:22:00 -0500593 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 }
595
Bob Moore4a90c7e2006-01-13 16:22:00 -0500596 return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type]));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597}
598
Len Brown4be44fc2005-08-05 00:44:28 -0400599char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600{
601
Len Brown4be44fc2005-08-05 00:44:28 -0400602 if (!obj_desc) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603 return ("[NULL Object Descriptor]");
604 }
605
Len Brown4be44fc2005-08-05 00:44:28 -0400606 return (acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607}
608
Robert Moore44f6c012005-04-18 22:49:35 -0400609/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 *
611 * FUNCTION: acpi_ut_get_node_name
612 *
613 * PARAMETERS: Object - A namespace node
614 *
615 * RETURN: Pointer to a string
616 *
617 * DESCRIPTION: Validate the node and return the node's ACPI name.
618 *
Robert Moore44f6c012005-04-18 22:49:35 -0400619 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620
Len Brown4be44fc2005-08-05 00:44:28 -0400621char *acpi_ut_get_node_name(void *object)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700622{
Len Brown4be44fc2005-08-05 00:44:28 -0400623 struct acpi_namespace_node *node = (struct acpi_namespace_node *)object;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624
625 /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
626
Len Brown4be44fc2005-08-05 00:44:28 -0400627 if (!object) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628 return ("NULL");
629 }
630
631 /* Check for Root node */
632
Len Brown4be44fc2005-08-05 00:44:28 -0400633 if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700634 return ("\"\\\" ");
635 }
636
637 /* Descriptor must be a namespace node */
638
Len Brown4be44fc2005-08-05 00:44:28 -0400639 if (node->descriptor != ACPI_DESC_TYPE_NAMED) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700640 return ("####");
641 }
642
643 /* Name must be a valid ACPI name */
644
Bob Moorec51a4de2005-11-17 13:07:00 -0500645 if (!acpi_ut_valid_acpi_name(node->name.integer)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646 return ("????");
647 }
648
649 /* Return the name */
650
651 return (node->name.ascii);
652}
653
Robert Moore44f6c012005-04-18 22:49:35 -0400654/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 *
656 * FUNCTION: acpi_ut_get_descriptor_name
657 *
658 * PARAMETERS: Object - An ACPI object
659 *
660 * RETURN: Pointer to a string
661 *
662 * DESCRIPTION: Validate object and return the descriptor type
663 *
Robert Moore44f6c012005-04-18 22:49:35 -0400664 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665
Robert Moore44f6c012005-04-18 22:49:35 -0400666/* Printable names of object descriptor types */
667
Len Brown4be44fc2005-08-05 00:44:28 -0400668static const char *acpi_gbl_desc_type_names[] = {
Bob Moore08978312005-10-21 00:00:00 -0400669/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670 /* 00 */ "Invalid",
671 /* 01 */ "Cached",
672 /* 02 */ "State-Generic",
673 /* 03 */ "State-Update",
674 /* 04 */ "State-Package",
675 /* 05 */ "State-Control",
Bob Moore08978312005-10-21 00:00:00 -0400676 /* 06 */ "State-RootParseScope",
677 /* 07 */ "State-ParseScope",
678 /* 08 */ "State-WalkScope",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 /* 09 */ "State-Result",
680 /* 10 */ "State-Notify",
681 /* 11 */ "State-Thread",
682 /* 12 */ "Walk",
683 /* 13 */ "Parser",
684 /* 14 */ "Operand",
685 /* 15 */ "Node"
Bob Moore08978312005-10-21 00:00:00 -0400686/*! [End] no source code translation !*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687};
688
Len Brown4be44fc2005-08-05 00:44:28 -0400689char *acpi_ut_get_descriptor_name(void *object)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690{
691
Len Brown4be44fc2005-08-05 00:44:28 -0400692 if (!object) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 return ("NULL OBJECT");
694 }
695
Len Brown4be44fc2005-08-05 00:44:28 -0400696 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
Bob Mooredefba1d2005-12-16 17:05:00 -0500697 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698 }
699
Bob Mooredefba1d2005-12-16 17:05:00 -0500700 return (ACPI_CAST_PTR(char,
701 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE
702 (object)]));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700703
704}
705
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
707/*
708 * Strings and procedures used for debug only
709 */
710
Robert Moore44f6c012005-04-18 22:49:35 -0400711/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712 *
713 * FUNCTION: acpi_ut_get_mutex_name
714 *
Robert Moore44f6c012005-04-18 22:49:35 -0400715 * PARAMETERS: mutex_id - The predefined ID for this mutex.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716 *
Robert Moore44f6c012005-04-18 22:49:35 -0400717 * RETURN: String containing the name of the mutex. Always returns a valid
718 * pointer.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700719 *
720 * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
721 *
Robert Moore44f6c012005-04-18 22:49:35 -0400722 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723
Len Brown4be44fc2005-08-05 00:44:28 -0400724char *acpi_ut_get_mutex_name(u32 mutex_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700725{
726
Len Brown4be44fc2005-08-05 00:44:28 -0400727 if (mutex_id > MAX_MUTEX) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700728 return ("Invalid Mutex ID");
729 }
730
731 return (acpi_gbl_mutex_names[mutex_id]);
732}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700733#endif
734
Robert Moore44f6c012005-04-18 22:49:35 -0400735/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736 *
737 * FUNCTION: acpi_ut_valid_object_type
738 *
739 * PARAMETERS: Type - Object type to be validated
740 *
Robert Moore44f6c012005-04-18 22:49:35 -0400741 * RETURN: TRUE if valid object type, FALSE otherwise
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742 *
743 * DESCRIPTION: Validate an object type
744 *
Robert Moore44f6c012005-04-18 22:49:35 -0400745 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700746
Len Brown4be44fc2005-08-05 00:44:28 -0400747u8 acpi_ut_valid_object_type(acpi_object_type type)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748{
749
Len Brown4be44fc2005-08-05 00:44:28 -0400750 if (type > ACPI_TYPE_LOCAL_MAX) {
Bob Moore52fc0b02006-10-02 00:00:00 -0400751
Linus Torvalds1da177e2005-04-16 15:20:36 -0700752 /* Note: Assumes all TYPEs are contiguous (external/local) */
753
754 return (FALSE);
755 }
756
757 return (TRUE);
758}
759
Robert Moore44f6c012005-04-18 22:49:35 -0400760/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700761 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700762 * FUNCTION: acpi_ut_init_globals
763 *
Robert Moore44f6c012005-04-18 22:49:35 -0400764 * PARAMETERS: None
765 *
766 * RETURN: None
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767 *
768 * DESCRIPTION: Init library globals. All globals that require specific
769 * initialization should be initialized here!
770 *
Robert Moore44f6c012005-04-18 22:49:35 -0400771 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772
Len Brown4be44fc2005-08-05 00:44:28 -0400773void acpi_ut_init_globals(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774{
Len Brown4be44fc2005-08-05 00:44:28 -0400775 acpi_status status;
776 u32 i;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700777
Len Brown4be44fc2005-08-05 00:44:28 -0400778 ACPI_FUNCTION_TRACE("ut_init_globals");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779
Robert Moore73459f72005-06-24 00:00:00 -0400780 /* Create all memory caches */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700781
Len Brown4be44fc2005-08-05 00:44:28 -0400782 status = acpi_ut_create_caches();
783 if (ACPI_FAILURE(status)) {
Robert Moore73459f72005-06-24 00:00:00 -0400784 return;
785 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786
787 /* ACPI table structure */
788
Len Brown4be44fc2005-08-05 00:44:28 -0400789 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) {
790 acpi_gbl_table_lists[i].next = NULL;
791 acpi_gbl_table_lists[i].count = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700792 }
793
794 /* Mutex locked flags */
795
Len Brown4be44fc2005-08-05 00:44:28 -0400796 for (i = 0; i < NUM_MUTEX; i++) {
797 acpi_gbl_mutex_info[i].mutex = NULL;
798 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
799 acpi_gbl_mutex_info[i].use_count = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800 }
801
Bob Moore28f55eb2005-12-02 18:27:00 -0500802 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
803 acpi_gbl_owner_id_mask[i] = 0;
804 }
805 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
806
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 /* GPE support */
808
Len Brown4be44fc2005-08-05 00:44:28 -0400809 acpi_gbl_gpe_xrupt_list_head = NULL;
810 acpi_gbl_gpe_fadt_blocks[0] = NULL;
811 acpi_gbl_gpe_fadt_blocks[1] = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812
813 /* Global notify handlers */
814
Len Brown4be44fc2005-08-05 00:44:28 -0400815 acpi_gbl_system_notify.handler = NULL;
816 acpi_gbl_device_notify.handler = NULL;
817 acpi_gbl_exception_handler = NULL;
818 acpi_gbl_init_handler = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819
820 /* Global "typed" ACPI table pointers */
821
Len Brown4be44fc2005-08-05 00:44:28 -0400822 acpi_gbl_RSDP = NULL;
823 acpi_gbl_XSDT = NULL;
824 acpi_gbl_FACS = NULL;
825 acpi_gbl_FADT = NULL;
826 acpi_gbl_DSDT = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827
828 /* Global Lock support */
829
Len Brown4be44fc2005-08-05 00:44:28 -0400830 acpi_gbl_global_lock_acquired = FALSE;
831 acpi_gbl_global_lock_thread_count = 0;
832 acpi_gbl_global_lock_handle = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833
834 /* Miscellaneous variables */
835
Len Brown4be44fc2005-08-05 00:44:28 -0400836 acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER;
837 acpi_gbl_rsdp_original_location = 0;
838 acpi_gbl_cm_single_step = FALSE;
839 acpi_gbl_db_terminate_threads = FALSE;
840 acpi_gbl_shutdown = FALSE;
841 acpi_gbl_ns_lookup_count = 0;
842 acpi_gbl_ps_find_count = 0;
843 acpi_gbl_acpi_hardware_present = TRUE;
Bob Moore28f55eb2005-12-02 18:27:00 -0500844 acpi_gbl_last_owner_id_index = 0;
845 acpi_gbl_next_owner_id_offset = 0;
Bob Moore50eca3e2005-09-30 19:03:00 -0400846 acpi_gbl_trace_method_name = 0;
847 acpi_gbl_trace_dbg_level = 0;
848 acpi_gbl_trace_dbg_layer = 0;
Len Brown4be44fc2005-08-05 00:44:28 -0400849 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
850 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700851
852 /* Hardware oriented */
853
Len Brown4be44fc2005-08-05 00:44:28 -0400854 acpi_gbl_events_initialized = FALSE;
855 acpi_gbl_system_awake_and_running = TRUE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856
857 /* Namespace */
858
Len Brown4be44fc2005-08-05 00:44:28 -0400859 acpi_gbl_root_node = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700860 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
861 acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
Len Brown4be44fc2005-08-05 00:44:28 -0400862 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
863 acpi_gbl_root_node_struct.child = NULL;
864 acpi_gbl_root_node_struct.peer = NULL;
865 acpi_gbl_root_node_struct.object = NULL;
866 acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700867
868#ifdef ACPI_DEBUG_OUTPUT
Len Brown4be44fc2005-08-05 00:44:28 -0400869 acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700870#endif
871
872 return_VOID;
873}