utglobal.c revision 78986
1227652Sgrehan/****************************************************************************** 2252707Sbryanv * 3227652Sgrehan * Module Name: utglobal - Global variables for the ACPI subsystem 4227652Sgrehan * $Revision: 123 $ 5227652Sgrehan * 6227652Sgrehan *****************************************************************************/ 7227652Sgrehan 8227652Sgrehan/****************************************************************************** 9227652Sgrehan * 10227652Sgrehan * 1. Copyright Notice 11227652Sgrehan * 12227652Sgrehan * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. 13227652Sgrehan * All rights reserved. 14227652Sgrehan * 15227652Sgrehan * 2. License 16227652Sgrehan * 17227652Sgrehan * 2.1. This is your license from Intel Corp. under its intellectual property 18227652Sgrehan * rights. You may have additional license terms from the party that provided 19227652Sgrehan * you this software, covering your right to use that party's intellectual 20227652Sgrehan * property rights. 21227652Sgrehan * 22227652Sgrehan * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23227652Sgrehan * copy of the source code appearing in this file ("Covered Code") an 24227652Sgrehan * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25227652Sgrehan * base code distributed originally by Intel ("Original Intel Code") to copy, 26227652Sgrehan * make derivatives, distribute, use and display any portion of the Covered 27227652Sgrehan * Code in any form, with the right to sublicense such rights; and 28227652Sgrehan * 29227652Sgrehan * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30227652Sgrehan * license (with the right to sublicense), under only those claims of Intel 31227652Sgrehan * patents that are infringed by the Original Intel Code, to make, use, sell, 32227652Sgrehan * offer to sell, and import the Covered Code and derivative works thereof 33227652Sgrehan * solely to the minimum extent necessary to exercise the above copyright 34227652Sgrehan * license, and in no event shall the patent license extend to any additions 35227652Sgrehan * to or modifications of the Original Intel Code. No other license or right 36227652Sgrehan * is granted directly or by implication, estoppel or otherwise; 37227652Sgrehan * 38227652Sgrehan * The above copyright and patent license is granted only if the following 39227652Sgrehan * conditions are met: 40227652Sgrehan * 41227652Sgrehan * 3. Conditions 42227652Sgrehan * 43227652Sgrehan * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44227652Sgrehan * Redistribution of source code of any substantial portion of the Covered 45227652Sgrehan * Code or modification with rights to further distribute source must include 46227652Sgrehan * the above Copyright Notice, the above License, this list of Conditions, 47227652Sgrehan * and the following Disclaimer and Export Compliance provision. In addition, 48227652Sgrehan * Licensee must cause all Covered Code to which Licensee contributes to 49227652Sgrehan * contain a file documenting the changes Licensee made to create that Covered 50227652Sgrehan * Code and the date of any change. Licensee must include in that file the 51252707Sbryanv * documentation of any changes made by any predecessor Licensee. Licensee 52252707Sbryanv * must include a prominent statement that the modification is derived, 53227652Sgrehan * directly or indirectly, from Original Intel Code. 54227652Sgrehan * 55227652Sgrehan * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56227652Sgrehan * Redistribution of source code of any substantial portion of the Covered 57227652Sgrehan * Code or modification without rights to further distribute source must 58227652Sgrehan * include the following Disclaimer and Export Compliance provision in the 59227652Sgrehan * documentation and/or other materials provided with distribution. In 60241470Sgrehan * addition, Licensee may not authorize further sublicense of source of any 61227652Sgrehan * portion of the Covered Code, and must include terms to the effect that the 62227652Sgrehan * license from Licensee to its licensee is limited to the intellectual 63227652Sgrehan * property embodied in the software Licensee provides to its licensee, and 64227652Sgrehan * not to intellectual property embodied in modifications its licensee may 65227652Sgrehan * make. 66227652Sgrehan * 67227652Sgrehan * 3.3. Redistribution of Executable. Redistribution in executable form of any 68227652Sgrehan * substantial portion of the Covered Code or modification must reproduce the 69227652Sgrehan * above Copyright Notice, and the following Disclaimer and Export Compliance 70227652Sgrehan * provision in the documentation and/or other materials provided with the 71227652Sgrehan * distribution. 72227652Sgrehan * 73227652Sgrehan * 3.4. Intel retains all right, title, and interest in and to the Original 74227652Sgrehan * Intel Code. 75227652Sgrehan * 76227652Sgrehan * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77227652Sgrehan * Intel shall be used in advertising or otherwise to promote the sale, use or 78227652Sgrehan * other dealings in products derived from or relating to the Covered Code 79227652Sgrehan * without prior written authorization from Intel. 80227652Sgrehan * 81227652Sgrehan * 4. Disclaimer and Export Compliance 82227652Sgrehan * 83227652Sgrehan * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84227652Sgrehan * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85227652Sgrehan * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86227652Sgrehan * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87227652Sgrehan * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88227652Sgrehan * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89252707Sbryanv * PARTICULAR PURPOSE. 90252707Sbryanv * 91252707Sbryanv * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92252707Sbryanv * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93252707Sbryanv * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94252707Sbryanv * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95252707Sbryanv * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96252707Sbryanv * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97252707Sbryanv * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98252707Sbryanv * LIMITED REMEDY. 99252707Sbryanv * 100252707Sbryanv * 4.3. Licensee shall not export, either directly or indirectly, any of this 101252707Sbryanv * software or system incorporating such software without first obtaining any 102252707Sbryanv * required license or other approval from the U. S. Department of Commerce or 103252707Sbryanv * any other agency or department of the United States Government. In the 104252707Sbryanv * event Licensee exports any such software from the United States or 105252707Sbryanv * re-exports any such software from a foreign destination, Licensee shall 106252707Sbryanv * ensure that the distribution and export/re-export of the software is in 107252707Sbryanv * compliance with all laws, regulations, orders, or other restrictions of the 108252707Sbryanv * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109227652Sgrehan * any of its subsidiaries will export/re-export any technical data, process, 110227652Sgrehan * software, or service, directly or indirectly, to any country for which the 111252707Sbryanv * United States government or any agency thereof requires an export license, 112227652Sgrehan * other governmental approval, or letter of assurance, without first obtaining 113227652Sgrehan * such license, approval or letter. 114227652Sgrehan * 115227652Sgrehan *****************************************************************************/ 116227652Sgrehan 117227652Sgrehan#define __UTGLOBAL_C__ 118227652Sgrehan#define DEFINE_ACPI_GLOBALS 119227652Sgrehan 120252707Sbryanv#include "acpi.h" 121227652Sgrehan#include "acevents.h" 122227652Sgrehan#include "acnamesp.h" 123227652Sgrehan#include "acinterp.h" 124227652Sgrehan#include "amlcode.h" 125252707Sbryanv 126227652Sgrehan 127227652Sgrehan#define _COMPONENT ACPI_UTILITIES 128227652Sgrehan MODULE_NAME ("utglobal") 129227652Sgrehan 130227652Sgrehan 131227652Sgrehan/****************************************************************************** 132227652Sgrehan * 133227652Sgrehan * Static global variable initialization. 134227652Sgrehan * 135227652Sgrehan ******************************************************************************/ 136227652Sgrehan 137227652Sgrehan/* 138227652Sgrehan * We want the debug switches statically initialized so they 139227652Sgrehan * are already set when the debugger is entered. 140252707Sbryanv */ 141227652Sgrehan 142252707Sbryanv/* Debug switch - level and trace mask */ 143227652Sgrehan 144227652Sgrehan#ifdef ACPI_DEBUG 145227652SgrehanUINT32 AcpiDbgLevel = DEBUG_DEFAULT; 146227652Sgrehan#else 147227652SgrehanUINT32 AcpiDbgLevel = NORMAL_DEFAULT; 148227652Sgrehan#endif 149227652Sgrehan 150227652Sgrehan/* Debug switch - layer (component) mask */ 151227652Sgrehan 152227652SgrehanUINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT; 153227652SgrehanUINT32 AcpiGbl_NestingLevel = 0; 154227652Sgrehan 155227652Sgrehan 156227652Sgrehan/* Debugger globals */ 157227652Sgrehan 158227652SgrehanBOOLEAN AcpiGbl_DbTerminateThreads = FALSE; 159227652SgrehanBOOLEAN AcpiGbl_MethodExecuting = FALSE; 160227652Sgrehan 161227652Sgrehan/* System flags */ 162227652Sgrehan 163227652SgrehanUINT32 AcpiGbl_SystemFlags = 0; 164227652SgrehanUINT32 AcpiGbl_StartupFlags = 0; 165227652Sgrehan 166238360Sgrehan/* System starts unitialized! */ 167238360SgrehanBOOLEAN AcpiGbl_Shutdown = TRUE; 168238360Sgrehan 169238360Sgrehan 170238360SgrehanUINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128}; 171238360Sgrehan 172238360Sgrehan 173238360Sgrehan/****************************************************************************** 174238360Sgrehan * 175238360Sgrehan * Namespace globals 176238360Sgrehan * 177238360Sgrehan ******************************************************************************/ 178238360Sgrehan 179238360Sgrehan 180238360Sgrehan/* 181227652Sgrehan * Names built-in to the interpreter 182227652Sgrehan * 183227652Sgrehan * Initial values are currently supported only for types String and Number. 184227652Sgrehan * To avoid type punning, both are specified as strings in this table. 185227652Sgrehan * 186227652Sgrehan * NOTES: 187227652Sgrehan * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run 188227652Sgrehan * during the initialization sequence. 189227652Sgrehan */ 190227652Sgrehan 191227652SgrehanPREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = 192227652Sgrehan{ 193227652Sgrehan {"_GPE", INTERNAL_TYPE_DEF_ANY}, 194227652Sgrehan {"_PR_", INTERNAL_TYPE_DEF_ANY}, 195227652Sgrehan {"_SB_", ACPI_TYPE_DEVICE}, 196227652Sgrehan {"_SI_", INTERNAL_TYPE_DEF_ANY}, 197227652Sgrehan {"_TZ_", INTERNAL_TYPE_DEF_ANY}, 198227652Sgrehan {"_REV", ACPI_TYPE_INTEGER, "2"}, 199227652Sgrehan {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 200227652Sgrehan {"_GL_", ACPI_TYPE_MUTEX, "0"}, 201227652Sgrehan {NULL, ACPI_TYPE_ANY} /* Table terminator */ 202227652Sgrehan}; 203227652Sgrehan 204227652Sgrehan 205227652Sgrehan/* 206227652Sgrehan * Properties of the ACPI Object Types, both internal and external. 207227652Sgrehan * 208227652Sgrehan * Elements of AcpiNsProperties are bit significant 209227652Sgrehan * and the table is indexed by values of ACPI_OBJECT_TYPE 210227652Sgrehan */ 211227652Sgrehan 212227652SgrehanUINT8 AcpiGbl_NsProperties[] = 213227652Sgrehan{ 214227652Sgrehan NSP_NORMAL, /* 00 Any */ 215227652Sgrehan NSP_NORMAL, /* 01 Number */ 216227652Sgrehan NSP_NORMAL, /* 02 String */ 217227652Sgrehan NSP_NORMAL, /* 03 Buffer */ 218227652Sgrehan NSP_LOCAL, /* 04 Package */ 219227652Sgrehan NSP_NORMAL, /* 05 FieldUnit */ 220227652Sgrehan NSP_NEWSCOPE | NSP_LOCAL, /* 06 Device */ 221227652Sgrehan NSP_LOCAL, /* 07 AcpiEvent */ 222227652Sgrehan NSP_NEWSCOPE | NSP_LOCAL, /* 08 Method */ 223227652Sgrehan NSP_LOCAL, /* 09 Mutex */ 224227652Sgrehan NSP_LOCAL, /* 10 Region */ 225227652Sgrehan NSP_NEWSCOPE | NSP_LOCAL, /* 11 Power */ 226227652Sgrehan NSP_NEWSCOPE | NSP_LOCAL, /* 12 Processor */ 227227652Sgrehan NSP_NEWSCOPE | NSP_LOCAL, /* 13 Thermal */ 228227652Sgrehan NSP_NORMAL, /* 14 BufferField */ 229227652Sgrehan NSP_NORMAL, /* 15 DdbHandle */ 230227652Sgrehan NSP_NORMAL, /* 16 Debug Object */ 231227652Sgrehan NSP_NORMAL, /* 17 DefField */ 232227652Sgrehan NSP_NORMAL, /* 18 BankField */ 233227652Sgrehan NSP_NORMAL, /* 19 IndexField */ 234227652Sgrehan NSP_NORMAL, /* 20 Reference */ 235227652Sgrehan NSP_NORMAL, /* 21 Alias */ 236227652Sgrehan NSP_NORMAL, /* 22 Notify */ 237227652Sgrehan NSP_NORMAL, /* 23 Address Handler */ 238227652Sgrehan NSP_NEWSCOPE | NSP_LOCAL, /* 24 Resource Desc */ 239227652Sgrehan NSP_NEWSCOPE | NSP_LOCAL, /* 25 Resource Field */ 240227652Sgrehan NSP_NORMAL, /* 26 DefFieldDefn */ 241227652Sgrehan NSP_NORMAL, /* 27 BankFieldDefn */ 242227652Sgrehan NSP_NORMAL, /* 28 IndexFieldDefn */ 243227652Sgrehan NSP_NORMAL, /* 29 If */ 244227652Sgrehan NSP_NORMAL, /* 30 Else */ 245227652Sgrehan NSP_NORMAL, /* 31 While */ 246227652Sgrehan NSP_NEWSCOPE, /* 32 Scope */ 247227652Sgrehan NSP_LOCAL, /* 33 DefAny */ 248227652Sgrehan NSP_NORMAL, /* 34 Extra */ 249227652Sgrehan NSP_NORMAL /* 35 Invalid */ 250227652Sgrehan}; 251227652Sgrehan 252227652Sgrehan 253227652Sgrehan/* Hex to ASCII conversion table */ 254227652Sgrehan 255227652SgrehanNATIVE_CHAR AcpiGbl_HexToAscii[] = 256227652Sgrehan {'0','1','2','3','4','5','6','7', 257227652Sgrehan '8','9','A','B','C','D','E','F'}; 258227652Sgrehan 259252707Sbryanv 260227652Sgrehan/****************************************************************************** 261227652Sgrehan * 262227652Sgrehan * Table globals 263227652Sgrehan * 264227652Sgrehan * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes. 265227652Sgrehan * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables 266227652Sgrehan * that are not used by the subsystem are simply ignored. 267227652Sgrehan * 268227652Sgrehan ******************************************************************************/ 269227652Sgrehan 270227652Sgrehan 271227652SgrehanACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES]; 272241394Skevlo 273227652Sgrehan 274227652SgrehanACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] = 275227652Sgrehan{ 276227652Sgrehan /*********** Name, Signature, Signature size, How many allowed?, Supported? Global typed pointer */ 277 278 /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, 279 /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_DSDT}, 280 /* FADT 2 */ {FADT_SIG, FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FADT}, 281 /* FACS 3 */ {FACS_SIG, FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FACS}, 282 /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 283 /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, 284 /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, 285}; 286 287 288#ifdef ACPI_DEBUG 289 290/****************************************************************************** 291 * 292 * Strings and procedures used for debug only 293 * 294 ******************************************************************************/ 295 296NATIVE_CHAR *MsgAcpiErrorBreak = "*** Break on ACPI_ERROR ***\n"; 297 298 299/***************************************************************************** 300 * 301 * FUNCTION: AcpiUtGetMutexName 302 * 303 * PARAMETERS: None. 304 * 305 * RETURN: Status 306 * 307 * DESCRIPTION: Translate a mutex ID into a name string (Debug only) 308 * 309 ****************************************************************************/ 310 311NATIVE_CHAR * 312AcpiUtGetMutexName ( 313 UINT32 MutexId) 314{ 315 316 if (MutexId > MAX_MTX) 317 { 318 return ("Invalid Mutex ID"); 319 } 320 321 return (AcpiGbl_MutexNames[MutexId]); 322} 323 324 325/* 326 * Elements of AcpiGbl_NsTypeNames below must match 327 * one-to-one with values of ACPI_OBJECT_TYPE 328 * 329 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when 330 * stored in a table it really means that we have thus far seen no evidence to 331 * indicatewhat type is actually going to be stored for this entry. 332 */ 333 334static NATIVE_CHAR AcpiGbl_BadType[] = "UNDEFINED"; 335#define TYPE_NAME_LENGTH 9 /* Maximum length of each string */ 336 337static NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */ 338{ 339 /* 00 */ "Untyped", 340 /* 01 */ "Integer", 341 /* 02 */ "String", 342 /* 03 */ "Buffer", 343 /* 04 */ "Package", 344 /* 05 */ "FieldUnit", 345 /* 06 */ "Device", 346 /* 07 */ "Event", 347 /* 08 */ "Method", 348 /* 09 */ "Mutex", 349 /* 10 */ "Region", 350 /* 11 */ "Power", 351 /* 12 */ "Processor", 352 /* 13 */ "Thermal", 353 /* 14 */ "BuffField", 354 /* 15 */ "DdbHandle", 355 /* 16 */ "DebugObj", 356 /* 17 */ "RegnField", 357 /* 18 */ "BankField", 358 /* 19 */ "IndxField", 359 /* 20 */ "Reference", 360 /* 21 */ "Alias", 361 /* 22 */ "Notify", 362 /* 23 */ "AddrHndlr", 363 /* 24 */ "RsrcDesc", 364 /* 25 */ "RsrcField", 365 /* 26 */ "RgnFldDfn", 366 /* 27 */ "BnkFldDfn", 367 /* 28 */ "IdxFldDfn", 368 /* 29 */ "If", 369 /* 30 */ "Else", 370 /* 31 */ "While", 371 /* 32 */ "Scope", 372 /* 33 */ "DefAny", 373 /* 34 */ "Extra", 374 /* 35 */ "Invalid" 375}; 376 377 378/***************************************************************************** 379 * 380 * FUNCTION: AcpiUtGetTypeName 381 * 382 * PARAMETERS: None. 383 * 384 * RETURN: Status 385 * 386 * DESCRIPTION: Translate a Type ID into a name string (Debug only) 387 * 388 ****************************************************************************/ 389 390NATIVE_CHAR * 391AcpiUtGetTypeName ( 392 UINT32 Type) 393{ 394 395 if (Type > INTERNAL_TYPE_INVALID) 396 { 397 return (AcpiGbl_BadType); 398 } 399 400 return (AcpiGbl_NsTypeNames[Type]); 401} 402 403 404/* Region type decoding */ 405 406NATIVE_CHAR *AcpiGbl_RegionTypes[NUM_REGION_TYPES] = 407{ 408 "SystemMemory", 409 "SystemIO", 410 "PCIConfig", 411 "EmbeddedControl", 412 "SMBus", 413 "CMOS", 414 "PCIBarTarget", 415}; 416 417 418/***************************************************************************** 419 * 420 * FUNCTION: AcpiUtGetRegionName 421 * 422 * PARAMETERS: None. 423 * 424 * RETURN: Status 425 * 426 * DESCRIPTION: Translate a Space ID into a name string (Debug only) 427 * 428 ****************************************************************************/ 429 430NATIVE_CHAR * 431AcpiUtGetRegionName ( 432 UINT8 SpaceId) 433{ 434 435 if (SpaceId >= USER_REGION_BEGIN) 436 { 437 return ("UserDefinedRegion"); 438 } 439 440 else if (SpaceId >= NUM_REGION_TYPES) 441 { 442 return ("InvalidSpaceID"); 443 } 444 445 return (AcpiGbl_RegionTypes[SpaceId]); 446} 447 448 449/* Data used in keeping track of fields */ 450 451NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] = 452{ 453 "skip", 454 "?access?" 455}; /* FE = Field Element */ 456 457 458NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] = 459{ 460 "Error", 461 "MTR", 462 "MEQ", 463 "MLE", 464 "MLT", 465 "MGE", 466 "MGT" 467}; 468 469 470/* Access type decoding */ 471 472NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] = 473{ 474 "AnyAcc", 475 "ByteAcc", 476 "WordAcc", 477 "DWordAcc", 478 "BlockAcc", 479 "SMBSendRecvAcc", 480 "SMBQuickAcc" 481}; 482 483 484/* Update rule decoding */ 485 486NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = 487{ 488 "Preserve", 489 "WriteAsOnes", 490 "WriteAsZeros" 491}; 492 493#endif 494 495 496/***************************************************************************** 497 * 498 * FUNCTION: AcpiUtValidObjectType 499 * 500 * PARAMETERS: None. 501 * 502 * RETURN: TRUE if valid object type 503 * 504 * DESCRIPTION: Validate an object type 505 * 506 ****************************************************************************/ 507 508BOOLEAN 509AcpiUtValidObjectType ( 510 UINT32 Type) 511{ 512 513 if (Type > ACPI_TYPE_MAX) 514 { 515 if ((Type < INTERNAL_TYPE_BEGIN) || 516 (Type > INTERNAL_TYPE_MAX)) 517 { 518 return (FALSE); 519 } 520 } 521 522 return (TRUE); 523} 524 525 526/***************************************************************************** 527 * 528 * FUNCTION: AcpiUtFormatException 529 * 530 * PARAMETERS: Status - Acpi status to be formatted 531 * 532 * RETURN: Formatted status string 533 * 534 * DESCRIPTION: Convert an ACPI exception to a string 535 * 536 ****************************************************************************/ 537 538NATIVE_CHAR * 539AcpiUtFormatException ( 540 ACPI_STATUS Status) 541{ 542 NATIVE_CHAR *Exception = "UNKNOWN_STATUS"; 543 ACPI_STATUS SubStatus; 544 545 546 SubStatus = (Status & ~AE_CODE_MASK); 547 548 549 switch (Status & AE_CODE_MASK) 550 { 551 case AE_CODE_ENVIRONMENTAL: 552 553 if (SubStatus <= AE_CODE_ENV_MAX) 554 { 555 Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; 556 } 557 break; 558 559 case AE_CODE_PROGRAMMER: 560 561 if (SubStatus <= AE_CODE_PGM_MAX) 562 { 563 Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; 564 } 565 break; 566 567 case AE_CODE_ACPI_TABLES: 568 569 if (SubStatus <= AE_CODE_TBL_MAX) 570 { 571 Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; 572 } 573 break; 574 575 case AE_CODE_AML: 576 577 if (SubStatus <= AE_CODE_AML_MAX) 578 { 579 Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; 580 } 581 break; 582 583 case AE_CODE_CONTROL: 584 585 if (SubStatus <= AE_CODE_CTRL_MAX) 586 { 587 Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; 588 } 589 break; 590 591 default: 592 break; 593 } 594 595 596 return (Exception); 597} 598 599 600/**************************************************************************** 601 * 602 * FUNCTION: AcpiUtAllocateOwnerId 603 * 604 * PARAMETERS: IdType - Type of ID (method or table) 605 * 606 * DESCRIPTION: Allocate a table or method owner id 607 * 608 ***************************************************************************/ 609 610ACPI_OWNER_ID 611AcpiUtAllocateOwnerId ( 612 UINT32 IdType) 613{ 614 ACPI_OWNER_ID OwnerId = 0xFFFF; 615 616 617 FUNCTION_TRACE ("UtAllocateOwnerId"); 618 619 620 AcpiUtAcquireMutex (ACPI_MTX_CACHES); 621 622 switch (IdType) 623 { 624 case OWNER_TYPE_TABLE: 625 626 OwnerId = AcpiGbl_NextTableOwnerId; 627 AcpiGbl_NextTableOwnerId++; 628 629 if (AcpiGbl_NextTableOwnerId == FIRST_METHOD_ID) 630 { 631 AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; 632 } 633 break; 634 635 636 case OWNER_TYPE_METHOD: 637 638 OwnerId = AcpiGbl_NextMethodOwnerId; 639 AcpiGbl_NextMethodOwnerId++; 640 641 if (AcpiGbl_NextMethodOwnerId == FIRST_TABLE_ID) 642 { 643 AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; 644 } 645 break; 646 } 647 648 649 AcpiUtReleaseMutex (ACPI_MTX_CACHES); 650 651 return_VALUE (OwnerId); 652} 653 654 655/**************************************************************************** 656 * 657 * FUNCTION: AcpiUtInitGlobals 658 * 659 * PARAMETERS: none 660 * 661 * DESCRIPTION: Init library globals. All globals that require specific 662 * initialization should be initialized here! 663 * 664 ***************************************************************************/ 665 666void 667AcpiUtInitGlobals ( 668 void) 669{ 670 UINT32 i; 671 672 673 FUNCTION_TRACE ("UtInitGlobals"); 674 675 676 /* ACPI table structure */ 677 678 for (i = 0; i < NUM_ACPI_TABLES; i++) 679 { 680 AcpiGbl_AcpiTables[i].Prev = &AcpiGbl_AcpiTables[i]; 681 AcpiGbl_AcpiTables[i].Next = &AcpiGbl_AcpiTables[i]; 682 AcpiGbl_AcpiTables[i].Pointer = NULL; 683 AcpiGbl_AcpiTables[i].Length = 0; 684 AcpiGbl_AcpiTables[i].Allocation = ACPI_MEM_NOT_ALLOCATED; 685 AcpiGbl_AcpiTables[i].Count = 0; 686 } 687 688 689 /* Address Space handler array */ 690 691 for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++) 692 { 693 AcpiGbl_AddressSpaces[i].Handler = NULL; 694 AcpiGbl_AddressSpaces[i].Context = NULL; 695 } 696 697 /* Mutex locked flags */ 698 699 for (i = 0; i < NUM_MTX; i++) 700 { 701 AcpiGbl_AcpiMutexInfo[i].Mutex = NULL; 702 AcpiGbl_AcpiMutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; 703 AcpiGbl_AcpiMutexInfo[i].UseCount = 0; 704 } 705 706 /* Global notify handlers */ 707 708 AcpiGbl_SysNotify.Handler = NULL; 709 AcpiGbl_DrvNotify.Handler = NULL; 710 711 /* Global "typed" ACPI table pointers */ 712 713 AcpiGbl_RSDP = NULL; 714 AcpiGbl_XSDT = NULL; 715 AcpiGbl_FACS = NULL; 716 AcpiGbl_FADT = NULL; 717 AcpiGbl_DSDT = NULL; 718 719 720 /* Global Lock support */ 721 722 AcpiGbl_GlobalLockAcquired = FALSE; 723 AcpiGbl_GlobalLockThreadCount = 0; 724 725 /* Miscellaneous variables */ 726 727 AcpiGbl_SystemFlags = 0; 728 AcpiGbl_StartupFlags = 0; 729 AcpiGbl_RsdpOriginalLocation = 0; 730 AcpiGbl_CmSingleStep = FALSE; 731 AcpiGbl_DbTerminateThreads = FALSE; 732 AcpiGbl_Shutdown = FALSE; 733 AcpiGbl_NsLookupCount = 0; 734 AcpiGbl_PsFindCount = 0; 735 AcpiGbl_AcpiHardwarePresent = TRUE; 736 AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; 737 AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; 738 AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; 739 740 /* Cache of small "state" objects */ 741 742 AcpiGbl_GenericStateCache = NULL; 743 AcpiGbl_GenericStateCacheDepth = 0; 744 AcpiGbl_StateCacheRequests = 0; 745 AcpiGbl_StateCacheHits = 0; 746 747 AcpiGbl_ParseCache = NULL; 748 AcpiGbl_ParseCacheDepth = 0; 749 AcpiGbl_ParseCacheRequests = 0; 750 AcpiGbl_ParseCacheHits = 0; 751 752 AcpiGbl_ExtParseCache = NULL; 753 AcpiGbl_ExtParseCacheDepth = 0; 754 AcpiGbl_ExtParseCacheRequests = 0; 755 AcpiGbl_ExtParseCacheHits = 0; 756 757 AcpiGbl_ObjectCache = NULL; 758 AcpiGbl_ObjectCacheDepth = 0; 759 AcpiGbl_ObjectCacheRequests = 0; 760 AcpiGbl_ObjectCacheHits = 0; 761 762 AcpiGbl_WalkStateCache = NULL; 763 AcpiGbl_WalkStateCacheDepth = 0; 764 AcpiGbl_WalkStateCacheRequests = 0; 765 AcpiGbl_WalkStateCacheHits = 0; 766 767 /* Hardware oriented */ 768 769 AcpiGbl_Gpe0EnableRegisterSave = NULL; 770 AcpiGbl_Gpe1EnableRegisterSave = NULL; 771 AcpiGbl_OriginalMode = SYS_MODE_UNKNOWN; /* original ACPI/legacy mode */ 772 AcpiGbl_GpeRegisters = NULL; 773 AcpiGbl_GpeInfo = NULL; 774 775 /* Namespace */ 776 777 AcpiGbl_RootNode = NULL; 778 779 AcpiGbl_RootNodeStruct.Name = ACPI_ROOT_NAME; 780 AcpiGbl_RootNodeStruct.DataType = ACPI_DESC_TYPE_NAMED; 781 AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_ANY; 782 AcpiGbl_RootNodeStruct.Child = NULL; 783 AcpiGbl_RootNodeStruct.Peer = NULL; 784 AcpiGbl_RootNodeStruct.Object = NULL; 785 AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; 786 787 /* Memory allocation metrics - compiled out in non-debug mode. */ 788 789 INITIALIZE_ALLOCATION_METRICS(); 790 791 return_VOID; 792} 793 794 795