utglobal.c revision 67754
167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Module Name: cmglobal - Global variables for the ACPI subsystem 467754Smsmith * $Revision: 104 $ 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 16967754Smsmith/****************************************************************************** 17067754Smsmith * 17167754Smsmith * Namespace globals 17267754Smsmith * 17367754Smsmith ******************************************************************************/ 17467754Smsmith 17567754Smsmith 17667754Smsmith/* 17767754Smsmith * Names built-in to the interpreter 17867754Smsmith * 17967754Smsmith * Initial values are currently supported only for types String and Number. 18067754Smsmith * To avoid type punning, both are specified as strings in this table. 18167754Smsmith */ 18267754Smsmith 18367754SmsmithPREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = 18467754Smsmith{ 18567754Smsmith {"_GPE", INTERNAL_TYPE_DEF_ANY}, 18667754Smsmith {"_PR_", INTERNAL_TYPE_DEF_ANY}, 18767754Smsmith {"_SB_", INTERNAL_TYPE_DEF_ANY}, 18867754Smsmith {"_SI_", INTERNAL_TYPE_DEF_ANY}, 18967754Smsmith {"_TZ_", INTERNAL_TYPE_DEF_ANY}, 19067754Smsmith {"_REV", ACPI_TYPE_NUMBER, "2"}, 19167754Smsmith {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 19267754Smsmith {"_GL_", ACPI_TYPE_MUTEX, "0"}, 19367754Smsmith 19467754Smsmith /* Table terminator */ 19567754Smsmith 19667754Smsmith {NULL, ACPI_TYPE_ANY} 19767754Smsmith}; 19867754Smsmith 19967754Smsmith 20067754Smsmith/* 20167754Smsmith * Properties of the ACPI Object Types, both internal and external. 20267754Smsmith * 20367754Smsmith * Elements of AcpiNsProperties are bit significant 20467754Smsmith * and the table is indexed by values of ACPI_OBJECT_TYPE 20567754Smsmith */ 20667754Smsmith 20767754SmsmithUINT8 AcpiGbl_NsProperties[] = 20867754Smsmith{ 20967754Smsmith NSP_NORMAL, /* 00 Any */ 21067754Smsmith NSP_NORMAL, /* 01 Number */ 21167754Smsmith NSP_NORMAL, /* 02 String */ 21267754Smsmith NSP_NORMAL, /* 03 Buffer */ 21367754Smsmith NSP_LOCAL, /* 04 Package */ 21467754Smsmith NSP_NORMAL, /* 05 FieldUnit */ 21567754Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 06 Device */ 21667754Smsmith NSP_LOCAL, /* 07 AcpiEvent */ 21767754Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 08 Method */ 21867754Smsmith NSP_LOCAL, /* 09 Mutex */ 21967754Smsmith NSP_LOCAL, /* 10 Region */ 22067754Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 11 Power */ 22167754Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 12 Processor */ 22267754Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 13 Thermal */ 22367754Smsmith NSP_NORMAL, /* 14 BufferField */ 22467754Smsmith NSP_NORMAL, /* 15 DdbHandle */ 22567754Smsmith NSP_NORMAL, /* 16 Debug Object */ 22667754Smsmith NSP_NORMAL, /* 17 DefField */ 22767754Smsmith NSP_NORMAL, /* 18 BankField */ 22867754Smsmith NSP_NORMAL, /* 19 IndexField */ 22967754Smsmith NSP_NORMAL, /* 20 Reference */ 23067754Smsmith NSP_NORMAL, /* 21 Alias */ 23167754Smsmith NSP_NORMAL, /* 22 Notify */ 23267754Smsmith NSP_NORMAL, /* 23 Address Handler */ 23367754Smsmith NSP_NORMAL, /* 24 DefFieldDefn */ 23467754Smsmith NSP_NORMAL, /* 25 BankFieldDefn */ 23567754Smsmith NSP_NORMAL, /* 26 IndexFieldDefn */ 23667754Smsmith NSP_NORMAL, /* 27 If */ 23767754Smsmith NSP_NORMAL, /* 28 Else */ 23867754Smsmith NSP_NORMAL, /* 29 While */ 23967754Smsmith NSP_NEWSCOPE, /* 30 Scope */ 24067754Smsmith NSP_LOCAL, /* 31 DefAny */ 24167754Smsmith NSP_NORMAL, /* 32 Method Arg */ 24267754Smsmith NSP_NORMAL, /* 33 Method Local */ 24367754Smsmith NSP_NORMAL, /* 34 Extra */ 24467754Smsmith NSP_NORMAL /* 35 Invalid */ 24567754Smsmith}; 24667754Smsmith 24767754Smsmith 24867754Smsmith/****************************************************************************** 24967754Smsmith * 25067754Smsmith * Table globals 25167754Smsmith * 25267754Smsmith ******************************************************************************/ 25367754Smsmith 25467754Smsmith 25567754SmsmithACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES]; 25667754Smsmith 25767754Smsmith 25867754SmsmithACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] = 25967754Smsmith{ 26067754Smsmith /* Name, Signature, Signature size, How many allowed?, Supported? Global typed pointer */ 26167754Smsmith 26267754Smsmith /* RSDP 0 */ {"RSDP", RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, 26367754Smsmith /* APIC 1 */ {APIC_SIG, APIC_SIG, sizeof (APIC_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_APIC}, 26467754Smsmith /* DSDT 2 */ {DSDT_SIG, DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_DSDT}, 26567754Smsmith /* FACP 3 */ {FACP_SIG, FACP_SIG, sizeof (FACP_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FACP}, 26667754Smsmith /* FACS 4 */ {FACS_SIG, FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FACS}, 26767754Smsmith /* PSDT 5 */ {PSDT_SIG, PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 26867754Smsmith /* RSDT 6 */ {RSDT_SIG, RSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, 26967754Smsmith /* SSDT 7 */ {SSDT_SIG, SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 27067754Smsmith /* SBST 8 */ {SBST_SIG, SBST_SIG, sizeof (SBST_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_SBST}, 27167754Smsmith /* SPIC 9 */ {SPIC_SIG, SPIC_SIG, sizeof (SPIC_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 27267754Smsmith /* BOOT 10 */{BOOT_SIG, BOOT_SIG, sizeof (BOOT_SIG)-1, ACPI_TABLE_SINGLE, AE_SUPPORT, NULL} 27367754Smsmith}; 27467754Smsmith 27567754Smsmith 27667754Smsmith#ifdef ACPI_DEBUG 27767754Smsmith 27867754Smsmith/****************************************************************************** 27967754Smsmith * 28067754Smsmith * Strings and procedures used for debug only 28167754Smsmith * 28267754Smsmith ******************************************************************************/ 28367754Smsmith 28467754SmsmithNATIVE_CHAR *MsgAcpiErrorBreak = "*** Break on ACPI_ERROR ***\n"; 28567754Smsmith 28667754Smsmith 28767754Smsmith/***************************************************************************** 28867754Smsmith * 28967754Smsmith * FUNCTION: AcpiCmGetMutexName 29067754Smsmith * 29167754Smsmith * PARAMETERS: None. 29267754Smsmith * 29367754Smsmith * RETURN: Status 29467754Smsmith * 29567754Smsmith * DESCRIPTION: Translate a mutex ID into a name string (Debug only) 29667754Smsmith * 29767754Smsmith ****************************************************************************/ 29867754Smsmith 29967754SmsmithNATIVE_CHAR * 30067754SmsmithAcpiCmGetMutexName ( 30167754Smsmith UINT32 MutexId) 30267754Smsmith{ 30367754Smsmith 30467754Smsmith if (MutexId > MAX_MTX) 30567754Smsmith { 30667754Smsmith return ("Invalid Mutex ID"); 30767754Smsmith } 30867754Smsmith 30967754Smsmith return (AcpiGbl_MutexNames[MutexId]); 31067754Smsmith} 31167754Smsmith 31267754Smsmith 31367754Smsmith/* 31467754Smsmith * Elements of AcpiGbl_NsTypeNames below must match 31567754Smsmith * one-to-one with values of ACPI_OBJECT_TYPE 31667754Smsmith * 31767754Smsmith * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when 31867754Smsmith * stored in a table it really means that we have thus far seen no evidence to 31967754Smsmith * indicatewhat type is actually going to be stored for this entry. 32067754Smsmith */ 32167754Smsmith 32267754Smsmithstatic NATIVE_CHAR AcpiGbl_BadType[] = "UNDEFINED"; 32367754Smsmith#define TYPE_NAME_LENGTH 9 /* Maximum length of each string */ 32467754Smsmith 32567754Smsmithstatic NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */ 32667754Smsmith{ 32767754Smsmith /* 00 */ "Untyped", 32867754Smsmith /* 01 */ "Number", 32967754Smsmith /* 02 */ "String", 33067754Smsmith /* 03 */ "Buffer", 33167754Smsmith /* 04 */ "Package", 33267754Smsmith /* 05 */ "FieldUnit", 33367754Smsmith /* 06 */ "Device", 33467754Smsmith /* 07 */ "Event", 33567754Smsmith /* 08 */ "Method", 33667754Smsmith /* 09 */ "Mutex", 33767754Smsmith /* 10 */ "Region", 33867754Smsmith /* 11 */ "Power", 33967754Smsmith /* 12 */ "Processor", 34067754Smsmith /* 13 */ "Thermal", 34167754Smsmith /* 14 */ "BufferFld", 34267754Smsmith /* 15 */ "DdbHandle", 34367754Smsmith /* 16 */ "DebugObj", 34467754Smsmith /* 17 */ "DefField", 34567754Smsmith /* 18 */ "BnkField", 34667754Smsmith /* 19 */ "IdxField", 34767754Smsmith /* 20 */ "Reference", 34867754Smsmith /* 21 */ "Alias", 34967754Smsmith /* 22 */ "Notify", 35067754Smsmith /* 23 */ "AddrHndlr", 35167754Smsmith /* 24 */ "DefFldDfn", 35267754Smsmith /* 25 */ "BnkFldDfn", 35367754Smsmith /* 26 */ "IdxFldDfn", 35467754Smsmith /* 27 */ "If", 35567754Smsmith /* 28 */ "Else", 35667754Smsmith /* 29 */ "While", 35767754Smsmith /* 30 */ "Scope", 35867754Smsmith /* 31 */ "DefAny", 35967754Smsmith /* 32 */ "MethodArg", 36067754Smsmith /* 33 */ "MethodLcl", 36167754Smsmith /* 34 */ "Extra", 36267754Smsmith /* 35 */ "Invalid" 36367754Smsmith}; 36467754Smsmith 36567754Smsmith 36667754Smsmith/***************************************************************************** 36767754Smsmith * 36867754Smsmith * FUNCTION: AcpiCmGetTypeName 36967754Smsmith * 37067754Smsmith * PARAMETERS: None. 37167754Smsmith * 37267754Smsmith * RETURN: Status 37367754Smsmith * 37467754Smsmith * DESCRIPTION: Translate a Type ID into a name string (Debug only) 37567754Smsmith * 37667754Smsmith ****************************************************************************/ 37767754Smsmith 37867754SmsmithNATIVE_CHAR * 37967754SmsmithAcpiCmGetTypeName ( 38067754Smsmith UINT32 Type) 38167754Smsmith{ 38267754Smsmith 38367754Smsmith if (Type > INTERNAL_TYPE_INVALID) 38467754Smsmith { 38567754Smsmith return (AcpiGbl_BadType); 38667754Smsmith } 38767754Smsmith 38867754Smsmith return (AcpiGbl_NsTypeNames[Type]); 38967754Smsmith} 39067754Smsmith 39167754Smsmith#endif 39267754Smsmith 39367754Smsmith 39467754Smsmith/***************************************************************************** 39567754Smsmith * 39667754Smsmith * FUNCTION: AcpiCmValidObjectType 39767754Smsmith * 39867754Smsmith * PARAMETERS: None. 39967754Smsmith * 40067754Smsmith * RETURN: TRUE if valid object type 40167754Smsmith * 40267754Smsmith * DESCRIPTION: Validate an object type 40367754Smsmith * 40467754Smsmith ****************************************************************************/ 40567754Smsmith 40667754SmsmithBOOLEAN 40767754SmsmithAcpiCmValidObjectType ( 40867754Smsmith UINT32 Type) 40967754Smsmith{ 41067754Smsmith 41167754Smsmith if (Type > ACPI_TYPE_MAX) 41267754Smsmith { 41367754Smsmith if ((Type < INTERNAL_TYPE_BEGIN) || 41467754Smsmith (Type > INTERNAL_TYPE_MAX)) 41567754Smsmith { 41667754Smsmith return (FALSE); 41767754Smsmith } 41867754Smsmith } 41967754Smsmith 42067754Smsmith return (TRUE); 42167754Smsmith} 42267754Smsmith 42367754Smsmith 42467754Smsmith/***************************************************************************** 42567754Smsmith * 42667754Smsmith * FUNCTION: AcpiCmFormatException 42767754Smsmith * 42867754Smsmith * PARAMETERS: Status - Acpi status to be formatted 42967754Smsmith * 43067754Smsmith * RETURN: Formatted status string 43167754Smsmith * 43267754Smsmith * DESCRIPTION: Convert an ACPI exception to a string 43367754Smsmith * 43467754Smsmith ****************************************************************************/ 43567754Smsmith 43667754SmsmithNATIVE_CHAR * 43767754SmsmithAcpiCmFormatException ( 43867754Smsmith ACPI_STATUS Status) 43967754Smsmith{ 44067754Smsmith NATIVE_CHAR *Exception = "UNKNOWN_STATUS"; 44167754Smsmith ACPI_STATUS SubStatus; 44267754Smsmith 44367754Smsmith 44467754Smsmith SubStatus = (Status & ~AE_CODE_MASK); 44567754Smsmith 44667754Smsmith 44767754Smsmith switch (Status & AE_CODE_MASK) 44867754Smsmith { 44967754Smsmith case AE_CODE_ENVIRONMENTAL: 45067754Smsmith 45167754Smsmith if (SubStatus <= AE_CODE_ENV_MAX) 45267754Smsmith { 45367754Smsmith Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; 45467754Smsmith } 45567754Smsmith break; 45667754Smsmith 45767754Smsmith case AE_CODE_PROGRAMMER: 45867754Smsmith 45967754Smsmith if (SubStatus <= AE_CODE_PGM_MAX) 46067754Smsmith { 46167754Smsmith Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; 46267754Smsmith } 46367754Smsmith break; 46467754Smsmith 46567754Smsmith case AE_CODE_ACPI_TABLES: 46667754Smsmith 46767754Smsmith if (SubStatus <= AE_CODE_TBL_MAX) 46867754Smsmith { 46967754Smsmith Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; 47067754Smsmith } 47167754Smsmith break; 47267754Smsmith 47367754Smsmith case AE_CODE_AML: 47467754Smsmith 47567754Smsmith if (SubStatus <= AE_CODE_AML_MAX) 47667754Smsmith { 47767754Smsmith Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; 47867754Smsmith } 47967754Smsmith break; 48067754Smsmith 48167754Smsmith case AE_CODE_CONTROL: 48267754Smsmith 48367754Smsmith if (SubStatus <= AE_CODE_CTRL_MAX) 48467754Smsmith { 48567754Smsmith Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; 48667754Smsmith } 48767754Smsmith break; 48867754Smsmith 48967754Smsmith default: 49067754Smsmith break; 49167754Smsmith } 49267754Smsmith 49367754Smsmith 49467754Smsmith return (Exception); 49567754Smsmith} 49667754Smsmith 49767754Smsmith 49867754Smsmith/**************************************************************************** 49967754Smsmith * 50067754Smsmith * FUNCTION: AcpiCmAllocateOwnerId 50167754Smsmith * 50267754Smsmith * PARAMETERS: IdType - Type of ID (method or table) 50367754Smsmith * 50467754Smsmith * DESCRIPTION: Allocate a table or method owner id 50567754Smsmith * 50667754Smsmith ***************************************************************************/ 50767754Smsmith 50867754SmsmithACPI_OWNER_ID 50967754SmsmithAcpiCmAllocateOwnerId ( 51067754Smsmith UINT32 IdType) 51167754Smsmith{ 51267754Smsmith ACPI_OWNER_ID OwnerId = 0xFFFF; 51367754Smsmith 51467754Smsmith 51567754Smsmith FUNCTION_TRACE ("CmAllocateOwnerId"); 51667754Smsmith 51767754Smsmith 51867754Smsmith AcpiCmAcquireMutex (ACPI_MTX_CACHES); 51967754Smsmith 52067754Smsmith switch (IdType) 52167754Smsmith { 52267754Smsmith case OWNER_TYPE_TABLE: 52367754Smsmith 52467754Smsmith OwnerId = AcpiGbl_NextTableOwnerId; 52567754Smsmith AcpiGbl_NextTableOwnerId++; 52667754Smsmith 52767754Smsmith if (AcpiGbl_NextTableOwnerId == FIRST_METHOD_ID) 52867754Smsmith { 52967754Smsmith AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; 53067754Smsmith } 53167754Smsmith break; 53267754Smsmith 53367754Smsmith 53467754Smsmith case OWNER_TYPE_METHOD: 53567754Smsmith 53667754Smsmith OwnerId = AcpiGbl_NextMethodOwnerId; 53767754Smsmith AcpiGbl_NextMethodOwnerId++; 53867754Smsmith 53967754Smsmith if (AcpiGbl_NextMethodOwnerId == FIRST_TABLE_ID) 54067754Smsmith { 54167754Smsmith AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; 54267754Smsmith } 54367754Smsmith break; 54467754Smsmith } 54567754Smsmith 54667754Smsmith 54767754Smsmith AcpiCmReleaseMutex (ACPI_MTX_CACHES); 54867754Smsmith 54967754Smsmith return_VALUE (OwnerId); 55067754Smsmith} 55167754Smsmith 55267754Smsmith 55367754Smsmith/**************************************************************************** 55467754Smsmith * 55567754Smsmith * FUNCTION: AcpiCmInitGlobals 55667754Smsmith * 55767754Smsmith * PARAMETERS: none 55867754Smsmith * 55967754Smsmith * DESCRIPTION: Init library globals. All globals that require specific 56067754Smsmith * initialization should be initialized here! 56167754Smsmith * 56267754Smsmith ***************************************************************************/ 56367754Smsmith 56467754Smsmithvoid 56567754SmsmithAcpiCmInitGlobals ( 56667754Smsmith void) 56767754Smsmith{ 56867754Smsmith UINT32 i; 56967754Smsmith 57067754Smsmith 57167754Smsmith FUNCTION_TRACE ("CmInitGlobals"); 57267754Smsmith 57367754Smsmith 57467754Smsmith /* ACPI table structure */ 57567754Smsmith 57667754Smsmith for (i = 0; i < NUM_ACPI_TABLES; i++) 57767754Smsmith { 57867754Smsmith AcpiGbl_AcpiTables[i].Prev = &AcpiGbl_AcpiTables[i]; 57967754Smsmith AcpiGbl_AcpiTables[i].Next = &AcpiGbl_AcpiTables[i]; 58067754Smsmith AcpiGbl_AcpiTables[i].Pointer = NULL; 58167754Smsmith AcpiGbl_AcpiTables[i].Length = 0; 58267754Smsmith AcpiGbl_AcpiTables[i].Allocation = ACPI_MEM_NOT_ALLOCATED; 58367754Smsmith AcpiGbl_AcpiTables[i].Count = 0; 58467754Smsmith } 58567754Smsmith 58667754Smsmith 58767754Smsmith /* Address Space handler array */ 58867754Smsmith 58967754Smsmith for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++) 59067754Smsmith { 59167754Smsmith AcpiGbl_AddressSpaces[i].Handler = NULL; 59267754Smsmith AcpiGbl_AddressSpaces[i].Context = NULL; 59367754Smsmith } 59467754Smsmith 59567754Smsmith /* Mutex locked flags */ 59667754Smsmith 59767754Smsmith for (i = 0; i < NUM_MTX; i++) 59867754Smsmith { 59967754Smsmith AcpiGbl_AcpiMutexInfo[i].Mutex = NULL; 60067754Smsmith AcpiGbl_AcpiMutexInfo[i].Locked = FALSE; 60167754Smsmith AcpiGbl_AcpiMutexInfo[i].UseCount = 0; 60267754Smsmith } 60367754Smsmith 60467754Smsmith /* Global notify handlers */ 60567754Smsmith 60667754Smsmith AcpiGbl_SysNotify.Handler = NULL; 60767754Smsmith AcpiGbl_DrvNotify.Handler = NULL; 60867754Smsmith 60967754Smsmith /* Global "typed" ACPI table pointers */ 61067754Smsmith 61167754Smsmith AcpiGbl_RSDP = NULL; 61267754Smsmith AcpiGbl_RSDT = NULL; 61367754Smsmith AcpiGbl_FACS = NULL; 61467754Smsmith AcpiGbl_FACP = NULL; 61567754Smsmith AcpiGbl_APIC = NULL; 61667754Smsmith AcpiGbl_DSDT = NULL; 61767754Smsmith AcpiGbl_SBST = NULL; 61867754Smsmith 61967754Smsmith 62067754Smsmith /* Global Lock support */ 62167754Smsmith 62267754Smsmith AcpiGbl_GlobalLockAcquired = FALSE; 62367754Smsmith AcpiGbl_GlobalLockThreadCount = 0; 62467754Smsmith 62567754Smsmith /* Miscellaneous variables */ 62667754Smsmith 62767754Smsmith AcpiGbl_SystemFlags = 0; 62867754Smsmith AcpiGbl_StartupFlags = 0; 62967754Smsmith AcpiGbl_GlobalLockSet = FALSE; 63067754Smsmith AcpiGbl_RsdpOriginalLocation = 0; 63167754Smsmith AcpiGbl_WhenToParseMethods = METHOD_PARSE_CONFIGURATION; 63267754Smsmith AcpiGbl_CmSingleStep = FALSE; 63367754Smsmith AcpiGbl_DbTerminateThreads = FALSE; 63467754Smsmith AcpiGbl_Shutdown = FALSE; 63567754Smsmith AcpiGbl_NsLookupCount = 0; 63667754Smsmith AcpiGbl_PsFindCount = 0; 63767754Smsmith AcpiGbl_AcpiHardwarePresent = TRUE; 63867754Smsmith AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; 63967754Smsmith AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; 64067754Smsmith AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; 64167754Smsmith 64267754Smsmith /* Cache of small "state" objects */ 64367754Smsmith 64467754Smsmith AcpiGbl_GenericStateCache = NULL; 64567754Smsmith AcpiGbl_GenericStateCacheDepth = 0; 64667754Smsmith AcpiGbl_StateCacheRequests = 0; 64767754Smsmith AcpiGbl_StateCacheHits = 0; 64867754Smsmith 64967754Smsmith AcpiGbl_ParseCache = NULL; 65067754Smsmith AcpiGbl_ParseCacheDepth = 0; 65167754Smsmith AcpiGbl_ParseCacheRequests = 0; 65267754Smsmith AcpiGbl_ParseCacheHits = 0; 65367754Smsmith 65467754Smsmith AcpiGbl_ExtParseCache = NULL; 65567754Smsmith AcpiGbl_ExtParseCacheDepth = 0; 65667754Smsmith AcpiGbl_ExtParseCacheRequests = 0; 65767754Smsmith AcpiGbl_ExtParseCacheHits = 0; 65867754Smsmith 65967754Smsmith AcpiGbl_ObjectCache = NULL; 66067754Smsmith AcpiGbl_ObjectCacheDepth = 0; 66167754Smsmith AcpiGbl_ObjectCacheRequests = 0; 66267754Smsmith AcpiGbl_ObjectCacheHits = 0; 66367754Smsmith 66467754Smsmith AcpiGbl_WalkStateCache = NULL; 66567754Smsmith AcpiGbl_WalkStateCacheDepth = 0; 66667754Smsmith AcpiGbl_WalkStateCacheRequests = 0; 66767754Smsmith AcpiGbl_WalkStateCacheHits = 0; 66867754Smsmith 66967754Smsmith /* Interpreter */ 67067754Smsmith 67167754Smsmith AcpiGbl_BufSeq = 0; 67267754Smsmith AcpiGbl_NodeErr = FALSE; 67367754Smsmith 67467754Smsmith /* Parser */ 67567754Smsmith 67667754Smsmith AcpiGbl_ParsedNamespaceRoot = NULL; 67767754Smsmith 67867754Smsmith /* Hardware oriented */ 67967754Smsmith 68067754Smsmith AcpiGbl_Gpe0EnableRegisterSave = NULL; 68167754Smsmith AcpiGbl_Gpe1EnableRegisterSave = NULL; 68267754Smsmith AcpiGbl_OriginalMode = SYS_MODE_UNKNOWN; /* original ACPI/legacy mode */ 68367754Smsmith AcpiGbl_GpeRegisters = NULL; 68467754Smsmith AcpiGbl_GpeInfo = NULL; 68567754Smsmith 68667754Smsmith /* Namespace */ 68767754Smsmith 68867754Smsmith AcpiGbl_RootNode = NULL; 68967754Smsmith 69067754Smsmith AcpiGbl_RootNodeStruct.Name = ACPI_ROOT_NAME; 69167754Smsmith AcpiGbl_RootNodeStruct.DataType = ACPI_DESC_TYPE_NAMED; 69267754Smsmith AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_ANY; 69367754Smsmith AcpiGbl_RootNodeStruct.Child = NULL; 69467754Smsmith AcpiGbl_RootNodeStruct.Peer = NULL; 69567754Smsmith AcpiGbl_RootNodeStruct.Object = NULL; 69667754Smsmith AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; 69767754Smsmith 69867754Smsmith /* Memory allocation metrics - compiled out in non-debug mode. */ 69967754Smsmith 70067754Smsmith INITIALIZE_ALLOCATION_METRICS(); 70167754Smsmith 70267754Smsmith return_VOID; 70367754Smsmith} 70467754Smsmith 70567754Smsmith 706