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