utglobal.c revision 99679
167754Smsmith/******************************************************************************
267754Smsmith *
377424Smsmith * Module Name: utglobal - Global variables for the ACPI subsystem
499679Siwasaki *              $Revision: 162 $
567754Smsmith *
667754Smsmith *****************************************************************************/
767754Smsmith
867754Smsmith/******************************************************************************
967754Smsmith *
1067754Smsmith * 1. Copyright Notice
1167754Smsmith *
1291116Smsmith * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
1370243Smsmith * All rights reserved.
1467754Smsmith *
1567754Smsmith * 2. License
1667754Smsmith *
1767754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property
1867754Smsmith * rights.  You may have additional license terms from the party that provided
1967754Smsmith * you this software, covering your right to use that party's intellectual
2067754Smsmith * property rights.
2167754Smsmith *
2267754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2367754Smsmith * copy of the source code appearing in this file ("Covered Code") an
2467754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy,
2667754Smsmith * make derivatives, distribute, use and display any portion of the Covered
2767754Smsmith * Code in any form, with the right to sublicense such rights; and
2867754Smsmith *
2967754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3067754Smsmith * license (with the right to sublicense), under only those claims of Intel
3167754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell,
3267754Smsmith * offer to sell, and import the Covered Code and derivative works thereof
3367754Smsmith * solely to the minimum extent necessary to exercise the above copyright
3467754Smsmith * license, and in no event shall the patent license extend to any additions
3567754Smsmith * to or modifications of the Original Intel Code.  No other license or right
3667754Smsmith * is granted directly or by implication, estoppel or otherwise;
3767754Smsmith *
3867754Smsmith * The above copyright and patent license is granted only if the following
3967754Smsmith * conditions are met:
4067754Smsmith *
4167754Smsmith * 3. Conditions
4267754Smsmith *
4367754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4467754Smsmith * Redistribution of source code of any substantial portion of the Covered
4567754Smsmith * Code or modification with rights to further distribute source must include
4667754Smsmith * the above Copyright Notice, the above License, this list of Conditions,
4767754Smsmith * and the following Disclaimer and Export Compliance provision.  In addition,
4867754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to
4967754Smsmith * contain a file documenting the changes Licensee made to create that Covered
5067754Smsmith * Code and the date of any change.  Licensee must include in that file the
5167754Smsmith * documentation of any changes made by any predecessor Licensee.  Licensee
5267754Smsmith * must include a prominent statement that the modification is derived,
5367754Smsmith * directly or indirectly, from Original Intel Code.
5467754Smsmith *
5567754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5667754Smsmith * Redistribution of source code of any substantial portion of the Covered
5767754Smsmith * Code or modification without rights to further distribute source must
5867754Smsmith * include the following Disclaimer and Export Compliance provision in the
5967754Smsmith * documentation and/or other materials provided with distribution.  In
6067754Smsmith * addition, Licensee may not authorize further sublicense of source of any
6167754Smsmith * portion of the Covered Code, and must include terms to the effect that the
6267754Smsmith * license from Licensee to its licensee is limited to the intellectual
6367754Smsmith * property embodied in the software Licensee provides to its licensee, and
6467754Smsmith * not to intellectual property embodied in modifications its licensee may
6567754Smsmith * make.
6667754Smsmith *
6767754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any
6867754Smsmith * substantial portion of the Covered Code or modification must reproduce the
6967754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance
7067754Smsmith * provision in the documentation and/or other materials provided with the
7167754Smsmith * distribution.
7267754Smsmith *
7367754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original
7467754Smsmith * Intel Code.
7567754Smsmith *
7667754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7767754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or
7867754Smsmith * other dealings in products derived from or relating to the Covered Code
7967754Smsmith * without prior written authorization from Intel.
8067754Smsmith *
8167754Smsmith * 4. Disclaimer and Export Compliance
8267754Smsmith *
8367754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8467754Smsmith * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8567754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8667754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8767754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8867754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8967754Smsmith * PARTICULAR PURPOSE.
9067754Smsmith *
9167754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9267754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9367754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9467754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9567754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9667754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9767754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9867754Smsmith * LIMITED REMEDY.
9967754Smsmith *
10067754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this
10167754Smsmith * software or system incorporating such software without first obtaining any
10267754Smsmith * required license or other approval from the U. S. Department of Commerce or
10367754Smsmith * any other agency or department of the United States Government.  In the
10467754Smsmith * event Licensee exports any such software from the United States or
10567754Smsmith * re-exports any such software from a foreign destination, Licensee shall
10667754Smsmith * ensure that the distribution and export/re-export of the software is in
10767754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the
10867754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10967754Smsmith * any of its subsidiaries will export/re-export any technical data, process,
11067754Smsmith * software, or service, directly or indirectly, to any country for which the
11167754Smsmith * United States government or any agency thereof requires an export license,
11267754Smsmith * other governmental approval, or letter of assurance, without first obtaining
11367754Smsmith * such license, approval or letter.
11467754Smsmith *
11567754Smsmith *****************************************************************************/
11667754Smsmith
11777424Smsmith#define __UTGLOBAL_C__
11867754Smsmith#define DEFINE_ACPI_GLOBALS
11967754Smsmith
12067754Smsmith#include "acpi.h"
12167754Smsmith#include "acnamesp.h"
12267754Smsmith
12377424Smsmith#define _COMPONENT          ACPI_UTILITIES
12491116Smsmith        ACPI_MODULE_NAME    ("utglobal")
12567754Smsmith
12667754Smsmith
12799146Siwasaki
12867754Smsmith/******************************************************************************
12967754Smsmith *
13080062Smsmith * FUNCTION:    AcpiFormatException
13180062Smsmith *
13280062Smsmith * PARAMETERS:  Status       - The ACPI_STATUS code to be formatted
13380062Smsmith *
13480062Smsmith * RETURN:      A string containing the exception  text
13580062Smsmith *
13680062Smsmith * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
13780062Smsmith *
13880062Smsmith ******************************************************************************/
13980062Smsmith
14080062Smsmithconst char *
14180062SmsmithAcpiFormatException (
14280062Smsmith    ACPI_STATUS             Status)
14380062Smsmith{
14483174Smsmith    const char              *Exception = "UNKNOWN_STATUS_CODE";
14580062Smsmith    ACPI_STATUS             SubStatus;
14680062Smsmith
14780062Smsmith
14899146Siwasaki    ACPI_FUNCTION_NAME ("FormatException");
14999146Siwasaki
15099146Siwasaki
15180062Smsmith    SubStatus = (Status & ~AE_CODE_MASK);
15280062Smsmith
15380062Smsmith    switch (Status & AE_CODE_MASK)
15480062Smsmith    {
15580062Smsmith    case AE_CODE_ENVIRONMENTAL:
15680062Smsmith
15780062Smsmith        if (SubStatus <= AE_CODE_ENV_MAX)
15880062Smsmith        {
15980062Smsmith            Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
16099146Siwasaki            break;
16180062Smsmith        }
16299146Siwasaki        goto Unknown;
16380062Smsmith
16480062Smsmith    case AE_CODE_PROGRAMMER:
16580062Smsmith
16680062Smsmith        if (SubStatus <= AE_CODE_PGM_MAX)
16780062Smsmith        {
16880062Smsmith            Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
16999146Siwasaki            break;
17080062Smsmith        }
17199146Siwasaki        goto Unknown;
17280062Smsmith
17380062Smsmith    case AE_CODE_ACPI_TABLES:
17480062Smsmith
17580062Smsmith        if (SubStatus <= AE_CODE_TBL_MAX)
17680062Smsmith        {
17780062Smsmith            Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
17899146Siwasaki            break;
17980062Smsmith        }
18099146Siwasaki        goto Unknown;
18180062Smsmith
18280062Smsmith    case AE_CODE_AML:
18380062Smsmith
18480062Smsmith        if (SubStatus <= AE_CODE_AML_MAX)
18580062Smsmith        {
18680062Smsmith            Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
18799146Siwasaki            break;
18880062Smsmith        }
18999146Siwasaki        goto Unknown;
19080062Smsmith
19180062Smsmith    case AE_CODE_CONTROL:
19280062Smsmith
19380062Smsmith        if (SubStatus <= AE_CODE_CTRL_MAX)
19480062Smsmith        {
19580062Smsmith            Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
19699146Siwasaki            break;
19780062Smsmith        }
19899146Siwasaki        goto Unknown;
19980062Smsmith
20080062Smsmith    default:
20199146Siwasaki        goto Unknown;
20280062Smsmith    }
20380062Smsmith
20480062Smsmith
20580062Smsmith    return ((const char *) Exception);
20699146Siwasaki
20799146SiwasakiUnknown:
20899146Siwasaki
20999146Siwasaki    ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", Status));
21099146Siwasaki    return ((const char *) Exception);
21180062Smsmith}
21280062Smsmith
21380062Smsmith
21480062Smsmith/******************************************************************************
21580062Smsmith *
21667754Smsmith * Static global variable initialization.
21767754Smsmith *
21867754Smsmith ******************************************************************************/
21967754Smsmith
22067754Smsmith/*
22167754Smsmith * We want the debug switches statically initialized so they
22267754Smsmith * are already set when the debugger is entered.
22367754Smsmith */
22467754Smsmith
22567754Smsmith/* Debug switch - level and trace mask */
22667754Smsmith
22767754Smsmith#ifdef ACPI_DEBUG
22867754SmsmithUINT32                      AcpiDbgLevel = DEBUG_DEFAULT;
22967754Smsmith#else
23067754SmsmithUINT32                      AcpiDbgLevel = NORMAL_DEFAULT;
23167754Smsmith#endif
23267754Smsmith
23367754Smsmith/* Debug switch - layer (component) mask */
23467754Smsmith
23577424SmsmithUINT32                      AcpiDbgLayer = ACPI_COMPONENT_DEFAULT;
23667754SmsmithUINT32                      AcpiGbl_NestingLevel = 0;
23767754Smsmith
23867754Smsmith
23967754Smsmith/* Debugger globals */
24067754Smsmith
24167754SmsmithBOOLEAN                     AcpiGbl_DbTerminateThreads = FALSE;
24267754SmsmithBOOLEAN                     AcpiGbl_MethodExecuting = FALSE;
24367754Smsmith
24467754Smsmith/* System flags */
24567754Smsmith
24667754SmsmithUINT32                      AcpiGbl_StartupFlags = 0;
24767754Smsmith
24887031Smsmith/* System starts uninitialized */
24983174Smsmith
25067754SmsmithBOOLEAN                     AcpiGbl_Shutdown = TRUE;
25167754Smsmith
25283174Smsmithconst UINT8                 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128};
25367754Smsmith
25483174Smsmithconst NATIVE_CHAR           *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES] = {
25583174Smsmith                                "\\_S0_","\\_S1_","\\_S2_","\\_S3_",
25683174Smsmith                                "\\_S4_","\\_S5_","\\_S4B"};
25769450Smsmith
25869450Smsmith
25967754Smsmith/******************************************************************************
26067754Smsmith *
26167754Smsmith * Namespace globals
26267754Smsmith *
26367754Smsmith ******************************************************************************/
26467754Smsmith
26567754Smsmith
26667754Smsmith/*
26767754Smsmith * Names built-in to the interpreter
26867754Smsmith *
26967754Smsmith * Initial values are currently supported only for types String and Number.
27067754Smsmith * To avoid type punning, both are specified as strings in this table.
27177424Smsmith *
27277424Smsmith * NOTES:
27377424Smsmith * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run
27477424Smsmith *    during the initialization sequence.
27567754Smsmith */
27667754Smsmith
27791116Smsmithconst ACPI_PREDEFINED_NAMES     AcpiGbl_PreDefinedNames[] =
27867754Smsmith{
27999679Siwasaki    {"_GPE",    INTERNAL_TYPE_DEF_ANY,      NULL},
28099679Siwasaki    {"_PR_",    INTERNAL_TYPE_DEF_ANY,      NULL},
28199679Siwasaki    {"_SB_",    ACPI_TYPE_DEVICE,           NULL},
28299679Siwasaki    {"_SI_",    INTERNAL_TYPE_DEF_ANY,      NULL},
28399679Siwasaki    {"_TZ_",    INTERNAL_TYPE_DEF_ANY,      NULL},
28499146Siwasaki    {"_REV",    ACPI_TYPE_INTEGER,          "2"},
28599146Siwasaki    {"_OS_",    ACPI_TYPE_STRING,           ACPI_OS_NAME},
28699146Siwasaki    {"_GL_",    ACPI_TYPE_MUTEX,            "0"},
28799679Siwasaki    {NULL,      ACPI_TYPE_ANY,              NULL}              /* Table terminator */
28867754Smsmith};
28967754Smsmith
29067754Smsmith
29167754Smsmith/*
29267754Smsmith * Properties of the ACPI Object Types, both internal and external.
29367754Smsmith *
29467754Smsmith * Elements of AcpiNsProperties are bit significant
29567754Smsmith * and the table is indexed by values of ACPI_OBJECT_TYPE
29667754Smsmith */
29767754Smsmith
29891116Smsmithconst UINT8                     AcpiGbl_NsProperties[] =
29967754Smsmith{
30091116Smsmith    ACPI_NS_NORMAL,                     /* 00 Any              */
30191116Smsmith    ACPI_NS_NORMAL,                     /* 01 Number           */
30291116Smsmith    ACPI_NS_NORMAL,                     /* 02 String           */
30391116Smsmith    ACPI_NS_NORMAL,                     /* 03 Buffer           */
30499146Siwasaki    ACPI_NS_NORMAL,                     /* 04 Package          */
30591116Smsmith    ACPI_NS_NORMAL,                     /* 05 FieldUnit        */
30699146Siwasaki    ACPI_NS_NEWSCOPE,                   /* 06 Device           */
30799146Siwasaki    ACPI_NS_NORMAL,                     /* 07 Event            */
30899146Siwasaki    ACPI_NS_NEWSCOPE,                   /* 08 Method           */
30999146Siwasaki    ACPI_NS_NORMAL,                     /* 09 Mutex            */
31099146Siwasaki    ACPI_NS_NORMAL,                     /* 10 Region           */
31199146Siwasaki    ACPI_NS_NEWSCOPE,                   /* 11 Power            */
31299146Siwasaki    ACPI_NS_NEWSCOPE,                   /* 12 Processor        */
31399146Siwasaki    ACPI_NS_NEWSCOPE,                   /* 13 Thermal          */
31491116Smsmith    ACPI_NS_NORMAL,                     /* 14 BufferField      */
31591116Smsmith    ACPI_NS_NORMAL,                     /* 15 DdbHandle        */
31691116Smsmith    ACPI_NS_NORMAL,                     /* 16 Debug Object     */
31791116Smsmith    ACPI_NS_NORMAL,                     /* 17 DefField         */
31891116Smsmith    ACPI_NS_NORMAL,                     /* 18 BankField        */
31991116Smsmith    ACPI_NS_NORMAL,                     /* 19 IndexField       */
32091116Smsmith    ACPI_NS_NORMAL,                     /* 20 Reference        */
32191116Smsmith    ACPI_NS_NORMAL,                     /* 21 Alias            */
32291116Smsmith    ACPI_NS_NORMAL,                     /* 22 Notify           */
32391116Smsmith    ACPI_NS_NORMAL,                     /* 23 Address Handler  */
32491116Smsmith    ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL,   /* 24 Resource Desc    */
32591116Smsmith    ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL,   /* 25 Resource Field   */
32691116Smsmith    ACPI_NS_NORMAL,                     /* 26 DefFieldDefn     */
32791116Smsmith    ACPI_NS_NORMAL,                     /* 27 BankFieldDefn    */
32891116Smsmith    ACPI_NS_NORMAL,                     /* 28 IndexFieldDefn   */
32991116Smsmith    ACPI_NS_NORMAL,                     /* 29 If               */
33091116Smsmith    ACPI_NS_NORMAL,                     /* 30 Else             */
33191116Smsmith    ACPI_NS_NORMAL,                     /* 31 While            */
33291116Smsmith    ACPI_NS_NEWSCOPE,                   /* 32 Scope            */
33391116Smsmith    ACPI_NS_LOCAL,                      /* 33 DefAny           */
33491116Smsmith    ACPI_NS_NORMAL,                     /* 34 Extra            */
33591116Smsmith    ACPI_NS_NORMAL,                     /* 35 Data             */
33691116Smsmith    ACPI_NS_NORMAL                      /* 36 Invalid          */
33767754Smsmith};
33867754Smsmith
33967754Smsmith
34071867Smsmith/* Hex to ASCII conversion table */
34171867Smsmith
34299679Siwasakistatic const NATIVE_CHAR    AcpiGbl_HexToAscii[] =
34371867Smsmith                                {'0','1','2','3','4','5','6','7',
34499679Siwasaki                                 '8','9','A','B','C','D','E','F'};
34571867Smsmith
34683174Smsmith/*****************************************************************************
34783174Smsmith *
34883174Smsmith * FUNCTION:    AcpiUtHexToAsciiChar
34983174Smsmith *
35083174Smsmith * PARAMETERS:  Integer             - Contains the hex digit
35183174Smsmith *              Position            - bit position of the digit within the
35283174Smsmith *                                    integer
35383174Smsmith *
35483174Smsmith * RETURN:      Ascii character
35583174Smsmith *
35683174Smsmith * DESCRIPTION: Convert a hex digit to an ascii character
35783174Smsmith *
35883174Smsmith ****************************************************************************/
35983174Smsmith
36099679Siwasakichar
36182367SmsmithAcpiUtHexToAsciiChar (
36282367Smsmith    ACPI_INTEGER            Integer,
36382367Smsmith    UINT32                  Position)
36482367Smsmith{
36571867Smsmith
36682367Smsmith    return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
36782367Smsmith}
36882367Smsmith
36983174Smsmith
37067754Smsmith/******************************************************************************
37167754Smsmith *
37291116Smsmith * Table name globals
37367754Smsmith *
37469450Smsmith * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
37569450Smsmith * it is NOT an exhaustive list of all possible ACPI tables.  All ACPI tables
37669450Smsmith * that are not used by the subsystem are simply ignored.
37769450Smsmith *
37891116Smsmith * Do NOT add any table to this list that is not consumed directly by this
37991116Smsmith * subsystem.
38091116Smsmith *
38167754Smsmith ******************************************************************************/
38267754Smsmith
38367754Smsmith
38467754SmsmithACPI_TABLE_DESC             AcpiGbl_AcpiTables[NUM_ACPI_TABLES];
38567754Smsmith
38667754Smsmith
38767754SmsmithACPI_TABLE_SUPPORT          AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] =
38867754Smsmith{
38991116Smsmith    /***********    Name,   Signature, Global typed pointer     Signature size,      How many allowed?,    Contains valid AML? */
39067754Smsmith
39191116Smsmith    /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL,                    sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE},
39291116Smsmith    /* DSDT 1 */ {DSDT_SIG,  DSDT_SIG, (void **) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE   | ACPI_TABLE_EXECUTABLE},
39391116Smsmith    /* FADT 2 */ {FADT_SIG,  FADT_SIG, (void **) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE},
39491116Smsmith    /* FACS 3 */ {FACS_SIG,  FACS_SIG, (void **) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE},
39591116Smsmith    /* PSDT 4 */ {PSDT_SIG,  PSDT_SIG, NULL,                    sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
39691116Smsmith    /* SSDT 5 */ {SSDT_SIG,  SSDT_SIG, NULL,                    sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
39791116Smsmith    /* XSDT 6 */ {XSDT_SIG,  XSDT_SIG, NULL,                    sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE},
39867754Smsmith};
39967754Smsmith
40067754Smsmith
40191116Smsmith/******************************************************************************
40291116Smsmith *
40391116Smsmith * Event and Hardware globals
40491116Smsmith *
40591116Smsmith ******************************************************************************/
40691116Smsmith
40791116SmsmithACPI_BIT_REGISTER_INFO      AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] =
40891116Smsmith{
40991116Smsmith    /* Name                                     Parent Register             Register Bit Position                   Register Bit Mask       */
41091116Smsmith
41191116Smsmith    /* ACPI_BITREG_TIMER_STATUS         */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_TIMER_STATUS,          ACPI_BITMASK_TIMER_STATUS},
41291116Smsmith    /* ACPI_BITREG_BUS_MASTER_STATUS    */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_BUS_MASTER_STATUS,     ACPI_BITMASK_BUS_MASTER_STATUS},
41391116Smsmith    /* ACPI_BITREG_GLOBAL_LOCK_STATUS   */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,    ACPI_BITMASK_GLOBAL_LOCK_STATUS},
41491116Smsmith    /* ACPI_BITREG_POWER_BUTTON_STATUS  */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_POWER_BUTTON_STATUS,   ACPI_BITMASK_POWER_BUTTON_STATUS},
41591116Smsmith    /* ACPI_BITREG_SLEEP_BUTTON_STATUS  */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,   ACPI_BITMASK_SLEEP_BUTTON_STATUS},
41691116Smsmith    /* ACPI_BITREG_RT_CLOCK_STATUS      */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_RT_CLOCK_STATUS,       ACPI_BITMASK_RT_CLOCK_STATUS},
41791116Smsmith    /* ACPI_BITREG_WAKE_STATUS          */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_WAKE_STATUS,           ACPI_BITMASK_WAKE_STATUS},
41891116Smsmith
41991116Smsmith    /* ACPI_BITREG_TIMER_ENABLE         */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_TIMER_ENABLE,          ACPI_BITMASK_TIMER_ENABLE},
42091116Smsmith    /* ACPI_BITREG_GLOBAL_LOCK_ENABLE   */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,    ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
42191116Smsmith    /* ACPI_BITREG_POWER_BUTTON_ENABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_POWER_BUTTON_ENABLE,   ACPI_BITMASK_POWER_BUTTON_ENABLE},
42291116Smsmith    /* ACPI_BITREG_SLEEP_BUTTON_ENABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,   ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
42391116Smsmith    /* ACPI_BITREG_RT_CLOCK_ENABLE      */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_RT_CLOCK_ENABLE,       ACPI_BITMASK_RT_CLOCK_ENABLE},
42491116Smsmith    /* ACPI_BITREG_WAKE_ENABLE          */   {ACPI_REGISTER_PM1_ENABLE,   0,                                      0},
42591116Smsmith
42691116Smsmith    /* ACPI_BITREG_SCI_ENABLE           */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SCI_ENABLE,            ACPI_BITMASK_SCI_ENABLE},
42791116Smsmith    /* ACPI_BITREG_BUS_MASTER_RLD       */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_BUS_MASTER_RLD,        ACPI_BITMASK_BUS_MASTER_RLD},
42891116Smsmith    /* ACPI_BITREG_GLOBAL_LOCK_RELEASE  */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,   ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
42991116Smsmith    /* ACPI_BITREG_SLEEP_TYPE_A         */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_TYPE_X,          ACPI_BITMASK_SLEEP_TYPE_X},
43091116Smsmith    /* ACPI_BITREG_SLEEP_TYPE_B         */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_TYPE_X,          ACPI_BITMASK_SLEEP_TYPE_X},
43191116Smsmith    /* ACPI_BITREG_SLEEP_ENABLE         */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_ENABLE,          ACPI_BITMASK_SLEEP_ENABLE},
43291116Smsmith
43391116Smsmith    /* ACPI_BITREG_ARB_DIS              */   {ACPI_REGISTER_PM2_CONTROL,  ACPI_BITPOSITION_ARB_DISABLE,           ACPI_BITMASK_ARB_DISABLE}
43491116Smsmith};
43591116Smsmith
43691116Smsmith
43791116SmsmithACPI_FIXED_EVENT_INFO       AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
43891116Smsmith{
43991116Smsmith    /* ACPI_EVENT_PMTIMER       */  {ACPI_BITREG_TIMER_STATUS,          ACPI_BITREG_TIMER_ENABLE,        ACPI_BITMASK_TIMER_STATUS,          ACPI_BITMASK_TIMER_ENABLE},
44091116Smsmith    /* ACPI_EVENT_GLOBAL        */  {ACPI_BITREG_GLOBAL_LOCK_STATUS,    ACPI_BITREG_GLOBAL_LOCK_ENABLE,  ACPI_BITMASK_GLOBAL_LOCK_STATUS,    ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
44191116Smsmith    /* ACPI_EVENT_POWER_BUTTON  */  {ACPI_BITREG_POWER_BUTTON_STATUS,   ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS,   ACPI_BITMASK_POWER_BUTTON_ENABLE},
44291116Smsmith    /* ACPI_EVENT_SLEEP_BUTTON  */  {ACPI_BITREG_SLEEP_BUTTON_STATUS,   ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS,   ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
44391116Smsmith    /* ACPI_EVENT_RTC           */  {ACPI_BITREG_RT_CLOCK_STATUS,       ACPI_BITREG_RT_CLOCK_ENABLE,     0,                                  0},
44491116Smsmith};
44591116Smsmith
44691116Smsmith/*****************************************************************************
44791116Smsmith *
44891116Smsmith * FUNCTION:    AcpiUtGetRegionName
44991116Smsmith *
45091116Smsmith * PARAMETERS:  None.
45191116Smsmith *
45291116Smsmith * RETURN:      Status
45391116Smsmith *
45491116Smsmith * DESCRIPTION: Translate a Space ID into a name string (Debug only)
45591116Smsmith *
45691116Smsmith ****************************************************************************/
45791116Smsmith
45891116Smsmith/* Region type decoding */
45991116Smsmith
46099679Siwasakistatic const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
46191116Smsmith{
46291116Smsmith    "SystemMemory",
46391116Smsmith    "SystemIO",
46491116Smsmith    "PCIConfig",
46591116Smsmith    "EmbeddedControl",
46691116Smsmith    "SMBus",
46791116Smsmith    "CMOS",
46891116Smsmith    "PCIBarTarget",
46991116Smsmith    "DataTable",
47091116Smsmith};
47191116Smsmith
47291116Smsmith
47391116SmsmithNATIVE_CHAR *
47491116SmsmithAcpiUtGetRegionName (
47591116Smsmith    UINT8                   SpaceId)
47691116Smsmith{
47791116Smsmith
47891116Smsmith    if (SpaceId >= ACPI_USER_REGION_BEGIN)
47991116Smsmith    {
48091116Smsmith        return ("UserDefinedRegion");
48191116Smsmith    }
48291116Smsmith
48391116Smsmith    else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
48491116Smsmith    {
48591116Smsmith        return ("InvalidSpaceID");
48691116Smsmith    }
48791116Smsmith
48891116Smsmith    return ((NATIVE_CHAR *) AcpiGbl_RegionTypes[SpaceId]);
48991116Smsmith}
49091116Smsmith
49191116Smsmith
49291116Smsmith/*****************************************************************************
49391116Smsmith *
49491116Smsmith * FUNCTION:    AcpiUtGetEventName
49591116Smsmith *
49691116Smsmith * PARAMETERS:  None.
49791116Smsmith *
49891116Smsmith * RETURN:      Status
49991116Smsmith *
50091116Smsmith * DESCRIPTION: Translate a Event ID into a name string (Debug only)
50191116Smsmith *
50291116Smsmith ****************************************************************************/
50391116Smsmith
50491116Smsmith/* Event type decoding */
50591116Smsmith
50699679Siwasakistatic const NATIVE_CHAR *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
50791116Smsmith{
50891116Smsmith    "PM_Timer",
50991116Smsmith    "GlobalLock",
51091116Smsmith    "PowerButton",
51191116Smsmith    "SleepButton",
51291116Smsmith    "RealTimeClock",
51391116Smsmith};
51491116Smsmith
51591116Smsmith
51691116SmsmithNATIVE_CHAR *
51791116SmsmithAcpiUtGetEventName (
51891116Smsmith    UINT32                  EventId)
51991116Smsmith{
52091116Smsmith
52191116Smsmith    if (EventId > ACPI_EVENT_MAX)
52291116Smsmith    {
52391116Smsmith        return ("InvalidEventID");
52491116Smsmith    }
52591116Smsmith
52691116Smsmith    return ((NATIVE_CHAR *) AcpiGbl_EventTypes[EventId]);
52791116Smsmith}
52891116Smsmith
52991116Smsmith
53099679Siwasaki#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
53167754Smsmith
53283174Smsmith/*
53367754Smsmith * Strings and procedures used for debug only
53467754Smsmith *
53583174Smsmith */
53667754Smsmith
53767754Smsmith
53867754Smsmith/*****************************************************************************
53967754Smsmith *
54077424Smsmith * FUNCTION:    AcpiUtGetMutexName
54167754Smsmith *
54267754Smsmith * PARAMETERS:  None.
54367754Smsmith *
54467754Smsmith * RETURN:      Status
54567754Smsmith *
54667754Smsmith * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
54767754Smsmith *
54867754Smsmith ****************************************************************************/
54967754Smsmith
55067754SmsmithNATIVE_CHAR *
55177424SmsmithAcpiUtGetMutexName (
55267754Smsmith    UINT32                  MutexId)
55367754Smsmith{
55467754Smsmith
55567754Smsmith    if (MutexId > MAX_MTX)
55667754Smsmith    {
55767754Smsmith        return ("Invalid Mutex ID");
55867754Smsmith    }
55967754Smsmith
56067754Smsmith    return (AcpiGbl_MutexNames[MutexId]);
56167754Smsmith}
56267754Smsmith
56367754Smsmith
56491116Smsmith/*****************************************************************************
56591116Smsmith *
56691116Smsmith * FUNCTION:    AcpiUtGetTypeName
56791116Smsmith *
56891116Smsmith * PARAMETERS:  None.
56991116Smsmith *
57091116Smsmith * RETURN:      Status
57191116Smsmith *
57291116Smsmith * DESCRIPTION: Translate a Type ID into a name string (Debug only)
57391116Smsmith *
57491116Smsmith ****************************************************************************/
57591116Smsmith
57667754Smsmith/*
57767754Smsmith * Elements of AcpiGbl_NsTypeNames below must match
57867754Smsmith * one-to-one with values of ACPI_OBJECT_TYPE
57967754Smsmith *
58067754Smsmith * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when
58167754Smsmith * stored in a table it really means that we have thus far seen no evidence to
58267754Smsmith * indicatewhat type is actually going to be stored for this entry.
58367754Smsmith */
58467754Smsmith
58583174Smsmithstatic const NATIVE_CHAR    AcpiGbl_BadType[] = "UNDEFINED";
58685756Smsmith#define TYPE_NAME_LENGTH    12                           /* Maximum length of each string */
58767754Smsmith
58883174Smsmithstatic const NATIVE_CHAR    *AcpiGbl_NsTypeNames[] =    /* printable names of ACPI types */
58967754Smsmith{
59067754Smsmith    /* 00 */ "Untyped",
59171867Smsmith    /* 01 */ "Integer",
59267754Smsmith    /* 02 */ "String",
59367754Smsmith    /* 03 */ "Buffer",
59467754Smsmith    /* 04 */ "Package",
59567754Smsmith    /* 05 */ "FieldUnit",
59667754Smsmith    /* 06 */ "Device",
59767754Smsmith    /* 07 */ "Event",
59867754Smsmith    /* 08 */ "Method",
59967754Smsmith    /* 09 */ "Mutex",
60067754Smsmith    /* 10 */ "Region",
60167754Smsmith    /* 11 */ "Power",
60267754Smsmith    /* 12 */ "Processor",
60367754Smsmith    /* 13 */ "Thermal",
60485756Smsmith    /* 14 */ "BufferField",
60567754Smsmith    /* 15 */ "DdbHandle",
60685756Smsmith    /* 16 */ "DebugObject",
60785756Smsmith    /* 17 */ "RegionField",
60877424Smsmith    /* 18 */ "BankField",
60985756Smsmith    /* 19 */ "IndexField",
61067754Smsmith    /* 20 */ "Reference",
61167754Smsmith    /* 21 */ "Alias",
61267754Smsmith    /* 22 */ "Notify",
61385756Smsmith    /* 23 */ "AddrHandler",
61485756Smsmith    /* 24 */ "ResourceDesc",
61585756Smsmith    /* 25 */ "ResourceFld",
61685756Smsmith    /* 26 */ "RegionFldDfn",
61785756Smsmith    /* 27 */ "BankFldDfn",
61885756Smsmith    /* 28 */ "IndexFldDfn",
61978986Smsmith    /* 29 */ "If",
62078986Smsmith    /* 30 */ "Else",
62178986Smsmith    /* 31 */ "While",
62278986Smsmith    /* 32 */ "Scope",
62378986Smsmith    /* 33 */ "DefAny",
62478986Smsmith    /* 34 */ "Extra",
62587031Smsmith    /* 35 */ "Data",
62687031Smsmith    /* 36 */ "Invalid"
62767754Smsmith};
62867754Smsmith
62967754Smsmith
63067754SmsmithNATIVE_CHAR *
63177424SmsmithAcpiUtGetTypeName (
63291116Smsmith    ACPI_OBJECT_TYPE        Type)
63367754Smsmith{
63467754Smsmith
63567754Smsmith    if (Type > INTERNAL_TYPE_INVALID)
63667754Smsmith    {
63783174Smsmith        return ((NATIVE_CHAR *) AcpiGbl_BadType);
63867754Smsmith    }
63967754Smsmith
64083174Smsmith    return ((NATIVE_CHAR *) AcpiGbl_NsTypeNames[Type]);
64167754Smsmith}
64267754Smsmith
64369746Smsmith
64499679SiwasakiNATIVE_CHAR *
64599679SiwasakiAcpiUtGetObjectTypeName (
64699679Siwasaki    ACPI_OPERAND_OBJECT     *ObjDesc)
64799679Siwasaki{
64899679Siwasaki
64999679Siwasaki    if (!ObjDesc)
65099679Siwasaki    {
65199679Siwasaki        return ("[NULL Object Descriptor]");
65299679Siwasaki    }
65399679Siwasaki
65499679Siwasaki    return (AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)));
65599679Siwasaki}
65699679Siwasaki
65799679Siwasaki
65899679Siwasaki/* Various strings for future use */
65999679Siwasaki
66099679Siwasaki#if 0
66199679Siwasaki#include "amlcode.h"
66299679Siwasaki
66369746Smsmith/* Data used in keeping track of fields */
66469746Smsmith
66599679Siwasakistatic const NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] =
66669746Smsmith{
66769746Smsmith    "skip",
66869746Smsmith    "?access?"
66969746Smsmith};              /* FE = Field Element */
67069746Smsmith
67169746Smsmith
67299679Siwasakistatic const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] =
67369746Smsmith{
67469746Smsmith    "Error",
67569746Smsmith    "MTR",
67669746Smsmith    "MEQ",
67769746Smsmith    "MLE",
67869746Smsmith    "MLT",
67969746Smsmith    "MGE",
68069746Smsmith    "MGT"
68169746Smsmith};
68269746Smsmith
68369746Smsmith
68469746Smsmith/* Access type decoding */
68569746Smsmith
68699679Siwasakistatic const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] =
68769746Smsmith{
68869746Smsmith    "AnyAcc",
68969746Smsmith    "ByteAcc",
69069746Smsmith    "WordAcc",
69169746Smsmith    "DWordAcc",
69287031Smsmith    "QWordAcc",
69387031Smsmith    "BufferAcc",
69469746Smsmith};
69569746Smsmith
69669746Smsmith
69769746Smsmith/* Update rule decoding */
69869746Smsmith
69999679Siwasakistatic const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] =
70069746Smsmith{
70169746Smsmith    "Preserve",
70269746Smsmith    "WriteAsOnes",
70369746Smsmith    "WriteAsZeros"
70469746Smsmith};
70599679Siwasaki#endif /* Future use */
70669746Smsmith
70767754Smsmith#endif
70867754Smsmith
70967754Smsmith
71067754Smsmith/*****************************************************************************
71167754Smsmith *
71277424Smsmith * FUNCTION:    AcpiUtValidObjectType
71367754Smsmith *
71467754Smsmith * PARAMETERS:  None.
71567754Smsmith *
71667754Smsmith * RETURN:      TRUE if valid object type
71767754Smsmith *
71867754Smsmith * DESCRIPTION: Validate an object type
71967754Smsmith *
72067754Smsmith ****************************************************************************/
72167754Smsmith
72267754SmsmithBOOLEAN
72377424SmsmithAcpiUtValidObjectType (
72491116Smsmith    ACPI_OBJECT_TYPE        Type)
72567754Smsmith{
72667754Smsmith
72767754Smsmith    if (Type > ACPI_TYPE_MAX)
72867754Smsmith    {
72967754Smsmith        if ((Type < INTERNAL_TYPE_BEGIN) ||
73067754Smsmith            (Type > INTERNAL_TYPE_MAX))
73167754Smsmith        {
73267754Smsmith            return (FALSE);
73367754Smsmith        }
73467754Smsmith    }
73567754Smsmith
73667754Smsmith    return (TRUE);
73767754Smsmith}
73867754Smsmith
73967754Smsmith
74067754Smsmith/****************************************************************************
74167754Smsmith *
74277424Smsmith * FUNCTION:    AcpiUtAllocateOwnerId
74367754Smsmith *
74467754Smsmith * PARAMETERS:  IdType          - Type of ID (method or table)
74567754Smsmith *
74667754Smsmith * DESCRIPTION: Allocate a table or method owner id
74767754Smsmith *
74867754Smsmith ***************************************************************************/
74967754Smsmith
75067754SmsmithACPI_OWNER_ID
75177424SmsmithAcpiUtAllocateOwnerId (
75267754Smsmith    UINT32                  IdType)
75367754Smsmith{
75467754Smsmith    ACPI_OWNER_ID           OwnerId = 0xFFFF;
75567754Smsmith
75667754Smsmith
75791116Smsmith    ACPI_FUNCTION_TRACE ("UtAllocateOwnerId");
75867754Smsmith
75967754Smsmith
76091116Smsmith    if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
76191116Smsmith    {
76291116Smsmith        return (0);
76391116Smsmith    }
76467754Smsmith
76567754Smsmith    switch (IdType)
76667754Smsmith    {
76791116Smsmith    case ACPI_OWNER_TYPE_TABLE:
76867754Smsmith
76967754Smsmith        OwnerId = AcpiGbl_NextTableOwnerId;
77067754Smsmith        AcpiGbl_NextTableOwnerId++;
77167754Smsmith
77291116Smsmith        if (AcpiGbl_NextTableOwnerId == ACPI_FIRST_METHOD_ID)
77367754Smsmith        {
77491116Smsmith            AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
77567754Smsmith        }
77667754Smsmith        break;
77767754Smsmith
77867754Smsmith
77991116Smsmith    case ACPI_OWNER_TYPE_METHOD:
78067754Smsmith
78167754Smsmith        OwnerId = AcpiGbl_NextMethodOwnerId;
78267754Smsmith        AcpiGbl_NextMethodOwnerId++;
78367754Smsmith
78491116Smsmith        if (AcpiGbl_NextMethodOwnerId == ACPI_FIRST_TABLE_ID)
78567754Smsmith        {
78691116Smsmith            AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
78767754Smsmith        }
78867754Smsmith        break;
78999679Siwasaki
79099679Siwasaki    default:
79199679Siwasaki        break;
79267754Smsmith    }
79367754Smsmith
79491116Smsmith    (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
79567754Smsmith    return_VALUE (OwnerId);
79667754Smsmith}
79767754Smsmith
79867754Smsmith
79967754Smsmith/****************************************************************************
80067754Smsmith *
80177424Smsmith * FUNCTION:    AcpiUtInitGlobals
80267754Smsmith *
80367754Smsmith * PARAMETERS:  none
80467754Smsmith *
80567754Smsmith * DESCRIPTION: Init library globals.  All globals that require specific
80667754Smsmith *              initialization should be initialized here!
80767754Smsmith *
80867754Smsmith ***************************************************************************/
80967754Smsmith
81067754Smsmithvoid
81177424SmsmithAcpiUtInitGlobals (
81267754Smsmith    void)
81367754Smsmith{
81467754Smsmith    UINT32                  i;
81567754Smsmith
81667754Smsmith
81791116Smsmith    ACPI_FUNCTION_TRACE ("UtInitGlobals");
81867754Smsmith
81982367Smsmith    /* Memory allocation and cache lists */
82082367Smsmith
82191116Smsmith    ACPI_MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS);
82282367Smsmith
82391116Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset         = (UINT16) ACPI_PTR_DIFF (&(((ACPI_GENERIC_STATE *) NULL)->Common.Next), NULL);
82499679Siwasaki    AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset        = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL);
82599679Siwasaki    AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset    = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL);
82691116Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset       = (UINT16) ACPI_PTR_DIFF (&(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next), NULL);
82791116Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset          = (UINT16) ACPI_PTR_DIFF (&(((ACPI_WALK_STATE *) NULL)->Next), NULL);
82882367Smsmith
82983174Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize        = sizeof (ACPI_NAMESPACE_NODE);
83083174Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize         = sizeof (ACPI_GENERIC_STATE);
83199679Siwasaki    AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize        = sizeof (ACPI_PARSE_OBJ_COMMON);
83299679Siwasaki    AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize    = sizeof (ACPI_PARSE_OBJ_NAMED);
83383174Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ObjectSize       = sizeof (ACPI_OPERAND_OBJECT);
83483174Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ObjectSize          = sizeof (ACPI_WALK_STATE);
83582367Smsmith
83682367Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].MaxCacheDepth      = MAX_STATE_CACHE_DEPTH;
83782367Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].MaxCacheDepth     = MAX_PARSE_CACHE_DEPTH;
83882367Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].MaxCacheDepth = MAX_EXTPARSE_CACHE_DEPTH;
83982367Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].MaxCacheDepth    = MAX_OBJECT_CACHE_DEPTH;
84082367Smsmith    AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].MaxCacheDepth       = MAX_WALK_CACHE_DEPTH;
84182367Smsmith
84283174Smsmith    ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].ListName       = "Global Memory Allocation");
84383174Smsmith    ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ListName       = "Namespace Nodes");
84483174Smsmith    ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ListName        = "State Object Cache");
84583174Smsmith    ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ListName       = "Parse Node Cache");
84683174Smsmith    ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ListName   = "Extended Parse Node Cache");
84783174Smsmith    ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ListName      = "Operand Object Cache");
84883174Smsmith    ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ListName         = "Tree Walk Node Cache");
84982367Smsmith
85067754Smsmith    /* ACPI table structure */
85167754Smsmith
85267754Smsmith    for (i = 0; i < NUM_ACPI_TABLES; i++)
85367754Smsmith    {
85467754Smsmith        AcpiGbl_AcpiTables[i].Prev          = &AcpiGbl_AcpiTables[i];
85567754Smsmith        AcpiGbl_AcpiTables[i].Next          = &AcpiGbl_AcpiTables[i];
85667754Smsmith        AcpiGbl_AcpiTables[i].Pointer       = NULL;
85767754Smsmith        AcpiGbl_AcpiTables[i].Length        = 0;
85867754Smsmith        AcpiGbl_AcpiTables[i].Allocation    = ACPI_MEM_NOT_ALLOCATED;
85967754Smsmith        AcpiGbl_AcpiTables[i].Count         = 0;
86067754Smsmith    }
86167754Smsmith
86267754Smsmith    /* Mutex locked flags */
86367754Smsmith
86467754Smsmith    for (i = 0; i < NUM_MTX; i++)
86567754Smsmith    {
86667754Smsmith        AcpiGbl_AcpiMutexInfo[i].Mutex      = NULL;
86777424Smsmith        AcpiGbl_AcpiMutexInfo[i].OwnerId    = ACPI_MUTEX_NOT_ACQUIRED;
86867754Smsmith        AcpiGbl_AcpiMutexInfo[i].UseCount   = 0;
86967754Smsmith    }
87067754Smsmith
87167754Smsmith    /* Global notify handlers */
87267754Smsmith
87367754Smsmith    AcpiGbl_SysNotify.Handler           = NULL;
87467754Smsmith    AcpiGbl_DrvNotify.Handler           = NULL;
87599679Siwasaki    AcpiGbl_InitHandler                 = NULL;
87667754Smsmith
87767754Smsmith    /* Global "typed" ACPI table pointers */
87867754Smsmith
87967754Smsmith    AcpiGbl_RSDP                        = NULL;
88069450Smsmith    AcpiGbl_XSDT                        = NULL;
88167754Smsmith    AcpiGbl_FACS                        = NULL;
88269450Smsmith    AcpiGbl_FADT                        = NULL;
88367754Smsmith    AcpiGbl_DSDT                        = NULL;
88467754Smsmith
88567754Smsmith    /* Global Lock support */
88667754Smsmith
88767754Smsmith    AcpiGbl_GlobalLockAcquired          = FALSE;
88867754Smsmith    AcpiGbl_GlobalLockThreadCount       = 0;
88991116Smsmith    AcpiGbl_GlobalLockHandle            = 0;
89067754Smsmith
89167754Smsmith    /* Miscellaneous variables */
89267754Smsmith
89399146Siwasaki    AcpiGbl_TableFlags                  = ACPI_PHYSICAL_POINTER;
89467754Smsmith    AcpiGbl_RsdpOriginalLocation        = 0;
89567754Smsmith    AcpiGbl_CmSingleStep                = FALSE;
89667754Smsmith    AcpiGbl_DbTerminateThreads          = FALSE;
89767754Smsmith    AcpiGbl_Shutdown                    = FALSE;
89867754Smsmith    AcpiGbl_NsLookupCount               = 0;
89967754Smsmith    AcpiGbl_PsFindCount                 = 0;
90067754Smsmith    AcpiGbl_AcpiHardwarePresent         = TRUE;
90191116Smsmith    AcpiGbl_NextTableOwnerId            = ACPI_FIRST_TABLE_ID;
90291116Smsmith    AcpiGbl_NextMethodOwnerId           = ACPI_FIRST_METHOD_ID;
90367754Smsmith    AcpiGbl_DebuggerConfiguration       = DEBUGGER_THREADING;
90491116Smsmith    AcpiGbl_DbOutputFlags               = ACPI_DB_CONSOLE_OUTPUT;
90567754Smsmith
90667754Smsmith    /* Hardware oriented */
90767754Smsmith
90891116Smsmith    AcpiGbl_GpeRegisterInfo             = NULL;
90991116Smsmith    AcpiGbl_GpeNumberInfo               = NULL;
91067754Smsmith
91167754Smsmith    /* Namespace */
91267754Smsmith
91367754Smsmith    AcpiGbl_RootNode                    = NULL;
91467754Smsmith
91599146Siwasaki    AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
91691116Smsmith    AcpiGbl_RootNodeStruct.Descriptor   = ACPI_DESC_TYPE_NAMED;
91767754Smsmith    AcpiGbl_RootNodeStruct.Type         = ACPI_TYPE_ANY;
91867754Smsmith    AcpiGbl_RootNodeStruct.Child        = NULL;
91967754Smsmith    AcpiGbl_RootNodeStruct.Peer         = NULL;
92067754Smsmith    AcpiGbl_RootNodeStruct.Object       = NULL;
92167754Smsmith    AcpiGbl_RootNodeStruct.Flags        = ANOBJ_END_OF_PEER_LIST;
92267754Smsmith
92367754Smsmith
92483174Smsmith#ifdef ACPI_DEBUG
92599679Siwasaki    AcpiGbl_LowestStackPointer          = ACPI_SIZE_MAX;
92683174Smsmith#endif
92783174Smsmith
92867754Smsmith    return_VOID;
92967754Smsmith}
93067754Smsmith
93167754Smsmith
932