utglobal.c revision 77424
167754Smsmith/****************************************************************************** 267754Smsmith * 377424Smsmith * Module Name: utglobal - Global variables for the ACPI subsystem 477424Smsmith * $Revision: 122 $ 567754Smsmith * 667754Smsmith *****************************************************************************/ 767754Smsmith 867754Smsmith/****************************************************************************** 967754Smsmith * 1067754Smsmith * 1. Copyright Notice 1167754Smsmith * 1271867Smsmith * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 "acevents.h" 12267754Smsmith#include "acnamesp.h" 12367754Smsmith#include "acinterp.h" 12469746Smsmith#include "amlcode.h" 12567754Smsmith 12667754Smsmith 12777424Smsmith#define _COMPONENT ACPI_UTILITIES 12877424Smsmith MODULE_NAME ("utglobal") 12967754Smsmith 13067754Smsmith 13167754Smsmith/****************************************************************************** 13267754Smsmith * 13367754Smsmith * Static global variable initialization. 13467754Smsmith * 13567754Smsmith ******************************************************************************/ 13667754Smsmith 13767754Smsmith/* 13867754Smsmith * We want the debug switches statically initialized so they 13967754Smsmith * are already set when the debugger is entered. 14067754Smsmith */ 14167754Smsmith 14267754Smsmith/* Debug switch - level and trace mask */ 14367754Smsmith 14467754Smsmith#ifdef ACPI_DEBUG 14567754SmsmithUINT32 AcpiDbgLevel = DEBUG_DEFAULT; 14667754Smsmith#else 14767754SmsmithUINT32 AcpiDbgLevel = NORMAL_DEFAULT; 14867754Smsmith#endif 14967754Smsmith 15067754Smsmith/* Debug switch - layer (component) mask */ 15167754Smsmith 15277424SmsmithUINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT; 15367754SmsmithUINT32 AcpiGbl_NestingLevel = 0; 15467754Smsmith 15567754Smsmith 15667754Smsmith/* Debugger globals */ 15767754Smsmith 15867754SmsmithBOOLEAN AcpiGbl_DbTerminateThreads = FALSE; 15967754SmsmithBOOLEAN AcpiGbl_MethodExecuting = FALSE; 16067754Smsmith 16167754Smsmith/* System flags */ 16267754Smsmith 16367754SmsmithUINT32 AcpiGbl_SystemFlags = 0; 16467754SmsmithUINT32 AcpiGbl_StartupFlags = 0; 16567754Smsmith 16667754Smsmith/* System starts unitialized! */ 16767754SmsmithBOOLEAN AcpiGbl_Shutdown = TRUE; 16867754Smsmith 16967754Smsmith 17069450SmsmithUINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128}; 17169450Smsmith 17269450Smsmith 17367754Smsmith/****************************************************************************** 17467754Smsmith * 17567754Smsmith * Namespace globals 17667754Smsmith * 17767754Smsmith ******************************************************************************/ 17867754Smsmith 17967754Smsmith 18067754Smsmith/* 18167754Smsmith * Names built-in to the interpreter 18267754Smsmith * 18367754Smsmith * Initial values are currently supported only for types String and Number. 18467754Smsmith * To avoid type punning, both are specified as strings in this table. 18577424Smsmith * 18677424Smsmith * NOTES: 18777424Smsmith * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run 18877424Smsmith * during the initialization sequence. 18967754Smsmith */ 19067754Smsmith 19167754SmsmithPREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = 19267754Smsmith{ 19367754Smsmith {"_GPE", INTERNAL_TYPE_DEF_ANY}, 19467754Smsmith {"_PR_", INTERNAL_TYPE_DEF_ANY}, 19577424Smsmith {"_SB_", ACPI_TYPE_DEVICE}, 19667754Smsmith {"_SI_", INTERNAL_TYPE_DEF_ANY}, 19767754Smsmith {"_TZ_", INTERNAL_TYPE_DEF_ANY}, 19871867Smsmith {"_REV", ACPI_TYPE_INTEGER, "2"}, 19967754Smsmith {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 20067754Smsmith {"_GL_", ACPI_TYPE_MUTEX, "0"}, 20177424Smsmith {NULL, ACPI_TYPE_ANY} /* Table terminator */ 20267754Smsmith}; 20367754Smsmith 20467754Smsmith 20567754Smsmith/* 20667754Smsmith * Properties of the ACPI Object Types, both internal and external. 20767754Smsmith * 20867754Smsmith * Elements of AcpiNsProperties are bit significant 20967754Smsmith * and the table is indexed by values of ACPI_OBJECT_TYPE 21067754Smsmith */ 21167754Smsmith 21267754SmsmithUINT8 AcpiGbl_NsProperties[] = 21367754Smsmith{ 21467754Smsmith NSP_NORMAL, /* 00 Any */ 21567754Smsmith NSP_NORMAL, /* 01 Number */ 21667754Smsmith NSP_NORMAL, /* 02 String */ 21767754Smsmith NSP_NORMAL, /* 03 Buffer */ 21867754Smsmith NSP_LOCAL, /* 04 Package */ 21967754Smsmith NSP_NORMAL, /* 05 FieldUnit */ 22067754Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 06 Device */ 22167754Smsmith NSP_LOCAL, /* 07 AcpiEvent */ 22267754Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 08 Method */ 22367754Smsmith NSP_LOCAL, /* 09 Mutex */ 22467754Smsmith NSP_LOCAL, /* 10 Region */ 22567754Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 11 Power */ 22667754Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 12 Processor */ 22767754Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 13 Thermal */ 22867754Smsmith NSP_NORMAL, /* 14 BufferField */ 22967754Smsmith NSP_NORMAL, /* 15 DdbHandle */ 23067754Smsmith NSP_NORMAL, /* 16 Debug Object */ 23167754Smsmith NSP_NORMAL, /* 17 DefField */ 23267754Smsmith NSP_NORMAL, /* 18 BankField */ 23367754Smsmith NSP_NORMAL, /* 19 IndexField */ 23467754Smsmith NSP_NORMAL, /* 20 Reference */ 23567754Smsmith NSP_NORMAL, /* 21 Alias */ 23667754Smsmith NSP_NORMAL, /* 22 Notify */ 23767754Smsmith NSP_NORMAL, /* 23 Address Handler */ 23869450Smsmith NSP_NEWSCOPE | NSP_LOCAL, /* 24 Resource */ 23969450Smsmith NSP_NORMAL, /* 25 DefFieldDefn */ 24069450Smsmith NSP_NORMAL, /* 26 BankFieldDefn */ 24169450Smsmith NSP_NORMAL, /* 27 IndexFieldDefn */ 24269450Smsmith NSP_NORMAL, /* 28 If */ 24369450Smsmith NSP_NORMAL, /* 29 Else */ 24469450Smsmith NSP_NORMAL, /* 30 While */ 24569450Smsmith NSP_NEWSCOPE, /* 31 Scope */ 24669450Smsmith NSP_LOCAL, /* 32 DefAny */ 24769746Smsmith NSP_NORMAL, /* 33 Extra */ 24869746Smsmith NSP_NORMAL /* 34 Invalid */ 24967754Smsmith}; 25067754Smsmith 25167754Smsmith 25271867Smsmith/* Hex to ASCII conversion table */ 25371867Smsmith 25471867SmsmithNATIVE_CHAR AcpiGbl_HexToAscii[] = 25571867Smsmith {'0','1','2','3','4','5','6','7', 25671867Smsmith '8','9','A','B','C','D','E','F'}; 25771867Smsmith 25871867Smsmith 25967754Smsmith/****************************************************************************** 26067754Smsmith * 26167754Smsmith * Table globals 26267754Smsmith * 26369450Smsmith * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes. 26469450Smsmith * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables 26569450Smsmith * that are not used by the subsystem are simply ignored. 26669450Smsmith * 26767754Smsmith ******************************************************************************/ 26867754Smsmith 26967754Smsmith 27067754SmsmithACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES]; 27167754Smsmith 27267754Smsmith 27367754SmsmithACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] = 27467754Smsmith{ 27569450Smsmith /*********** Name, Signature, Signature size, How many allowed?, Supported? Global typed pointer */ 27667754Smsmith 27769450Smsmith /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, 27869450Smsmith /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_DSDT}, 27969450Smsmith /* FADT 2 */ {FADT_SIG, FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FADT}, 28069450Smsmith /* FACS 3 */ {FACS_SIG, FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FACS}, 28169450Smsmith /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 28269450Smsmith /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 28369450Smsmith /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, 28467754Smsmith}; 28567754Smsmith 28667754Smsmith 28767754Smsmith#ifdef ACPI_DEBUG 28867754Smsmith 28967754Smsmith/****************************************************************************** 29067754Smsmith * 29167754Smsmith * Strings and procedures used for debug only 29267754Smsmith * 29367754Smsmith ******************************************************************************/ 29467754Smsmith 29567754SmsmithNATIVE_CHAR *MsgAcpiErrorBreak = "*** Break on ACPI_ERROR ***\n"; 29667754Smsmith 29767754Smsmith 29867754Smsmith/***************************************************************************** 29967754Smsmith * 30077424Smsmith * FUNCTION: AcpiUtGetMutexName 30167754Smsmith * 30267754Smsmith * PARAMETERS: None. 30367754Smsmith * 30467754Smsmith * RETURN: Status 30567754Smsmith * 30667754Smsmith * DESCRIPTION: Translate a mutex ID into a name string (Debug only) 30767754Smsmith * 30867754Smsmith ****************************************************************************/ 30967754Smsmith 31067754SmsmithNATIVE_CHAR * 31177424SmsmithAcpiUtGetMutexName ( 31267754Smsmith UINT32 MutexId) 31367754Smsmith{ 31467754Smsmith 31567754Smsmith if (MutexId > MAX_MTX) 31667754Smsmith { 31767754Smsmith return ("Invalid Mutex ID"); 31867754Smsmith } 31967754Smsmith 32067754Smsmith return (AcpiGbl_MutexNames[MutexId]); 32167754Smsmith} 32267754Smsmith 32367754Smsmith 32467754Smsmith/* 32567754Smsmith * Elements of AcpiGbl_NsTypeNames below must match 32667754Smsmith * one-to-one with values of ACPI_OBJECT_TYPE 32767754Smsmith * 32867754Smsmith * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when 32967754Smsmith * stored in a table it really means that we have thus far seen no evidence to 33067754Smsmith * indicatewhat type is actually going to be stored for this entry. 33167754Smsmith */ 33267754Smsmith 33367754Smsmithstatic NATIVE_CHAR AcpiGbl_BadType[] = "UNDEFINED"; 33467754Smsmith#define TYPE_NAME_LENGTH 9 /* Maximum length of each string */ 33567754Smsmith 33667754Smsmithstatic NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */ 33767754Smsmith{ 33867754Smsmith /* 00 */ "Untyped", 33971867Smsmith /* 01 */ "Integer", 34067754Smsmith /* 02 */ "String", 34167754Smsmith /* 03 */ "Buffer", 34267754Smsmith /* 04 */ "Package", 34367754Smsmith /* 05 */ "FieldUnit", 34467754Smsmith /* 06 */ "Device", 34567754Smsmith /* 07 */ "Event", 34667754Smsmith /* 08 */ "Method", 34767754Smsmith /* 09 */ "Mutex", 34867754Smsmith /* 10 */ "Region", 34967754Smsmith /* 11 */ "Power", 35067754Smsmith /* 12 */ "Processor", 35167754Smsmith /* 13 */ "Thermal", 35277424Smsmith /* 14 */ "BuffField", 35367754Smsmith /* 15 */ "DdbHandle", 35467754Smsmith /* 16 */ "DebugObj", 35577424Smsmith /* 17 */ "RegnField", 35677424Smsmith /* 18 */ "BankField", 35777424Smsmith /* 19 */ "IndxField", 35867754Smsmith /* 20 */ "Reference", 35967754Smsmith /* 21 */ "Alias", 36067754Smsmith /* 22 */ "Notify", 36167754Smsmith /* 23 */ "AddrHndlr", 36269450Smsmith /* 24 */ "Resource", 36377424Smsmith /* 25 */ "RgnFldDfn", 36469450Smsmith /* 26 */ "BnkFldDfn", 36569450Smsmith /* 27 */ "IdxFldDfn", 36669450Smsmith /* 28 */ "If", 36769450Smsmith /* 29 */ "Else", 36869450Smsmith /* 30 */ "While", 36969450Smsmith /* 31 */ "Scope", 37069450Smsmith /* 32 */ "DefAny", 37169746Smsmith /* 33 */ "Extra", 37269746Smsmith /* 34 */ "Invalid" 37367754Smsmith}; 37467754Smsmith 37567754Smsmith 37667754Smsmith/***************************************************************************** 37767754Smsmith * 37877424Smsmith * FUNCTION: AcpiUtGetTypeName 37967754Smsmith * 38067754Smsmith * PARAMETERS: None. 38167754Smsmith * 38267754Smsmith * RETURN: Status 38367754Smsmith * 38467754Smsmith * DESCRIPTION: Translate a Type ID into a name string (Debug only) 38567754Smsmith * 38667754Smsmith ****************************************************************************/ 38767754Smsmith 38867754SmsmithNATIVE_CHAR * 38977424SmsmithAcpiUtGetTypeName ( 39067754Smsmith UINT32 Type) 39167754Smsmith{ 39267754Smsmith 39367754Smsmith if (Type > INTERNAL_TYPE_INVALID) 39467754Smsmith { 39567754Smsmith return (AcpiGbl_BadType); 39667754Smsmith } 39767754Smsmith 39867754Smsmith return (AcpiGbl_NsTypeNames[Type]); 39967754Smsmith} 40067754Smsmith 40169746Smsmith 40269746Smsmith/* Region type decoding */ 40369746Smsmith 40469746SmsmithNATIVE_CHAR *AcpiGbl_RegionTypes[NUM_REGION_TYPES] = 40569746Smsmith{ 40669746Smsmith "SystemMemory", 40769746Smsmith "SystemIO", 40869746Smsmith "PCIConfig", 40969746Smsmith "EmbeddedControl", 41069746Smsmith "SMBus", 41169746Smsmith "CMOS", 41269746Smsmith "PCIBarTarget", 41369746Smsmith}; 41469746Smsmith 41569746Smsmith 41669746Smsmith/***************************************************************************** 41769746Smsmith * 41877424Smsmith * FUNCTION: AcpiUtGetRegionName 41969746Smsmith * 42069746Smsmith * PARAMETERS: None. 42169746Smsmith * 42269746Smsmith * RETURN: Status 42369746Smsmith * 42469746Smsmith * DESCRIPTION: Translate a Space ID into a name string (Debug only) 42569746Smsmith * 42669746Smsmith ****************************************************************************/ 42769746Smsmith 42869746SmsmithNATIVE_CHAR * 42977424SmsmithAcpiUtGetRegionName ( 43069746Smsmith UINT8 SpaceId) 43169746Smsmith{ 43269746Smsmith 43369746Smsmith if (SpaceId >= USER_REGION_BEGIN) 43469746Smsmith { 43569746Smsmith return ("UserDefinedRegion"); 43669746Smsmith } 43769746Smsmith 43869746Smsmith else if (SpaceId >= NUM_REGION_TYPES) 43969746Smsmith { 44069746Smsmith return ("InvalidSpaceID"); 44169746Smsmith } 44269746Smsmith 44369746Smsmith return (AcpiGbl_RegionTypes[SpaceId]); 44469746Smsmith} 44569746Smsmith 44669746Smsmith 44769746Smsmith/* Data used in keeping track of fields */ 44869746Smsmith 44969746SmsmithNATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] = 45069746Smsmith{ 45169746Smsmith "skip", 45269746Smsmith "?access?" 45369746Smsmith}; /* FE = Field Element */ 45469746Smsmith 45569746Smsmith 45669746SmsmithNATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] = 45769746Smsmith{ 45869746Smsmith "Error", 45969746Smsmith "MTR", 46069746Smsmith "MEQ", 46169746Smsmith "MLE", 46269746Smsmith "MLT", 46369746Smsmith "MGE", 46469746Smsmith "MGT" 46569746Smsmith}; 46669746Smsmith 46769746Smsmith 46869746Smsmith/* Access type decoding */ 46969746Smsmith 47069746SmsmithNATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] = 47169746Smsmith{ 47269746Smsmith "AnyAcc", 47369746Smsmith "ByteAcc", 47469746Smsmith "WordAcc", 47569746Smsmith "DWordAcc", 47669746Smsmith "BlockAcc", 47769746Smsmith "SMBSendRecvAcc", 47869746Smsmith "SMBQuickAcc" 47969746Smsmith}; 48069746Smsmith 48169746Smsmith 48269746Smsmith/* Update rule decoding */ 48369746Smsmith 48469746SmsmithNATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = 48569746Smsmith{ 48669746Smsmith "Preserve", 48769746Smsmith "WriteAsOnes", 48869746Smsmith "WriteAsZeros" 48969746Smsmith}; 49069746Smsmith 49167754Smsmith#endif 49267754Smsmith 49367754Smsmith 49467754Smsmith/***************************************************************************** 49567754Smsmith * 49677424Smsmith * FUNCTION: AcpiUtValidObjectType 49767754Smsmith * 49867754Smsmith * PARAMETERS: None. 49967754Smsmith * 50067754Smsmith * RETURN: TRUE if valid object type 50167754Smsmith * 50267754Smsmith * DESCRIPTION: Validate an object type 50367754Smsmith * 50467754Smsmith ****************************************************************************/ 50567754Smsmith 50667754SmsmithBOOLEAN 50777424SmsmithAcpiUtValidObjectType ( 50867754Smsmith UINT32 Type) 50967754Smsmith{ 51067754Smsmith 51167754Smsmith if (Type > ACPI_TYPE_MAX) 51267754Smsmith { 51367754Smsmith if ((Type < INTERNAL_TYPE_BEGIN) || 51467754Smsmith (Type > INTERNAL_TYPE_MAX)) 51567754Smsmith { 51667754Smsmith return (FALSE); 51767754Smsmith } 51867754Smsmith } 51967754Smsmith 52067754Smsmith return (TRUE); 52167754Smsmith} 52267754Smsmith 52367754Smsmith 52467754Smsmith/***************************************************************************** 52567754Smsmith * 52677424Smsmith * FUNCTION: AcpiUtFormatException 52767754Smsmith * 52867754Smsmith * PARAMETERS: Status - Acpi status to be formatted 52967754Smsmith * 53067754Smsmith * RETURN: Formatted status string 53167754Smsmith * 53267754Smsmith * DESCRIPTION: Convert an ACPI exception to a string 53367754Smsmith * 53467754Smsmith ****************************************************************************/ 53567754Smsmith 53667754SmsmithNATIVE_CHAR * 53777424SmsmithAcpiUtFormatException ( 53867754Smsmith ACPI_STATUS Status) 53967754Smsmith{ 54067754Smsmith NATIVE_CHAR *Exception = "UNKNOWN_STATUS"; 54167754Smsmith ACPI_STATUS SubStatus; 54267754Smsmith 54367754Smsmith 54467754Smsmith SubStatus = (Status & ~AE_CODE_MASK); 54567754Smsmith 54667754Smsmith 54767754Smsmith switch (Status & AE_CODE_MASK) 54867754Smsmith { 54967754Smsmith case AE_CODE_ENVIRONMENTAL: 55067754Smsmith 55167754Smsmith if (SubStatus <= AE_CODE_ENV_MAX) 55267754Smsmith { 55367754Smsmith Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; 55467754Smsmith } 55567754Smsmith break; 55667754Smsmith 55767754Smsmith case AE_CODE_PROGRAMMER: 55867754Smsmith 55967754Smsmith if (SubStatus <= AE_CODE_PGM_MAX) 56067754Smsmith { 56167754Smsmith Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; 56267754Smsmith } 56367754Smsmith break; 56467754Smsmith 56567754Smsmith case AE_CODE_ACPI_TABLES: 56667754Smsmith 56767754Smsmith if (SubStatus <= AE_CODE_TBL_MAX) 56867754Smsmith { 56967754Smsmith Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; 57067754Smsmith } 57167754Smsmith break; 57267754Smsmith 57367754Smsmith case AE_CODE_AML: 57467754Smsmith 57567754Smsmith if (SubStatus <= AE_CODE_AML_MAX) 57667754Smsmith { 57767754Smsmith Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; 57867754Smsmith } 57967754Smsmith break; 58067754Smsmith 58167754Smsmith case AE_CODE_CONTROL: 58267754Smsmith 58367754Smsmith if (SubStatus <= AE_CODE_CTRL_MAX) 58467754Smsmith { 58567754Smsmith Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; 58667754Smsmith } 58767754Smsmith break; 58867754Smsmith 58967754Smsmith default: 59067754Smsmith break; 59167754Smsmith } 59267754Smsmith 59367754Smsmith 59467754Smsmith return (Exception); 59567754Smsmith} 59667754Smsmith 59767754Smsmith 59867754Smsmith/**************************************************************************** 59967754Smsmith * 60077424Smsmith * FUNCTION: AcpiUtAllocateOwnerId 60167754Smsmith * 60267754Smsmith * PARAMETERS: IdType - Type of ID (method or table) 60367754Smsmith * 60467754Smsmith * DESCRIPTION: Allocate a table or method owner id 60567754Smsmith * 60667754Smsmith ***************************************************************************/ 60767754Smsmith 60867754SmsmithACPI_OWNER_ID 60977424SmsmithAcpiUtAllocateOwnerId ( 61067754Smsmith UINT32 IdType) 61167754Smsmith{ 61267754Smsmith ACPI_OWNER_ID OwnerId = 0xFFFF; 61367754Smsmith 61467754Smsmith 61577424Smsmith FUNCTION_TRACE ("UtAllocateOwnerId"); 61667754Smsmith 61767754Smsmith 61877424Smsmith AcpiUtAcquireMutex (ACPI_MTX_CACHES); 61967754Smsmith 62067754Smsmith switch (IdType) 62167754Smsmith { 62267754Smsmith case OWNER_TYPE_TABLE: 62367754Smsmith 62467754Smsmith OwnerId = AcpiGbl_NextTableOwnerId; 62567754Smsmith AcpiGbl_NextTableOwnerId++; 62667754Smsmith 62767754Smsmith if (AcpiGbl_NextTableOwnerId == FIRST_METHOD_ID) 62867754Smsmith { 62967754Smsmith AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; 63067754Smsmith } 63167754Smsmith break; 63267754Smsmith 63367754Smsmith 63467754Smsmith case OWNER_TYPE_METHOD: 63567754Smsmith 63667754Smsmith OwnerId = AcpiGbl_NextMethodOwnerId; 63767754Smsmith AcpiGbl_NextMethodOwnerId++; 63867754Smsmith 63967754Smsmith if (AcpiGbl_NextMethodOwnerId == FIRST_TABLE_ID) 64067754Smsmith { 64167754Smsmith AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; 64267754Smsmith } 64367754Smsmith break; 64467754Smsmith } 64567754Smsmith 64667754Smsmith 64777424Smsmith AcpiUtReleaseMutex (ACPI_MTX_CACHES); 64867754Smsmith 64967754Smsmith return_VALUE (OwnerId); 65067754Smsmith} 65167754Smsmith 65267754Smsmith 65367754Smsmith/**************************************************************************** 65467754Smsmith * 65577424Smsmith * FUNCTION: AcpiUtInitGlobals 65667754Smsmith * 65767754Smsmith * PARAMETERS: none 65867754Smsmith * 65967754Smsmith * DESCRIPTION: Init library globals. All globals that require specific 66067754Smsmith * initialization should be initialized here! 66167754Smsmith * 66267754Smsmith ***************************************************************************/ 66367754Smsmith 66467754Smsmithvoid 66577424SmsmithAcpiUtInitGlobals ( 66667754Smsmith void) 66767754Smsmith{ 66867754Smsmith UINT32 i; 66967754Smsmith 67067754Smsmith 67177424Smsmith FUNCTION_TRACE ("UtInitGlobals"); 67267754Smsmith 67367754Smsmith 67467754Smsmith /* ACPI table structure */ 67567754Smsmith 67667754Smsmith for (i = 0; i < NUM_ACPI_TABLES; i++) 67767754Smsmith { 67867754Smsmith AcpiGbl_AcpiTables[i].Prev = &AcpiGbl_AcpiTables[i]; 67967754Smsmith AcpiGbl_AcpiTables[i].Next = &AcpiGbl_AcpiTables[i]; 68067754Smsmith AcpiGbl_AcpiTables[i].Pointer = NULL; 68167754Smsmith AcpiGbl_AcpiTables[i].Length = 0; 68267754Smsmith AcpiGbl_AcpiTables[i].Allocation = ACPI_MEM_NOT_ALLOCATED; 68367754Smsmith AcpiGbl_AcpiTables[i].Count = 0; 68467754Smsmith } 68567754Smsmith 68667754Smsmith 68767754Smsmith /* Address Space handler array */ 68867754Smsmith 68967754Smsmith for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++) 69067754Smsmith { 69167754Smsmith AcpiGbl_AddressSpaces[i].Handler = NULL; 69267754Smsmith AcpiGbl_AddressSpaces[i].Context = NULL; 69367754Smsmith } 69467754Smsmith 69567754Smsmith /* Mutex locked flags */ 69667754Smsmith 69767754Smsmith for (i = 0; i < NUM_MTX; i++) 69867754Smsmith { 69967754Smsmith AcpiGbl_AcpiMutexInfo[i].Mutex = NULL; 70077424Smsmith AcpiGbl_AcpiMutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; 70167754Smsmith AcpiGbl_AcpiMutexInfo[i].UseCount = 0; 70267754Smsmith } 70367754Smsmith 70467754Smsmith /* Global notify handlers */ 70567754Smsmith 70667754Smsmith AcpiGbl_SysNotify.Handler = NULL; 70767754Smsmith AcpiGbl_DrvNotify.Handler = NULL; 70867754Smsmith 70967754Smsmith /* Global "typed" ACPI table pointers */ 71067754Smsmith 71167754Smsmith AcpiGbl_RSDP = NULL; 71269450Smsmith AcpiGbl_XSDT = NULL; 71367754Smsmith AcpiGbl_FACS = NULL; 71469450Smsmith AcpiGbl_FADT = NULL; 71567754Smsmith AcpiGbl_DSDT = NULL; 71667754Smsmith 71767754Smsmith 71867754Smsmith /* Global Lock support */ 71967754Smsmith 72067754Smsmith AcpiGbl_GlobalLockAcquired = FALSE; 72167754Smsmith AcpiGbl_GlobalLockThreadCount = 0; 72267754Smsmith 72367754Smsmith /* Miscellaneous variables */ 72467754Smsmith 72567754Smsmith AcpiGbl_SystemFlags = 0; 72667754Smsmith AcpiGbl_StartupFlags = 0; 72767754Smsmith AcpiGbl_RsdpOriginalLocation = 0; 72867754Smsmith AcpiGbl_CmSingleStep = FALSE; 72967754Smsmith AcpiGbl_DbTerminateThreads = FALSE; 73067754Smsmith AcpiGbl_Shutdown = FALSE; 73167754Smsmith AcpiGbl_NsLookupCount = 0; 73267754Smsmith AcpiGbl_PsFindCount = 0; 73367754Smsmith AcpiGbl_AcpiHardwarePresent = TRUE; 73467754Smsmith AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; 73567754Smsmith AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; 73667754Smsmith AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; 73767754Smsmith 73867754Smsmith /* Cache of small "state" objects */ 73967754Smsmith 74067754Smsmith AcpiGbl_GenericStateCache = NULL; 74167754Smsmith AcpiGbl_GenericStateCacheDepth = 0; 74267754Smsmith AcpiGbl_StateCacheRequests = 0; 74367754Smsmith AcpiGbl_StateCacheHits = 0; 74467754Smsmith 74567754Smsmith AcpiGbl_ParseCache = NULL; 74667754Smsmith AcpiGbl_ParseCacheDepth = 0; 74767754Smsmith AcpiGbl_ParseCacheRequests = 0; 74867754Smsmith AcpiGbl_ParseCacheHits = 0; 74967754Smsmith 75067754Smsmith AcpiGbl_ExtParseCache = NULL; 75167754Smsmith AcpiGbl_ExtParseCacheDepth = 0; 75267754Smsmith AcpiGbl_ExtParseCacheRequests = 0; 75367754Smsmith AcpiGbl_ExtParseCacheHits = 0; 75467754Smsmith 75567754Smsmith AcpiGbl_ObjectCache = NULL; 75667754Smsmith AcpiGbl_ObjectCacheDepth = 0; 75767754Smsmith AcpiGbl_ObjectCacheRequests = 0; 75867754Smsmith AcpiGbl_ObjectCacheHits = 0; 75967754Smsmith 76067754Smsmith AcpiGbl_WalkStateCache = NULL; 76167754Smsmith AcpiGbl_WalkStateCacheDepth = 0; 76267754Smsmith AcpiGbl_WalkStateCacheRequests = 0; 76367754Smsmith AcpiGbl_WalkStateCacheHits = 0; 76467754Smsmith 76567754Smsmith /* Hardware oriented */ 76667754Smsmith 76767754Smsmith AcpiGbl_Gpe0EnableRegisterSave = NULL; 76867754Smsmith AcpiGbl_Gpe1EnableRegisterSave = NULL; 76967754Smsmith AcpiGbl_OriginalMode = SYS_MODE_UNKNOWN; /* original ACPI/legacy mode */ 77067754Smsmith AcpiGbl_GpeRegisters = NULL; 77167754Smsmith AcpiGbl_GpeInfo = NULL; 77267754Smsmith 77367754Smsmith /* Namespace */ 77467754Smsmith 77567754Smsmith AcpiGbl_RootNode = NULL; 77667754Smsmith 77767754Smsmith AcpiGbl_RootNodeStruct.Name = ACPI_ROOT_NAME; 77867754Smsmith AcpiGbl_RootNodeStruct.DataType = ACPI_DESC_TYPE_NAMED; 77967754Smsmith AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_ANY; 78067754Smsmith AcpiGbl_RootNodeStruct.Child = NULL; 78167754Smsmith AcpiGbl_RootNodeStruct.Peer = NULL; 78267754Smsmith AcpiGbl_RootNodeStruct.Object = NULL; 78367754Smsmith AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; 78467754Smsmith 78567754Smsmith /* Memory allocation metrics - compiled out in non-debug mode. */ 78667754Smsmith 78767754Smsmith INITIALIZE_ALLOCATION_METRICS(); 78867754Smsmith 78967754Smsmith return_VOID; 79067754Smsmith} 79167754Smsmith 79267754Smsmith 793