utglobal.c revision 82367
1/****************************************************************************** 2 * 3 * Module Name: utglobal - Global variables for the ACPI subsystem 4 * $Revision: 127 $ 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 * 134 * FUNCTION: AcpiFormatException 135 * 136 * PARAMETERS: Status - The ACPI_STATUS code to be formatted 137 * 138 * RETURN: A string containing the exception text 139 * 140 * DESCRIPTION: This function translates an ACPI exception into an ASCII string. 141 * 142 ******************************************************************************/ 143 144const char * 145AcpiFormatException ( 146 ACPI_STATUS Status) 147{ 148 char *Exception = "UNKNOWN_STATUS_CODE"; 149 ACPI_STATUS SubStatus; 150 151 152 SubStatus = (Status & ~AE_CODE_MASK); 153 154 155 switch (Status & AE_CODE_MASK) 156 { 157 case AE_CODE_ENVIRONMENTAL: 158 159 if (SubStatus <= AE_CODE_ENV_MAX) 160 { 161 Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; 162 } 163 break; 164 165 case AE_CODE_PROGRAMMER: 166 167 if (SubStatus <= AE_CODE_PGM_MAX) 168 { 169 Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; 170 } 171 break; 172 173 case AE_CODE_ACPI_TABLES: 174 175 if (SubStatus <= AE_CODE_TBL_MAX) 176 { 177 Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; 178 } 179 break; 180 181 case AE_CODE_AML: 182 183 if (SubStatus <= AE_CODE_AML_MAX) 184 { 185 Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; 186 } 187 break; 188 189 case AE_CODE_CONTROL: 190 191 if (SubStatus <= AE_CODE_CTRL_MAX) 192 { 193 Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; 194 } 195 break; 196 197 default: 198 break; 199 } 200 201 202 return ((const char *) Exception); 203} 204 205 206/****************************************************************************** 207 * 208 * Static global variable initialization. 209 * 210 ******************************************************************************/ 211 212/* 213 * We want the debug switches statically initialized so they 214 * are already set when the debugger is entered. 215 */ 216 217/* Debug switch - level and trace mask */ 218 219#ifdef ACPI_DEBUG 220UINT32 AcpiDbgLevel = DEBUG_DEFAULT; 221#else 222UINT32 AcpiDbgLevel = NORMAL_DEFAULT; 223#endif 224 225/* Debug switch - layer (component) mask */ 226 227UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT; 228UINT32 AcpiGbl_NestingLevel = 0; 229 230 231/* Debugger globals */ 232 233BOOLEAN AcpiGbl_DbTerminateThreads = FALSE; 234BOOLEAN AcpiGbl_MethodExecuting = FALSE; 235 236/* System flags */ 237 238UINT32 AcpiGbl_SystemFlags = 0; 239UINT32 AcpiGbl_StartupFlags = 0; 240 241/* System starts unitialized! */ 242BOOLEAN AcpiGbl_Shutdown = TRUE; 243 244 245UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128}; 246 247 248/****************************************************************************** 249 * 250 * Namespace globals 251 * 252 ******************************************************************************/ 253 254 255/* 256 * Names built-in to the interpreter 257 * 258 * Initial values are currently supported only for types String and Number. 259 * To avoid type punning, both are specified as strings in this table. 260 * 261 * NOTES: 262 * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run 263 * during the initialization sequence. 264 */ 265 266PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = 267{ 268 {"_GPE", INTERNAL_TYPE_DEF_ANY}, 269 {"_PR_", INTERNAL_TYPE_DEF_ANY}, 270 {"_SB_", ACPI_TYPE_DEVICE}, 271 {"_SI_", INTERNAL_TYPE_DEF_ANY}, 272 {"_TZ_", INTERNAL_TYPE_DEF_ANY}, 273 {"_REV", ACPI_TYPE_INTEGER, "2"}, 274 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 275 {"_GL_", ACPI_TYPE_MUTEX, "0"}, 276 {NULL, ACPI_TYPE_ANY} /* Table terminator */ 277}; 278 279 280/* 281 * Properties of the ACPI Object Types, both internal and external. 282 * 283 * Elements of AcpiNsProperties are bit significant 284 * and the table is indexed by values of ACPI_OBJECT_TYPE 285 */ 286 287UINT8 AcpiGbl_NsProperties[] = 288{ 289 NSP_NORMAL, /* 00 Any */ 290 NSP_NORMAL, /* 01 Number */ 291 NSP_NORMAL, /* 02 String */ 292 NSP_NORMAL, /* 03 Buffer */ 293 NSP_LOCAL, /* 04 Package */ 294 NSP_NORMAL, /* 05 FieldUnit */ 295 NSP_NEWSCOPE | NSP_LOCAL, /* 06 Device */ 296 NSP_LOCAL, /* 07 AcpiEvent */ 297 NSP_NEWSCOPE | NSP_LOCAL, /* 08 Method */ 298 NSP_LOCAL, /* 09 Mutex */ 299 NSP_LOCAL, /* 10 Region */ 300 NSP_NEWSCOPE | NSP_LOCAL, /* 11 Power */ 301 NSP_NEWSCOPE | NSP_LOCAL, /* 12 Processor */ 302 NSP_NEWSCOPE | NSP_LOCAL, /* 13 Thermal */ 303 NSP_NORMAL, /* 14 BufferField */ 304 NSP_NORMAL, /* 15 DdbHandle */ 305 NSP_NORMAL, /* 16 Debug Object */ 306 NSP_NORMAL, /* 17 DefField */ 307 NSP_NORMAL, /* 18 BankField */ 308 NSP_NORMAL, /* 19 IndexField */ 309 NSP_NORMAL, /* 20 Reference */ 310 NSP_NORMAL, /* 21 Alias */ 311 NSP_NORMAL, /* 22 Notify */ 312 NSP_NORMAL, /* 23 Address Handler */ 313 NSP_NEWSCOPE | NSP_LOCAL, /* 24 Resource Desc */ 314 NSP_NEWSCOPE | NSP_LOCAL, /* 25 Resource Field */ 315 NSP_NORMAL, /* 26 DefFieldDefn */ 316 NSP_NORMAL, /* 27 BankFieldDefn */ 317 NSP_NORMAL, /* 28 IndexFieldDefn */ 318 NSP_NORMAL, /* 29 If */ 319 NSP_NORMAL, /* 30 Else */ 320 NSP_NORMAL, /* 31 While */ 321 NSP_NEWSCOPE, /* 32 Scope */ 322 NSP_LOCAL, /* 33 DefAny */ 323 NSP_NORMAL, /* 34 Extra */ 324 NSP_NORMAL /* 35 Invalid */ 325}; 326 327 328/* Hex to ASCII conversion table */ 329 330NATIVE_CHAR AcpiGbl_HexToAscii[] = 331 {'0','1','2','3','4','5','6','7', 332 '8','9','A','B','C','D','E','F'}; 333 334UINT8 335AcpiUtHexToAsciiChar ( 336 ACPI_INTEGER Integer, 337 UINT32 Position) 338{ 339 340 return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); 341} 342 343/****************************************************************************** 344 * 345 * Table globals 346 * 347 * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes. 348 * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables 349 * that are not used by the subsystem are simply ignored. 350 * 351 ******************************************************************************/ 352 353 354ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES]; 355 356 357ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] = 358{ 359 /*********** Name, Signature, Signature size, How many allowed?, Supported? Global typed pointer */ 360 361 /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, 362 /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_DSDT}, 363 /* FADT 2 */ {FADT_SIG, FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FADT}, 364 /* FACS 3 */ {FACS_SIG, FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FACS}, 365 /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 366 /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 367 /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, 368}; 369 370 371#ifdef ACPI_DEBUG 372 373/****************************************************************************** 374 * 375 * Strings and procedures used for debug only 376 * 377 ******************************************************************************/ 378 379NATIVE_CHAR *MsgAcpiErrorBreak = "*** Break on ACPI_ERROR ***\n"; 380 381 382/***************************************************************************** 383 * 384 * FUNCTION: AcpiUtGetMutexName 385 * 386 * PARAMETERS: None. 387 * 388 * RETURN: Status 389 * 390 * DESCRIPTION: Translate a mutex ID into a name string (Debug only) 391 * 392 ****************************************************************************/ 393 394NATIVE_CHAR * 395AcpiUtGetMutexName ( 396 UINT32 MutexId) 397{ 398 399 if (MutexId > MAX_MTX) 400 { 401 return ("Invalid Mutex ID"); 402 } 403 404 return (AcpiGbl_MutexNames[MutexId]); 405} 406 407 408/* 409 * Elements of AcpiGbl_NsTypeNames below must match 410 * one-to-one with values of ACPI_OBJECT_TYPE 411 * 412 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when 413 * stored in a table it really means that we have thus far seen no evidence to 414 * indicatewhat type is actually going to be stored for this entry. 415 */ 416 417static NATIVE_CHAR AcpiGbl_BadType[] = "UNDEFINED"; 418#define TYPE_NAME_LENGTH 9 /* Maximum length of each string */ 419 420static NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */ 421{ 422 /* 00 */ "Untyped", 423 /* 01 */ "Integer", 424 /* 02 */ "String", 425 /* 03 */ "Buffer", 426 /* 04 */ "Package", 427 /* 05 */ "FieldUnit", 428 /* 06 */ "Device", 429 /* 07 */ "Event", 430 /* 08 */ "Method", 431 /* 09 */ "Mutex", 432 /* 10 */ "Region", 433 /* 11 */ "Power", 434 /* 12 */ "Processor", 435 /* 13 */ "Thermal", 436 /* 14 */ "BuffField", 437 /* 15 */ "DdbHandle", 438 /* 16 */ "DebugObj", 439 /* 17 */ "RegnField", 440 /* 18 */ "BankField", 441 /* 19 */ "IndxField", 442 /* 20 */ "Reference", 443 /* 21 */ "Alias", 444 /* 22 */ "Notify", 445 /* 23 */ "AddrHndlr", 446 /* 24 */ "RsrcDesc", 447 /* 25 */ "RsrcField", 448 /* 26 */ "RgnFldDfn", 449 /* 27 */ "BnkFldDfn", 450 /* 28 */ "IdxFldDfn", 451 /* 29 */ "If", 452 /* 30 */ "Else", 453 /* 31 */ "While", 454 /* 32 */ "Scope", 455 /* 33 */ "DefAny", 456 /* 34 */ "Extra", 457 /* 35 */ "Invalid" 458}; 459 460 461/***************************************************************************** 462 * 463 * FUNCTION: AcpiUtGetTypeName 464 * 465 * PARAMETERS: None. 466 * 467 * RETURN: Status 468 * 469 * DESCRIPTION: Translate a Type ID into a name string (Debug only) 470 * 471 ****************************************************************************/ 472 473NATIVE_CHAR * 474AcpiUtGetTypeName ( 475 UINT32 Type) 476{ 477 478 if (Type > INTERNAL_TYPE_INVALID) 479 { 480 return (AcpiGbl_BadType); 481 } 482 483 return (AcpiGbl_NsTypeNames[Type]); 484} 485 486 487/* Region type decoding */ 488 489NATIVE_CHAR *AcpiGbl_RegionTypes[NUM_REGION_TYPES] = 490{ 491 "SystemMemory", 492 "SystemIO", 493 "PCIConfig", 494 "EmbeddedControl", 495 "SMBus", 496 "CMOS", 497 "PCIBarTarget", 498}; 499 500 501/***************************************************************************** 502 * 503 * FUNCTION: AcpiUtGetRegionName 504 * 505 * PARAMETERS: None. 506 * 507 * RETURN: Status 508 * 509 * DESCRIPTION: Translate a Space ID into a name string (Debug only) 510 * 511 ****************************************************************************/ 512 513NATIVE_CHAR * 514AcpiUtGetRegionName ( 515 UINT8 SpaceId) 516{ 517 518 if (SpaceId >= USER_REGION_BEGIN) 519 { 520 return ("UserDefinedRegion"); 521 } 522 523 else if (SpaceId >= NUM_REGION_TYPES) 524 { 525 return ("InvalidSpaceID"); 526 } 527 528 return (AcpiGbl_RegionTypes[SpaceId]); 529} 530 531 532/* Data used in keeping track of fields */ 533 534NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] = 535{ 536 "skip", 537 "?access?" 538}; /* FE = Field Element */ 539 540 541NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] = 542{ 543 "Error", 544 "MTR", 545 "MEQ", 546 "MLE", 547 "MLT", 548 "MGE", 549 "MGT" 550}; 551 552 553/* Access type decoding */ 554 555NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] = 556{ 557 "AnyAcc", 558 "ByteAcc", 559 "WordAcc", 560 "DWordAcc", 561 "BlockAcc", 562 "SMBSendRecvAcc", 563 "SMBQuickAcc" 564}; 565 566 567/* Update rule decoding */ 568 569NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = 570{ 571 "Preserve", 572 "WriteAsOnes", 573 "WriteAsZeros" 574}; 575 576#endif 577 578 579/***************************************************************************** 580 * 581 * FUNCTION: AcpiUtValidObjectType 582 * 583 * PARAMETERS: None. 584 * 585 * RETURN: TRUE if valid object type 586 * 587 * DESCRIPTION: Validate an object type 588 * 589 ****************************************************************************/ 590 591BOOLEAN 592AcpiUtValidObjectType ( 593 UINT32 Type) 594{ 595 596 if (Type > ACPI_TYPE_MAX) 597 { 598 if ((Type < INTERNAL_TYPE_BEGIN) || 599 (Type > INTERNAL_TYPE_MAX)) 600 { 601 return (FALSE); 602 } 603 } 604 605 return (TRUE); 606} 607 608 609/**************************************************************************** 610 * 611 * FUNCTION: AcpiUtAllocateOwnerId 612 * 613 * PARAMETERS: IdType - Type of ID (method or table) 614 * 615 * DESCRIPTION: Allocate a table or method owner id 616 * 617 ***************************************************************************/ 618 619ACPI_OWNER_ID 620AcpiUtAllocateOwnerId ( 621 UINT32 IdType) 622{ 623 ACPI_OWNER_ID OwnerId = 0xFFFF; 624 625 626 FUNCTION_TRACE ("UtAllocateOwnerId"); 627 628 629 AcpiUtAcquireMutex (ACPI_MTX_CACHES); 630 631 switch (IdType) 632 { 633 case OWNER_TYPE_TABLE: 634 635 OwnerId = AcpiGbl_NextTableOwnerId; 636 AcpiGbl_NextTableOwnerId++; 637 638 if (AcpiGbl_NextTableOwnerId == FIRST_METHOD_ID) 639 { 640 AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; 641 } 642 break; 643 644 645 case OWNER_TYPE_METHOD: 646 647 OwnerId = AcpiGbl_NextMethodOwnerId; 648 AcpiGbl_NextMethodOwnerId++; 649 650 if (AcpiGbl_NextMethodOwnerId == FIRST_TABLE_ID) 651 { 652 AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; 653 } 654 break; 655 } 656 657 658 AcpiUtReleaseMutex (ACPI_MTX_CACHES); 659 660 return_VALUE (OwnerId); 661} 662 663 664/**************************************************************************** 665 * 666 * FUNCTION: AcpiUtInitGlobals 667 * 668 * PARAMETERS: none 669 * 670 * DESCRIPTION: Init library globals. All globals that require specific 671 * initialization should be initialized here! 672 * 673 ***************************************************************************/ 674 675void 676AcpiUtInitGlobals ( 677 void) 678{ 679 UINT32 i; 680 681 682 FUNCTION_TRACE ("UtInitGlobals"); 683 684 685 686 /* Memory allocation and cache lists */ 687 688 MEMSET (AcpiGbl_MemoryLists, 0, 689 sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS); 690 691 AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_GENERIC_STATE *) NULL)->Common.Next); 692 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_PARSE_OBJECT *) NULL)->Next); 693 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_PARSE2_OBJECT *) NULL)->Next); 694 AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next); 695 AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_WALK_STATE *) NULL)->Next); 696 697 AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize = sizeof (ACPI_NAMESPACE_NODE); 698 AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize = sizeof (ACPI_GENERIC_STATE); 699 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJECT); 700 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE2_OBJECT); 701 AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ObjectSize = sizeof (ACPI_OPERAND_OBJECT); 702 AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ObjectSize = sizeof (ACPI_WALK_STATE); 703 704 AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].MaxCacheDepth = MAX_STATE_CACHE_DEPTH; 705 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].MaxCacheDepth = MAX_PARSE_CACHE_DEPTH; 706 AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].MaxCacheDepth = MAX_EXTPARSE_CACHE_DEPTH; 707 AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].MaxCacheDepth = MAX_OBJECT_CACHE_DEPTH; 708 AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].MaxCacheDepth = MAX_WALK_CACHE_DEPTH; 709 710 711 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].ListName = "Global Memory Allocation"); 712 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ListName = "Namespace Nodes"); 713 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ListName = "State Object Cache"); 714 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ListName = "Parse Node Cache"); 715 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ListName = "Extended Parse Node Cache"); 716 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ListName = "Operand Object Cache"); 717 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ListName = "Tree Walk Node Cache"); 718 719 /* ACPI table structure */ 720 721 for (i = 0; i < NUM_ACPI_TABLES; i++) 722 { 723 AcpiGbl_AcpiTables[i].Prev = &AcpiGbl_AcpiTables[i]; 724 AcpiGbl_AcpiTables[i].Next = &AcpiGbl_AcpiTables[i]; 725 AcpiGbl_AcpiTables[i].Pointer = NULL; 726 AcpiGbl_AcpiTables[i].Length = 0; 727 AcpiGbl_AcpiTables[i].Allocation = ACPI_MEM_NOT_ALLOCATED; 728 AcpiGbl_AcpiTables[i].Count = 0; 729 } 730 731 732 /* Address Space handler array */ 733 734 for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++) 735 { 736 AcpiGbl_AddressSpaces[i].Handler = NULL; 737 AcpiGbl_AddressSpaces[i].Context = NULL; 738 } 739 740 /* Mutex locked flags */ 741 742 for (i = 0; i < NUM_MTX; i++) 743 { 744 AcpiGbl_AcpiMutexInfo[i].Mutex = NULL; 745 AcpiGbl_AcpiMutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; 746 AcpiGbl_AcpiMutexInfo[i].UseCount = 0; 747 } 748 749 /* Global notify handlers */ 750 751 AcpiGbl_SysNotify.Handler = NULL; 752 AcpiGbl_DrvNotify.Handler = NULL; 753 754 /* Global "typed" ACPI table pointers */ 755 756 AcpiGbl_RSDP = NULL; 757 AcpiGbl_XSDT = NULL; 758 AcpiGbl_FACS = NULL; 759 AcpiGbl_FADT = NULL; 760 AcpiGbl_DSDT = NULL; 761 762 763 /* Global Lock support */ 764 765 AcpiGbl_GlobalLockAcquired = FALSE; 766 AcpiGbl_GlobalLockThreadCount = 0; 767 768 /* Miscellaneous variables */ 769 770 AcpiGbl_SystemFlags = 0; 771 AcpiGbl_StartupFlags = 0; 772 AcpiGbl_RsdpOriginalLocation = 0; 773 AcpiGbl_CmSingleStep = FALSE; 774 AcpiGbl_DbTerminateThreads = FALSE; 775 AcpiGbl_Shutdown = FALSE; 776 AcpiGbl_NsLookupCount = 0; 777 AcpiGbl_PsFindCount = 0; 778 AcpiGbl_AcpiHardwarePresent = TRUE; 779 AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; 780 AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; 781 AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; 782 783 784 /* Hardware oriented */ 785 786 AcpiGbl_Gpe0EnableRegisterSave = NULL; 787 AcpiGbl_Gpe1EnableRegisterSave = NULL; 788 AcpiGbl_OriginalMode = SYS_MODE_UNKNOWN; /* original ACPI/legacy mode */ 789 AcpiGbl_GpeRegisters = NULL; 790 AcpiGbl_GpeInfo = NULL; 791 792 /* Namespace */ 793 794 AcpiGbl_RootNode = NULL; 795 796 AcpiGbl_RootNodeStruct.Name = ACPI_ROOT_NAME; 797 AcpiGbl_RootNodeStruct.DataType = ACPI_DESC_TYPE_NAMED; 798 AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_ANY; 799 AcpiGbl_RootNodeStruct.Child = NULL; 800 AcpiGbl_RootNodeStruct.Peer = NULL; 801 AcpiGbl_RootNodeStruct.Object = NULL; 802 AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; 803 804 805 return_VOID; 806} 807 808 809