utglobal.c revision 213806
167754Smsmith/******************************************************************************
267754Smsmith *
377424Smsmith * Module Name: utglobal - Global variables for the ACPI subsystem
467754Smsmith *
567754Smsmith *****************************************************************************/
667754Smsmith
767754Smsmith/******************************************************************************
867754Smsmith *
967754Smsmith * 1. Copyright Notice
1067754Smsmith *
11202771Sjkim * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
1270243Smsmith * All rights reserved.
1367754Smsmith *
1467754Smsmith * 2. License
1567754Smsmith *
1667754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property
1767754Smsmith * rights.  You may have additional license terms from the party that provided
1867754Smsmith * you this software, covering your right to use that party's intellectual
1967754Smsmith * property rights.
2067754Smsmith *
2167754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2267754Smsmith * copy of the source code appearing in this file ("Covered Code") an
2367754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2467754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy,
2567754Smsmith * make derivatives, distribute, use and display any portion of the Covered
2667754Smsmith * Code in any form, with the right to sublicense such rights; and
2767754Smsmith *
2867754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
2967754Smsmith * license (with the right to sublicense), under only those claims of Intel
3067754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell,
3167754Smsmith * offer to sell, and import the Covered Code and derivative works thereof
3267754Smsmith * solely to the minimum extent necessary to exercise the above copyright
3367754Smsmith * license, and in no event shall the patent license extend to any additions
3467754Smsmith * to or modifications of the Original Intel Code.  No other license or right
3567754Smsmith * is granted directly or by implication, estoppel or otherwise;
3667754Smsmith *
3767754Smsmith * The above copyright and patent license is granted only if the following
3867754Smsmith * conditions are met:
3967754Smsmith *
4067754Smsmith * 3. Conditions
4167754Smsmith *
4267754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4367754Smsmith * Redistribution of source code of any substantial portion of the Covered
4467754Smsmith * Code or modification with rights to further distribute source must include
4567754Smsmith * the above Copyright Notice, the above License, this list of Conditions,
4667754Smsmith * and the following Disclaimer and Export Compliance provision.  In addition,
4767754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to
4867754Smsmith * contain a file documenting the changes Licensee made to create that Covered
4967754Smsmith * Code and the date of any change.  Licensee must include in that file the
5067754Smsmith * documentation of any changes made by any predecessor Licensee.  Licensee
5167754Smsmith * must include a prominent statement that the modification is derived,
5267754Smsmith * directly or indirectly, from Original Intel Code.
5367754Smsmith *
5467754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5567754Smsmith * Redistribution of source code of any substantial portion of the Covered
5667754Smsmith * Code or modification without rights to further distribute source must
5767754Smsmith * include the following Disclaimer and Export Compliance provision in the
5867754Smsmith * documentation and/or other materials provided with distribution.  In
5967754Smsmith * addition, Licensee may not authorize further sublicense of source of any
6067754Smsmith * portion of the Covered Code, and must include terms to the effect that the
6167754Smsmith * license from Licensee to its licensee is limited to the intellectual
6267754Smsmith * property embodied in the software Licensee provides to its licensee, and
6367754Smsmith * not to intellectual property embodied in modifications its licensee may
6467754Smsmith * make.
6567754Smsmith *
6667754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any
6767754Smsmith * substantial portion of the Covered Code or modification must reproduce the
6867754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance
6967754Smsmith * provision in the documentation and/or other materials provided with the
7067754Smsmith * distribution.
7167754Smsmith *
7267754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original
7367754Smsmith * Intel Code.
7467754Smsmith *
7567754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7667754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or
7767754Smsmith * other dealings in products derived from or relating to the Covered Code
7867754Smsmith * without prior written authorization from Intel.
7967754Smsmith *
8067754Smsmith * 4. Disclaimer and Export Compliance
8167754Smsmith *
8267754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8367754Smsmith * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8467754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8567754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8667754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8767754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8867754Smsmith * PARTICULAR PURPOSE.
8967754Smsmith *
9067754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9167754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9267754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9367754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9467754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9567754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9667754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9767754Smsmith * LIMITED REMEDY.
9867754Smsmith *
9967754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this
10067754Smsmith * software or system incorporating such software without first obtaining any
10167754Smsmith * required license or other approval from the U. S. Department of Commerce or
10267754Smsmith * any other agency or department of the United States Government.  In the
10367754Smsmith * event Licensee exports any such software from the United States or
10467754Smsmith * re-exports any such software from a foreign destination, Licensee shall
10567754Smsmith * ensure that the distribution and export/re-export of the software is in
10667754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the
10767754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10867754Smsmith * any of its subsidiaries will export/re-export any technical data, process,
10967754Smsmith * software, or service, directly or indirectly, to any country for which the
11067754Smsmith * United States government or any agency thereof requires an export license,
11167754Smsmith * other governmental approval, or letter of assurance, without first obtaining
11267754Smsmith * such license, approval or letter.
11367754Smsmith *
11467754Smsmith *****************************************************************************/
11567754Smsmith
11677424Smsmith#define __UTGLOBAL_C__
11767754Smsmith#define DEFINE_ACPI_GLOBALS
11867754Smsmith
119193341Sjkim#include <contrib/dev/acpica/include/acpi.h>
120193341Sjkim#include <contrib/dev/acpica/include/accommon.h>
121193341Sjkim#include <contrib/dev/acpica/include/acnamesp.h>
12267754Smsmith
12377424Smsmith#define _COMPONENT          ACPI_UTILITIES
12491116Smsmith        ACPI_MODULE_NAME    ("utglobal")
12567754Smsmith
12667754Smsmith
127151937Sjkim/*******************************************************************************
12867754Smsmith *
12967754Smsmith * Static global variable initialization.
13067754Smsmith *
13167754Smsmith ******************************************************************************/
13267754Smsmith
13367754Smsmith/*
13467754Smsmith * We want the debug switches statically initialized so they
13567754Smsmith * are already set when the debugger is entered.
13667754Smsmith */
13767754Smsmith
13867754Smsmith/* Debug switch - level and trace mask */
13967754Smsmith
140102550Siwasaki#ifdef ACPI_DEBUG_OUTPUT
141114237SnjlUINT32                      AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
14267754Smsmith#else
143114237SnjlUINT32                      AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
14467754Smsmith#endif
14567754Smsmith
14667754Smsmith/* Debug switch - layer (component) mask */
14767754Smsmith
14877424SmsmithUINT32                      AcpiDbgLayer = ACPI_COMPONENT_DEFAULT;
14967754SmsmithUINT32                      AcpiGbl_NestingLevel = 0;
15067754Smsmith
15167754Smsmith/* Debugger globals */
15267754Smsmith
15367754SmsmithBOOLEAN                     AcpiGbl_DbTerminateThreads = FALSE;
154114237SnjlBOOLEAN                     AcpiGbl_AbortMethod = FALSE;
15567754SmsmithBOOLEAN                     AcpiGbl_MethodExecuting = FALSE;
15667754Smsmith
15767754Smsmith/* System flags */
15867754Smsmith
15967754SmsmithUINT32                      AcpiGbl_StartupFlags = 0;
16067754Smsmith
16187031Smsmith/* System starts uninitialized */
16283174Smsmith
16367754SmsmithBOOLEAN                     AcpiGbl_Shutdown = TRUE;
16467754Smsmith
165129684Snjlconst char                  *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] =
166129684Snjl{
167129684Snjl    "\\_S0_",
168129684Snjl    "\\_S1_",
169129684Snjl    "\\_S2_",
170129684Snjl    "\\_S3_",
171129684Snjl    "\\_S4_",
172129684Snjl    "\\_S5_"
173129684Snjl};
17469450Smsmith
175197104Sjkimconst char                  *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS] =
176129684Snjl{
177197104Sjkim    "_S0W",
178197104Sjkim    "_S1W",
179197104Sjkim    "_S2W",
180197104Sjkim    "_S3W",
181197104Sjkim    "_S4W"
182197104Sjkim};
183197104Sjkim
184197104Sjkimconst char                  *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] =
185197104Sjkim{
186129684Snjl    "_S1D",
187129684Snjl    "_S2D",
188129684Snjl    "_S3D",
189129684Snjl    "_S4D"
190129684Snjl};
19169450Smsmith
192167802Sjkim
193167802Sjkim/*******************************************************************************
194167802Sjkim *
195167802Sjkim * FUNCTION:    AcpiFormatException
196167802Sjkim *
197167802Sjkim * PARAMETERS:  Status       - The ACPI_STATUS code to be formatted
198167802Sjkim *
199167802Sjkim * RETURN:      A string containing the exception text. A valid pointer is
200167802Sjkim *              always returned.
201167802Sjkim *
202167802Sjkim * DESCRIPTION: This function translates an ACPI exception into an ASCII string
203167802Sjkim *              It is here instead of utxface.c so it is always present.
204167802Sjkim *
205167802Sjkim ******************************************************************************/
206167802Sjkim
207167802Sjkimconst char *
208167802SjkimAcpiFormatException (
209167802Sjkim    ACPI_STATUS             Status)
210129684Snjl{
211167802Sjkim    const char              *Exception = NULL;
212151937Sjkim
213151937Sjkim
214167802Sjkim    ACPI_FUNCTION_ENTRY ();
215151937Sjkim
216127175Snjl
217167802Sjkim    Exception = AcpiUtValidateException (Status);
218167802Sjkim    if (!Exception)
219167802Sjkim    {
220167802Sjkim        /* Exception code was not recognized */
221127175Snjl
222167802Sjkim        ACPI_ERROR ((AE_INFO,
223167802Sjkim            "Unknown exception code: 0x%8.8X", Status));
224167802Sjkim
225167802Sjkim        Exception = "UNKNOWN_STATUS_CODE";
226167802Sjkim    }
227167802Sjkim
228167802Sjkim    return (ACPI_CAST_PTR (const char, Exception));
229167802Sjkim}
230167802Sjkim
231167802SjkimACPI_EXPORT_SYMBOL (AcpiFormatException)
232167802Sjkim
233167802Sjkim
234151937Sjkim/*******************************************************************************
23567754Smsmith *
23667754Smsmith * Namespace globals
23767754Smsmith *
23867754Smsmith ******************************************************************************/
23967754Smsmith
24067754Smsmith/*
241104470Siwasaki * Predefined ACPI Names (Built-in to the Interpreter)
24267754Smsmith *
24377424Smsmith * NOTES:
244127175Snjl * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
24577424Smsmith *    during the initialization sequence.
246151937Sjkim * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
247213806Sjkim *    perform a Notify() operation on it. 09/2010: Changed to type Device.
248213806Sjkim *    This still allows notifies, but does not confuse host code that
249213806Sjkim *    searches for valid ThermalZone objects.
25067754Smsmith */
25191116Smsmithconst ACPI_PREDEFINED_NAMES     AcpiGbl_PreDefinedNames[] =
25267754Smsmith{
253107325Siwasaki    {"_GPE",    ACPI_TYPE_LOCAL_SCOPE,      NULL},
254107325Siwasaki    {"_PR_",    ACPI_TYPE_LOCAL_SCOPE,      NULL},
25599679Siwasaki    {"_SB_",    ACPI_TYPE_DEVICE,           NULL},
256107325Siwasaki    {"_SI_",    ACPI_TYPE_LOCAL_SCOPE,      NULL},
257213806Sjkim    {"_TZ_",    ACPI_TYPE_DEVICE,           NULL},
258151937Sjkim    {"_REV",    ACPI_TYPE_INTEGER,          (char *) ACPI_CA_SUPPORT_LEVEL},
25999146Siwasaki    {"_OS_",    ACPI_TYPE_STRING,           ACPI_OS_NAME},
260151937Sjkim    {"_GL_",    ACPI_TYPE_MUTEX,            (char *) 1},
261102550Siwasaki
262127175Snjl#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
263151937Sjkim    {"_OSI",    ACPI_TYPE_METHOD,           (char *) 1},
264102550Siwasaki#endif
265151937Sjkim
266151937Sjkim    /* Table terminator */
267151937Sjkim
268151937Sjkim    {NULL,      ACPI_TYPE_ANY,              NULL}
26967754Smsmith};
27067754Smsmith
27167754Smsmith/*
27267754Smsmith * Properties of the ACPI Object Types, both internal and external.
273104470Siwasaki * The table is indexed by values of ACPI_OBJECT_TYPE
27467754Smsmith */
275193267Sjkimconst UINT8                     AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] =
27667754Smsmith{
27791116Smsmith    ACPI_NS_NORMAL,                     /* 00 Any              */
27891116Smsmith    ACPI_NS_NORMAL,                     /* 01 Number           */
27991116Smsmith    ACPI_NS_NORMAL,                     /* 02 String           */
28091116Smsmith    ACPI_NS_NORMAL,                     /* 03 Buffer           */
28199146Siwasaki    ACPI_NS_NORMAL,                     /* 04 Package          */
28291116Smsmith    ACPI_NS_NORMAL,                     /* 05 FieldUnit        */
28399146Siwasaki    ACPI_NS_NEWSCOPE,                   /* 06 Device           */
28499146Siwasaki    ACPI_NS_NORMAL,                     /* 07 Event            */
28599146Siwasaki    ACPI_NS_NEWSCOPE,                   /* 08 Method           */
28699146Siwasaki    ACPI_NS_NORMAL,                     /* 09 Mutex            */
28799146Siwasaki    ACPI_NS_NORMAL,                     /* 10 Region           */
28899146Siwasaki    ACPI_NS_NEWSCOPE,                   /* 11 Power            */
28999146Siwasaki    ACPI_NS_NEWSCOPE,                   /* 12 Processor        */
29099146Siwasaki    ACPI_NS_NEWSCOPE,                   /* 13 Thermal          */
29191116Smsmith    ACPI_NS_NORMAL,                     /* 14 BufferField      */
29291116Smsmith    ACPI_NS_NORMAL,                     /* 15 DdbHandle        */
29391116Smsmith    ACPI_NS_NORMAL,                     /* 16 Debug Object     */
29491116Smsmith    ACPI_NS_NORMAL,                     /* 17 DefField         */
29591116Smsmith    ACPI_NS_NORMAL,                     /* 18 BankField        */
29691116Smsmith    ACPI_NS_NORMAL,                     /* 19 IndexField       */
29791116Smsmith    ACPI_NS_NORMAL,                     /* 20 Reference        */
29891116Smsmith    ACPI_NS_NORMAL,                     /* 21 Alias            */
299128212Snjl    ACPI_NS_NORMAL,                     /* 22 MethodAlias      */
300128212Snjl    ACPI_NS_NORMAL,                     /* 23 Notify           */
301128212Snjl    ACPI_NS_NORMAL,                     /* 24 Address Handler  */
302128212Snjl    ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL,   /* 25 Resource Desc    */
303128212Snjl    ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL,   /* 26 Resource Field   */
304128212Snjl    ACPI_NS_NEWSCOPE,                   /* 27 Scope            */
305128212Snjl    ACPI_NS_NORMAL,                     /* 28 Extra            */
306128212Snjl    ACPI_NS_NORMAL,                     /* 29 Data             */
307128212Snjl    ACPI_NS_NORMAL                      /* 30 Invalid          */
30867754Smsmith};
30967754Smsmith
31067754Smsmith
31171867Smsmith/* Hex to ASCII conversion table */
31271867Smsmith
313114237Snjlstatic const char           AcpiGbl_HexToAscii[] =
314151937Sjkim{
315151937Sjkim    '0','1','2','3','4','5','6','7',
316151937Sjkim    '8','9','A','B','C','D','E','F'
317151937Sjkim};
31871867Smsmith
319151937Sjkim
320151937Sjkim/*******************************************************************************
32183174Smsmith *
32283174Smsmith * FUNCTION:    AcpiUtHexToAsciiChar
32383174Smsmith *
32483174Smsmith * PARAMETERS:  Integer             - Contains the hex digit
32583174Smsmith *              Position            - bit position of the digit within the
326151937Sjkim *                                    integer (multiple of 4)
32783174Smsmith *
328151937Sjkim * RETURN:      The converted Ascii character
32983174Smsmith *
330151937Sjkim * DESCRIPTION: Convert a hex digit to an Ascii character
33183174Smsmith *
332151937Sjkim ******************************************************************************/
33383174Smsmith
33499679Siwasakichar
33582367SmsmithAcpiUtHexToAsciiChar (
336202771Sjkim    UINT64                  Integer,
33782367Smsmith    UINT32                  Position)
33882367Smsmith{
33971867Smsmith
34082367Smsmith    return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
34182367Smsmith}
34282367Smsmith
34383174Smsmith
34491116Smsmith/******************************************************************************
34591116Smsmith *
34691116Smsmith * Event and Hardware globals
34791116Smsmith *
34891116Smsmith ******************************************************************************/
34991116Smsmith
35091116SmsmithACPI_BIT_REGISTER_INFO      AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] =
35191116Smsmith{
35291116Smsmith    /* Name                                     Parent Register             Register Bit Position                   Register Bit Mask       */
35391116Smsmith
35491116Smsmith    /* ACPI_BITREG_TIMER_STATUS         */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_TIMER_STATUS,          ACPI_BITMASK_TIMER_STATUS},
35591116Smsmith    /* ACPI_BITREG_BUS_MASTER_STATUS    */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_BUS_MASTER_STATUS,     ACPI_BITMASK_BUS_MASTER_STATUS},
35691116Smsmith    /* ACPI_BITREG_GLOBAL_LOCK_STATUS   */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,    ACPI_BITMASK_GLOBAL_LOCK_STATUS},
35791116Smsmith    /* ACPI_BITREG_POWER_BUTTON_STATUS  */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_POWER_BUTTON_STATUS,   ACPI_BITMASK_POWER_BUTTON_STATUS},
35891116Smsmith    /* ACPI_BITREG_SLEEP_BUTTON_STATUS  */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,   ACPI_BITMASK_SLEEP_BUTTON_STATUS},
35991116Smsmith    /* ACPI_BITREG_RT_CLOCK_STATUS      */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_RT_CLOCK_STATUS,       ACPI_BITMASK_RT_CLOCK_STATUS},
36091116Smsmith    /* ACPI_BITREG_WAKE_STATUS          */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_WAKE_STATUS,           ACPI_BITMASK_WAKE_STATUS},
361151937Sjkim    /* ACPI_BITREG_PCIEXP_WAKE_STATUS   */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,    ACPI_BITMASK_PCIEXP_WAKE_STATUS},
36291116Smsmith
36391116Smsmith    /* ACPI_BITREG_TIMER_ENABLE         */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_TIMER_ENABLE,          ACPI_BITMASK_TIMER_ENABLE},
36491116Smsmith    /* ACPI_BITREG_GLOBAL_LOCK_ENABLE   */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,    ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
36591116Smsmith    /* ACPI_BITREG_POWER_BUTTON_ENABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_POWER_BUTTON_ENABLE,   ACPI_BITMASK_POWER_BUTTON_ENABLE},
36691116Smsmith    /* ACPI_BITREG_SLEEP_BUTTON_ENABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,   ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
36791116Smsmith    /* ACPI_BITREG_RT_CLOCK_ENABLE      */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_RT_CLOCK_ENABLE,       ACPI_BITMASK_RT_CLOCK_ENABLE},
368151937Sjkim    /* ACPI_BITREG_PCIEXP_WAKE_DISABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,   ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
36991116Smsmith
37091116Smsmith    /* ACPI_BITREG_SCI_ENABLE           */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SCI_ENABLE,            ACPI_BITMASK_SCI_ENABLE},
37191116Smsmith    /* ACPI_BITREG_BUS_MASTER_RLD       */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_BUS_MASTER_RLD,        ACPI_BITMASK_BUS_MASTER_RLD},
37291116Smsmith    /* ACPI_BITREG_GLOBAL_LOCK_RELEASE  */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,   ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
373193267Sjkim    /* ACPI_BITREG_SLEEP_TYPE           */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_TYPE,            ACPI_BITMASK_SLEEP_TYPE},
37491116Smsmith    /* ACPI_BITREG_SLEEP_ENABLE         */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_ENABLE,          ACPI_BITMASK_SLEEP_ENABLE},
37591116Smsmith
37691116Smsmith    /* ACPI_BITREG_ARB_DIS              */   {ACPI_REGISTER_PM2_CONTROL,  ACPI_BITPOSITION_ARB_DISABLE,           ACPI_BITMASK_ARB_DISABLE}
37791116Smsmith};
37891116Smsmith
37991116Smsmith
38091116SmsmithACPI_FIXED_EVENT_INFO       AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
38191116Smsmith{
38291116Smsmith    /* ACPI_EVENT_PMTIMER       */  {ACPI_BITREG_TIMER_STATUS,          ACPI_BITREG_TIMER_ENABLE,        ACPI_BITMASK_TIMER_STATUS,          ACPI_BITMASK_TIMER_ENABLE},
38391116Smsmith    /* ACPI_EVENT_GLOBAL        */  {ACPI_BITREG_GLOBAL_LOCK_STATUS,    ACPI_BITREG_GLOBAL_LOCK_ENABLE,  ACPI_BITMASK_GLOBAL_LOCK_STATUS,    ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
38491116Smsmith    /* ACPI_EVENT_POWER_BUTTON  */  {ACPI_BITREG_POWER_BUTTON_STATUS,   ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS,   ACPI_BITMASK_POWER_BUTTON_ENABLE},
38591116Smsmith    /* ACPI_EVENT_SLEEP_BUTTON  */  {ACPI_BITREG_SLEEP_BUTTON_STATUS,   ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS,   ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
386123315Snjl    /* ACPI_EVENT_RTC           */  {ACPI_BITREG_RT_CLOCK_STATUS,       ACPI_BITREG_RT_CLOCK_ENABLE,     ACPI_BITMASK_RT_CLOCK_STATUS,       ACPI_BITMASK_RT_CLOCK_ENABLE},
38791116Smsmith};
38891116Smsmith
389151937Sjkim/*******************************************************************************
39091116Smsmith *
39191116Smsmith * FUNCTION:    AcpiUtGetRegionName
39291116Smsmith *
39391116Smsmith * PARAMETERS:  None.
39491116Smsmith *
39591116Smsmith * RETURN:      Status
39691116Smsmith *
39791116Smsmith * DESCRIPTION: Translate a Space ID into a name string (Debug only)
39891116Smsmith *
399151937Sjkim ******************************************************************************/
40091116Smsmith
40191116Smsmith/* Region type decoding */
40291116Smsmith
403114237Snjlconst char        *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
40491116Smsmith{
40591116Smsmith    "SystemMemory",
40691116Smsmith    "SystemIO",
407100966Siwasaki    "PCI_Config",
40891116Smsmith    "EmbeddedControl",
40991116Smsmith    "SMBus",
410193267Sjkim    "SystemCMOS",
411100966Siwasaki    "PCIBARTarget",
412197104Sjkim    "IPMI",
413114237Snjl    "DataTable"
41491116Smsmith};
41591116Smsmith
41691116Smsmith
417114237Snjlchar *
41891116SmsmithAcpiUtGetRegionName (
41991116Smsmith    UINT8                   SpaceId)
42091116Smsmith{
42191116Smsmith
42291116Smsmith    if (SpaceId >= ACPI_USER_REGION_BEGIN)
42391116Smsmith    {
42491116Smsmith        return ("UserDefinedRegion");
42591116Smsmith    }
42691116Smsmith    else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
42791116Smsmith    {
428114237Snjl        return ("InvalidSpaceId");
42991116Smsmith    }
43091116Smsmith
431167802Sjkim    return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId]));
43291116Smsmith}
43391116Smsmith
43491116Smsmith
435151937Sjkim/*******************************************************************************
43691116Smsmith *
43791116Smsmith * FUNCTION:    AcpiUtGetEventName
43891116Smsmith *
43991116Smsmith * PARAMETERS:  None.
44091116Smsmith *
44191116Smsmith * RETURN:      Status
44291116Smsmith *
44391116Smsmith * DESCRIPTION: Translate a Event ID into a name string (Debug only)
44491116Smsmith *
445151937Sjkim ******************************************************************************/
44691116Smsmith
44791116Smsmith/* Event type decoding */
44891116Smsmith
449114237Snjlstatic const char        *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
45091116Smsmith{
45191116Smsmith    "PM_Timer",
45291116Smsmith    "GlobalLock",
45391116Smsmith    "PowerButton",
45491116Smsmith    "SleepButton",
45591116Smsmith    "RealTimeClock",
45691116Smsmith};
45791116Smsmith
45891116Smsmith
459114237Snjlchar *
46091116SmsmithAcpiUtGetEventName (
46191116Smsmith    UINT32                  EventId)
46291116Smsmith{
46391116Smsmith
46491116Smsmith    if (EventId > ACPI_EVENT_MAX)
46591116Smsmith    {
46691116Smsmith        return ("InvalidEventID");
46791116Smsmith    }
46891116Smsmith
469167802Sjkim    return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId]));
47091116Smsmith}
47191116Smsmith
47291116Smsmith
473151937Sjkim/*******************************************************************************
47467754Smsmith *
47591116Smsmith * FUNCTION:    AcpiUtGetTypeName
47691116Smsmith *
47791116Smsmith * PARAMETERS:  None.
47891116Smsmith *
47991116Smsmith * RETURN:      Status
48091116Smsmith *
48191116Smsmith * DESCRIPTION: Translate a Type ID into a name string (Debug only)
48291116Smsmith *
483151937Sjkim ******************************************************************************/
48491116Smsmith
48567754Smsmith/*
48667754Smsmith * Elements of AcpiGbl_NsTypeNames below must match
48767754Smsmith * one-to-one with values of ACPI_OBJECT_TYPE
48867754Smsmith *
489151937Sjkim * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
490151937Sjkim * when stored in a table it really means that we have thus far seen no
491151937Sjkim * evidence to indicate what type is actually going to be stored for this entry.
49267754Smsmith */
493114237Snjlstatic const char           AcpiGbl_BadType[] = "UNDEFINED";
49467754Smsmith
495151937Sjkim/* Printable names of the ACPI object types */
496151937Sjkim
497151937Sjkimstatic const char           *AcpiGbl_NsTypeNames[] =
49867754Smsmith{
49967754Smsmith    /* 00 */ "Untyped",
50071867Smsmith    /* 01 */ "Integer",
50167754Smsmith    /* 02 */ "String",
50267754Smsmith    /* 03 */ "Buffer",
50367754Smsmith    /* 04 */ "Package",
50467754Smsmith    /* 05 */ "FieldUnit",
50567754Smsmith    /* 06 */ "Device",
50667754Smsmith    /* 07 */ "Event",
50767754Smsmith    /* 08 */ "Method",
50867754Smsmith    /* 09 */ "Mutex",
50967754Smsmith    /* 10 */ "Region",
51067754Smsmith    /* 11 */ "Power",
51167754Smsmith    /* 12 */ "Processor",
51267754Smsmith    /* 13 */ "Thermal",
51385756Smsmith    /* 14 */ "BufferField",
51467754Smsmith    /* 15 */ "DdbHandle",
51585756Smsmith    /* 16 */ "DebugObject",
51685756Smsmith    /* 17 */ "RegionField",
51777424Smsmith    /* 18 */ "BankField",
51885756Smsmith    /* 19 */ "IndexField",
51967754Smsmith    /* 20 */ "Reference",
52067754Smsmith    /* 21 */ "Alias",
521128212Snjl    /* 22 */ "MethodAlias",
522128212Snjl    /* 23 */ "Notify",
523128212Snjl    /* 24 */ "AddrHandler",
524128212Snjl    /* 25 */ "ResourceDesc",
525128212Snjl    /* 26 */ "ResourceFld",
526128212Snjl    /* 27 */ "Scope",
527128212Snjl    /* 28 */ "Extra",
528128212Snjl    /* 29 */ "Data",
529128212Snjl    /* 30 */ "Invalid"
53067754Smsmith};
53167754Smsmith
53267754Smsmith
533114237Snjlchar *
53477424SmsmithAcpiUtGetTypeName (
53591116Smsmith    ACPI_OBJECT_TYPE        Type)
53667754Smsmith{
53767754Smsmith
538107325Siwasaki    if (Type > ACPI_TYPE_INVALID)
53967754Smsmith    {
540167802Sjkim        return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
54167754Smsmith    }
54267754Smsmith
543167802Sjkim    return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type]));
54467754Smsmith}
54567754Smsmith
54669746Smsmith
547114237Snjlchar *
54899679SiwasakiAcpiUtGetObjectTypeName (
54999679Siwasaki    ACPI_OPERAND_OBJECT     *ObjDesc)
55099679Siwasaki{
55199679Siwasaki
55299679Siwasaki    if (!ObjDesc)
55399679Siwasaki    {
55499679Siwasaki        return ("[NULL Object Descriptor]");
55599679Siwasaki    }
55699679Siwasaki
557193267Sjkim    return (AcpiUtGetTypeName (ObjDesc->Common.Type));
55899679Siwasaki}
55999679Siwasaki
56099679Siwasaki
561151937Sjkim/*******************************************************************************
562123315Snjl *
563123315Snjl * FUNCTION:    AcpiUtGetNodeName
564123315Snjl *
565123315Snjl * PARAMETERS:  Object               - A namespace node
566123315Snjl *
567123315Snjl * RETURN:      Pointer to a string
568123315Snjl *
569123315Snjl * DESCRIPTION: Validate the node and return the node's ACPI name.
570123315Snjl *
571151937Sjkim ******************************************************************************/
572123315Snjl
573123315Snjlchar *
574123315SnjlAcpiUtGetNodeName (
575123315Snjl    void                    *Object)
576123315Snjl{
577128212Snjl    ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) Object;
578123315Snjl
579123315Snjl
580128212Snjl    /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
581128212Snjl
582123315Snjl    if (!Object)
583123315Snjl    {
584128212Snjl        return ("NULL");
585123315Snjl    }
586123315Snjl
587128212Snjl    /* Check for Root node */
588123315Snjl
589128212Snjl    if ((Object == ACPI_ROOT_OBJECT) ||
590128212Snjl        (Object == AcpiGbl_RootNode))
591128212Snjl    {
592128212Snjl        return ("\"\\\" ");
593128212Snjl    }
594128212Snjl
595128212Snjl    /* Descriptor must be a namespace node */
596128212Snjl
597167802Sjkim    if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
598123315Snjl    {
599128212Snjl        return ("####");
600123315Snjl    }
601123315Snjl
602193267Sjkim    /*
603193267Sjkim     * Ensure name is valid. The name was validated/repaired when the node
604193267Sjkim     * was created, but make sure it has not been corrupted.
605193267Sjkim     */
606193267Sjkim    AcpiUtRepairName (Node->Name.Ascii);
607128212Snjl
608128212Snjl    /* Return the name */
609128212Snjl
610123315Snjl    return (Node->Name.Ascii);
611123315Snjl}
612123315Snjl
613123315Snjl
614151937Sjkim/*******************************************************************************
615123315Snjl *
616123315Snjl * FUNCTION:    AcpiUtGetDescriptorName
617123315Snjl *
618123315Snjl * PARAMETERS:  Object               - An ACPI object
619123315Snjl *
620123315Snjl * RETURN:      Pointer to a string
621123315Snjl *
622123315Snjl * DESCRIPTION: Validate object and return the descriptor type
623123315Snjl *
624151937Sjkim ******************************************************************************/
625123315Snjl
626151937Sjkim/* Printable names of object descriptor types */
627151937Sjkim
628151937Sjkimstatic const char           *AcpiGbl_DescTypeNames[] =
629123315Snjl{
630207344Sjkim    /* 00 */ "Not a Descriptor",
631123315Snjl    /* 01 */ "Cached",
632123315Snjl    /* 02 */ "State-Generic",
633123315Snjl    /* 03 */ "State-Update",
634123315Snjl    /* 04 */ "State-Package",
635123315Snjl    /* 05 */ "State-Control",
636123315Snjl    /* 06 */ "State-RootParseScope",
637123315Snjl    /* 07 */ "State-ParseScope",
638123315Snjl    /* 08 */ "State-WalkScope",
639123315Snjl    /* 09 */ "State-Result",
640123315Snjl    /* 10 */ "State-Notify",
641123315Snjl    /* 11 */ "State-Thread",
642123315Snjl    /* 12 */ "Walk",
643123315Snjl    /* 13 */ "Parser",
644123315Snjl    /* 14 */ "Operand",
645123315Snjl    /* 15 */ "Node"
646123315Snjl};
647123315Snjl
648123315Snjl
649123315Snjlchar *
650123315SnjlAcpiUtGetDescriptorName (
651123315Snjl    void                    *Object)
652123315Snjl{
653123315Snjl
654123315Snjl    if (!Object)
655123315Snjl    {
656123315Snjl        return ("NULL OBJECT");
657123315Snjl    }
658123315Snjl
659123315Snjl    if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX)
660123315Snjl    {
661207344Sjkim        return ("Not a Descriptor");
662123315Snjl    }
663123315Snjl
664167802Sjkim    return (ACPI_CAST_PTR (char,
665167802Sjkim        AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]));
666123315Snjl
667123315Snjl}
668123315Snjl
669123315Snjl
670193267Sjkim/*******************************************************************************
671193267Sjkim *
672193267Sjkim * FUNCTION:    AcpiUtGetReferenceName
673193267Sjkim *
674193267Sjkim * PARAMETERS:  Object               - An ACPI reference object
675193267Sjkim *
676193267Sjkim * RETURN:      Pointer to a string
677193267Sjkim *
678193267Sjkim * DESCRIPTION: Decode a reference object sub-type to a string.
679193267Sjkim *
680193267Sjkim ******************************************************************************/
681193267Sjkim
682193267Sjkim/* Printable names of reference object sub-types */
683193267Sjkim
684193267Sjkimstatic const char           *AcpiGbl_RefClassNames[] =
685193267Sjkim{
686193267Sjkim    /* 00 */ "Local",
687193267Sjkim    /* 01 */ "Argument",
688193267Sjkim    /* 02 */ "RefOf",
689193267Sjkim    /* 03 */ "Index",
690193267Sjkim    /* 04 */ "DdbHandle",
691193267Sjkim    /* 05 */ "Named Object",
692193267Sjkim    /* 06 */ "Debug"
693193267Sjkim};
694193267Sjkim
695193267Sjkimconst char *
696193267SjkimAcpiUtGetReferenceName (
697193267Sjkim    ACPI_OPERAND_OBJECT     *Object)
698193267Sjkim{
699193267Sjkim
700193267Sjkim    if (!Object)
701193267Sjkim    {
702193267Sjkim        return ("NULL Object");
703193267Sjkim    }
704193267Sjkim
705193267Sjkim    if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
706193267Sjkim    {
707193267Sjkim        return ("Not an Operand object");
708193267Sjkim    }
709193267Sjkim
710193267Sjkim    if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
711193267Sjkim    {
712193267Sjkim        return ("Not a Reference object");
713193267Sjkim    }
714193267Sjkim
715193267Sjkim    if (Object->Reference.Class > ACPI_REFCLASS_MAX)
716193267Sjkim    {
717193267Sjkim        return ("Unknown Reference class");
718193267Sjkim    }
719193267Sjkim
720193267Sjkim    return (AcpiGbl_RefClassNames[Object->Reference.Class]);
721193267Sjkim}
722193267Sjkim
723193267Sjkim
724102550Siwasaki#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
725100966Siwasaki/*
726100966Siwasaki * Strings and procedures used for debug only
727100966Siwasaki */
72899679Siwasaki
729151937Sjkim/*******************************************************************************
730100966Siwasaki *
731100966Siwasaki * FUNCTION:    AcpiUtGetMutexName
732100966Siwasaki *
733151937Sjkim * PARAMETERS:  MutexId         - The predefined ID for this mutex.
734100966Siwasaki *
735151937Sjkim * RETURN:      String containing the name of the mutex. Always returns a valid
736151937Sjkim *              pointer.
737100966Siwasaki *
738100966Siwasaki * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
739100966Siwasaki *
740151937Sjkim ******************************************************************************/
74169746Smsmith
742114237Snjlchar *
743100966SiwasakiAcpiUtGetMutexName (
744100966Siwasaki    UINT32                  MutexId)
74569746Smsmith{
74669746Smsmith
747167802Sjkim    if (MutexId > ACPI_MAX_MUTEX)
748100966Siwasaki    {
749100966Siwasaki        return ("Invalid Mutex ID");
750100966Siwasaki    }
75169746Smsmith
752100966Siwasaki    return (AcpiGbl_MutexNames[MutexId]);
753100966Siwasaki}
754193267Sjkim
755193267Sjkim
756193267Sjkim/*******************************************************************************
757193267Sjkim *
758193267Sjkim * FUNCTION:    AcpiUtGetNotifyName
759193267Sjkim *
760193267Sjkim * PARAMETERS:  NotifyValue     - Value from the Notify() request
761193267Sjkim *
762193267Sjkim * RETURN:      String corresponding to the Notify Value.
763193267Sjkim *
764193267Sjkim * DESCRIPTION: Translate a Notify Value to a notify namestring.
765193267Sjkim *
766193267Sjkim ******************************************************************************/
767193267Sjkim
768193267Sjkim/* Names for Notify() values, used for debug output */
769193267Sjkim
770193267Sjkimstatic const char        *AcpiGbl_NotifyValueNames[] =
771193267Sjkim{
772193267Sjkim    "Bus Check",
773193267Sjkim    "Device Check",
774193267Sjkim    "Device Wake",
775193267Sjkim    "Eject Request",
776193267Sjkim    "Device Check Light",
777193267Sjkim    "Frequency Mismatch",
778193267Sjkim    "Bus Mode Mismatch",
779193267Sjkim    "Power Fault",
780193267Sjkim    "Capabilities Check",
781193267Sjkim    "Device PLD Check",
782193267Sjkim    "Reserved",
783193267Sjkim    "System Locality Update"
784193267Sjkim};
785193267Sjkim
786193267Sjkimconst char *
787193267SjkimAcpiUtGetNotifyName (
788193267Sjkim    UINT32                  NotifyValue)
789193267Sjkim{
790193267Sjkim
791193267Sjkim    if (NotifyValue <= ACPI_NOTIFY_MAX)
792193267Sjkim    {
793193267Sjkim        return (AcpiGbl_NotifyValueNames[NotifyValue]);
794193267Sjkim    }
795193267Sjkim    else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
796193267Sjkim    {
797193267Sjkim        return ("Reserved");
798193267Sjkim    }
799193267Sjkim    else /* Greater or equal to 0x80 */
800193267Sjkim    {
801193267Sjkim        return ("**Device Specific**");
802193267Sjkim    }
803193267Sjkim}
80467754Smsmith#endif
80567754Smsmith
80667754Smsmith
807151937Sjkim/*******************************************************************************
80867754Smsmith *
80977424Smsmith * FUNCTION:    AcpiUtValidObjectType
81067754Smsmith *
811107325Siwasaki * PARAMETERS:  Type            - Object type to be validated
81267754Smsmith *
813151937Sjkim * RETURN:      TRUE if valid object type, FALSE otherwise
81467754Smsmith *
81567754Smsmith * DESCRIPTION: Validate an object type
81667754Smsmith *
817151937Sjkim ******************************************************************************/
81867754Smsmith
81967754SmsmithBOOLEAN
82077424SmsmithAcpiUtValidObjectType (
82191116Smsmith    ACPI_OBJECT_TYPE        Type)
82267754Smsmith{
82367754Smsmith
824107325Siwasaki    if (Type > ACPI_TYPE_LOCAL_MAX)
82567754Smsmith    {
826107325Siwasaki        /* Note: Assumes all TYPEs are contiguous (external/local) */
827107325Siwasaki
828107325Siwasaki        return (FALSE);
82967754Smsmith    }
83067754Smsmith
83167754Smsmith    return (TRUE);
83267754Smsmith}
83367754Smsmith
83467754Smsmith
835151937Sjkim/*******************************************************************************
83667754Smsmith *
837151937Sjkim * FUNCTION:    AcpiUtInitGlobals
83867754Smsmith *
839151937Sjkim * PARAMETERS:  None
84067754Smsmith *
841193267Sjkim * RETURN:      Status
84267754Smsmith *
84367754Smsmith * DESCRIPTION: Init library globals.  All globals that require specific
84467754Smsmith *              initialization should be initialized here!
84567754Smsmith *
846151937Sjkim ******************************************************************************/
84767754Smsmith
848193267SjkimACPI_STATUS
84977424SmsmithAcpiUtInitGlobals (
85067754Smsmith    void)
85167754Smsmith{
852151937Sjkim    ACPI_STATUS             Status;
85367754Smsmith    UINT32                  i;
85467754Smsmith
85567754Smsmith
856167802Sjkim    ACPI_FUNCTION_TRACE (UtInitGlobals);
85767754Smsmith
858127175Snjl
859151937Sjkim    /* Create all memory caches */
86082367Smsmith
861151937Sjkim    Status = AcpiUtCreateCaches ();
862151937Sjkim    if (ACPI_FAILURE (Status))
863151937Sjkim    {
864193267Sjkim        return_ACPI_STATUS (Status);
865151937Sjkim    }
86682367Smsmith
86767754Smsmith    /* Mutex locked flags */
86867754Smsmith
869167802Sjkim    for (i = 0; i < ACPI_NUM_MUTEX; i++)
87067754Smsmith    {
871117521Snjl        AcpiGbl_MutexInfo[i].Mutex          = NULL;
872151937Sjkim        AcpiGbl_MutexInfo[i].ThreadId       = ACPI_MUTEX_NOT_ACQUIRED;
873117521Snjl        AcpiGbl_MutexInfo[i].UseCount       = 0;
87467754Smsmith    }
87567754Smsmith
876167802Sjkim    for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)
877167802Sjkim    {
878167802Sjkim        AcpiGbl_OwnerIdMask[i]              = 0;
879167802Sjkim    }
880167802Sjkim
881193267Sjkim    /* Last OwnerID is never valid */
882193267Sjkim
883193267Sjkim    AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
884193267Sjkim
885193267Sjkim    /* Event counters */
886193267Sjkim
887193267Sjkim    AcpiMethodCount                     = 0;
888193267Sjkim    AcpiSciCount                        = 0;
889193267Sjkim    AcpiGpeCount                        = 0;
890193267Sjkim
891193267Sjkim    for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
892193267Sjkim    {
893193267Sjkim        AcpiFixedEventCount[i]              = 0;
894193267Sjkim    }
895193267Sjkim
896114237Snjl    /* GPE support */
897114237Snjl
898117521Snjl    AcpiGbl_GpeXruptListHead            = NULL;
899117521Snjl    AcpiGbl_GpeFadtBlocks[0]            = NULL;
900117521Snjl    AcpiGbl_GpeFadtBlocks[1]            = NULL;
901193267Sjkim    AcpiCurrentGpeCount                 = 0;
902114237Snjl
903193267Sjkim    /* Global handlers */
90467754Smsmith
905117521Snjl    AcpiGbl_SystemNotify.Handler        = NULL;
906117521Snjl    AcpiGbl_DeviceNotify.Handler        = NULL;
907138287Smarks    AcpiGbl_ExceptionHandler            = NULL;
90899679Siwasaki    AcpiGbl_InitHandler                 = NULL;
909193267Sjkim    AcpiGbl_TableHandler                = NULL;
910210976Sjkim    AcpiGbl_InterfaceHandler            = NULL;
91167754Smsmith
91267754Smsmith    /* Global Lock support */
91367754Smsmith
914167802Sjkim    AcpiGbl_GlobalLockSemaphore         = NULL;
915167802Sjkim    AcpiGbl_GlobalLockMutex             = NULL;
91667754Smsmith    AcpiGbl_GlobalLockAcquired          = FALSE;
91791116Smsmith    AcpiGbl_GlobalLockHandle            = 0;
918193267Sjkim    AcpiGbl_GlobalLockPresent           = FALSE;
91967754Smsmith
92067754Smsmith    /* Miscellaneous variables */
92167754Smsmith
922206117Sjkim    AcpiGbl_DSDT                        = NULL;
92367754Smsmith    AcpiGbl_CmSingleStep                = FALSE;
92467754Smsmith    AcpiGbl_DbTerminateThreads          = FALSE;
92567754Smsmith    AcpiGbl_Shutdown                    = FALSE;
92667754Smsmith    AcpiGbl_NsLookupCount               = 0;
92767754Smsmith    AcpiGbl_PsFindCount                 = 0;
92867754Smsmith    AcpiGbl_AcpiHardwarePresent         = TRUE;
929167802Sjkim    AcpiGbl_LastOwnerIdIndex            = 0;
930167802Sjkim    AcpiGbl_NextOwnerIdOffset           = 0;
931151937Sjkim    AcpiGbl_TraceMethodName             = 0;
932151937Sjkim    AcpiGbl_TraceDbgLevel               = 0;
933151937Sjkim    AcpiGbl_TraceDbgLayer               = 0;
93467754Smsmith    AcpiGbl_DebuggerConfiguration       = DEBUGGER_THREADING;
93591116Smsmith    AcpiGbl_DbOutputFlags               = ACPI_DB_CONSOLE_OUTPUT;
936193267Sjkim    AcpiGbl_OsiData                     = 0;
937210976Sjkim    AcpiGbl_OsiMutex                    = NULL;
93867754Smsmith
93967754Smsmith    /* Hardware oriented */
94067754Smsmith
941104470Siwasaki    AcpiGbl_EventsInitialized           = FALSE;
942129684Snjl    AcpiGbl_SystemAwakeAndRunning       = TRUE;
94367754Smsmith
94467754Smsmith    /* Namespace */
94567754Smsmith
946197104Sjkim    AcpiGbl_ModuleCodeList              = NULL;
94767754Smsmith    AcpiGbl_RootNode                    = NULL;
94899146Siwasaki    AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
949167802Sjkim    AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
950107325Siwasaki    AcpiGbl_RootNodeStruct.Type         = ACPI_TYPE_DEVICE;
951209746Sjkim    AcpiGbl_RootNodeStruct.Parent       = NULL;
95267754Smsmith    AcpiGbl_RootNodeStruct.Child        = NULL;
95367754Smsmith    AcpiGbl_RootNodeStruct.Peer         = NULL;
95467754Smsmith    AcpiGbl_RootNodeStruct.Object       = NULL;
95567754Smsmith
95667754Smsmith
957198237Sjkim#ifdef ACPI_DISASSEMBLER
958198237Sjkim    AcpiGbl_ExternalList                = NULL;
959198237Sjkim#endif
960198237Sjkim
961102550Siwasaki#ifdef ACPI_DEBUG_OUTPUT
962193267Sjkim    AcpiGbl_LowestStackPointer          = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX);
96383174Smsmith#endif
96483174Smsmith
965167802Sjkim#ifdef ACPI_DBG_TRACK_ALLOCATIONS
966167802Sjkim    AcpiGbl_DisplayFinalMemStats        = FALSE;
967209746Sjkim    AcpiGbl_DisableMemTracking          = FALSE;
968167802Sjkim#endif
969167802Sjkim
970193267Sjkim    return_ACPI_STATUS (AE_OK);
97167754Smsmith}
97267754Smsmith
973167802Sjkim/* Public globals */
97467754Smsmith
975193267SjkimACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
976167802SjkimACPI_EXPORT_SYMBOL (AcpiDbgLevel)
977167802SjkimACPI_EXPORT_SYMBOL (AcpiDbgLayer)
978167802SjkimACPI_EXPORT_SYMBOL (AcpiGpeCount)
979193267SjkimACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount)
980167802Sjkim
981167802Sjkim
982