dswload.c revision 99679
1/****************************************************************************** 2 * 3 * Module Name: dswload - Dispatcher namespace load callbacks 4 * $Revision: 66 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2002, 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 __DSWLOAD_C__ 118 119#include "acpi.h" 120#include "acparser.h" 121#include "amlcode.h" 122#include "acdispat.h" 123#include "acinterp.h" 124#include "acnamesp.h" 125#include "acevents.h" 126 127 128#define _COMPONENT ACPI_DISPATCHER 129 ACPI_MODULE_NAME ("dswload") 130 131 132/******************************************************************************* 133 * 134 * FUNCTION: AcpiDsInitCallbacks 135 * 136 * PARAMETERS: WalkState - Current state of the parse tree walk 137 * PassNumber - 1, 2, or 3 138 * 139 * RETURN: Status 140 * 141 * DESCRIPTION: Init walk state callbacks 142 * 143 ******************************************************************************/ 144 145ACPI_STATUS 146AcpiDsInitCallbacks ( 147 ACPI_WALK_STATE *WalkState, 148 UINT32 PassNumber) 149{ 150 151 switch (PassNumber) 152 { 153 case 1: 154 WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; 155 WalkState->DescendingCallback = AcpiDsLoad1BeginOp; 156 WalkState->AscendingCallback = AcpiDsLoad1EndOp; 157 break; 158 159 case 2: 160 WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; 161 WalkState->DescendingCallback = AcpiDsLoad2BeginOp; 162 WalkState->AscendingCallback = AcpiDsLoad2EndOp; 163 break; 164 165 case 3: 166 WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; 167 WalkState->DescendingCallback = AcpiDsExecBeginOp; 168 WalkState->AscendingCallback = AcpiDsExecEndOp; 169 break; 170 171 default: 172 return (AE_BAD_PARAMETER); 173 } 174 175 return (AE_OK); 176} 177 178 179/******************************************************************************* 180 * 181 * FUNCTION: AcpiDsLoad1BeginOp 182 * 183 * PARAMETERS: WalkState - Current state of the parse tree walk 184 * Op - Op that has been just been reached in the 185 * walk; Arguments have not been evaluated yet. 186 * 187 * RETURN: Status 188 * 189 * DESCRIPTION: Descending callback used during the loading of ACPI tables. 190 * 191 ******************************************************************************/ 192 193ACPI_STATUS 194AcpiDsLoad1BeginOp ( 195 ACPI_WALK_STATE *WalkState, 196 ACPI_PARSE_OBJECT **OutOp) 197{ 198 ACPI_PARSE_OBJECT *Op; 199 ACPI_NAMESPACE_NODE *Node; 200 ACPI_STATUS Status; 201 ACPI_OBJECT_TYPE ObjectType; 202 NATIVE_CHAR *Path; 203 204 205 ACPI_FUNCTION_NAME ("DsLoad1BeginOp"); 206 207 Op = WalkState->Op; 208 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); 209 210 211 if (Op && (Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)) 212 { 213 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); 214 } 215 216 /* We are only interested in opcodes that have an associated name */ 217 218 if (Op) 219 { 220 if (!(WalkState->OpInfo->Flags & AML_NAMED)) 221 { 222 *OutOp = Op; 223 return (AE_OK); 224 } 225 226 /* Check if this object has already been installed in the namespace */ 227 228 if (Op->Common.Node) 229 { 230 *OutOp = Op; 231 return (AE_OK); 232 } 233 } 234 235 Path = AcpiPsGetNextNamestring (&WalkState->ParserState); 236 237 /* Map the raw opcode into an internal object type */ 238 239 ObjectType = WalkState->OpInfo->ObjectType; 240 241 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 242 "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); 243 244 /* 245 * Enter the named type into the internal namespace. We enter the name 246 * as we go downward in the parse tree. Any necessary subobjects that involve 247 * arguments to the opcode must be created as we go back up the parse tree later. 248 */ 249 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, 250 ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH, WalkState, &(Node)); 251 252 if (ACPI_FAILURE (Status)) 253 { 254 return (Status); 255 } 256 257 if (!Op) 258 { 259 /* Create a new op */ 260 261 Op = AcpiPsAllocOp (WalkState->Opcode); 262 if (!Op) 263 { 264 return (AE_NO_MEMORY); 265 } 266 } 267 268 /* Initialize */ 269 270 Op->Named.Name = Node->Name.Integer; 271 272 /* 273 * Put the Node in the "op" object that the parser uses, so we 274 * can get it again quickly when this scope is closed 275 */ 276 Op->Common.Node = Node; 277 AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op); 278 279 *OutOp = Op; 280 return (Status); 281} 282 283 284/******************************************************************************* 285 * 286 * FUNCTION: AcpiDsLoad1EndOp 287 * 288 * PARAMETERS: WalkState - Current state of the parse tree walk 289 * Op - Op that has been just been completed in the 290 * walk; Arguments have now been evaluated. 291 * 292 * RETURN: Status 293 * 294 * DESCRIPTION: Ascending callback used during the loading of the namespace, 295 * both control methods and everything else. 296 * 297 ******************************************************************************/ 298 299ACPI_STATUS 300AcpiDsLoad1EndOp ( 301 ACPI_WALK_STATE *WalkState) 302{ 303 ACPI_PARSE_OBJECT *Op; 304 ACPI_OBJECT_TYPE ObjectType; 305 ACPI_STATUS Status = AE_OK; 306 307 308 ACPI_FUNCTION_NAME ("DsLoad1EndOp"); 309 310 Op = WalkState->Op; 311 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); 312 313 314 /* We are only interested in opcodes that have an associated name */ 315 316 if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD))) 317 { 318 return (AE_OK); 319 } 320 321 /* Get the object type to determine if we should pop the scope */ 322 323 ObjectType = WalkState->OpInfo->ObjectType; 324 325 if (WalkState->OpInfo->Flags & AML_FIELD) 326 { 327 if (WalkState->Opcode == AML_FIELD_OP || 328 WalkState->Opcode == AML_BANK_FIELD_OP || 329 WalkState->Opcode == AML_INDEX_FIELD_OP) 330 { 331 Status = AcpiDsInitFieldObjects (Op, WalkState); 332 } 333 return (Status); 334 } 335 336 337 if (Op->Common.AmlOpcode == AML_REGION_OP) 338 { 339 Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, 340 (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), WalkState); 341 if (ACPI_FAILURE (Status)) 342 { 343 return (Status); 344 } 345 } 346 347 if (Op->Common.AmlOpcode == AML_NAME_OP) 348 { 349 /* For Name opcode, get the object type from the argument */ 350 351 if (Op->Common.Value.Arg) 352 { 353 ObjectType = (AcpiPsGetOpcodeInfo ((Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType; 354 Op->Common.Node->Type = (UINT8) ObjectType; 355 } 356 } 357 358 /* Pop the scope stack */ 359 360 if (AcpiNsOpensScope (ObjectType)) 361 { 362 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", 363 AcpiUtGetTypeName (ObjectType), Op)); 364 365 Status = AcpiDsScopeStackPop (WalkState); 366 } 367 368 return (Status); 369} 370 371 372/******************************************************************************* 373 * 374 * FUNCTION: AcpiDsLoad2BeginOp 375 * 376 * PARAMETERS: WalkState - Current state of the parse tree walk 377 * Op - Op that has been just been reached in the 378 * walk; Arguments have not been evaluated yet. 379 * 380 * RETURN: Status 381 * 382 * DESCRIPTION: Descending callback used during the loading of ACPI tables. 383 * 384 ******************************************************************************/ 385 386ACPI_STATUS 387AcpiDsLoad2BeginOp ( 388 ACPI_WALK_STATE *WalkState, 389 ACPI_PARSE_OBJECT **OutOp) 390{ 391 ACPI_PARSE_OBJECT *Op; 392 ACPI_NAMESPACE_NODE *Node; 393 ACPI_STATUS Status; 394 ACPI_OBJECT_TYPE ObjectType; 395 NATIVE_CHAR *BufferPtr; 396 397 398 ACPI_FUNCTION_NAME ("DsLoad2BeginOp"); 399 400 401 Op = WalkState->Op; 402 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); 403 404 if (Op) 405 { 406 /* We only care about Namespace opcodes here */ 407 408 if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || 409 (!(WalkState->OpInfo->Flags & AML_NAMED))) 410 { 411 return (AE_OK); 412 } 413 414 /* 415 * Get the name we are going to enter or lookup in the namespace 416 */ 417 if (WalkState->Opcode == AML_INT_NAMEPATH_OP) 418 { 419 /* For Namepath op, get the path string */ 420 421 BufferPtr = Op->Common.Value.String; 422 if (!BufferPtr) 423 { 424 /* No name, just exit */ 425 426 return (AE_OK); 427 } 428 } 429 else 430 { 431 /* Get name from the op */ 432 433 BufferPtr = (NATIVE_CHAR *) &Op->Named.Name; 434 } 435 } 436 else 437 { 438 /* Get the namestring from the raw AML */ 439 440 BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); 441 } 442 443 /* Map the opcode into an internal object type */ 444 445 ObjectType = WalkState->OpInfo->ObjectType; 446 447 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 448 "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); 449 450 451 if (WalkState->Opcode == AML_FIELD_OP || 452 WalkState->Opcode == AML_BANK_FIELD_OP || 453 WalkState->Opcode == AML_INDEX_FIELD_OP) 454 { 455 Node = NULL; 456 Status = AE_OK; 457 } 458 else if (WalkState->Opcode == AML_INT_NAMEPATH_OP) 459 { 460 /* 461 * The NamePath is an object reference to an existing object. Don't enter the 462 * name into the namespace, but look it up for use later 463 */ 464 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, 465 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); 466 } 467 else 468 { 469 /* All other opcodes */ 470 471 if (Op && Op->Common.Node) 472 { 473 /* This op/node was previously entered into the namespace */ 474 475 Node = Op->Common.Node; 476 477 if (AcpiNsOpensScope (ObjectType)) 478 { 479 Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); 480 if (ACPI_FAILURE (Status)) 481 { 482 return (Status); 483 } 484 485 } 486 return (AE_OK); 487 } 488 489 /* 490 * Enter the named type into the internal namespace. We enter the name 491 * as we go downward in the parse tree. Any necessary subobjects that involve 492 * arguments to the opcode must be created as we go back up the parse tree later. 493 */ 494 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, 495 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, WalkState, &(Node)); 496 } 497 498 if (ACPI_SUCCESS (Status)) 499 { 500 if (!Op) 501 { 502 /* Create a new op */ 503 504 Op = AcpiPsAllocOp (WalkState->Opcode); 505 if (!Op) 506 { 507 return (AE_NO_MEMORY); 508 } 509 510 /* Initialize the new op */ 511 512 if (Node) 513 { 514 Op->Named.Name = Node->Name.Integer; 515 } 516 if (OutOp) 517 { 518 *OutOp = Op; 519 } 520 } 521 522 /* 523 * Put the Node in the "op" object that the parser uses, so we 524 * can get it again quickly when this scope is closed 525 */ 526 Op->Common.Node = Node; 527 } 528 529 return (Status); 530} 531 532 533/******************************************************************************* 534 * 535 * FUNCTION: AcpiDsLoad2EndOp 536 * 537 * PARAMETERS: WalkState - Current state of the parse tree walk 538 * Op - Op that has been just been completed in the 539 * walk; Arguments have now been evaluated. 540 * 541 * RETURN: Status 542 * 543 * DESCRIPTION: Ascending callback used during the loading of the namespace, 544 * both control methods and everything else. 545 * 546 ******************************************************************************/ 547 548ACPI_STATUS 549AcpiDsLoad2EndOp ( 550 ACPI_WALK_STATE *WalkState) 551{ 552 ACPI_PARSE_OBJECT *Op; 553 ACPI_STATUS Status = AE_OK; 554 ACPI_OBJECT_TYPE ObjectType; 555 ACPI_NAMESPACE_NODE *Node; 556 ACPI_PARSE_OBJECT *Arg; 557 ACPI_NAMESPACE_NODE *NewNode; 558 UINT32 i; 559 560 561 ACPI_FUNCTION_NAME ("DsLoad2EndOp"); 562 563 Op = WalkState->Op; 564 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", 565 WalkState->OpInfo->Name, Op, WalkState)); 566 567 /* Only interested in opcodes that have namespace objects */ 568 569 if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) 570 { 571 return (AE_OK); 572 } 573 574 if (Op->Common.AmlOpcode == AML_SCOPE_OP) 575 { 576 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 577 "Ending scope Op=%p State=%p\n", Op, WalkState)); 578 579 if (Op->Named.Name == ACPI_UINT16_MAX) 580 { 581 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n", 582 Op, WalkState)); 583 return (AE_OK); 584 } 585 } 586 587 588 ObjectType = WalkState->OpInfo->ObjectType; 589 590 /* 591 * Get the Node/name from the earlier lookup 592 * (It was saved in the *op structure) 593 */ 594 Node = Op->Common.Node; 595 596 /* 597 * Put the Node on the object stack (Contains the ACPI Name of 598 * this object) 599 */ 600 WalkState->Operands[0] = (void *) Node; 601 WalkState->NumOperands = 1; 602 603 /* Pop the scope stack */ 604 605 if (AcpiNsOpensScope (ObjectType)) 606 { 607 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", 608 AcpiUtGetTypeName (ObjectType), Op)); 609 610 Status = AcpiDsScopeStackPop (WalkState); 611 if (ACPI_FAILURE (Status)) 612 { 613 return (Status); 614 } 615 } 616 617 /* 618 * Named operations are as follows: 619 * 620 * AML_ALIAS 621 * AML_BANKFIELD 622 * AML_CREATEBITFIELD 623 * AML_CREATEBYTEFIELD 624 * AML_CREATEDWORDFIELD 625 * AML_CREATEFIELD 626 * AML_CREATEQWORDFIELD 627 * AML_CREATEWORDFIELD 628 * AML_DATA_REGION 629 * AML_DEVICE 630 * AML_EVENT 631 * AML_FIELD 632 * AML_INDEXFIELD 633 * AML_METHOD 634 * AML_METHODCALL 635 * AML_MUTEX 636 * AML_NAME 637 * AML_NAMEDFIELD 638 * AML_OPREGION 639 * AML_POWERRES 640 * AML_PROCESSOR 641 * AML_SCOPE 642 * AML_THERMALZONE 643 */ 644 645 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 646 "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", 647 AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node)); 648 649 /* Decode the opcode */ 650 651 Arg = Op->Common.Value.Arg; 652 653 switch (WalkState->OpInfo->Type) 654 { 655 case AML_TYPE_CREATE_FIELD: 656 657 /* 658 * Create the field object, but the field buffer and index must 659 * be evaluated later during the execution phase 660 */ 661 Status = AcpiDsCreateBufferField (Op, WalkState); 662 break; 663 664 665 case AML_TYPE_NAMED_FIELD: 666 667 switch (Op->Common.AmlOpcode) 668 { 669 case AML_INDEX_FIELD_OP: 670 671 Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, 672 WalkState); 673 break; 674 675 case AML_BANK_FIELD_OP: 676 677 Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); 678 break; 679 680 case AML_FIELD_OP: 681 682 Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState); 683 break; 684 685 default: 686 /* All NAMED_FIELD opcodes must be handled above */ 687 break; 688 } 689 break; 690 691 692 case AML_TYPE_NAMED_SIMPLE: 693 694 Status = AcpiDsCreateOperands (WalkState, Arg); 695 if (ACPI_FAILURE (Status)) 696 { 697 goto Cleanup; 698 } 699 700 switch (Op->Common.AmlOpcode) 701 { 702 case AML_PROCESSOR_OP: 703 704 Status = AcpiExCreateProcessor (WalkState); 705 break; 706 707 case AML_POWER_RES_OP: 708 709 Status = AcpiExCreatePowerResource (WalkState); 710 break; 711 712 case AML_MUTEX_OP: 713 714 Status = AcpiExCreateMutex (WalkState); 715 break; 716 717 case AML_EVENT_OP: 718 719 Status = AcpiExCreateEvent (WalkState); 720 break; 721 722 case AML_DATA_REGION_OP: 723 724 Status = AcpiExCreateTableRegion (WalkState); 725 break; 726 727 case AML_ALIAS_OP: 728 729 Status = AcpiExCreateAlias (WalkState); 730 break; 731 732 default: 733 /* Unknown opcode */ 734 735 Status = AE_OK; 736 goto Cleanup; 737 } 738 739 /* Delete operands */ 740 741 for (i = 1; i < WalkState->NumOperands; i++) 742 { 743 AcpiUtRemoveReference (WalkState->Operands[i]); 744 WalkState->Operands[i] = NULL; 745 } 746 747 break; 748 749 750 case AML_TYPE_NAMED_COMPLEX: 751 752 switch (Op->Common.AmlOpcode) 753 { 754 case AML_METHOD_OP: 755 /* 756 * MethodOp PkgLength NameString MethodFlags TermList 757 */ 758 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 759 "LOADING-Method: State=%p Op=%p NamedObj=%p\n", 760 WalkState, Op, Node)); 761 762 if (!AcpiNsGetAttachedObject (Node)) 763 { 764 Status = AcpiDsCreateOperands (WalkState, Arg); 765 if (ACPI_FAILURE (Status)) 766 { 767 goto Cleanup; 768 } 769 770 Status = AcpiExCreateMethod (Op->Named.Data, 771 Op->Named.Length, WalkState); 772 } 773 break; 774 775 776 case AML_REGION_OP: 777 /* 778 * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId. 779 * (We must save the address of the AML of the address and length operands) 780 */ 781 /* 782 * If we have a valid region, initialize it 783 * Namespace is NOT locked at this point. 784 */ 785 Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), FALSE); 786 if (ACPI_FAILURE (Status)) 787 { 788 /* 789 * If AE_NOT_EXIST is returned, it is not fatal 790 * because many regions get created before a handler 791 * is installed for said region. 792 */ 793 if (AE_NOT_EXIST == Status) 794 { 795 Status = AE_OK; 796 } 797 } 798 break; 799 800 801 case AML_NAME_OP: 802 803 Status = AcpiDsCreateNode (WalkState, Node, Op); 804 break; 805 806 807 default: 808 /* All NAMED_COMPLEX opcodes must be handled above */ 809 break; 810 } 811 break; 812 813 814 case AML_CLASS_INTERNAL: 815 816 /* case AML_INT_NAMEPATH_OP: */ 817 break; 818 819 820 case AML_CLASS_METHOD_CALL: 821 822 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 823 "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", 824 WalkState, Op, Node)); 825 826 /* 827 * Lookup the method name and save the Node 828 */ 829 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 830 ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, 831 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, 832 WalkState, &(NewNode)); 833 if (ACPI_SUCCESS (Status)) 834 { 835 /* 836 * Make sure that what we found is indeed a method 837 * We didn't search for a method on purpose, to see if the name would resolve 838 */ 839 if (NewNode->Type != ACPI_TYPE_METHOD) 840 { 841 Status = AE_AML_OPERAND_TYPE; 842 } 843 844 /* We could put the returned object (Node) on the object stack for later, but 845 * for now, we will put it in the "op" object that the parser uses, so we 846 * can get it again at the end of this scope 847 */ 848 Op->Common.Node = NewNode; 849 } 850 851 break; 852 853 854 default: 855 break; 856 } 857 858 859Cleanup: 860 861 /* Remove the Node pushed at the very beginning */ 862 863 WalkState->Operands[0] = NULL; 864 WalkState->NumOperands = 0; 865 return (Status); 866} 867 868 869