Update ACPI build wrappers to use new ACPICA(20050309) code.
[dragonfly.git] / sys / contrib / dev / acpica-unix-20050211 / compiler / aslload.c
1 /******************************************************************************
2  *
3  * Module Name: dswload - Dispatcher namespace load callbacks
4  *              $Revision: 63 $
5  *
6  *****************************************************************************/
7
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2005, 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 __ASLLOAD_C__
118
119 #include "aslcompiler.h"
120 #include "amlcode.h"
121 #include "acdispat.h"
122 #include "acnamesp.h"
123
124 #include "aslcompiler.y.h"
125
126 #define _COMPONENT          ACPI_COMPILER
127         ACPI_MODULE_NAME    ("aslload")
128
129
130 /*******************************************************************************
131  *
132  * FUNCTION:    LdLoadNamespace
133  *
134  * PARAMETERS:  None
135  *
136  * RETURN:      Status
137  *
138  * DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the
139  *              named ASL/AML objects into the namespace.  The namespace is
140  *              constructed in order to resolve named references and references
141  *              to named fields within resource templates/descriptors.
142  *
143  ******************************************************************************/
144
145 ACPI_STATUS
146 LdLoadNamespace (
147     ACPI_PARSE_OBJECT       *RootOp)
148 {
149     ACPI_WALK_STATE         *WalkState;
150
151
152     DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n");
153
154     /* Create a new walk state */
155
156     WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
157     if (!WalkState)
158     {
159         return AE_NO_MEMORY;
160     }
161
162     /* Perform the walk of the parse tree */
163
164     TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace1Begin,
165                         LdNamespace1End, WalkState);
166
167     /* Dump the namespace if debug is enabled */
168
169     AcpiNsDumpTables (ACPI_NS_ALL, ACPI_UINT32_MAX);
170     return AE_OK;
171 }
172
173
174 /*******************************************************************************
175  *
176  * FUNCTION:    LdLoadFieldElements
177  *
178  * PARAMETERS:  Op          - Parent node (Field)
179  *              WalkState       - Current walk state
180  *
181  * RETURN:      Status
182  *
183  * DESCRIPTION: Enter the named elements of the field (children of the parent)
184  *              into the namespace.
185  *
186  ******************************************************************************/
187
188 ACPI_STATUS
189 LdLoadFieldElements (
190     ACPI_PARSE_OBJECT       *Op,
191     ACPI_WALK_STATE         *WalkState)
192 {
193     ACPI_PARSE_OBJECT       *Child = NULL;
194     ACPI_NAMESPACE_NODE     *Node;
195     ACPI_STATUS             Status;
196
197
198     /* Get the first named field element */
199
200     switch (Op->Asl.AmlOpcode)
201     {
202     case AML_BANK_FIELD_OP:
203
204         Child = UtGetArg (Op, 6);
205         break;
206
207     case AML_INDEX_FIELD_OP:
208
209         Child = UtGetArg (Op, 5);
210         break;
211
212     case AML_FIELD_OP:
213
214         Child = UtGetArg (Op, 4);
215         break;
216
217     default:
218         /* No other opcodes should arrive here */
219         return (AE_BAD_PARAMETER);
220     }
221
222     /* Enter all elements into the namespace */
223
224     while (Child)
225     {
226         switch (Child->Asl.AmlOpcode)
227         {
228         case AML_INT_RESERVEDFIELD_OP:
229         case AML_INT_ACCESSFIELD_OP:
230
231             break;
232
233         default:
234
235             Status = AcpiNsLookup (WalkState->ScopeInfo, Child->Asl.Value.String,
236                             ACPI_TYPE_LOCAL_REGION_FIELD, ACPI_IMODE_LOAD_PASS1,
237                             ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND,
238                             NULL, &Node);
239             if (ACPI_FAILURE (Status))
240             {
241                 if (Status != AE_ALREADY_EXISTS)
242                 {
243                      return (Status);
244                 }
245
246                 /*
247                  * The name already exists in this scope
248                  * But continue processing the elements
249                  */
250                 AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, Child->Asl.Value.String);
251             }
252             else
253             {
254                 Child->Asl.Node = Node;
255                 Node->Object = (ACPI_OPERAND_OBJECT *) Child;
256             }
257             break;
258         }
259         Child = Child->Asl.Next;
260     }
261     return (AE_OK);
262 }
263
264
265 /*******************************************************************************
266  *
267  * FUNCTION:    LdLoadResourceElements
268  *
269  * PARAMETERS:  Op          - Parent node (Resource Descriptor)
270  *              WalkState       - Current walk state
271  *
272  * RETURN:      Status
273  *
274  * DESCRIPTION: Enter the named elements of the resource descriptor (children
275  *              of the parent) into the namespace.
276  *
277  * NOTE: In the real AML namespace, these named elements never exist.  But
278  *       we simply use the namespace here as a symbol table so we can look
279  *       them up as they are referenced.
280  *
281  ******************************************************************************/
282
283 ACPI_STATUS
284 LdLoadResourceElements (
285     ACPI_PARSE_OBJECT       *Op,
286     ACPI_WALK_STATE         *WalkState)
287 {
288     ACPI_PARSE_OBJECT       *InitializerOp = NULL;
289     ACPI_NAMESPACE_NODE     *Node;
290     ACPI_STATUS             Status;
291
292
293     /*
294      * Enter the resouce name into the namespace
295      * This opens a scope
296      */
297     Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath,
298                     ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
299                     WalkState, &Node);
300     if (ACPI_FAILURE (Status))
301     {
302         return (Status);
303     }
304
305     /*
306      * Now enter the predefined fields, for easy lookup when referenced
307      * by the source ASL
308      */
309     InitializerOp = ASL_GET_CHILD_NODE (Op);
310     while (InitializerOp)
311     {
312
313         if (InitializerOp->Asl.ExternalName)
314         {
315             Status = AcpiNsLookup (WalkState->ScopeInfo,
316                             InitializerOp->Asl.ExternalName,
317                             ACPI_TYPE_LOCAL_RESOURCE_FIELD,
318                             ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE,
319                             NULL, &Node);
320             if (ACPI_FAILURE (Status))
321             {
322                 return (Status);
323             }
324
325             /*
326              * Store the field offset in the namespace node so it
327              * can be used when the field is referenced
328              */
329             Node->OwnerId = (UINT16) InitializerOp->Asl.Value.Integer;
330             InitializerOp->Asl.Node = Node;
331             Node->Object = (ACPI_OPERAND_OBJECT *) InitializerOp;
332
333             /* Pass thru the field type (Bitfield or Bytefield) */
334
335             if (InitializerOp->Asl.CompileFlags & NODE_IS_BIT_OFFSET)
336             {
337                 Node->Flags |= ANOBJ_IS_BIT_OFFSET;
338             }
339         }
340         InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
341     }
342
343     return (AE_OK);
344 }
345
346
347 /*******************************************************************************
348  *
349  * FUNCTION:    LdNamespace1Begin
350  *
351  * PARAMETERS:  ASL_WALK_CALLBACK
352  *
353  * RETURN:      Status
354  *
355  * DESCRIPTION: Descending callback used during the parse tree walk.  If this
356  *              is a named AML opcode, enter into the namespace
357  *
358  ******************************************************************************/
359
360 ACPI_STATUS
361 LdNamespace1Begin (
362     ACPI_PARSE_OBJECT       *Op,
363     UINT32                  Level,
364     void                    *Context)
365 {
366     ACPI_WALK_STATE         *WalkState = (ACPI_WALK_STATE *) Context;
367     ACPI_NAMESPACE_NODE     *Node;
368     ACPI_STATUS             Status;
369     ACPI_OBJECT_TYPE        ObjectType;
370     ACPI_OBJECT_TYPE        ActualObjectType = ACPI_TYPE_ANY;
371     char                    *Path;
372     UINT32                  Flags = ACPI_NS_NO_UPSEARCH;
373     ACPI_PARSE_OBJECT       *Arg;
374     UINT32                  i;
375
376
377     ACPI_FUNCTION_NAME ("LdNamespace1Begin");
378     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n",
379         Op, Op->Asl.ParseOpName));
380
381
382     /*
383      * We are only interested in opcodes that have an associated name
384      * (or multiple names)
385      */
386     switch (Op->Asl.AmlOpcode)
387     {
388     case AML_BANK_FIELD_OP:
389     case AML_INDEX_FIELD_OP:
390     case AML_FIELD_OP:
391
392         Status = LdLoadFieldElements (Op, WalkState);
393         return (Status);
394
395     default:
396
397         /* All other opcodes go below */
398         break;
399     }
400
401     /* Check if this object has already been installed in the namespace */
402
403     if (Op->Asl.Node)
404     {
405         return (AE_OK);
406     }
407
408     Path = Op->Asl.Namepath;
409     if (!Path)
410     {
411         return (AE_OK);
412     }
413
414     /* Map the raw opcode into an internal object type */
415
416     switch (Op->Asl.ParseOpcode)
417     {
418     case PARSEOP_NAME:
419
420         Arg = Op->Asl.Child;        /* Get the NameSeg/NameString node */
421         Arg = Arg->Asl.Next;        /* First peer is the object to be associated with the name */
422
423         /* Get the data type associated with the named object, not the name itself */
424
425         /* Log2 loop to convert from Btype (binary) to Etype (encoded) */
426
427         ObjectType = 1;
428         for (i = 1; i < Arg->Asl.AcpiBtype; i *= 2)
429         {
430             ObjectType++;
431         }
432         break;
433
434
435     case PARSEOP_EXTERNAL:
436
437         /*
438          * "External" simply enters a name and type into the namespace.
439          * We must be careful to not open a new scope, however, no matter
440          * what type the external name refers to (e.g., a method)
441          *
442          * first child is name, next child is ObjectType
443          */
444         ActualObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer;
445         ObjectType = ACPI_TYPE_ANY;
446         break;
447
448
449     case PARSEOP_DEFAULT_ARG:
450
451         if(Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)
452         {
453             Status = LdLoadResourceElements (Op, WalkState);
454             goto Exit;
455         }
456
457         ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
458         break;
459
460
461     case PARSEOP_SCOPE:
462
463         /*
464          * The name referenced by Scope(Name) must already exist at this point.
465          * In other words, forward references for Scope() are not supported.
466          * The only real reason for this is that the MS interpreter cannot
467          * handle this case.  Perhaps someday this case can go away.
468          */
469         Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
470                         ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
471         if (ACPI_FAILURE (Status))
472         {
473             if (Status == AE_NOT_FOUND)
474             {
475                 /* The name was not found, go ahead and create it */
476
477                 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_LOCAL_SCOPE,
478                                 ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
479
480                 /*
481                  * However, this is an error -- primarily because the MS
482                  * interpreter can't handle a forward reference from the
483                  * Scope() operator.
484                  */
485                 AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, Op->Asl.ExternalName);
486                 AslError (ASL_ERROR, ASL_MSG_SCOPE_FWD_REF, Op, Op->Asl.ExternalName);
487                 goto FinishNode;
488             }
489
490             AslCoreSubsystemError (Op, Status, "Failure from lookup\n", FALSE);
491             goto Exit;
492         }
493
494         /* We found a node with this name, now check the type */
495
496         switch (Node->Type)
497         {
498         case ACPI_TYPE_LOCAL_SCOPE:
499         case ACPI_TYPE_DEVICE:
500         case ACPI_TYPE_POWER:
501         case ACPI_TYPE_PROCESSOR:
502         case ACPI_TYPE_THERMAL:
503
504             /* These are acceptable types - they all open a new scope */
505             break;
506
507         case ACPI_TYPE_INTEGER:
508         case ACPI_TYPE_STRING:
509         case ACPI_TYPE_BUFFER:
510
511             /*
512              * These types we will allow, but we will change the type.  This
513              * enables some existing code of the form:
514              *
515              *  Name (DEB, 0)
516              *  Scope (DEB) { ... }
517              *
518              * Which is used to workaround the fact that the MS interpreter
519              * does not allow Scope() forward references.
520              */
521             sprintf (MsgBuffer, "%s [%s], changing type to [Scope]",
522                 Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
523             AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
524
525             /*
526              * Switch the type to scope, open the new scope
527              */
528             Node->Type = ACPI_TYPE_LOCAL_SCOPE;
529             Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, WalkState);
530             if (ACPI_FAILURE (Status))
531             {
532                 return_ACPI_STATUS (Status);
533             }
534             break;
535
536         default:
537
538             /*
539              * All other types are an error
540              */
541             sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
542             AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
543
544             /*
545              * However, switch the type to be an actual scope so
546              * that compilation can continue without generating a whole
547              * cascade of additional errors.  Open the new scope.
548              */
549             Node->Type = ACPI_TYPE_LOCAL_SCOPE;
550             Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, WalkState);
551             if (ACPI_FAILURE (Status))
552             {
553                 return_ACPI_STATUS (Status);
554             }
555             break;
556         }
557
558         Status = AE_OK;
559         goto FinishNode;
560
561
562     default:
563
564         ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
565         break;
566     }
567
568
569     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n",
570             Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType)));
571
572     /* The name must not already exist */
573
574     Flags |= ACPI_NS_ERROR_IF_FOUND;
575
576     /*
577      * Enter the named type into the internal namespace.  We enter the name
578      * as we go downward in the parse tree.  Any necessary subobjects that involve
579      * arguments to the opcode must be created as we go back up the parse tree later.
580      */
581     Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
582                     ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
583     if (ACPI_FAILURE (Status))
584     {
585         if (Status == AE_ALREADY_EXISTS)
586         {
587             /* The name already exists in this scope */
588
589             if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
590             {
591                 Node->Type = (UINT8) ObjectType;
592                 Status = AE_OK;
593             }
594             else
595             {
596                 AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, Op->Asl.ExternalName);
597                 Status = AE_OK;
598                 goto Exit;
599             }
600         }
601         else
602         {
603             AslCoreSubsystemError (Op, Status, "Failure from lookup %s\n", FALSE);
604             goto Exit;
605         }
606     }
607
608
609 FinishNode:
610     /*
611      * Point the parse node to the new namespace node, and point
612      * the Node back to the original Parse node
613      */
614     Op->Asl.Node = Node;
615     Node->Object = (ACPI_OPERAND_OBJECT *) Op;
616
617     /* Set the actual data type if appropriate (EXTERNAL term only) */
618
619     if (ActualObjectType != ACPI_TYPE_ANY)
620     {
621         Node->Type = (UINT8) ActualObjectType;
622         Node->OwnerId = ASL_EXTERNAL_METHOD;
623     }
624
625     if (Op->Asl.ParseOpcode == PARSEOP_METHOD)
626     {
627         /*
628          * Get the method argument count from "Extra" and store
629          * it in the OwnerId field of the namespace node
630          */
631         Node->OwnerId = (UINT16) Op->Asl.Extra;
632     }
633
634 Exit:
635     return (Status);
636 }
637
638
639 /*******************************************************************************
640  *
641  * FUNCTION:    LdNamespace1End
642  *
643  * PARAMETERS:  ASL_WALK_CALLBACK
644  *
645  * RETURN:      Status
646  *
647  * DESCRIPTION: Ascending callback used during the loading of the namespace,
648  *              We only need to worry about managing the scope stack here.
649  *
650  ******************************************************************************/
651
652 ACPI_STATUS
653 LdNamespace1End (
654     ACPI_PARSE_OBJECT       *Op,
655     UINT32                  Level,
656     void                    *Context)
657 {
658     ACPI_WALK_STATE         *WalkState = (ACPI_WALK_STATE *) Context;
659     ACPI_OBJECT_TYPE        ObjectType;
660
661
662     ACPI_FUNCTION_NAME ("LdNamespace1End");
663
664
665     /* We are only interested in opcodes that have an associated name */
666
667     if (!Op->Asl.Namepath)
668     {
669         return (AE_OK);
670     }
671
672     /* Get the type to determine if we should pop the scope */
673
674     if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) &&
675         (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC))
676     {
677         /* TBD: Merge into AcpiDsMapNamedOpcodeToDataType */
678
679         ObjectType = ACPI_TYPE_LOCAL_RESOURCE;
680     }
681     else
682     {
683         ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
684     }
685
686     /* Pop the scope stack */
687
688     if (AcpiNsOpensScope (ObjectType))
689     {
690
691         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
692             "(%s): Popping scope for Op [%s] %p\n",
693             AcpiUtGetTypeName (ObjectType), Op->Asl.ParseOpName, Op));
694
695         AcpiDsScopeStackPop (WalkState);
696     }
697
698     return (AE_OK);
699 }
700
701