utglobal.c revision 87031
1/****************************************************************************** 2 * 3 * Module Name: utglobal - Global variables for the ACPI subsystem 4 * $Revision: 136 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. 13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. 21 * 22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23 * copy of the source code appearing in this file ("Covered Code") an 24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25 * base code distributed originally by Intel ("Original Intel Code") to copy, 26 * make derivatives, distribute, use and display any portion of the Covered 27 * Code in any form, with the right to sublicense such rights; and 28 * 29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30 * license (with the right to sublicense), under only those claims of Intel 31 * patents that are infringed by the Original Intel Code, to make, use, sell, 32 * offer to sell, and import the Covered Code and derivative works thereof 33 * solely to the minimum extent necessary to exercise the above copyright 34 * license, and in no event shall the patent license extend to any additions 35 * to or modifications of the Original Intel Code. No other license or right 36 * is granted directly or by implication, estoppel or otherwise; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 43 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44 * Redistribution of source code of any substantial portion of the Covered 45 * Code or modification with rights to further distribute source must include 46 * the above Copyright Notice, the above License, this list of Conditions, 47 * and the following Disclaimer and Export Compliance provision. In addition, 48 * Licensee must cause all Covered Code to which Licensee contributes to 49 * contain a file documenting the changes Licensee made to create that Covered 50 * Code and the date of any change. Licensee must include in that file the 51 * documentation of any changes made by any predecessor Licensee. Licensee 52 * must include a prominent statement that the modification is derived, 53 * directly or indirectly, from Original Intel Code. 54 * 55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56 * Redistribution of source code of any substantial portion of the Covered 57 * Code or modification without rights to further distribute source must 58 * include the following Disclaimer and Export Compliance provision in the 59 * documentation and/or other materials provided with distribution. In 60 * addition, Licensee may not authorize further sublicense of source of any 61 * portion of the Covered Code, and must include terms to the effect that the 62 * license from Licensee to its licensee is limited to the intellectual 63 * property embodied in the software Licensee provides to its licensee, and 64 * not to intellectual property embodied in modifications its licensee may 65 * make. 66 * 67 * 3.3. Redistribution of Executable. Redistribution in executable form of any 68 * substantial portion of the Covered Code or modification must reproduce the 69 * above Copyright Notice, and the following Disclaimer and Export Compliance 70 * provision in the documentation and/or other materials provided with the 71 * distribution. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77 * Intel shall be used in advertising or otherwise to promote the sale, use or 78 * other dealings in products derived from or relating to the Covered Code 79 * without prior written authorization from Intel. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89 * PARTICULAR PURPOSE. 90 * 91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98 * LIMITED REMEDY. 99 * 100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 101 * software or system incorporating such software without first obtaining any 102 * required license or other approval from the U. S. Department of Commerce or 103 * any other agency or department of the United States Government. In the 104 * event Licensee exports any such software from the United States or 105 * re-exports any such software from a foreign destination, Licensee shall 106 * ensure that the distribution and export/re-export of the software is in 107 * compliance with all laws, regulations, orders, or other restrictions of the 108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109 * any of its subsidiaries will export/re-export any technical data, process, 110 * software, or service, directly or indirectly, to any country for which the 111 * United States government or any agency thereof requires an export license, 112 * other governmental approval, or letter of assurance, without first obtaining 113 * such license, approval or letter. 114 * 115 *****************************************************************************/ 116 117#define __UTGLOBAL_C__ 118#define DEFINE_ACPI_GLOBALS 119 120#include "acpi.h" 121#include "acevents.h" 122#include "acnamesp.h" 123#include "acinterp.h" 124#include "amlcode.h" 125 126 127#define _COMPONENT ACPI_UTILITIES 128 MODULE_NAME ("utglobal") 129 130 131/****************************************************************************** 132 * 133 * FUNCTION: AcpiFormatException 134 * 135 * PARAMETERS: Status - The ACPI_STATUS code to be formatted 136 * 137 * RETURN: A string containing the exception text 138 * 139 * DESCRIPTION: This function translates an ACPI exception into an ASCII string. 140 * 141 ******************************************************************************/ 142 143const char * 144AcpiFormatException ( 145 ACPI_STATUS Status) 146{ 147 const char *Exception = "UNKNOWN_STATUS_CODE"; 148 ACPI_STATUS SubStatus; 149 150 151 SubStatus = (Status & ~AE_CODE_MASK); 152 153 154 switch (Status & AE_CODE_MASK) 155 { 156 case AE_CODE_ENVIRONMENTAL: 157 158 if (SubStatus <= AE_CODE_ENV_MAX) 159 { 160 Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; 161 } 162 break; 163 164 case AE_CODE_PROGRAMMER: 165 166 if (SubStatus <= AE_CODE_PGM_MAX) 167 { 168 Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; 169 } 170 break; 171 172 case AE_CODE_ACPI_TABLES: 173 174 if (SubStatus <= AE_CODE_TBL_MAX) 175 { 176 Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; 177 } 178 break; 179 180 case AE_CODE_AML: 181 182 if (SubStatus <= AE_CODE_AML_MAX) 183 { 184 Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; 185 } 186 break; 187 188 case AE_CODE_CONTROL: 189 190 if (SubStatus <= AE_CODE_CTRL_MAX) 191 { 192 Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; 193 } 194 break; 195 196 default: 197 break; 198 } 199 200 201 return ((const char *) Exception); 202} 203 204 205/****************************************************************************** 206 * 207 * Static global variable initialization. 208 * 209 ******************************************************************************/ 210 211/* 212 * We want the debug switches statically initialized so they 213 * are already set when the debugger is entered. 214 */ 215 216/* Debug switch - level and trace mask */ 217 218#ifdef ACPI_DEBUG 219UINT32 AcpiDbgLevel = DEBUG_DEFAULT; 220#else 221UINT32 AcpiDbgLevel = NORMAL_DEFAULT; 222#endif 223 224/* Debug switch - layer (component) mask */ 225 226UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT; 227UINT32 AcpiGbl_NestingLevel = 0; 228 229 230/* Debugger globals */ 231 232BOOLEAN AcpiGbl_DbTerminateThreads = FALSE; 233BOOLEAN AcpiGbl_MethodExecuting = FALSE; 234 235/* System flags */ 236 237UINT32 AcpiGbl_StartupFlags = 0; 238 239/* System starts uninitialized */ 240 241BOOLEAN AcpiGbl_Shutdown = TRUE; 242 243const UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128}; 244 245const NATIVE_CHAR *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES] = { 246 "\\_S0_","\\_S1_","\\_S2_","\\_S3_", 247 "\\_S4_","\\_S5_","\\_S4B"}; 248 249 250/****************************************************************************** 251 * 252 * Namespace globals 253 * 254 ******************************************************************************/ 255 256 257/* 258 * Names built-in to the interpreter 259 * 260 * Initial values are currently supported only for types String and Number. 261 * To avoid type punning, both are specified as strings in this table. 262 * 263 * NOTES: 264 * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run 265 * during the initialization sequence. 266 */ 267 268const PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = 269{ 270 {"_GPE", INTERNAL_TYPE_DEF_ANY}, 271 {"_PR_", INTERNAL_TYPE_DEF_ANY}, 272 {"_SB_", ACPI_TYPE_DEVICE}, 273 {"_SI_", INTERNAL_TYPE_DEF_ANY}, 274 {"_TZ_", INTERNAL_TYPE_DEF_ANY}, 275 {"_REV", ACPI_TYPE_INTEGER, "2"}, 276 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 277 {"_GL_", ACPI_TYPE_MUTEX, "0"}, 278 {NULL, ACPI_TYPE_ANY} /* Table terminator */ 279}; 280 281 282/* 283 * Properties of the ACPI Object Types, both internal and external. 284 * 285 * Elements of AcpiNsProperties are bit significant 286 * and the table is indexed by values of ACPI_OBJECT_TYPE 287 */ 288 289const UINT8 AcpiGbl_NsProperties[] = 290{ 291 NSP_NORMAL, /* 00 Any */ 292 NSP_NORMAL, /* 01 Number */ 293 NSP_NORMAL, /* 02 String */ 294 NSP_NORMAL, /* 03 Buffer */ 295 NSP_LOCAL, /* 04 Package */ 296 NSP_NORMAL, /* 05 FieldUnit */ 297 NSP_NEWSCOPE | NSP_LOCAL, /* 06 Device */ 298 NSP_LOCAL, /* 07 AcpiEvent */ 299 NSP_NEWSCOPE | NSP_LOCAL, /* 08 Method */ 300 NSP_LOCAL, /* 09 Mutex */ 301 NSP_LOCAL, /* 10 Region */ 302 NSP_NEWSCOPE | NSP_LOCAL, /* 11 Power */ 303 NSP_NEWSCOPE | NSP_LOCAL, /* 12 Processor */ 304 NSP_NEWSCOPE | NSP_LOCAL, /* 13 Thermal */ 305 NSP_NORMAL, /* 14 BufferField */ 306 NSP_NORMAL, /* 15 DdbHandle */ 307 NSP_NORMAL, /* 16 Debug Object */ 308 NSP_NORMAL, /* 17 DefField */ 309 NSP_NORMAL, /* 18 BankField */ 310 NSP_NORMAL, /* 19 IndexField */ 311 NSP_NORMAL, /* 20 Reference */ 312 NSP_NORMAL, /* 21 Alias */ 313 NSP_NORMAL, /* 22 Notify */ 314 NSP_NORMAL, /* 23 Address Handler */ 315 NSP_NEWSCOPE | NSP_LOCAL, /* 24 Resource Desc */ 316 NSP_NEWSCOPE | NSP_LOCAL, /* 25 Resource Field */ 317 NSP_NORMAL, /* 26 DefFieldDefn */ 318 NSP_NORMAL, /* 27 BankFieldDefn */ 319 NSP_NORMAL, /* 28 IndexFieldDefn */ 320 NSP_NORMAL, /* 29 If */ 321 NSP_NORMAL, /* 30 Else */ 322 NSP_NORMAL, /* 31 While */ 323 NSP_NEWSCOPE, /* 32 Scope */ 324 NSP_LOCAL, /* 33 DefAny */ 325 NSP_NORMAL, /* 34 Extra */ 326 NSP_NORMAL, /* 35 Data */ 327 NSP_NORMAL /* 36 Invalid */ 328}; 329 330 331/* Hex to ASCII conversion table */ 332 333const NATIVE_CHAR AcpiGbl_HexToAscii[] = 334 {'0','1','2','3','4','5','6','7', 335 '8','9','A','B','C','D','E','F'}; 336 337/***************************************************************************** 338 * 339 * FUNCTION: AcpiUtHexToAsciiChar 340 * 341 * PARAMETERS: Integer - Contains the hex digit 342 * Position - bit position of the digit within the 343 * integer 344 * 345 * RETURN: Ascii character 346 * 347 * DESCRIPTION: Convert a hex digit to an ascii character 348 * 349 ****************************************************************************/ 350 351UINT8 352AcpiUtHexToAsciiChar ( 353 ACPI_INTEGER Integer, 354 UINT32 Position) 355{ 356 357 return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); 358} 359 360 361/****************************************************************************** 362 * 363 * Table globals 364 * 365 * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes. 366 * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables 367 * that are not used by the subsystem are simply ignored. 368 * 369 ******************************************************************************/ 370 371 372ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES]; 373 374 375ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] = 376{ 377 /*********** Name, Signature, Signature size, How many allowed?, Supported? Global typed pointer */ 378 379 /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, 380 /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_DSDT}, 381 /* FADT 2 */ {FADT_SIG, FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FADT}, 382 /* FACS 3 */ {FACS_SIG, FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FACS}, 383 /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 384 /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 385 /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, 386}; 387 388 389#ifdef ACPI_DEBUG 390 391/* 392 * Strings and procedures used for debug only 393 * 394 */ 395 396 397/***************************************************************************** 398 * 399 * FUNCTION: AcpiUtGetMutexName 400 * 401 * PARAMETERS: None. 402 * 403 * RETURN: Status 404 * 405 * DESCRIPTION: Translate a mutex ID into a name string (Debug only) 406 * 407 ****************************************************************************/ 408 409NATIVE_CHAR * 410AcpiUtGetMutexName ( 411 UINT32 MutexId) 412{ 413 414 if (MutexId > MAX_MTX) 415 { 416 return ("Invalid Mutex ID"); 417 } 418 419 return (AcpiGbl_MutexNames[MutexId]); 420} 421 422 423/* 424 * Elements of AcpiGbl_NsTypeNames below must match 425 * one-to-one with values of ACPI_OBJECT_TYPE 426 * 427 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when 428 * stored in a table it really means that we have thus far seen no evidence to 429 * indicatewhat type is actually going to be stored for this entry. 430 */ 431 432static const NATIVE_CHAR AcpiGbl_BadType[] = "UNDEFINED"; 433#define TYPE_NAME_LENGTH 12 /* Maximum length of each string */ 434 435static const NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */ 436{ 437 /* 00 */ "Untyped", 438 /* 01 */ "Integer", 439 /* 02 */ "String", 440 /* 03 */ "Buffer", 441 /* 04 */ "Package", 442 /* 05 */ "FieldUnit", 443 /* 06 */ "Device", 444 /* 07 */ "Event", 445 /* 08 */ "Method", 446 /* 09 */ "Mutex", 447 /* 10 */ "Region", 448 /* 11 */ "Power", 449 /* 12 */ "Processor", 450 /* 13 */ "Thermal", 451 /* 14 */ "BufferField", 452 /* 15 */ "DdbHandle", 453 /* 16 */ "DebugObject", 454 /* 17 */ "RegionField", 455 /* 18 */ "BankField", 456 /* 19 */ "IndexField", 457 /* 20 */ "Reference", 458 /* 21 */ "Alias", 459 /* 22 */ "Notify", 460 /* 23 */ "AddrHandler", 461 /* 24 */ "ResourceDesc", 462 /* 25 */ "ResourceFld", 463 /* 26 */ "RegionFldDfn", 464 /* 27 */ "BankFldDfn", 465 /* 28 */ "IndexFldDfn", 466 /* 29 */ "If", 467 /* 30 */ "Else", 468 /* 31 */ "While", 469 /* 32 */ "Scope", 470 /* 33 */ "DefAny", 471 /* 34 */ "Extra", 472 /* 35 */ "Data", 473 /* 36 */ "Invalid" 474}; 475 476 477/***************************************************************************** 478 * 479 * FUNCTION: AcpiUtGetTypeName 480 * 481 * PARAMETERS: None. 482 * 483 * RETURN: Status 484 * 485 * DESCRIPTION: Translate a Type ID into a name string (Debug only) 486 * 487 ****************************************************************************/ 488 489NATIVE_CHAR * 490AcpiUtGetTypeName ( 491 UINT32 Type) 492{ 493 494 if (Type > INTERNAL_TYPE_INVALID) 495 { 496 return ((NATIVE_CHAR *) AcpiGbl_BadType); 497 } 498 499 return ((NATIVE_CHAR *) AcpiGbl_NsTypeNames[Type]); 500} 501 502 503/* Region type decoding */ 504 505const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = 506{ 507 "SystemMemory", 508 "SystemIO", 509 "PCIConfig", 510 "EmbeddedControl", 511 "SMBus", 512 "CMOS", 513 "PCIBarTarget", 514}; 515 516 517/***************************************************************************** 518 * 519 * FUNCTION: AcpiUtGetRegionName 520 * 521 * PARAMETERS: None. 522 * 523 * RETURN: Status 524 * 525 * DESCRIPTION: Translate a Space ID into a name string (Debug only) 526 * 527 ****************************************************************************/ 528 529NATIVE_CHAR * 530AcpiUtGetRegionName ( 531 UINT8 SpaceId) 532{ 533 534 if (SpaceId >= ACPI_USER_REGION_BEGIN) 535 { 536 return ("UserDefinedRegion"); 537 } 538 539 else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) 540 { 541 return ("InvalidSpaceID"); 542 } 543 544 return ((NATIVE_CHAR *) AcpiGbl_RegionTypes[SpaceId]); 545} 546 547 548/* Data used in keeping track of fields */ 549 550const NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] = 551{ 552 "skip", 553 "?access?" 554}; /* FE = Field Element */ 555 556 557const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] = 558{ 559 "Error", 560 "MTR", 561 "MEQ", 562 "MLE", 563 "MLT", 564 "MGE", 565 "MGT" 566}; 567 568 569/* Access type decoding */ 570 571const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] = 572{ 573 "AnyAcc", 574 "ByteAcc", 575 "WordAcc", 576 "DWordAcc", 577 "QWordAcc", 578 "BufferAcc", 579}; 580 581 582/* Update rule decoding */ 583 584const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = 585{ 586 "Preserve", 587 "WriteAsOnes", 588 "WriteAsZeros" 589}; 590 591#endif 592 593 594/***************************************************************************** 595 * 596 * FUNCTION: AcpiUtValidObjectType 597 * 598 * PARAMETERS: None. 599 * 600 * RETURN: TRUE if valid object type 601 * 602 * DESCRIPTION: Validate an object type 603 * 604 ****************************************************************************/ 605 606BOOLEAN 607AcpiUtValidObjectType ( 608 UINT32 Type) 609{ 610 611 if (Type > ACPI_TYPE_MAX) 612 { 613 if ((Type < INTERNAL_TYPE_BEGIN) || 614 (Type > INTERNAL_TYPE_MAX)) 615 { 616 return (FALSE); 617 } 618 } 619 620 return (TRUE); 621} 622 623 624/**************************************************************************** 625 * 626 * FUNCTION: AcpiUtAllocateOwnerId 627 * 628 * PARAMETERS: IdType - Type of ID (method or table) 629 * 630 * DESCRIPTION: Allocate a table or method owner id 631 * 632 ***************************************************************************/ 633 634ACPI_OWNER_ID 635AcpiUtAllocateOwnerId ( 636 UINT32 IdType) 637{ 638 ACPI_OWNER_ID OwnerId = 0xFFFF; 639 640 641 FUNCTION_TRACE ("UtAllocateOwnerId"); 642 643 644 AcpiUtAcquireMutex (ACPI_MTX_CACHES); 645 646 switch (IdType) 647 { 648 case OWNER_TYPE_TABLE: 649 650 OwnerId = AcpiGbl_NextTableOwnerId; 651 AcpiGbl_NextTableOwnerId++; 652 653 if (AcpiGbl_NextTableOwnerId == FIRST_METHOD_ID) 654 { 655 AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; 656 } 657 break; 658 659 660 case OWNER_TYPE_METHOD: 661 662 OwnerId = AcpiGbl_NextMethodOwnerId; 663 AcpiGbl_NextMethodOwnerId++; 664 665 if (AcpiGbl_NextMethodOwnerId == FIRST_TABLE_ID) 666 { 667 AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; 668 } 669 break; 670 } 671 672 673 AcpiUtReleaseMutex (ACPI_MTX_CACHES); 674 675 return_VALUE (OwnerId); 676} 677 678 679/**************************************************************************** 680 * 681 * FUNCTION: AcpiUtInitGlobals 682 * 683 * PARAMETERS: none 684 * 685 * DESCRIPTION: Init library globals. All globals that require specific 686 * initialization should be initialized here! 687 * 688 ***************************************************************************/ 689 690void 691AcpiUtInitGlobals ( 692 void) 693{ 694 UINT32 i; 695 696 697 FUNCTION_TRACE ("UtInitGlobals"); 698 699 /* Memory allocation and cache lists */ 700 701 MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS); 702 703 AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_GENERIC_STATE *) NULL)->Common.Next); 704 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_PARSE_OBJECT *) NULL)->Next); 705 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_PARSE2_OBJECT *) NULL)->Next); 706 AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next); 707 AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_WALK_STATE *) NULL)->Next); 708 709 AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize = sizeof (ACPI_NAMESPACE_NODE); 710 AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize = sizeof (ACPI_GENERIC_STATE); 711 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJECT); 712 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE2_OBJECT); 713 AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ObjectSize = sizeof (ACPI_OPERAND_OBJECT); 714 AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ObjectSize = sizeof (ACPI_WALK_STATE); 715 716 AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].MaxCacheDepth = MAX_STATE_CACHE_DEPTH; 717 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].MaxCacheDepth = MAX_PARSE_CACHE_DEPTH; 718 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].MaxCacheDepth = MAX_EXTPARSE_CACHE_DEPTH; 719 AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].MaxCacheDepth = MAX_OBJECT_CACHE_DEPTH; 720 AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].MaxCacheDepth = MAX_WALK_CACHE_DEPTH; 721 722 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].ListName = "Global Memory Allocation"); 723 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ListName = "Namespace Nodes"); 724 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ListName = "State Object Cache"); 725 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ListName = "Parse Node Cache"); 726 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ListName = "Extended Parse Node Cache"); 727 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ListName = "Operand Object Cache"); 728 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ListName = "Tree Walk Node Cache"); 729 730 /* ACPI table structure */ 731 732 for (i = 0; i < NUM_ACPI_TABLES; i++) 733 { 734 AcpiGbl_AcpiTables[i].Prev = &AcpiGbl_AcpiTables[i]; 735 AcpiGbl_AcpiTables[i].Next = &AcpiGbl_AcpiTables[i]; 736 AcpiGbl_AcpiTables[i].Pointer = NULL; 737 AcpiGbl_AcpiTables[i].Length = 0; 738 AcpiGbl_AcpiTables[i].Allocation = ACPI_MEM_NOT_ALLOCATED; 739 AcpiGbl_AcpiTables[i].Count = 0; 740 } 741 742 /* Mutex locked flags */ 743 744 for (i = 0; i < NUM_MTX; i++) 745 { 746 AcpiGbl_AcpiMutexInfo[i].Mutex = NULL; 747 AcpiGbl_AcpiMutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; 748 AcpiGbl_AcpiMutexInfo[i].UseCount = 0; 749 } 750 751 /* Global notify handlers */ 752 753 AcpiGbl_SysNotify.Handler = NULL; 754 AcpiGbl_DrvNotify.Handler = NULL; 755 756 /* Global "typed" ACPI table pointers */ 757 758 AcpiGbl_RSDP = NULL; 759 AcpiGbl_XSDT = NULL; 760 AcpiGbl_FACS = NULL; 761 AcpiGbl_FADT = NULL; 762 AcpiGbl_DSDT = NULL; 763 764 /* Global Lock support */ 765 766 AcpiGbl_GlobalLockAcquired = FALSE; 767 AcpiGbl_GlobalLockThreadCount = 0; 768 769 /* Miscellaneous variables */ 770 771 AcpiGbl_RsdpOriginalLocation = 0; 772 AcpiGbl_CmSingleStep = FALSE; 773 AcpiGbl_DbTerminateThreads = FALSE; 774 AcpiGbl_Shutdown = FALSE; 775 AcpiGbl_NsLookupCount = 0; 776 AcpiGbl_PsFindCount = 0; 777 AcpiGbl_AcpiHardwarePresent = TRUE; 778 AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; 779 AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; 780 AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; 781 782 /* Hardware oriented */ 783 784 AcpiGbl_Gpe0EnableRegisterSave = NULL; 785 AcpiGbl_Gpe1EnableRegisterSave = NULL; 786 AcpiGbl_OriginalMode = SYS_MODE_UNKNOWN; /* original ACPI/legacy mode */ 787 AcpiGbl_GpeRegisters = NULL; 788 AcpiGbl_GpeInfo = NULL; 789 790 /* Namespace */ 791 792 AcpiGbl_RootNode = NULL; 793 794 AcpiGbl_RootNodeStruct.Name = ACPI_ROOT_NAME; 795 AcpiGbl_RootNodeStruct.DataType = ACPI_DESC_TYPE_NAMED; 796 AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_ANY; 797 AcpiGbl_RootNodeStruct.Child = NULL; 798 AcpiGbl_RootNodeStruct.Peer = NULL; 799 AcpiGbl_RootNodeStruct.Object = NULL; 800 AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; 801 802 803#ifdef ACPI_DEBUG 804 AcpiGbl_LowestStackPointer = ACPI_UINT32_MAX; 805#endif 806 807 return_VOID; 808} 809 810 811