1 /******************************************************************************
3 * Module Name: dswload - Dispatcher namespace load callbacks
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
13 * All rights reserved.
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
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
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;
38 * The above copyright and patent license is granted only if the following
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.
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
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
73 * 3.4. Intel retains all right, title, and interest in and to the Original
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.
81 * 4. Disclaimer and Export Compliance
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
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
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.
115 *****************************************************************************/
117 #define __DSWLOAD_C__
120 #include "acparser.h"
122 #include "acdispat.h"
123 #include "acinterp.h"
124 #include "acnamesp.h"
125 #include "acevents.h"
128 #define _COMPONENT ACPI_DISPATCHER
129 ACPI_MODULE_NAME ("dswload")
132 /*******************************************************************************
134 * FUNCTION: AcpiDsInitCallbacks
136 * PARAMETERS: WalkState - Current state of the parse tree walk
137 * PassNumber - 1, 2, or 3
141 * DESCRIPTION: Init walk state callbacks
143 ******************************************************************************/
146 AcpiDsInitCallbacks (
147 ACPI_WALK_STATE *WalkState,
154 WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE;
155 WalkState->DescendingCallback = AcpiDsLoad1BeginOp;
156 WalkState->AscendingCallback = AcpiDsLoad1EndOp;
160 WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE;
161 WalkState->DescendingCallback = AcpiDsLoad2BeginOp;
162 WalkState->AscendingCallback = AcpiDsLoad2EndOp;
166 #ifndef ACPI_NO_METHOD_EXECUTION
167 WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE;
168 WalkState->DescendingCallback = AcpiDsExecBeginOp;
169 WalkState->AscendingCallback = AcpiDsExecEndOp;
174 return (AE_BAD_PARAMETER);
181 /*******************************************************************************
183 * FUNCTION: AcpiDsLoad1BeginOp
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.
191 * DESCRIPTION: Descending callback used during the loading of ACPI tables.
193 ******************************************************************************/
197 ACPI_WALK_STATE *WalkState,
198 ACPI_PARSE_OBJECT **OutOp)
200 ACPI_PARSE_OBJECT *Op;
201 ACPI_NAMESPACE_NODE *Node;
203 ACPI_OBJECT_TYPE ObjectType;
208 ACPI_FUNCTION_NAME ("DsLoad1BeginOp");
212 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
214 /* We are only interested in opcodes that have an associated name */
218 if (!(WalkState->OpInfo->Flags & AML_NAMED))
221 if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
222 (WalkState->OpInfo->Class == AML_CLASS_CONTROL))
224 AcpiOsPrintf ("\n\n***EXECUTABLE OPCODE %s***\n\n", WalkState->OpInfo->Name);
226 return (AE_CTRL_SKIP);
233 /* Check if this object has already been installed in the namespace */
242 Path = AcpiPsGetNextNamestring (&WalkState->ParserState);
244 /* Map the raw opcode into an internal object type */
246 ObjectType = WalkState->OpInfo->ObjectType;
248 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
249 "State=%p Op=%p [%s]\n", WalkState, Op, AcpiUtGetTypeName (ObjectType)));
251 switch (WalkState->Opcode)
256 * The target name of the Scope() operator must exist at this point so
257 * that we can actually open the scope to enter new names underneath it.
258 * Allow search-to-root for single namesegs.
260 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
261 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
262 if (ACPI_FAILURE (Status))
264 ACPI_REPORT_NSERROR (Path, Status);
269 * Check to make sure that the target is
270 * one of the opcodes that actually opens a scope
274 case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
275 case ACPI_TYPE_DEVICE:
276 case ACPI_TYPE_POWER:
277 case ACPI_TYPE_PROCESSOR:
278 case ACPI_TYPE_THERMAL:
280 /* These are acceptable types */
283 case ACPI_TYPE_INTEGER:
284 case ACPI_TYPE_STRING:
285 case ACPI_TYPE_BUFFER:
288 * These types we will allow, but we will change the type. This
289 * enables some existing code of the form:
292 * Scope (DEB) { ... }
294 * Note: silently change the type here. On the second pass, we will report a warning
297 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
298 Path, AcpiUtGetTypeName (Node->Type)));
300 Node->Type = ACPI_TYPE_ANY;
301 WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
306 /* All other types are an error */
308 ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
309 AcpiUtGetTypeName (Node->Type), Path));
311 return (AE_AML_OPERAND_TYPE);
319 * For all other named opcodes, we will enter the name into the namespace.
321 * Setup the search flags.
322 * Since we are entering a name into the namespace, we do not want to
323 * enable the search-to-root upsearch.
325 * There are only two conditions where it is acceptable that the name
327 * 1) the Scope() operator can reopen a scoping object that was
328 * previously defined (Scope, Method, Device, etc.)
329 * 2) Whenever we are parsing a deferred opcode (OpRegion, Buffer,
330 * BufferField, or Package), the name of the object is already
333 if (WalkState->DeferredNode)
335 /* This name is already in the namespace, get the node */
337 Node = WalkState->DeferredNode;
342 Flags = ACPI_NS_NO_UPSEARCH;
343 if ((WalkState->Opcode != AML_SCOPE_OP) &&
344 (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)))
346 Flags |= ACPI_NS_ERROR_IF_FOUND;
347 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n",
348 AcpiUtGetTypeName (ObjectType)));
352 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n",
353 AcpiUtGetTypeName (ObjectType)));
357 * Enter the named type into the internal namespace. We enter the name
358 * as we go downward in the parse tree. Any necessary subobjects that involve
359 * arguments to the opcode must be created as we go back up the parse tree later.
361 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
362 ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
363 if (ACPI_FAILURE (Status))
365 ACPI_REPORT_NSERROR (Path, Status);
376 /* Create a new op */
378 Op = AcpiPsAllocOp (WalkState->Opcode);
381 return (AE_NO_MEMORY);
387 Op->Named.Name = Node->Name.Integer;
389 #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
390 Op->Named.Path = (UINT8 *) Path;
395 * Put the Node in the "op" object that the parser uses, so we
396 * can get it again quickly when this scope is closed
398 Op->Common.Node = Node;
399 AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op);
406 /*******************************************************************************
408 * FUNCTION: AcpiDsLoad1EndOp
410 * PARAMETERS: WalkState - Current state of the parse tree walk
411 * Op - Op that has been just been completed in the
412 * walk; Arguments have now been evaluated.
416 * DESCRIPTION: Ascending callback used during the loading of the namespace,
417 * both control methods and everything else.
419 ******************************************************************************/
423 ACPI_WALK_STATE *WalkState)
425 ACPI_PARSE_OBJECT *Op;
426 ACPI_OBJECT_TYPE ObjectType;
427 ACPI_STATUS Status = AE_OK;
430 ACPI_FUNCTION_NAME ("DsLoad1EndOp");
434 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
436 /* We are only interested in opcodes that have an associated name */
438 if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD)))
443 /* Get the object type to determine if we should pop the scope */
445 ObjectType = WalkState->OpInfo->ObjectType;
447 #ifndef ACPI_NO_METHOD_EXECUTION
448 if (WalkState->OpInfo->Flags & AML_FIELD)
450 if (WalkState->Opcode == AML_FIELD_OP ||
451 WalkState->Opcode == AML_BANK_FIELD_OP ||
452 WalkState->Opcode == AML_INDEX_FIELD_OP)
454 Status = AcpiDsInitFieldObjects (Op, WalkState);
460 if (Op->Common.AmlOpcode == AML_REGION_OP)
462 Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
463 (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), WalkState);
464 if (ACPI_FAILURE (Status))
471 if (Op->Common.AmlOpcode == AML_NAME_OP)
473 /* For Name opcode, get the object type from the argument */
475 if (Op->Common.Value.Arg)
477 ObjectType = (AcpiPsGetOpcodeInfo ((Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType;
478 Op->Common.Node->Type = (UINT8) ObjectType;
482 if (Op->Common.AmlOpcode == AML_METHOD_OP)
485 * MethodOp PkgLength NameString MethodFlags TermList
487 * Note: We must create the method node/object pair as soon as we
488 * see the method declaration. This allows later pass1 parsing
489 * of invocations of the method (need to know the number of
492 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
493 "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
494 WalkState, Op, Op->Named.Node));
496 if (!AcpiNsGetAttachedObject (Op->Named.Node))
498 WalkState->Operands[0] = (void *) Op->Named.Node;
499 WalkState->NumOperands = 1;
501 Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
502 if (ACPI_SUCCESS (Status))
504 Status = AcpiExCreateMethod (Op->Named.Data,
505 Op->Named.Length, WalkState);
507 WalkState->Operands[0] = NULL;
508 WalkState->NumOperands = 0;
510 if (ACPI_FAILURE (Status))
517 /* Pop the scope stack */
519 if (AcpiNsOpensScope (ObjectType))
521 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
522 AcpiUtGetTypeName (ObjectType), Op));
524 Status = AcpiDsScopeStackPop (WalkState);
531 /*******************************************************************************
533 * FUNCTION: AcpiDsLoad2BeginOp
535 * PARAMETERS: WalkState - Current state of the parse tree walk
536 * Op - Op that has been just been reached in the
537 * walk; Arguments have not been evaluated yet.
541 * DESCRIPTION: Descending callback used during the loading of ACPI tables.
543 ******************************************************************************/
547 ACPI_WALK_STATE *WalkState,
548 ACPI_PARSE_OBJECT **OutOp)
550 ACPI_PARSE_OBJECT *Op;
551 ACPI_NAMESPACE_NODE *Node;
553 ACPI_OBJECT_TYPE ObjectType;
557 ACPI_FUNCTION_TRACE ("DsLoad2BeginOp");
561 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
565 /* We only care about Namespace opcodes here */
567 if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
568 (!(WalkState->OpInfo->Flags & AML_NAMED)))
570 return_ACPI_STATUS (AE_OK);
574 * Get the name we are going to enter or lookup in the namespace
576 if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
578 /* For Namepath op, get the path string */
580 BufferPtr = Op->Common.Value.String;
583 /* No name, just exit */
585 return_ACPI_STATUS (AE_OK);
590 /* Get name from the op */
592 BufferPtr = (char *) &Op->Named.Name;
597 /* Get the namestring from the raw AML */
599 BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState);
602 /* Map the opcode into an internal object type */
604 ObjectType = WalkState->OpInfo->ObjectType;
606 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
607 "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType));
610 switch (WalkState->Opcode)
613 case AML_BANK_FIELD_OP:
614 case AML_INDEX_FIELD_OP:
620 case AML_INT_NAMEPATH_OP:
623 * The NamePath is an object reference to an existing object. Don't enter the
624 * name into the namespace, but look it up for use later
626 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
627 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
633 * The Path is an object reference to an existing object. Don't enter the
634 * name into the namespace, but look it up for use later
636 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
637 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
638 if (ACPI_FAILURE (Status))
640 ACPI_REPORT_NSERROR (BufferPtr, Status);
641 return_ACPI_STATUS (Status);
644 * We must check to make sure that the target is
645 * one of the opcodes that actually opens a scope
649 case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
650 case ACPI_TYPE_DEVICE:
651 case ACPI_TYPE_POWER:
652 case ACPI_TYPE_PROCESSOR:
653 case ACPI_TYPE_THERMAL:
655 /* These are acceptable types */
658 case ACPI_TYPE_INTEGER:
659 case ACPI_TYPE_STRING:
660 case ACPI_TYPE_BUFFER:
663 * These types we will allow, but we will change the type. This
664 * enables some existing code of the form:
667 * Scope (DEB) { ... }
670 ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
671 BufferPtr, AcpiUtGetTypeName (Node->Type)));
673 Node->Type = ACPI_TYPE_ANY;
674 WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
679 /* All other types are an error */
681 ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n",
682 AcpiUtGetTypeName (Node->Type), BufferPtr));
684 return (AE_AML_OPERAND_TYPE);
690 /* All other opcodes */
692 if (Op && Op->Common.Node)
694 /* This op/node was previously entered into the namespace */
696 Node = Op->Common.Node;
698 if (AcpiNsOpensScope (ObjectType))
700 Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
701 if (ACPI_FAILURE (Status))
703 return_ACPI_STATUS (Status);
707 return_ACPI_STATUS (AE_OK);
711 * Enter the named type into the internal namespace. We enter the name
712 * as we go downward in the parse tree. Any necessary subobjects that involve
713 * arguments to the opcode must be created as we go back up the parse tree later.
715 * Note: Name may already exist if we are executing a deferred opcode.
717 if (WalkState->DeferredNode)
719 /* This name is already in the namespace, get the node */
721 Node = WalkState->DeferredNode;
726 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
727 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, WalkState, &(Node));
731 if (ACPI_FAILURE (Status))
733 ACPI_REPORT_NSERROR (BufferPtr, Status);
734 return_ACPI_STATUS (Status);
740 /* Create a new op */
742 Op = AcpiPsAllocOp (WalkState->Opcode);
745 return_ACPI_STATUS (AE_NO_MEMORY);
748 /* Initialize the new op */
752 Op->Named.Name = Node->Name.Integer;
761 * Put the Node in the "op" object that the parser uses, so we
762 * can get it again quickly when this scope is closed
764 Op->Common.Node = Node;
766 return_ACPI_STATUS (Status);
770 /*******************************************************************************
772 * FUNCTION: AcpiDsLoad2EndOp
774 * PARAMETERS: WalkState - Current state of the parse tree walk
775 * Op - Op that has been just been completed in the
776 * walk; Arguments have now been evaluated.
780 * DESCRIPTION: Ascending callback used during the loading of the namespace,
781 * both control methods and everything else.
783 ******************************************************************************/
787 ACPI_WALK_STATE *WalkState)
789 ACPI_PARSE_OBJECT *Op;
790 ACPI_STATUS Status = AE_OK;
791 ACPI_OBJECT_TYPE ObjectType;
792 ACPI_NAMESPACE_NODE *Node;
793 ACPI_PARSE_OBJECT *Arg;
794 ACPI_NAMESPACE_NODE *NewNode;
795 #ifndef ACPI_NO_METHOD_EXECUTION
800 ACPI_FUNCTION_TRACE ("DsLoad2EndOp");
803 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
804 WalkState->OpInfo->Name, Op, WalkState));
806 /* Only interested in opcodes that have namespace objects */
808 if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
810 return_ACPI_STATUS (AE_OK);
813 if (Op->Common.AmlOpcode == AML_SCOPE_OP)
815 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
816 "Ending scope Op=%p State=%p\n", Op, WalkState));
820 ObjectType = WalkState->OpInfo->ObjectType;
823 * Get the Node/name from the earlier lookup
824 * (It was saved in the *op structure)
826 Node = Op->Common.Node;
829 * Put the Node on the object stack (Contains the ACPI Name of
832 WalkState->Operands[0] = (void *) Node;
833 WalkState->NumOperands = 1;
835 /* Pop the scope stack */
837 if (AcpiNsOpensScope (ObjectType) && (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP))
839 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
840 AcpiUtGetTypeName (ObjectType), Op));
842 Status = AcpiDsScopeStackPop (WalkState);
843 if (ACPI_FAILURE (Status))
850 * Named operations are as follows:
855 * AML_CREATEBYTEFIELD
856 * AML_CREATEDWORDFIELD
858 * AML_CREATEQWORDFIELD
859 * AML_CREATEWORDFIELD
877 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
878 "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
879 AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node));
881 /* Decode the opcode */
883 Arg = Op->Common.Value.Arg;
885 switch (WalkState->OpInfo->Type)
887 #ifndef ACPI_NO_METHOD_EXECUTION
889 case AML_TYPE_CREATE_FIELD:
892 * Create the field object, but the field buffer and index must
893 * be evaluated later during the execution phase
895 Status = AcpiDsCreateBufferField (Op, WalkState);
899 case AML_TYPE_NAMED_FIELD:
901 switch (Op->Common.AmlOpcode)
903 case AML_INDEX_FIELD_OP:
905 Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node,
909 case AML_BANK_FIELD_OP:
911 Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState);
916 Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState);
920 /* All NAMED_FIELD opcodes must be handled above */
926 case AML_TYPE_NAMED_SIMPLE:
928 Status = AcpiDsCreateOperands (WalkState, Arg);
929 if (ACPI_FAILURE (Status))
934 switch (Op->Common.AmlOpcode)
936 case AML_PROCESSOR_OP:
938 Status = AcpiExCreateProcessor (WalkState);
941 case AML_POWER_RES_OP:
943 Status = AcpiExCreatePowerResource (WalkState);
948 Status = AcpiExCreateMutex (WalkState);
953 Status = AcpiExCreateEvent (WalkState);
956 case AML_DATA_REGION_OP:
958 Status = AcpiExCreateTableRegion (WalkState);
963 Status = AcpiExCreateAlias (WalkState);
973 /* Delete operands */
975 for (i = 1; i < WalkState->NumOperands; i++)
977 AcpiUtRemoveReference (WalkState->Operands[i]);
978 WalkState->Operands[i] = NULL;
982 #endif /* ACPI_NO_METHOD_EXECUTION */
984 case AML_TYPE_NAMED_COMPLEX:
986 switch (Op->Common.AmlOpcode)
988 #ifndef ACPI_NO_METHOD_EXECUTION
991 * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId.
992 * (We must save the address of the AML of the address and length operands)
995 * If we have a valid region, initialize it
996 * Namespace is NOT locked at this point.
998 Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), FALSE);
999 if (ACPI_FAILURE (Status))
1002 * If AE_NOT_EXIST is returned, it is not fatal
1003 * because many regions get created before a handler
1004 * is installed for said region.
1006 if (AE_NOT_EXIST == Status)
1016 Status = AcpiDsCreateNode (WalkState, Node, Op);
1018 #endif /* ACPI_NO_METHOD_EXECUTION */
1022 /* All NAMED_COMPLEX opcodes must be handled above */
1023 /* Note: Method objects were already created in Pass 1 */
1029 case AML_CLASS_INTERNAL:
1031 /* case AML_INT_NAMEPATH_OP: */
1035 case AML_CLASS_METHOD_CALL:
1037 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
1038 "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
1039 WalkState, Op, Node));
1042 * Lookup the method name and save the Node
1044 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
1045 ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
1046 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
1047 WalkState, &(NewNode));
1048 if (ACPI_SUCCESS (Status))
1051 * Make sure that what we found is indeed a method
1052 * We didn't search for a method on purpose, to see if the name would resolve
1054 if (NewNode->Type != ACPI_TYPE_METHOD)
1056 Status = AE_AML_OPERAND_TYPE;
1059 /* We could put the returned object (Node) on the object stack for later, but
1060 * for now, we will put it in the "op" object that the parser uses, so we
1061 * can get it again at the end of this scope
1063 Op->Common.Node = NewNode;
1067 ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
1078 /* Remove the Node pushed at the very beginning */
1080 WalkState->Operands[0] = NULL;
1081 WalkState->NumOperands = 0;
1082 return_ACPI_STATUS (Status);