1 /******************************************************************************
3 * Module Name: utglobal - Global variables for the ACPI subsystem
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
13 * All rights reserved.
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
73 * 3.4. Intel retains all right, title, and interest in and to the Original
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
116 /* $DragonFly: src/sys/contrib/dev/acpica/Attic/utglobal.c,v 1.1 2003/09/24 03:32:16 drhodus Exp $ */
118 #define __UTGLOBAL_C__
119 #define DEFINE_ACPI_GLOBALS
122 #include "acnamesp.h"
124 #define _COMPONENT ACPI_UTILITIES
125 ACPI_MODULE_NAME ("utglobal")
128 /******************************************************************************
130 * FUNCTION: AcpiFormatException
132 * PARAMETERS: Status - The ACPI_STATUS code to be formatted
134 * RETURN: A string containing the exception text
136 * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
138 ******************************************************************************/
141 AcpiFormatException (
144 const char *Exception = "UNKNOWN_STATUS_CODE";
145 ACPI_STATUS SubStatus;
148 ACPI_FUNCTION_NAME ("FormatException");
151 SubStatus = (Status & ~AE_CODE_MASK);
153 switch (Status & AE_CODE_MASK)
155 case AE_CODE_ENVIRONMENTAL:
157 if (SubStatus <= AE_CODE_ENV_MAX)
159 Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
164 case AE_CODE_PROGRAMMER:
166 if (SubStatus <= AE_CODE_PGM_MAX)
168 Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
173 case AE_CODE_ACPI_TABLES:
175 if (SubStatus <= AE_CODE_TBL_MAX)
177 Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
184 if (SubStatus <= AE_CODE_AML_MAX)
186 Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
191 case AE_CODE_CONTROL:
193 if (SubStatus <= AE_CODE_CTRL_MAX)
195 Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
205 return ((const char *) Exception);
209 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", Status));
210 return ((const char *) Exception);
214 /******************************************************************************
216 * Static global variable initialization.
218 ******************************************************************************/
221 * We want the debug switches statically initialized so they
222 * are already set when the debugger is entered.
225 /* Debug switch - level and trace mask */
227 #ifdef ACPI_DEBUG_OUTPUT
228 UINT32 AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
230 UINT32 AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
233 /* Debug switch - layer (component) mask */
235 UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT;
236 UINT32 AcpiGbl_NestingLevel = 0;
239 /* Debugger globals */
241 BOOLEAN AcpiGbl_DbTerminateThreads = FALSE;
242 BOOLEAN AcpiGbl_AbortMethod = FALSE;
243 BOOLEAN AcpiGbl_MethodExecuting = FALSE;
247 UINT32 AcpiGbl_StartupFlags = 0;
249 /* System starts uninitialized */
251 BOOLEAN AcpiGbl_Shutdown = TRUE;
253 const UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128};
255 const char *AcpiGbl_DbSleepStates[ACPI_S_STATE_COUNT] = {
264 /******************************************************************************
268 ******************************************************************************/
272 * Predefined ACPI Names (Built-in to the Interpreter)
274 * Initial values are currently supported only for types String and Number.
275 * Both are specified as strings in this table.
278 * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run
279 * during the initialization sequence.
282 const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
284 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
285 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
286 {"_SB_", ACPI_TYPE_DEVICE, NULL},
287 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
288 {"_TZ_", ACPI_TYPE_LOCAL_SCOPE, NULL},
289 {"_REV", ACPI_TYPE_INTEGER, "2"},
290 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
291 {"_GL_", ACPI_TYPE_MUTEX, "0"},
293 #if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
294 {"_OSI", ACPI_TYPE_METHOD, "1"},
296 {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */
301 * Properties of the ACPI Object Types, both internal and external.
302 * The table is indexed by values of ACPI_OBJECT_TYPE
305 const UINT8 AcpiGbl_NsProperties[] =
307 ACPI_NS_NORMAL, /* 00 Any */
308 ACPI_NS_NORMAL, /* 01 Number */
309 ACPI_NS_NORMAL, /* 02 String */
310 ACPI_NS_NORMAL, /* 03 Buffer */
311 ACPI_NS_NORMAL, /* 04 Package */
312 ACPI_NS_NORMAL, /* 05 FieldUnit */
313 ACPI_NS_NEWSCOPE, /* 06 Device */
314 ACPI_NS_NORMAL, /* 07 Event */
315 ACPI_NS_NEWSCOPE, /* 08 Method */
316 ACPI_NS_NORMAL, /* 09 Mutex */
317 ACPI_NS_NORMAL, /* 10 Region */
318 ACPI_NS_NEWSCOPE, /* 11 Power */
319 ACPI_NS_NEWSCOPE, /* 12 Processor */
320 ACPI_NS_NEWSCOPE, /* 13 Thermal */
321 ACPI_NS_NORMAL, /* 14 BufferField */
322 ACPI_NS_NORMAL, /* 15 DdbHandle */
323 ACPI_NS_NORMAL, /* 16 Debug Object */
324 ACPI_NS_NORMAL, /* 17 DefField */
325 ACPI_NS_NORMAL, /* 18 BankField */
326 ACPI_NS_NORMAL, /* 19 IndexField */
327 ACPI_NS_NORMAL, /* 20 Reference */
328 ACPI_NS_NORMAL, /* 21 Alias */
329 ACPI_NS_NORMAL, /* 22 Notify */
330 ACPI_NS_NORMAL, /* 23 Address Handler */
331 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 24 Resource Desc */
332 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Field */
333 ACPI_NS_NEWSCOPE, /* 26 Scope */
334 ACPI_NS_NORMAL, /* 27 Extra */
335 ACPI_NS_NORMAL, /* 28 Data */
336 ACPI_NS_NORMAL /* 29 Invalid */
340 /* Hex to ASCII conversion table */
342 static const char AcpiGbl_HexToAscii[] =
343 {'0','1','2','3','4','5','6','7',
344 '8','9','A','B','C','D','E','F'};
346 /*****************************************************************************
348 * FUNCTION: AcpiUtHexToAsciiChar
350 * PARAMETERS: Integer - Contains the hex digit
351 * Position - bit position of the digit within the
354 * RETURN: Ascii character
356 * DESCRIPTION: Convert a hex digit to an ascii character
358 ****************************************************************************/
361 AcpiUtHexToAsciiChar (
362 ACPI_INTEGER Integer,
366 return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
370 /******************************************************************************
374 * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
375 * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
376 * that are not used by the subsystem are simply ignored.
378 * Do NOT add any table to this list that is not consumed directly by this
381 ******************************************************************************/
384 ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES];
387 ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] =
389 /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
391 /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
392 /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void **) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
393 /* FADT 2 */ {FADT_SIG, FADT_SIG, (void **) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE},
394 /* FACS 3 */ {FACS_SIG, FACS_SIG, (void **) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE},
395 /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
396 /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
397 /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
401 /******************************************************************************
403 * Event and Hardware globals
405 ******************************************************************************/
407 ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] =
409 /* Name Parent Register Register Bit Position Register Bit Mask */
411 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_TIMER_STATUS, ACPI_BITMASK_TIMER_STATUS},
412 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_BUS_MASTER_STATUS, ACPI_BITMASK_BUS_MASTER_STATUS},
413 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_STATUS},
414 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_STATUS},
415 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_STATUS},
416 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_STATUS},
417 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_WAKE_STATUS, ACPI_BITMASK_WAKE_STATUS},
419 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_TIMER_ENABLE, ACPI_BITMASK_TIMER_ENABLE},
420 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
421 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_ENABLE},
422 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
423 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE},
424 /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
426 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE},
427 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD},
428 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
429 /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X},
430 /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X},
431 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_ENABLE, ACPI_BITMASK_SLEEP_ENABLE},
433 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, ACPI_BITPOSITION_ARB_DISABLE, ACPI_BITMASK_ARB_DISABLE}
437 ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
439 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, ACPI_BITREG_TIMER_ENABLE, ACPI_BITMASK_TIMER_STATUS, ACPI_BITMASK_TIMER_ENABLE},
440 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, ACPI_BITREG_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
441 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE},
442 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
443 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, 0, 0},
446 /*****************************************************************************
448 * FUNCTION: AcpiUtGetRegionName
454 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
456 ****************************************************************************/
458 /* Region type decoding */
460 const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
462 /*! [Begin] no source code translation (keep these ASL Keywords as-is) */
471 /*! [End] no source code translation !*/
476 AcpiUtGetRegionName (
480 if (SpaceId >= ACPI_USER_REGION_BEGIN)
482 return ("UserDefinedRegion");
485 else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
487 return ("InvalidSpaceId");
490 return ((char *) AcpiGbl_RegionTypes[SpaceId]);
494 /*****************************************************************************
496 * FUNCTION: AcpiUtGetEventName
502 * DESCRIPTION: Translate a Event ID into a name string (Debug only)
504 ****************************************************************************/
506 /* Event type decoding */
508 static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
523 if (EventId > ACPI_EVENT_MAX)
525 return ("InvalidEventID");
528 return ((char *) AcpiGbl_EventTypes[EventId]);
532 /*****************************************************************************
534 * FUNCTION: AcpiUtGetTypeName
540 * DESCRIPTION: Translate a Type ID into a name string (Debug only)
542 ****************************************************************************/
545 * Elements of AcpiGbl_NsTypeNames below must match
546 * one-to-one with values of ACPI_OBJECT_TYPE
548 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when
549 * stored in a table it really means that we have thus far seen no evidence to
550 * indicatewhat type is actually going to be stored for this entry.
553 static const char AcpiGbl_BadType[] = "UNDEFINED";
554 #define TYPE_NAME_LENGTH 12 /* Maximum length of each string */
556 static const char *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */
563 /* 05 */ "FieldUnit",
570 /* 12 */ "Processor",
572 /* 14 */ "BufferField",
573 /* 15 */ "DdbHandle",
574 /* 16 */ "DebugObject",
575 /* 17 */ "RegionField",
576 /* 18 */ "BankField",
577 /* 19 */ "IndexField",
578 /* 20 */ "Reference",
581 /* 23 */ "AddrHandler",
582 /* 24 */ "ResourceDesc",
583 /* 25 */ "ResourceFld",
593 ACPI_OBJECT_TYPE Type)
596 if (Type > ACPI_TYPE_INVALID)
598 return ((char *) AcpiGbl_BadType);
601 return ((char *) AcpiGbl_NsTypeNames[Type]);
606 AcpiUtGetObjectTypeName (
607 ACPI_OPERAND_OBJECT *ObjDesc)
612 return ("[NULL Object Descriptor]");
615 return (AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)));
619 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
622 * Strings and procedures used for debug only
626 /*****************************************************************************
628 * FUNCTION: AcpiUtGetMutexName
634 * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
636 ****************************************************************************/
643 if (MutexId > MAX_MTX)
645 return ("Invalid Mutex ID");
648 return (AcpiGbl_MutexNames[MutexId]);
655 /*****************************************************************************
657 * FUNCTION: AcpiUtValidObjectType
659 * PARAMETERS: Type - Object type to be validated
661 * RETURN: TRUE if valid object type
663 * DESCRIPTION: Validate an object type
665 ****************************************************************************/
668 AcpiUtValidObjectType (
669 ACPI_OBJECT_TYPE Type)
672 if (Type > ACPI_TYPE_LOCAL_MAX)
674 /* Note: Assumes all TYPEs are contiguous (external/local) */
683 /****************************************************************************
685 * FUNCTION: AcpiUtAllocateOwnerId
687 * PARAMETERS: IdType - Type of ID (method or table)
689 * DESCRIPTION: Allocate a table or method owner id
691 ***************************************************************************/
694 AcpiUtAllocateOwnerId (
697 ACPI_OWNER_ID OwnerId = 0xFFFF;
700 ACPI_FUNCTION_TRACE ("UtAllocateOwnerId");
703 if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
710 case ACPI_OWNER_TYPE_TABLE:
712 OwnerId = AcpiGbl_NextTableOwnerId;
713 AcpiGbl_NextTableOwnerId++;
715 if (AcpiGbl_NextTableOwnerId == ACPI_FIRST_METHOD_ID)
717 AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
722 case ACPI_OWNER_TYPE_METHOD:
724 OwnerId = AcpiGbl_NextMethodOwnerId;
725 AcpiGbl_NextMethodOwnerId++;
727 if (AcpiGbl_NextMethodOwnerId == ACPI_FIRST_TABLE_ID)
729 AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
737 (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
738 return_VALUE (OwnerId);
742 /****************************************************************************
744 * FUNCTION: AcpiUtInitGlobals
748 * DESCRIPTION: Init library globals. All globals that require specific
749 * initialization should be initialized here!
751 ***************************************************************************/
760 ACPI_FUNCTION_TRACE ("UtInitGlobals");
762 /* Memory allocation and cache lists */
764 ACPI_MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS);
766 AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_GENERIC_STATE *) NULL)->Common.Next), NULL);
767 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL);
768 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL);
769 AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next), NULL);
770 AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_WALK_STATE *) NULL)->Next), NULL);
772 AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize = sizeof (ACPI_NAMESPACE_NODE);
773 AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize = sizeof (ACPI_GENERIC_STATE);
774 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJ_COMMON);
775 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE_OBJ_NAMED);
776 AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ObjectSize = sizeof (ACPI_OPERAND_OBJECT);
777 AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ObjectSize = sizeof (ACPI_WALK_STATE);
779 AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].MaxCacheDepth = ACPI_MAX_STATE_CACHE_DEPTH;
780 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].MaxCacheDepth = ACPI_MAX_PARSE_CACHE_DEPTH;
781 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].MaxCacheDepth = ACPI_MAX_EXTPARSE_CACHE_DEPTH;
782 AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].MaxCacheDepth = ACPI_MAX_OBJECT_CACHE_DEPTH;
783 AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].MaxCacheDepth = ACPI_MAX_WALK_CACHE_DEPTH;
785 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].ListName = "Global Memory Allocation");
786 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ListName = "Namespace Nodes");
787 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ListName = "State Object Cache");
788 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ListName = "Parse Node Cache");
789 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ListName = "Extended Parse Node Cache");
790 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ListName = "Operand Object Cache");
791 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ListName = "Tree Walk Node Cache");
793 /* ACPI table structure */
795 for (i = 0; i < NUM_ACPI_TABLES; i++)
797 AcpiGbl_AcpiTables[i].Prev = &AcpiGbl_AcpiTables[i];
798 AcpiGbl_AcpiTables[i].Next = &AcpiGbl_AcpiTables[i];
799 AcpiGbl_AcpiTables[i].Pointer = NULL;
800 AcpiGbl_AcpiTables[i].Length = 0;
801 AcpiGbl_AcpiTables[i].Allocation = ACPI_MEM_NOT_ALLOCATED;
802 AcpiGbl_AcpiTables[i].Count = 0;
805 /* Mutex locked flags */
807 for (i = 0; i < NUM_MTX; i++)
809 AcpiGbl_AcpiMutexInfo[i].Mutex = NULL;
810 AcpiGbl_AcpiMutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
811 AcpiGbl_AcpiMutexInfo[i].UseCount = 0;
816 AcpiGbl_GpeBlockListHead = NULL;
818 /* Global notify handlers */
820 AcpiGbl_SysNotify.Handler = NULL;
821 AcpiGbl_DrvNotify.Handler = NULL;
822 AcpiGbl_InitHandler = NULL;
824 /* Global "typed" ACPI table pointers */
832 /* Global Lock support */
834 AcpiGbl_GlobalLockAcquired = FALSE;
835 AcpiGbl_GlobalLockThreadCount = 0;
836 AcpiGbl_GlobalLockHandle = 0;
838 /* Miscellaneous variables */
840 AcpiGbl_TableFlags = ACPI_PHYSICAL_POINTER;
841 AcpiGbl_RsdpOriginalLocation = 0;
842 AcpiGbl_CmSingleStep = FALSE;
843 AcpiGbl_DbTerminateThreads = FALSE;
844 AcpiGbl_Shutdown = FALSE;
845 AcpiGbl_NsLookupCount = 0;
846 AcpiGbl_PsFindCount = 0;
847 AcpiGbl_AcpiHardwarePresent = TRUE;
848 AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
849 AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
850 AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING;
851 AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
853 /* Hardware oriented */
855 AcpiGbl_EventsInitialized = FALSE;
859 AcpiGbl_RootNode = NULL;
861 AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
862 AcpiGbl_RootNodeStruct.Descriptor = ACPI_DESC_TYPE_NAMED;
863 AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
864 AcpiGbl_RootNodeStruct.Child = NULL;
865 AcpiGbl_RootNodeStruct.Peer = NULL;
866 AcpiGbl_RootNodeStruct.Object = NULL;
867 AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST;
870 #ifdef ACPI_DEBUG_OUTPUT
871 AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX;