utglobal.c revision 69450
167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: cmglobal - Global variables for the ACPI subsystem
469450Smsmith *              $Revision: 110 $
567754Smsmith *
667754Smsmith *****************************************************************************/
767754Smsmith
867754Smsmith/******************************************************************************
967754Smsmith *
1067754Smsmith * 1. Copyright Notice
1167754Smsmith *
1267754Smsmith * Some or all of this work - Copyright (c) 1999, Intel Corp.  All rights
1367754Smsmith * 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
11767754Smsmith#define __CMGLOBAL_C__
11867754Smsmith#define DEFINE_ACPI_GLOBALS
11967754Smsmith
12067754Smsmith#include "acpi.h"
12167754Smsmith#include "acevents.h"
12267754Smsmith#include "acnamesp.h"
12367754Smsmith#include "acinterp.h"
12467754Smsmith
12567754Smsmith
12667754Smsmith#define _COMPONENT          MISCELLANEOUS
12767754Smsmith        MODULE_NAME         ("cmglobal")
12867754Smsmith
12967754Smsmith
13067754Smsmith/******************************************************************************
13167754Smsmith *
13267754Smsmith * Static global variable initialization.
13367754Smsmith *
13467754Smsmith ******************************************************************************/
13567754Smsmith
13667754Smsmith/*
13767754Smsmith * We want the debug switches statically initialized so they
13867754Smsmith * are already set when the debugger is entered.
13967754Smsmith */
14067754Smsmith
14167754Smsmith/* Debug switch - level and trace mask */
14267754Smsmith
14367754Smsmith#ifdef ACPI_DEBUG
14467754SmsmithUINT32                      AcpiDbgLevel = DEBUG_DEFAULT;
14567754Smsmith#else
14667754SmsmithUINT32                      AcpiDbgLevel = NORMAL_DEFAULT;
14767754Smsmith#endif
14867754Smsmith
14967754Smsmith/* Debug switch - layer (component) mask */
15067754Smsmith
15167754SmsmithUINT32                      AcpiDbgLayer = COMPONENT_DEFAULT;
15267754SmsmithUINT32                      AcpiGbl_NestingLevel = 0;
15367754Smsmith
15467754Smsmith
15567754Smsmith/* Debugger globals */
15667754Smsmith
15767754SmsmithBOOLEAN                     AcpiGbl_DbTerminateThreads = FALSE;
15867754SmsmithBOOLEAN                     AcpiGbl_MethodExecuting = FALSE;
15967754Smsmith
16067754Smsmith/* System flags */
16167754Smsmith
16267754SmsmithUINT32                      AcpiGbl_SystemFlags = 0;
16367754SmsmithUINT32                      AcpiGbl_StartupFlags = 0;
16467754Smsmith
16567754Smsmith/* System starts unitialized! */
16667754SmsmithBOOLEAN                     AcpiGbl_Shutdown = TRUE;
16767754Smsmith
16867754Smsmith
16969450SmsmithUINT8                       AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128};
17069450Smsmith
17169450Smsmith
17267754Smsmith/******************************************************************************
17367754Smsmith *
17467754Smsmith * Namespace globals
17567754Smsmith *
17667754Smsmith ******************************************************************************/
17767754Smsmith
17867754Smsmith
17967754Smsmith/*
18067754Smsmith * Names built-in to the interpreter
18167754Smsmith *
18267754Smsmith * Initial values are currently supported only for types String and Number.
18367754Smsmith * To avoid type punning, both are specified as strings in this table.
18467754Smsmith */
18567754Smsmith
18667754SmsmithPREDEFINED_NAMES            AcpiGbl_PreDefinedNames[] =
18767754Smsmith{
18867754Smsmith    {"_GPE",    INTERNAL_TYPE_DEF_ANY},
18967754Smsmith    {"_PR_",    INTERNAL_TYPE_DEF_ANY},
19067754Smsmith    {"_SB_",    INTERNAL_TYPE_DEF_ANY},
19167754Smsmith    {"_SI_",    INTERNAL_TYPE_DEF_ANY},
19267754Smsmith    {"_TZ_",    INTERNAL_TYPE_DEF_ANY},
19367754Smsmith    {"_REV",    ACPI_TYPE_NUMBER, "2"},
19467754Smsmith    {"_OS_",    ACPI_TYPE_STRING, ACPI_OS_NAME},
19567754Smsmith    {"_GL_",    ACPI_TYPE_MUTEX, "0"},
19667754Smsmith
19767754Smsmith    /* Table terminator */
19867754Smsmith
19967754Smsmith    {NULL,      ACPI_TYPE_ANY}
20067754Smsmith};
20167754Smsmith
20267754Smsmith
20367754Smsmith/*
20467754Smsmith * Properties of the ACPI Object Types, both internal and external.
20567754Smsmith *
20667754Smsmith * Elements of AcpiNsProperties are bit significant
20767754Smsmith * and the table is indexed by values of ACPI_OBJECT_TYPE
20867754Smsmith */
20967754Smsmith
21067754SmsmithUINT8                       AcpiGbl_NsProperties[] =
21167754Smsmith{
21267754Smsmith    NSP_NORMAL,                 /* 00 Any              */
21367754Smsmith    NSP_NORMAL,                 /* 01 Number           */
21467754Smsmith    NSP_NORMAL,                 /* 02 String           */
21567754Smsmith    NSP_NORMAL,                 /* 03 Buffer           */
21667754Smsmith    NSP_LOCAL,                  /* 04 Package          */
21767754Smsmith    NSP_NORMAL,                 /* 05 FieldUnit        */
21867754Smsmith    NSP_NEWSCOPE | NSP_LOCAL,   /* 06 Device           */
21967754Smsmith    NSP_LOCAL,                  /* 07 AcpiEvent        */
22067754Smsmith    NSP_NEWSCOPE | NSP_LOCAL,   /* 08 Method           */
22167754Smsmith    NSP_LOCAL,                  /* 09 Mutex            */
22267754Smsmith    NSP_LOCAL,                  /* 10 Region           */
22367754Smsmith    NSP_NEWSCOPE | NSP_LOCAL,   /* 11 Power            */
22467754Smsmith    NSP_NEWSCOPE | NSP_LOCAL,   /* 12 Processor        */
22567754Smsmith    NSP_NEWSCOPE | NSP_LOCAL,   /* 13 Thermal          */
22667754Smsmith    NSP_NORMAL,                 /* 14 BufferField      */
22767754Smsmith    NSP_NORMAL,                 /* 15 DdbHandle        */
22867754Smsmith    NSP_NORMAL,                 /* 16 Debug Object     */
22967754Smsmith    NSP_NORMAL,                 /* 17 DefField         */
23067754Smsmith    NSP_NORMAL,                 /* 18 BankField        */
23167754Smsmith    NSP_NORMAL,                 /* 19 IndexField       */
23267754Smsmith    NSP_NORMAL,                 /* 20 Reference        */
23367754Smsmith    NSP_NORMAL,                 /* 21 Alias            */
23467754Smsmith    NSP_NORMAL,                 /* 22 Notify           */
23567754Smsmith    NSP_NORMAL,                 /* 23 Address Handler  */
23669450Smsmith    NSP_NEWSCOPE | NSP_LOCAL,   /* 24 Resource         */
23769450Smsmith    NSP_NORMAL,                 /* 25 DefFieldDefn     */
23869450Smsmith    NSP_NORMAL,                 /* 26 BankFieldDefn    */
23969450Smsmith    NSP_NORMAL,                 /* 27 IndexFieldDefn   */
24069450Smsmith    NSP_NORMAL,                 /* 28 If               */
24169450Smsmith    NSP_NORMAL,                 /* 29 Else             */
24269450Smsmith    NSP_NORMAL,                 /* 30 While            */
24369450Smsmith    NSP_NEWSCOPE,               /* 31 Scope            */
24469450Smsmith    NSP_LOCAL,                  /* 32 DefAny           */
24569450Smsmith    NSP_NORMAL,                 /* 33 Method Arg       */
24669450Smsmith    NSP_NORMAL,                 /* 34 Method Local     */
24769450Smsmith    NSP_NORMAL,                 /* 35 Extra            */
24869450Smsmith    NSP_NORMAL                  /* 36 Invalid          */
24967754Smsmith};
25067754Smsmith
25167754Smsmith
25267754Smsmith/******************************************************************************
25367754Smsmith *
25467754Smsmith * Table globals
25567754Smsmith *
25669450Smsmith * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
25769450Smsmith * it is NOT an exhaustive list of all possible ACPI tables.  All ACPI tables
25869450Smsmith * that are not used by the subsystem are simply ignored.
25969450Smsmith *
26067754Smsmith ******************************************************************************/
26167754Smsmith
26267754Smsmith
26367754SmsmithACPI_TABLE_DESC             AcpiGbl_AcpiTables[NUM_ACPI_TABLES];
26467754Smsmith
26567754Smsmith
26667754SmsmithACPI_TABLE_SUPPORT          AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] =
26767754Smsmith{
26869450Smsmith    /***********    Name,    Signature,  Signature size,    How many allowed?,   Supported?  Global typed pointer */
26967754Smsmith
27069450Smsmith    /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      NULL},
27169450Smsmith    /* DSDT 1 */ {DSDT_SIG,  DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &AcpiGbl_DSDT},
27269450Smsmith    /* FADT 2 */ {FADT_SIG,  FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &AcpiGbl_FADT},
27369450Smsmith    /* FACS 3 */ {FACS_SIG,  FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &AcpiGbl_FACS},
27469450Smsmith    /* PSDT 4 */ {PSDT_SIG,  PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK,      NULL},
27569450Smsmith    /* SSDT 5 */ {SSDT_SIG,  SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK,      NULL},
27669450Smsmith    /* XSDT 6 */ {XSDT_SIG,  XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      NULL},
27767754Smsmith};
27867754Smsmith
27967754Smsmith
28067754Smsmith#ifdef ACPI_DEBUG
28167754Smsmith
28267754Smsmith/******************************************************************************
28367754Smsmith *
28467754Smsmith * Strings and procedures used for debug only
28567754Smsmith *
28667754Smsmith ******************************************************************************/
28767754Smsmith
28867754SmsmithNATIVE_CHAR                 *MsgAcpiErrorBreak = "*** Break on ACPI_ERROR ***\n";
28967754Smsmith
29067754Smsmith
29167754Smsmith/*****************************************************************************
29267754Smsmith *
29367754Smsmith * FUNCTION:    AcpiCmGetMutexName
29467754Smsmith *
29567754Smsmith * PARAMETERS:  None.
29667754Smsmith *
29767754Smsmith * RETURN:      Status
29867754Smsmith *
29967754Smsmith * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
30067754Smsmith *
30167754Smsmith ****************************************************************************/
30267754Smsmith
30367754SmsmithNATIVE_CHAR *
30467754SmsmithAcpiCmGetMutexName (
30567754Smsmith    UINT32                  MutexId)
30667754Smsmith{
30767754Smsmith
30867754Smsmith    if (MutexId > MAX_MTX)
30967754Smsmith    {
31067754Smsmith        return ("Invalid Mutex ID");
31167754Smsmith    }
31267754Smsmith
31367754Smsmith    return (AcpiGbl_MutexNames[MutexId]);
31467754Smsmith}
31567754Smsmith
31667754Smsmith
31767754Smsmith/*
31867754Smsmith * Elements of AcpiGbl_NsTypeNames below must match
31967754Smsmith * one-to-one with values of ACPI_OBJECT_TYPE
32067754Smsmith *
32167754Smsmith * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when
32267754Smsmith * stored in a table it really means that we have thus far seen no evidence to
32367754Smsmith * indicatewhat type is actually going to be stored for this entry.
32467754Smsmith */
32567754Smsmith
32667754Smsmithstatic NATIVE_CHAR          AcpiGbl_BadType[] = "UNDEFINED";
32767754Smsmith#define TYPE_NAME_LENGTH    9                       /* Maximum length of each string */
32867754Smsmith
32967754Smsmithstatic NATIVE_CHAR          *AcpiGbl_NsTypeNames[] =    /* printable names of ACPI types */
33067754Smsmith{
33167754Smsmith    /* 00 */ "Untyped",
33267754Smsmith    /* 01 */ "Number",
33367754Smsmith    /* 02 */ "String",
33467754Smsmith    /* 03 */ "Buffer",
33567754Smsmith    /* 04 */ "Package",
33667754Smsmith    /* 05 */ "FieldUnit",
33767754Smsmith    /* 06 */ "Device",
33867754Smsmith    /* 07 */ "Event",
33967754Smsmith    /* 08 */ "Method",
34067754Smsmith    /* 09 */ "Mutex",
34167754Smsmith    /* 10 */ "Region",
34267754Smsmith    /* 11 */ "Power",
34367754Smsmith    /* 12 */ "Processor",
34467754Smsmith    /* 13 */ "Thermal",
34567754Smsmith    /* 14 */ "BufferFld",
34667754Smsmith    /* 15 */ "DdbHandle",
34767754Smsmith    /* 16 */ "DebugObj",
34867754Smsmith    /* 17 */ "DefField",
34967754Smsmith    /* 18 */ "BnkField",
35067754Smsmith    /* 19 */ "IdxField",
35167754Smsmith    /* 20 */ "Reference",
35267754Smsmith    /* 21 */ "Alias",
35367754Smsmith    /* 22 */ "Notify",
35467754Smsmith    /* 23 */ "AddrHndlr",
35569450Smsmith    /* 24 */ "Resource",
35669450Smsmith    /* 25 */ "DefFldDfn",
35769450Smsmith    /* 26 */ "BnkFldDfn",
35869450Smsmith    /* 27 */ "IdxFldDfn",
35969450Smsmith    /* 28 */ "If",
36069450Smsmith    /* 29 */ "Else",
36169450Smsmith    /* 30 */ "While",
36269450Smsmith    /* 31 */ "Scope",
36369450Smsmith    /* 32 */ "DefAny",
36469450Smsmith    /* 33 */ "MethodArg",
36569450Smsmith    /* 34 */ "MethodLcl",
36669450Smsmith    /* 35 */ "Extra",
36769450Smsmith    /* 36 */ "Invalid"
36867754Smsmith};
36967754Smsmith
37067754Smsmith
37167754Smsmith/*****************************************************************************
37267754Smsmith *
37367754Smsmith * FUNCTION:    AcpiCmGetTypeName
37467754Smsmith *
37567754Smsmith * PARAMETERS:  None.
37667754Smsmith *
37767754Smsmith * RETURN:      Status
37867754Smsmith *
37967754Smsmith * DESCRIPTION: Translate a Type ID into a name string (Debug only)
38067754Smsmith *
38167754Smsmith ****************************************************************************/
38267754Smsmith
38367754SmsmithNATIVE_CHAR *
38467754SmsmithAcpiCmGetTypeName (
38567754Smsmith    UINT32                  Type)
38667754Smsmith{
38767754Smsmith
38867754Smsmith    if (Type > INTERNAL_TYPE_INVALID)
38967754Smsmith    {
39067754Smsmith        return (AcpiGbl_BadType);
39167754Smsmith    }
39267754Smsmith
39367754Smsmith    return (AcpiGbl_NsTypeNames[Type]);
39467754Smsmith}
39567754Smsmith
39667754Smsmith#endif
39767754Smsmith
39867754Smsmith
39967754Smsmith/*****************************************************************************
40067754Smsmith *
40167754Smsmith * FUNCTION:    AcpiCmValidObjectType
40267754Smsmith *
40367754Smsmith * PARAMETERS:  None.
40467754Smsmith *
40567754Smsmith * RETURN:      TRUE if valid object type
40667754Smsmith *
40767754Smsmith * DESCRIPTION: Validate an object type
40867754Smsmith *
40967754Smsmith ****************************************************************************/
41067754Smsmith
41167754SmsmithBOOLEAN
41267754SmsmithAcpiCmValidObjectType (
41367754Smsmith    UINT32                  Type)
41467754Smsmith{
41567754Smsmith
41667754Smsmith    if (Type > ACPI_TYPE_MAX)
41767754Smsmith    {
41867754Smsmith        if ((Type < INTERNAL_TYPE_BEGIN) ||
41967754Smsmith            (Type > INTERNAL_TYPE_MAX))
42067754Smsmith        {
42167754Smsmith            return (FALSE);
42267754Smsmith        }
42367754Smsmith    }
42467754Smsmith
42567754Smsmith    return (TRUE);
42667754Smsmith}
42767754Smsmith
42867754Smsmith
42967754Smsmith/*****************************************************************************
43067754Smsmith *
43167754Smsmith * FUNCTION:    AcpiCmFormatException
43267754Smsmith *
43367754Smsmith * PARAMETERS:  Status              - Acpi status to be formatted
43467754Smsmith *
43567754Smsmith * RETURN:      Formatted status string
43667754Smsmith *
43767754Smsmith * DESCRIPTION: Convert an ACPI exception to a string
43867754Smsmith *
43967754Smsmith ****************************************************************************/
44067754Smsmith
44167754SmsmithNATIVE_CHAR *
44267754SmsmithAcpiCmFormatException (
44367754Smsmith    ACPI_STATUS             Status)
44467754Smsmith{
44567754Smsmith    NATIVE_CHAR             *Exception = "UNKNOWN_STATUS";
44667754Smsmith    ACPI_STATUS             SubStatus;
44767754Smsmith
44867754Smsmith
44967754Smsmith    SubStatus = (Status & ~AE_CODE_MASK);
45067754Smsmith
45167754Smsmith
45267754Smsmith    switch (Status & AE_CODE_MASK)
45367754Smsmith    {
45467754Smsmith    case AE_CODE_ENVIRONMENTAL:
45567754Smsmith
45667754Smsmith        if (SubStatus <= AE_CODE_ENV_MAX)
45767754Smsmith        {
45867754Smsmith            Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
45967754Smsmith        }
46067754Smsmith        break;
46167754Smsmith
46267754Smsmith    case AE_CODE_PROGRAMMER:
46367754Smsmith
46467754Smsmith        if (SubStatus <= AE_CODE_PGM_MAX)
46567754Smsmith        {
46667754Smsmith            Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
46767754Smsmith        }
46867754Smsmith        break;
46967754Smsmith
47067754Smsmith    case AE_CODE_ACPI_TABLES:
47167754Smsmith
47267754Smsmith        if (SubStatus <= AE_CODE_TBL_MAX)
47367754Smsmith        {
47467754Smsmith            Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
47567754Smsmith        }
47667754Smsmith        break;
47767754Smsmith
47867754Smsmith    case AE_CODE_AML:
47967754Smsmith
48067754Smsmith        if (SubStatus <= AE_CODE_AML_MAX)
48167754Smsmith        {
48267754Smsmith            Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
48367754Smsmith        }
48467754Smsmith        break;
48567754Smsmith
48667754Smsmith    case AE_CODE_CONTROL:
48767754Smsmith
48867754Smsmith        if (SubStatus <= AE_CODE_CTRL_MAX)
48967754Smsmith        {
49067754Smsmith            Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
49167754Smsmith        }
49267754Smsmith        break;
49367754Smsmith
49467754Smsmith    default:
49567754Smsmith        break;
49667754Smsmith    }
49767754Smsmith
49867754Smsmith
49967754Smsmith    return (Exception);
50067754Smsmith}
50167754Smsmith
50267754Smsmith
50367754Smsmith/****************************************************************************
50467754Smsmith *
50567754Smsmith * FUNCTION:    AcpiCmAllocateOwnerId
50667754Smsmith *
50767754Smsmith * PARAMETERS:  IdType          - Type of ID (method or table)
50867754Smsmith *
50967754Smsmith * DESCRIPTION: Allocate a table or method owner id
51067754Smsmith *
51167754Smsmith ***************************************************************************/
51267754Smsmith
51367754SmsmithACPI_OWNER_ID
51467754SmsmithAcpiCmAllocateOwnerId (
51567754Smsmith    UINT32                  IdType)
51667754Smsmith{
51767754Smsmith    ACPI_OWNER_ID           OwnerId = 0xFFFF;
51867754Smsmith
51967754Smsmith
52067754Smsmith    FUNCTION_TRACE ("CmAllocateOwnerId");
52167754Smsmith
52267754Smsmith
52367754Smsmith    AcpiCmAcquireMutex (ACPI_MTX_CACHES);
52467754Smsmith
52567754Smsmith    switch (IdType)
52667754Smsmith    {
52767754Smsmith    case OWNER_TYPE_TABLE:
52867754Smsmith
52967754Smsmith        OwnerId = AcpiGbl_NextTableOwnerId;
53067754Smsmith        AcpiGbl_NextTableOwnerId++;
53167754Smsmith
53267754Smsmith        if (AcpiGbl_NextTableOwnerId == FIRST_METHOD_ID)
53367754Smsmith        {
53467754Smsmith            AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID;
53567754Smsmith        }
53667754Smsmith        break;
53767754Smsmith
53867754Smsmith
53967754Smsmith    case OWNER_TYPE_METHOD:
54067754Smsmith
54167754Smsmith        OwnerId = AcpiGbl_NextMethodOwnerId;
54267754Smsmith        AcpiGbl_NextMethodOwnerId++;
54367754Smsmith
54467754Smsmith        if (AcpiGbl_NextMethodOwnerId == FIRST_TABLE_ID)
54567754Smsmith        {
54667754Smsmith            AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID;
54767754Smsmith        }
54867754Smsmith        break;
54967754Smsmith    }
55067754Smsmith
55167754Smsmith
55267754Smsmith    AcpiCmReleaseMutex (ACPI_MTX_CACHES);
55367754Smsmith
55467754Smsmith    return_VALUE (OwnerId);
55567754Smsmith}
55667754Smsmith
55767754Smsmith
55867754Smsmith/****************************************************************************
55967754Smsmith *
56067754Smsmith * FUNCTION:    AcpiCmInitGlobals
56167754Smsmith *
56267754Smsmith * PARAMETERS:  none
56367754Smsmith *
56467754Smsmith * DESCRIPTION: Init library globals.  All globals that require specific
56567754Smsmith *              initialization should be initialized here!
56667754Smsmith *
56767754Smsmith ***************************************************************************/
56867754Smsmith
56967754Smsmithvoid
57067754SmsmithAcpiCmInitGlobals (
57167754Smsmith    void)
57267754Smsmith{
57367754Smsmith    UINT32                  i;
57467754Smsmith
57567754Smsmith
57667754Smsmith    FUNCTION_TRACE ("CmInitGlobals");
57767754Smsmith
57867754Smsmith
57967754Smsmith    /* ACPI table structure */
58067754Smsmith
58167754Smsmith    for (i = 0; i < NUM_ACPI_TABLES; i++)
58267754Smsmith    {
58367754Smsmith        AcpiGbl_AcpiTables[i].Prev          = &AcpiGbl_AcpiTables[i];
58467754Smsmith        AcpiGbl_AcpiTables[i].Next          = &AcpiGbl_AcpiTables[i];
58567754Smsmith        AcpiGbl_AcpiTables[i].Pointer       = NULL;
58667754Smsmith        AcpiGbl_AcpiTables[i].Length        = 0;
58767754Smsmith        AcpiGbl_AcpiTables[i].Allocation    = ACPI_MEM_NOT_ALLOCATED;
58867754Smsmith        AcpiGbl_AcpiTables[i].Count         = 0;
58967754Smsmith    }
59067754Smsmith
59167754Smsmith
59267754Smsmith    /* Address Space handler array */
59367754Smsmith
59467754Smsmith    for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++)
59567754Smsmith    {
59667754Smsmith        AcpiGbl_AddressSpaces[i].Handler    = NULL;
59767754Smsmith        AcpiGbl_AddressSpaces[i].Context    = NULL;
59867754Smsmith    }
59967754Smsmith
60067754Smsmith    /* Mutex locked flags */
60167754Smsmith
60267754Smsmith    for (i = 0; i < NUM_MTX; i++)
60367754Smsmith    {
60467754Smsmith        AcpiGbl_AcpiMutexInfo[i].Mutex      = NULL;
60567754Smsmith        AcpiGbl_AcpiMutexInfo[i].Locked     = FALSE;
60667754Smsmith        AcpiGbl_AcpiMutexInfo[i].UseCount   = 0;
60767754Smsmith    }
60867754Smsmith
60967754Smsmith    /* Global notify handlers */
61067754Smsmith
61167754Smsmith    AcpiGbl_SysNotify.Handler           = NULL;
61267754Smsmith    AcpiGbl_DrvNotify.Handler           = NULL;
61367754Smsmith
61467754Smsmith    /* Global "typed" ACPI table pointers */
61567754Smsmith
61667754Smsmith    AcpiGbl_RSDP                        = NULL;
61769450Smsmith    AcpiGbl_XSDT                        = NULL;
61867754Smsmith    AcpiGbl_FACS                        = NULL;
61969450Smsmith    AcpiGbl_FADT                        = NULL;
62067754Smsmith    AcpiGbl_DSDT                        = NULL;
62167754Smsmith
62267754Smsmith
62367754Smsmith    /* Global Lock support */
62467754Smsmith
62567754Smsmith    AcpiGbl_GlobalLockAcquired          = FALSE;
62667754Smsmith    AcpiGbl_GlobalLockThreadCount       = 0;
62767754Smsmith
62867754Smsmith    /* Miscellaneous variables */
62967754Smsmith
63067754Smsmith    AcpiGbl_SystemFlags                 = 0;
63167754Smsmith    AcpiGbl_StartupFlags                = 0;
63267754Smsmith    AcpiGbl_GlobalLockSet               = FALSE;
63367754Smsmith    AcpiGbl_RsdpOriginalLocation        = 0;
63467754Smsmith    AcpiGbl_CmSingleStep                = FALSE;
63567754Smsmith    AcpiGbl_DbTerminateThreads          = FALSE;
63667754Smsmith    AcpiGbl_Shutdown                    = FALSE;
63767754Smsmith    AcpiGbl_NsLookupCount               = 0;
63867754Smsmith    AcpiGbl_PsFindCount                 = 0;
63967754Smsmith    AcpiGbl_AcpiHardwarePresent         = TRUE;
64067754Smsmith    AcpiGbl_NextTableOwnerId            = FIRST_TABLE_ID;
64167754Smsmith    AcpiGbl_NextMethodOwnerId           = FIRST_METHOD_ID;
64267754Smsmith    AcpiGbl_DebuggerConfiguration       = DEBUGGER_THREADING;
64367754Smsmith
64467754Smsmith    /* Cache of small "state" objects */
64567754Smsmith
64667754Smsmith    AcpiGbl_GenericStateCache           = NULL;
64767754Smsmith    AcpiGbl_GenericStateCacheDepth      = 0;
64867754Smsmith    AcpiGbl_StateCacheRequests          = 0;
64967754Smsmith    AcpiGbl_StateCacheHits              = 0;
65067754Smsmith
65167754Smsmith    AcpiGbl_ParseCache                  = NULL;
65267754Smsmith    AcpiGbl_ParseCacheDepth             = 0;
65367754Smsmith    AcpiGbl_ParseCacheRequests          = 0;
65467754Smsmith    AcpiGbl_ParseCacheHits              = 0;
65567754Smsmith
65667754Smsmith    AcpiGbl_ExtParseCache               = NULL;
65767754Smsmith    AcpiGbl_ExtParseCacheDepth          = 0;
65867754Smsmith    AcpiGbl_ExtParseCacheRequests       = 0;
65967754Smsmith    AcpiGbl_ExtParseCacheHits           = 0;
66067754Smsmith
66167754Smsmith    AcpiGbl_ObjectCache                 = NULL;
66267754Smsmith    AcpiGbl_ObjectCacheDepth            = 0;
66367754Smsmith    AcpiGbl_ObjectCacheRequests         = 0;
66467754Smsmith    AcpiGbl_ObjectCacheHits             = 0;
66567754Smsmith
66667754Smsmith    AcpiGbl_WalkStateCache              = NULL;
66767754Smsmith    AcpiGbl_WalkStateCacheDepth         = 0;
66867754Smsmith    AcpiGbl_WalkStateCacheRequests      = 0;
66967754Smsmith    AcpiGbl_WalkStateCacheHits          = 0;
67067754Smsmith
67167754Smsmith    /* Hardware oriented */
67267754Smsmith
67367754Smsmith    AcpiGbl_Gpe0EnableRegisterSave      = NULL;
67467754Smsmith    AcpiGbl_Gpe1EnableRegisterSave      = NULL;
67567754Smsmith    AcpiGbl_OriginalMode                = SYS_MODE_UNKNOWN;   /*  original ACPI/legacy mode   */
67667754Smsmith    AcpiGbl_GpeRegisters                = NULL;
67767754Smsmith    AcpiGbl_GpeInfo                     = NULL;
67867754Smsmith
67967754Smsmith    /* Namespace */
68067754Smsmith
68167754Smsmith    AcpiGbl_RootNode                    = NULL;
68267754Smsmith
68367754Smsmith    AcpiGbl_RootNodeStruct.Name         = ACPI_ROOT_NAME;
68467754Smsmith    AcpiGbl_RootNodeStruct.DataType     = ACPI_DESC_TYPE_NAMED;
68567754Smsmith    AcpiGbl_RootNodeStruct.Type         = ACPI_TYPE_ANY;
68667754Smsmith    AcpiGbl_RootNodeStruct.Child        = NULL;
68767754Smsmith    AcpiGbl_RootNodeStruct.Peer         = NULL;
68867754Smsmith    AcpiGbl_RootNodeStruct.Object       = NULL;
68967754Smsmith    AcpiGbl_RootNodeStruct.Flags        = ANOBJ_END_OF_PEER_LIST;
69067754Smsmith
69167754Smsmith    /* Memory allocation metrics - compiled out in non-debug mode. */
69267754Smsmith
69367754Smsmith    INITIALIZE_ALLOCATION_METRICS();
69467754Smsmith
69567754Smsmith    return_VOID;
69667754Smsmith}
69767754Smsmith
69867754Smsmith
699