[NETFILTER]: ip6table_mangle: reroute when nfmark changes in NF_IP6_LOCAL_OUT
[hh.org.git] / drivers / acpi / utilities / utglobal.c
blob014030af8b5014f30415ede5cf3d5e9cf6d8f388
1 /******************************************************************************
3 * Module Name: utglobal - Global variables for the ACPI subsystem
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2006, R. Byron Moore
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 <acpi/acpi.h>
47 #include <acpi/acnamesp.h>
49 #define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME("utglobal")
52 /*******************************************************************************
54 * FUNCTION: acpi_format_exception
56 * PARAMETERS: Status - The acpi_status code to be formatted
58 * RETURN: A string containing the exception text. A valid pointer is
59 * always returned.
61 * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
63 ******************************************************************************/
64 const char *acpi_format_exception(acpi_status status)
66 acpi_status sub_status;
67 const char *exception = NULL;
69 ACPI_FUNCTION_ENTRY();
72 * Status is composed of two parts, a "type" and an actual code
74 sub_status = (status & ~AE_CODE_MASK);
76 switch (status & AE_CODE_MASK) {
77 case AE_CODE_ENVIRONMENTAL:
79 if (sub_status <= AE_CODE_ENV_MAX) {
80 exception = acpi_gbl_exception_names_env[sub_status];
82 break;
84 case AE_CODE_PROGRAMMER:
86 if (sub_status <= AE_CODE_PGM_MAX) {
87 exception =
88 acpi_gbl_exception_names_pgm[sub_status - 1];
90 break;
92 case AE_CODE_ACPI_TABLES:
94 if (sub_status <= AE_CODE_TBL_MAX) {
95 exception =
96 acpi_gbl_exception_names_tbl[sub_status - 1];
98 break;
100 case AE_CODE_AML:
102 if (sub_status <= AE_CODE_AML_MAX) {
103 exception =
104 acpi_gbl_exception_names_aml[sub_status - 1];
106 break;
108 case AE_CODE_CONTROL:
110 if (sub_status <= AE_CODE_CTRL_MAX) {
111 exception =
112 acpi_gbl_exception_names_ctrl[sub_status - 1];
114 break;
116 default:
117 break;
120 if (!exception) {
122 /* Exception code was not recognized */
124 ACPI_ERROR((AE_INFO,
125 "Unknown exception code: 0x%8.8X", status));
127 exception = "UNKNOWN_STATUS_CODE";
130 return (ACPI_CAST_PTR(const char, exception));
133 /*******************************************************************************
135 * Static global variable initialization.
137 ******************************************************************************/
140 * We want the debug switches statically initialized so they
141 * are already set when the debugger is entered.
144 /* Debug switch - level and trace mask */
145 u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
147 /* Debug switch - layer (component) mask */
149 u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
150 u32 acpi_gbl_nesting_level = 0;
152 /* Debugger globals */
154 u8 acpi_gbl_db_terminate_threads = FALSE;
155 u8 acpi_gbl_abort_method = FALSE;
156 u8 acpi_gbl_method_executing = FALSE;
158 /* System flags */
160 u32 acpi_gbl_startup_flags = 0;
162 /* System starts uninitialized */
164 u8 acpi_gbl_shutdown = TRUE;
166 const u8 acpi_gbl_decode_to8bit[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
168 const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
169 "\\_S0_",
170 "\\_S1_",
171 "\\_S2_",
172 "\\_S3_",
173 "\\_S4_",
174 "\\_S5_"
177 const char *acpi_gbl_highest_dstate_names[4] = {
178 "_S1D",
179 "_S2D",
180 "_S3D",
181 "_S4D"
184 /*******************************************************************************
186 * Namespace globals
188 ******************************************************************************/
191 * Predefined ACPI Names (Built-in to the Interpreter)
193 * NOTES:
194 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
195 * during the initialization sequence.
196 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
197 * perform a Notify() operation on it.
199 const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
200 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
201 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
202 {"_SB_", ACPI_TYPE_DEVICE, NULL},
203 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
204 {"_TZ_", ACPI_TYPE_THERMAL, NULL},
205 {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
206 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
207 {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
209 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
210 {"_OSI", ACPI_TYPE_METHOD, (char *)1},
211 #endif
213 /* Table terminator */
215 {NULL, ACPI_TYPE_ANY, NULL}
219 * Properties of the ACPI Object Types, both internal and external.
220 * The table is indexed by values of acpi_object_type
222 const u8 acpi_gbl_ns_properties[] = {
223 ACPI_NS_NORMAL, /* 00 Any */
224 ACPI_NS_NORMAL, /* 01 Number */
225 ACPI_NS_NORMAL, /* 02 String */
226 ACPI_NS_NORMAL, /* 03 Buffer */
227 ACPI_NS_NORMAL, /* 04 Package */
228 ACPI_NS_NORMAL, /* 05 field_unit */
229 ACPI_NS_NEWSCOPE, /* 06 Device */
230 ACPI_NS_NORMAL, /* 07 Event */
231 ACPI_NS_NEWSCOPE, /* 08 Method */
232 ACPI_NS_NORMAL, /* 09 Mutex */
233 ACPI_NS_NORMAL, /* 10 Region */
234 ACPI_NS_NEWSCOPE, /* 11 Power */
235 ACPI_NS_NEWSCOPE, /* 12 Processor */
236 ACPI_NS_NEWSCOPE, /* 13 Thermal */
237 ACPI_NS_NORMAL, /* 14 buffer_field */
238 ACPI_NS_NORMAL, /* 15 ddb_handle */
239 ACPI_NS_NORMAL, /* 16 Debug Object */
240 ACPI_NS_NORMAL, /* 17 def_field */
241 ACPI_NS_NORMAL, /* 18 bank_field */
242 ACPI_NS_NORMAL, /* 19 index_field */
243 ACPI_NS_NORMAL, /* 20 Reference */
244 ACPI_NS_NORMAL, /* 21 Alias */
245 ACPI_NS_NORMAL, /* 22 method_alias */
246 ACPI_NS_NORMAL, /* 23 Notify */
247 ACPI_NS_NORMAL, /* 24 Address Handler */
248 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */
249 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */
250 ACPI_NS_NEWSCOPE, /* 27 Scope */
251 ACPI_NS_NORMAL, /* 28 Extra */
252 ACPI_NS_NORMAL, /* 29 Data */
253 ACPI_NS_NORMAL /* 30 Invalid */
256 /* Hex to ASCII conversion table */
258 static const char acpi_gbl_hex_to_ascii[] = {
259 '0', '1', '2', '3', '4', '5', '6', '7',
260 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
263 /*******************************************************************************
265 * FUNCTION: acpi_ut_hex_to_ascii_char
267 * PARAMETERS: Integer - Contains the hex digit
268 * Position - bit position of the digit within the
269 * integer (multiple of 4)
271 * RETURN: The converted Ascii character
273 * DESCRIPTION: Convert a hex digit to an Ascii character
275 ******************************************************************************/
277 char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
280 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
283 /*******************************************************************************
285 * Table name globals
287 * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
288 * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
289 * that are not used by the subsystem are simply ignored.
291 * Do NOT add any table to this list that is not consumed directly by this
292 * subsystem (No MADT, ECDT, SBST, etc.)
294 ******************************************************************************/
296 struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1];
298 struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = {
299 /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
301 /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1,
302 ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}
304 /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *)&acpi_gbl_DSDT,
305 sizeof(DSDT_SIG) - 1,
306 ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE |
307 ACPI_TABLE_EXECUTABLE}
309 /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *)&acpi_gbl_FADT,
310 sizeof(FADT_SIG) - 1,
311 ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE}
313 /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *)&acpi_gbl_FACS,
314 sizeof(FACS_SIG) - 1,
315 ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE}
317 /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof(PSDT_SIG) - 1,
318 ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE |
319 ACPI_TABLE_EXECUTABLE}
321 /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof(SSDT_SIG) - 1,
322 ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE |
323 ACPI_TABLE_EXECUTABLE}
325 /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof(RSDT_SIG) - 1,
326 ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}
330 /******************************************************************************
332 * Event and Hardware globals
334 ******************************************************************************/
336 struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
337 /* Name Parent Register Register Bit Position Register Bit Mask */
339 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
340 ACPI_BITPOSITION_TIMER_STATUS,
341 ACPI_BITMASK_TIMER_STATUS},
342 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
343 ACPI_BITPOSITION_BUS_MASTER_STATUS,
344 ACPI_BITMASK_BUS_MASTER_STATUS},
345 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
346 ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
347 ACPI_BITMASK_GLOBAL_LOCK_STATUS},
348 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
349 ACPI_BITPOSITION_POWER_BUTTON_STATUS,
350 ACPI_BITMASK_POWER_BUTTON_STATUS},
351 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
352 ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
353 ACPI_BITMASK_SLEEP_BUTTON_STATUS},
354 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
355 ACPI_BITPOSITION_RT_CLOCK_STATUS,
356 ACPI_BITMASK_RT_CLOCK_STATUS},
357 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
358 ACPI_BITPOSITION_WAKE_STATUS,
359 ACPI_BITMASK_WAKE_STATUS},
360 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
361 ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
362 ACPI_BITMASK_PCIEXP_WAKE_STATUS},
364 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
365 ACPI_BITPOSITION_TIMER_ENABLE,
366 ACPI_BITMASK_TIMER_ENABLE},
367 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
368 ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
369 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
370 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
371 ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
372 ACPI_BITMASK_POWER_BUTTON_ENABLE},
373 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
374 ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
375 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
376 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
377 ACPI_BITPOSITION_RT_CLOCK_ENABLE,
378 ACPI_BITMASK_RT_CLOCK_ENABLE},
379 /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
380 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE,
381 ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
382 ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
384 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
385 ACPI_BITPOSITION_SCI_ENABLE,
386 ACPI_BITMASK_SCI_ENABLE},
387 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL,
388 ACPI_BITPOSITION_BUS_MASTER_RLD,
389 ACPI_BITMASK_BUS_MASTER_RLD},
390 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
391 ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
392 ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
393 /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL,
394 ACPI_BITPOSITION_SLEEP_TYPE_X,
395 ACPI_BITMASK_SLEEP_TYPE_X},
396 /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL,
397 ACPI_BITPOSITION_SLEEP_TYPE_X,
398 ACPI_BITMASK_SLEEP_TYPE_X},
399 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
400 ACPI_BITPOSITION_SLEEP_ENABLE,
401 ACPI_BITMASK_SLEEP_ENABLE},
403 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL,
404 ACPI_BITPOSITION_ARB_DISABLE,
405 ACPI_BITMASK_ARB_DISABLE}
408 struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
409 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS,
410 ACPI_BITREG_TIMER_ENABLE,
411 ACPI_BITMASK_TIMER_STATUS,
412 ACPI_BITMASK_TIMER_ENABLE},
413 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
414 ACPI_BITREG_GLOBAL_LOCK_ENABLE,
415 ACPI_BITMASK_GLOBAL_LOCK_STATUS,
416 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
417 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS,
418 ACPI_BITREG_POWER_BUTTON_ENABLE,
419 ACPI_BITMASK_POWER_BUTTON_STATUS,
420 ACPI_BITMASK_POWER_BUTTON_ENABLE},
421 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
422 ACPI_BITREG_SLEEP_BUTTON_ENABLE,
423 ACPI_BITMASK_SLEEP_BUTTON_STATUS,
424 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
425 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS,
426 ACPI_BITREG_RT_CLOCK_ENABLE,
427 ACPI_BITMASK_RT_CLOCK_STATUS,
428 ACPI_BITMASK_RT_CLOCK_ENABLE},
431 /*******************************************************************************
433 * FUNCTION: acpi_ut_get_region_name
435 * PARAMETERS: None.
437 * RETURN: Status
439 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
441 ******************************************************************************/
443 /* Region type decoding */
445 const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
446 "SystemMemory",
447 "SystemIO",
448 "PCI_Config",
449 "EmbeddedControl",
450 "SMBus",
451 "CMOS",
452 "PCIBARTarget",
453 "DataTable"
456 char *acpi_ut_get_region_name(u8 space_id)
459 if (space_id >= ACPI_USER_REGION_BEGIN) {
460 return ("UserDefinedRegion");
461 } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) {
462 return ("InvalidSpaceId");
465 return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
468 /*******************************************************************************
470 * FUNCTION: acpi_ut_get_event_name
472 * PARAMETERS: None.
474 * RETURN: Status
476 * DESCRIPTION: Translate a Event ID into a name string (Debug only)
478 ******************************************************************************/
480 /* Event type decoding */
482 static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
483 "PM_Timer",
484 "GlobalLock",
485 "PowerButton",
486 "SleepButton",
487 "RealTimeClock",
490 char *acpi_ut_get_event_name(u32 event_id)
493 if (event_id > ACPI_EVENT_MAX) {
494 return ("InvalidEventID");
497 return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id]));
500 /*******************************************************************************
502 * FUNCTION: acpi_ut_get_type_name
504 * PARAMETERS: None.
506 * RETURN: Status
508 * DESCRIPTION: Translate a Type ID into a name string (Debug only)
510 ******************************************************************************/
513 * Elements of acpi_gbl_ns_type_names below must match
514 * one-to-one with values of acpi_object_type
516 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
517 * when stored in a table it really means that we have thus far seen no
518 * evidence to indicate what type is actually going to be stored for this entry.
520 static const char acpi_gbl_bad_type[] = "UNDEFINED";
522 /* Printable names of the ACPI object types */
524 static const char *acpi_gbl_ns_type_names[] = {
525 /* 00 */ "Untyped",
526 /* 01 */ "Integer",
527 /* 02 */ "String",
528 /* 03 */ "Buffer",
529 /* 04 */ "Package",
530 /* 05 */ "FieldUnit",
531 /* 06 */ "Device",
532 /* 07 */ "Event",
533 /* 08 */ "Method",
534 /* 09 */ "Mutex",
535 /* 10 */ "Region",
536 /* 11 */ "Power",
537 /* 12 */ "Processor",
538 /* 13 */ "Thermal",
539 /* 14 */ "BufferField",
540 /* 15 */ "DdbHandle",
541 /* 16 */ "DebugObject",
542 /* 17 */ "RegionField",
543 /* 18 */ "BankField",
544 /* 19 */ "IndexField",
545 /* 20 */ "Reference",
546 /* 21 */ "Alias",
547 /* 22 */ "MethodAlias",
548 /* 23 */ "Notify",
549 /* 24 */ "AddrHandler",
550 /* 25 */ "ResourceDesc",
551 /* 26 */ "ResourceFld",
552 /* 27 */ "Scope",
553 /* 28 */ "Extra",
554 /* 29 */ "Data",
555 /* 30 */ "Invalid"
558 char *acpi_ut_get_type_name(acpi_object_type type)
561 if (type > ACPI_TYPE_INVALID) {
562 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
565 return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type]));
568 char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
571 if (!obj_desc) {
572 return ("[NULL Object Descriptor]");
575 return (acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)));
578 /*******************************************************************************
580 * FUNCTION: acpi_ut_get_node_name
582 * PARAMETERS: Object - A namespace node
584 * RETURN: Pointer to a string
586 * DESCRIPTION: Validate the node and return the node's ACPI name.
588 ******************************************************************************/
590 char *acpi_ut_get_node_name(void *object)
592 struct acpi_namespace_node *node = (struct acpi_namespace_node *)object;
594 /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
596 if (!object) {
597 return ("NULL");
600 /* Check for Root node */
602 if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) {
603 return ("\"\\\" ");
606 /* Descriptor must be a namespace node */
608 if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
609 return ("####");
612 /* Name must be a valid ACPI name */
614 if (!acpi_ut_valid_acpi_name(node->name.integer)) {
615 node->name.integer = acpi_ut_repair_name(node->name.integer);
618 /* Return the name */
620 return (node->name.ascii);
623 /*******************************************************************************
625 * FUNCTION: acpi_ut_get_descriptor_name
627 * PARAMETERS: Object - An ACPI object
629 * RETURN: Pointer to a string
631 * DESCRIPTION: Validate object and return the descriptor type
633 ******************************************************************************/
635 /* Printable names of object descriptor types */
637 static const char *acpi_gbl_desc_type_names[] = {
638 /* 00 */ "Invalid",
639 /* 01 */ "Cached",
640 /* 02 */ "State-Generic",
641 /* 03 */ "State-Update",
642 /* 04 */ "State-Package",
643 /* 05 */ "State-Control",
644 /* 06 */ "State-RootParseScope",
645 /* 07 */ "State-ParseScope",
646 /* 08 */ "State-WalkScope",
647 /* 09 */ "State-Result",
648 /* 10 */ "State-Notify",
649 /* 11 */ "State-Thread",
650 /* 12 */ "Walk",
651 /* 13 */ "Parser",
652 /* 14 */ "Operand",
653 /* 15 */ "Node"
656 char *acpi_ut_get_descriptor_name(void *object)
659 if (!object) {
660 return ("NULL OBJECT");
663 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
664 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
667 return (ACPI_CAST_PTR(char,
668 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE
669 (object)]));
673 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
675 * Strings and procedures used for debug only
678 /*******************************************************************************
680 * FUNCTION: acpi_ut_get_mutex_name
682 * PARAMETERS: mutex_id - The predefined ID for this mutex.
684 * RETURN: String containing the name of the mutex. Always returns a valid
685 * pointer.
687 * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
689 ******************************************************************************/
691 char *acpi_ut_get_mutex_name(u32 mutex_id)
694 if (mutex_id > ACPI_MAX_MUTEX) {
695 return ("Invalid Mutex ID");
698 return (acpi_gbl_mutex_names[mutex_id]);
700 #endif
702 /*******************************************************************************
704 * FUNCTION: acpi_ut_valid_object_type
706 * PARAMETERS: Type - Object type to be validated
708 * RETURN: TRUE if valid object type, FALSE otherwise
710 * DESCRIPTION: Validate an object type
712 ******************************************************************************/
714 u8 acpi_ut_valid_object_type(acpi_object_type type)
717 if (type > ACPI_TYPE_LOCAL_MAX) {
719 /* Note: Assumes all TYPEs are contiguous (external/local) */
721 return (FALSE);
724 return (TRUE);
727 /*******************************************************************************
729 * FUNCTION: acpi_ut_init_globals
731 * PARAMETERS: None
733 * RETURN: None
735 * DESCRIPTION: Init library globals. All globals that require specific
736 * initialization should be initialized here!
738 ******************************************************************************/
740 void acpi_ut_init_globals(void)
742 acpi_status status;
743 u32 i;
745 ACPI_FUNCTION_TRACE(ut_init_globals);
747 /* Create all memory caches */
749 status = acpi_ut_create_caches();
750 if (ACPI_FAILURE(status)) {
751 return;
754 /* ACPI table structure */
756 for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) {
757 acpi_gbl_table_lists[i].next = NULL;
758 acpi_gbl_table_lists[i].count = 0;
761 /* Mutex locked flags */
763 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
764 acpi_gbl_mutex_info[i].mutex = NULL;
765 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
766 acpi_gbl_mutex_info[i].use_count = 0;
769 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
770 acpi_gbl_owner_id_mask[i] = 0;
772 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
774 /* GPE support */
776 acpi_gbl_gpe_xrupt_list_head = NULL;
777 acpi_gbl_gpe_fadt_blocks[0] = NULL;
778 acpi_gbl_gpe_fadt_blocks[1] = NULL;
780 /* Global notify handlers */
782 acpi_gbl_system_notify.handler = NULL;
783 acpi_gbl_device_notify.handler = NULL;
784 acpi_gbl_exception_handler = NULL;
785 acpi_gbl_init_handler = NULL;
787 /* Global "typed" ACPI table pointers */
789 acpi_gbl_RSDP = NULL;
790 acpi_gbl_XSDT = NULL;
791 acpi_gbl_FACS = NULL;
792 acpi_gbl_FADT = NULL;
793 acpi_gbl_DSDT = NULL;
795 /* Global Lock support */
797 acpi_gbl_global_lock_semaphore = NULL;
798 acpi_gbl_global_lock_acquired = FALSE;
799 acpi_gbl_global_lock_thread_count = 0;
800 acpi_gbl_global_lock_handle = 0;
802 /* Miscellaneous variables */
804 acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER;
805 acpi_gbl_rsdp_original_location = 0;
806 acpi_gbl_cm_single_step = FALSE;
807 acpi_gbl_db_terminate_threads = FALSE;
808 acpi_gbl_shutdown = FALSE;
809 acpi_gbl_ns_lookup_count = 0;
810 acpi_gbl_ps_find_count = 0;
811 acpi_gbl_acpi_hardware_present = TRUE;
812 acpi_gbl_last_owner_id_index = 0;
813 acpi_gbl_next_owner_id_offset = 0;
814 acpi_gbl_trace_method_name = 0;
815 acpi_gbl_trace_dbg_level = 0;
816 acpi_gbl_trace_dbg_layer = 0;
817 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
818 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
820 /* Hardware oriented */
822 acpi_gbl_events_initialized = FALSE;
823 acpi_gbl_system_awake_and_running = TRUE;
825 /* Namespace */
827 acpi_gbl_root_node = NULL;
828 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
829 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
830 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
831 acpi_gbl_root_node_struct.child = NULL;
832 acpi_gbl_root_node_struct.peer = NULL;
833 acpi_gbl_root_node_struct.object = NULL;
834 acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST;
836 #ifdef ACPI_DEBUG_OUTPUT
837 acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX;
838 #endif
840 return_VOID;
843 ACPI_EXPORT_SYMBOL(acpi_dbg_level)
844 ACPI_EXPORT_SYMBOL(acpi_dbg_layer)