xref: /netbsd-src/sys/external/bsd/acpica/dist/dispatcher/dswload2.c (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /******************************************************************************
2  *
3  * Module Name: dswload2 - Dispatcher second pass namespace load callbacks
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2018, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #include "acpi.h"
45 #include "accommon.h"
46 #include "acparser.h"
47 #include "amlcode.h"
48 #include "acdispat.h"
49 #include "acinterp.h"
50 #include "acnamesp.h"
51 #include "acevents.h"
52 
53 #define _COMPONENT          ACPI_DISPATCHER
54         ACPI_MODULE_NAME    ("dswload2")
55 
56 
57 /*******************************************************************************
58  *
59  * FUNCTION:    AcpiDsLoad2BeginOp
60  *
61  * PARAMETERS:  WalkState       - Current state of the parse tree walk
62  *              OutOp           - Wher to return op if a new one is created
63  *
64  * RETURN:      Status
65  *
66  * DESCRIPTION: Descending callback used during the loading of ACPI tables.
67  *
68  ******************************************************************************/
69 
70 ACPI_STATUS
71 AcpiDsLoad2BeginOp (
72     ACPI_WALK_STATE         *WalkState,
73     ACPI_PARSE_OBJECT       **OutOp)
74 {
75     ACPI_PARSE_OBJECT       *Op;
76     ACPI_NAMESPACE_NODE     *Node;
77     ACPI_STATUS             Status;
78     ACPI_OBJECT_TYPE        ObjectType;
79     char                    *BufferPtr;
80     UINT32                  Flags;
81 
82 
83     ACPI_FUNCTION_TRACE (DsLoad2BeginOp);
84 
85 
86     Op = WalkState->Op;
87     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
88 
89     if (Op)
90     {
91         if ((WalkState->ControlState) &&
92             (WalkState->ControlState->Common.State ==
93                 ACPI_CONTROL_CONDITIONAL_EXECUTING))
94         {
95             /* We are executing a while loop outside of a method */
96 
97             Status = AcpiDsExecBeginOp (WalkState, OutOp);
98             return_ACPI_STATUS (Status);
99         }
100 
101         /* We only care about Namespace opcodes here */
102 
103         if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE)   &&
104               (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
105             (!(WalkState->OpInfo->Flags & AML_NAMED)))
106         {
107             return_ACPI_STATUS (AE_OK);
108         }
109 
110         /* Get the name we are going to enter or lookup in the namespace */
111 
112         if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
113         {
114             /* For Namepath op, get the path string */
115 
116             BufferPtr = Op->Common.Value.String;
117             if (!BufferPtr)
118             {
119                 /* No name, just exit */
120 
121                 return_ACPI_STATUS (AE_OK);
122             }
123         }
124         else
125         {
126             /* Get name from the op */
127 
128             BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name);
129         }
130     }
131     else
132     {
133         /* Get the namestring from the raw AML */
134 
135         BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState);
136     }
137 
138     /* Map the opcode into an internal object type */
139 
140     ObjectType = WalkState->OpInfo->ObjectType;
141 
142     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
143         "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType));
144 
145     switch (WalkState->Opcode)
146     {
147     case AML_FIELD_OP:
148     case AML_BANK_FIELD_OP:
149     case AML_INDEX_FIELD_OP:
150 
151         Node = NULL;
152         Status = AE_OK;
153         break;
154 
155     case AML_INT_NAMEPATH_OP:
156         /*
157          * The NamePath is an object reference to an existing object.
158          * Don't enter the name into the namespace, but look it up
159          * for use later.
160          */
161         Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
162             ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
163             WalkState, &(Node));
164         break;
165 
166     case AML_SCOPE_OP:
167 
168         /* Special case for Scope(\) -> refers to the Root node */
169 
170         if (Op && (Op->Named.Node == AcpiGbl_RootNode))
171         {
172             Node = Op->Named.Node;
173 
174             Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
175             if (ACPI_FAILURE (Status))
176             {
177                 return_ACPI_STATUS (Status);
178             }
179         }
180         else
181         {
182             /*
183              * The Path is an object reference to an existing object.
184              * Don't enter the name into the namespace, but look it up
185              * for use later.
186              */
187             Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
188                 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
189                 WalkState, &(Node));
190             if (ACPI_FAILURE (Status))
191             {
192 #ifdef ACPI_ASL_COMPILER
193                 if (Status == AE_NOT_FOUND)
194                 {
195                     Status = AE_OK;
196                 }
197                 else
198                 {
199                     ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
200                         BufferPtr, Status);
201                 }
202 #else
203                 ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
204                     BufferPtr, Status);
205 #endif
206                 return_ACPI_STATUS (Status);
207             }
208         }
209 
210         /*
211          * We must check to make sure that the target is
212          * one of the opcodes that actually opens a scope
213          */
214         switch (Node->Type)
215         {
216         case ACPI_TYPE_ANY:
217         case ACPI_TYPE_LOCAL_SCOPE:         /* Scope */
218         case ACPI_TYPE_DEVICE:
219         case ACPI_TYPE_POWER:
220         case ACPI_TYPE_PROCESSOR:
221         case ACPI_TYPE_THERMAL:
222 
223             /* These are acceptable types */
224             break;
225 
226         case ACPI_TYPE_INTEGER:
227         case ACPI_TYPE_STRING:
228         case ACPI_TYPE_BUFFER:
229 
230             /*
231              * These types we will allow, but we will change the type.
232              * This enables some existing code of the form:
233              *
234              *  Name (DEB, 0)
235              *  Scope (DEB) { ... }
236              */
237             ACPI_WARNING ((AE_INFO,
238                 "Type override - [%4.4s] had invalid type (%s) "
239                 "for Scope operator, changed to type ANY",
240                 AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
241 
242             Node->Type = ACPI_TYPE_ANY;
243             WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
244             break;
245 
246         case ACPI_TYPE_METHOD:
247 
248             /*
249              * Allow scope change to root during execution of module-level
250              * code. Root is typed METHOD during this time.
251              */
252             if ((Node == AcpiGbl_RootNode) &&
253                 (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
254             {
255                 break;
256             }
257 
258             /*lint -fallthrough */
259 
260         default:
261 
262             /* All other types are an error */
263 
264             ACPI_ERROR ((AE_INFO,
265                 "Invalid type (%s) for target of "
266                 "Scope operator [%4.4s] (Cannot override)",
267                 AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
268 
269             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
270         }
271         break;
272 
273     default:
274 
275         /* All other opcodes */
276 
277         if (Op && Op->Common.Node)
278         {
279             /* This op/node was previously entered into the namespace */
280 
281             Node = Op->Common.Node;
282 
283             if (AcpiNsOpensScope (ObjectType))
284             {
285                 Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
286                 if (ACPI_FAILURE (Status))
287                 {
288                     return_ACPI_STATUS (Status);
289                 }
290             }
291 
292             return_ACPI_STATUS (AE_OK);
293         }
294 
295         /*
296          * Enter the named type into the internal namespace. We enter the name
297          * as we go downward in the parse tree. Any necessary subobjects that
298          * involve arguments to the opcode must be created as we go back up the
299          * parse tree later.
300          *
301          * Note: Name may already exist if we are executing a deferred opcode.
302          */
303         if (WalkState->DeferredNode)
304         {
305             /* This name is already in the namespace, get the node */
306 
307             Node = WalkState->DeferredNode;
308             Status = AE_OK;
309             break;
310         }
311 
312         Flags = ACPI_NS_NO_UPSEARCH;
313         if (WalkState->PassNumber == ACPI_IMODE_EXECUTE)
314         {
315             /* Execution mode, node cannot already exist, node is temporary */
316 
317             Flags |= ACPI_NS_ERROR_IF_FOUND;
318 
319             if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
320             {
321                 Flags |= ACPI_NS_TEMPORARY;
322             }
323         }
324 
325 #ifdef ACPI_ASL_COMPILER
326 
327         /*
328          * Do not open a scope for AML_EXTERNAL_OP
329          * AcpiNsLookup can open a new scope based on the object type
330          * of this op. AML_EXTERNAL_OP is a declaration rather than a
331          * definition. In the case that this external is a method object,
332          * AcpiNsLookup will open a new scope. However, an AML_EXTERNAL_OP
333          * associated with the ACPI_TYPE_METHOD is a declaration, rather than
334          * a definition. Flags is set to avoid opening a scope for any
335          * AML_EXTERNAL_OP.
336          */
337         if (WalkState->Opcode == AML_EXTERNAL_OP)
338         {
339             Flags |= ACPI_NS_DONT_OPEN_SCOPE;
340         }
341 #endif
342 
343         /* Add new entry or lookup existing entry */
344 
345         Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
346             ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node);
347 
348         if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY))
349         {
350             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
351                 "***New Node [%4.4s] %p is temporary\n",
352                 AcpiUtGetNodeName (Node), Node));
353         }
354         break;
355     }
356 
357     if (ACPI_FAILURE (Status))
358     {
359         ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
360             BufferPtr, Status);
361         return_ACPI_STATUS (Status);
362     }
363 
364     if (!Op)
365     {
366         /* Create a new op */
367 
368         Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml);
369         if (!Op)
370         {
371             return_ACPI_STATUS (AE_NO_MEMORY);
372         }
373 
374         /* Initialize the new op */
375 
376         if (Node)
377         {
378             Op->Named.Name = Node->Name.Integer;
379         }
380         *OutOp = Op;
381     }
382 
383     /*
384      * Put the Node in the "op" object that the parser uses, so we
385      * can get it again quickly when this scope is closed
386      */
387     Op->Common.Node = Node;
388     return_ACPI_STATUS (Status);
389 }
390 
391 
392 /*******************************************************************************
393  *
394  * FUNCTION:    AcpiDsLoad2EndOp
395  *
396  * PARAMETERS:  WalkState       - Current state of the parse tree walk
397  *
398  * RETURN:      Status
399  *
400  * DESCRIPTION: Ascending callback used during the loading of the namespace,
401  *              both control methods and everything else.
402  *
403  ******************************************************************************/
404 
405 ACPI_STATUS
406 AcpiDsLoad2EndOp (
407     ACPI_WALK_STATE         *WalkState)
408 {
409     ACPI_PARSE_OBJECT       *Op;
410     ACPI_STATUS             Status = AE_OK;
411     ACPI_OBJECT_TYPE        ObjectType;
412     ACPI_NAMESPACE_NODE     *Node;
413     ACPI_PARSE_OBJECT       *Arg;
414     ACPI_NAMESPACE_NODE     *NewNode;
415 #ifndef ACPI_NO_METHOD_EXECUTION
416     UINT32                  i;
417     UINT8                   RegionSpace;
418 #endif
419 
420 
421     ACPI_FUNCTION_TRACE (DsLoad2EndOp);
422 
423     Op = WalkState->Op;
424     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
425         WalkState->OpInfo->Name, Op, WalkState));
426 
427     /* Check if opcode had an associated namespace object */
428 
429     if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
430     {
431         return_ACPI_STATUS (AE_OK);
432     }
433 
434     if (Op->Common.AmlOpcode == AML_SCOPE_OP)
435     {
436         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
437             "Ending scope Op=%p State=%p\n", Op, WalkState));
438     }
439 
440     ObjectType = WalkState->OpInfo->ObjectType;
441 
442     /*
443      * Get the Node/name from the earlier lookup
444      * (It was saved in the *op structure)
445      */
446     Node = Op->Common.Node;
447 
448     /*
449      * Put the Node on the object stack (Contains the ACPI Name of
450      * this object)
451      */
452     WalkState->Operands[0] = (void *) Node;
453     WalkState->NumOperands = 1;
454 
455     /* Pop the scope stack */
456 
457     if (AcpiNsOpensScope (ObjectType) &&
458        (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP))
459     {
460         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
461             AcpiUtGetTypeName (ObjectType), Op));
462 
463         Status = AcpiDsScopeStackPop (WalkState);
464         if (ACPI_FAILURE (Status))
465         {
466             goto Cleanup;
467         }
468     }
469 
470     /*
471      * Named operations are as follows:
472      *
473      * AML_ALIAS
474      * AML_BANKFIELD
475      * AML_CREATEBITFIELD
476      * AML_CREATEBYTEFIELD
477      * AML_CREATEDWORDFIELD
478      * AML_CREATEFIELD
479      * AML_CREATEQWORDFIELD
480      * AML_CREATEWORDFIELD
481      * AML_DATA_REGION
482      * AML_DEVICE
483      * AML_EVENT
484      * AML_FIELD
485      * AML_INDEXFIELD
486      * AML_METHOD
487      * AML_METHODCALL
488      * AML_MUTEX
489      * AML_NAME
490      * AML_NAMEDFIELD
491      * AML_OPREGION
492      * AML_POWERRES
493      * AML_PROCESSOR
494      * AML_SCOPE
495      * AML_THERMALZONE
496      */
497 
498     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
499         "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
500         AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node));
501 
502     /* Decode the opcode */
503 
504     Arg = Op->Common.Value.Arg;
505 
506     switch (WalkState->OpInfo->Type)
507     {
508 #ifndef ACPI_NO_METHOD_EXECUTION
509 
510     case AML_TYPE_CREATE_FIELD:
511         /*
512          * Create the field object, but the field buffer and index must
513          * be evaluated later during the execution phase
514          */
515         Status = AcpiDsCreateBufferField (Op, WalkState);
516         break;
517 
518      case AML_TYPE_NAMED_FIELD:
519         /*
520          * If we are executing a method, initialize the field
521          */
522         if (WalkState->MethodNode)
523         {
524             Status = AcpiDsInitFieldObjects (Op, WalkState);
525         }
526 
527         switch (Op->Common.AmlOpcode)
528         {
529         case AML_INDEX_FIELD_OP:
530 
531             Status = AcpiDsCreateIndexField (
532                 Op, (ACPI_HANDLE) Arg->Common.Node, WalkState);
533             break;
534 
535         case AML_BANK_FIELD_OP:
536 
537             Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState);
538             break;
539 
540         case AML_FIELD_OP:
541 
542             Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState);
543             break;
544 
545         default:
546 
547             /* All NAMED_FIELD opcodes must be handled above */
548             break;
549         }
550         break;
551 
552      case AML_TYPE_NAMED_SIMPLE:
553 
554         Status = AcpiDsCreateOperands (WalkState, Arg);
555         if (ACPI_FAILURE (Status))
556         {
557             goto Cleanup;
558         }
559 
560         switch (Op->Common.AmlOpcode)
561         {
562         case AML_PROCESSOR_OP:
563 
564             Status = AcpiExCreateProcessor (WalkState);
565             break;
566 
567         case AML_POWER_RESOURCE_OP:
568 
569             Status = AcpiExCreatePowerResource (WalkState);
570             break;
571 
572         case AML_MUTEX_OP:
573 
574             Status = AcpiExCreateMutex (WalkState);
575             break;
576 
577         case AML_EVENT_OP:
578 
579             Status = AcpiExCreateEvent (WalkState);
580             break;
581 
582         case AML_ALIAS_OP:
583 
584             Status = AcpiExCreateAlias (WalkState);
585             break;
586 
587         default:
588 
589             /* Unknown opcode */
590 
591             Status = AE_OK;
592             goto Cleanup;
593         }
594 
595         /* Delete operands */
596 
597         for (i = 1; i < WalkState->NumOperands; i++)
598         {
599             AcpiUtRemoveReference (WalkState->Operands[i]);
600             WalkState->Operands[i] = NULL;
601         }
602 
603         break;
604 #endif /* ACPI_NO_METHOD_EXECUTION */
605 
606     case AML_TYPE_NAMED_COMPLEX:
607 
608         switch (Op->Common.AmlOpcode)
609         {
610 #ifndef ACPI_NO_METHOD_EXECUTION
611         case AML_REGION_OP:
612         case AML_DATA_REGION_OP:
613 
614             if (Op->Common.AmlOpcode == AML_REGION_OP)
615             {
616                 RegionSpace = (ACPI_ADR_SPACE_TYPE)
617                     ((Op->Common.Value.Arg)->Common.Value.Integer);
618             }
619             else
620             {
621                 RegionSpace = ACPI_ADR_SPACE_DATA_TABLE;
622             }
623 
624             /*
625              * The OpRegion is not fully parsed at this time. The only valid
626              * argument is the SpaceId. (We must save the address of the
627              * AML of the address and length operands)
628              *
629              * If we have a valid region, initialize it. The namespace is
630              * unlocked at this point.
631              *
632              * Need to unlock interpreter if it is locked (if we are running
633              * a control method), in order to allow _REG methods to be run
634              * during AcpiEvInitializeRegion.
635              */
636             if (WalkState->MethodNode)
637             {
638                 /*
639                  * Executing a method: initialize the region and unlock
640                  * the interpreter
641                  */
642                 Status = AcpiExCreateRegion (Op->Named.Data,
643                     Op->Named.Length, RegionSpace, WalkState);
644                 if (ACPI_FAILURE (Status))
645                 {
646                     return_ACPI_STATUS (Status);
647                 }
648             }
649 
650             Status = AcpiEvInitializeRegion (
651                 AcpiNsGetAttachedObject (Node));
652             break;
653 
654         case AML_NAME_OP:
655 
656             Status = AcpiDsCreateNode (WalkState, Node, Op);
657             break;
658 
659         case AML_METHOD_OP:
660             /*
661              * MethodOp PkgLength NameString MethodFlags TermList
662              *
663              * Note: We must create the method node/object pair as soon as we
664              * see the method declaration. This allows later pass1 parsing
665              * of invocations of the method (need to know the number of
666              * arguments.)
667              */
668             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
669                 "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
670                 WalkState, Op, Op->Named.Node));
671 
672             if (!AcpiNsGetAttachedObject (Op->Named.Node))
673             {
674                 WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node);
675                 WalkState->NumOperands = 1;
676 
677                 Status = AcpiDsCreateOperands (
678                     WalkState, Op->Common.Value.Arg);
679                 if (ACPI_SUCCESS (Status))
680                 {
681                     Status = AcpiExCreateMethod (
682                         Op->Named.Data, Op->Named.Length, WalkState);
683                 }
684 
685                 WalkState->Operands[0] = NULL;
686                 WalkState->NumOperands = 0;
687 
688                 if (ACPI_FAILURE (Status))
689                 {
690                     return_ACPI_STATUS (Status);
691                 }
692             }
693             break;
694 
695 #endif /* ACPI_NO_METHOD_EXECUTION */
696 
697         default:
698 
699             /* All NAMED_COMPLEX opcodes must be handled above */
700             break;
701         }
702         break;
703 
704     case AML_CLASS_INTERNAL:
705 
706         /* case AML_INT_NAMEPATH_OP: */
707         break;
708 
709     case AML_CLASS_METHOD_CALL:
710 
711         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
712             "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
713             WalkState, Op, Node));
714 
715         /*
716          * Lookup the method name and save the Node
717          */
718         Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
719             ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
720             ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
721             WalkState, &(NewNode));
722         if (ACPI_SUCCESS (Status))
723         {
724             /*
725              * Make sure that what we found is indeed a method
726              * We didn't search for a method on purpose, to see if the name
727              * would resolve
728              */
729             if (NewNode->Type != ACPI_TYPE_METHOD)
730             {
731                 Status = AE_AML_OPERAND_TYPE;
732             }
733 
734             /* We could put the returned object (Node) on the object stack for
735              * later, but for now, we will put it in the "op" object that the
736              * parser uses, so we can get it again at the end of this scope
737              */
738             Op->Common.Node = NewNode;
739         }
740         else
741         {
742             ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
743                 Arg->Common.Value.String, Status);
744         }
745         break;
746 
747 
748     default:
749 
750         break;
751     }
752 
753 Cleanup:
754 
755     /* Remove the Node pushed at the very beginning */
756 
757     WalkState->Operands[0] = NULL;
758     WalkState->NumOperands = 0;
759     return_ACPI_STATUS (Status);
760 }
761