dswload.c revision 70243
1/******************************************************************************
2 *
3 * Module Name: dswload - Dispatcher namespace load callbacks
4 *              $Revision: 25 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 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          DISPATCHER
129        MODULE_NAME         ("dswload")
130
131
132/*****************************************************************************
133 *
134 * FUNCTION:    AcpiDsLoad1BeginOp
135 *
136 * PARAMETERS:  WalkState       - Current state of the parse tree walk
137 *              Op              - Op that has been just been reached in the
138 *                                walk;  Arguments have not been evaluated yet.
139 *
140 * RETURN:      Status
141 *
142 * DESCRIPTION: Descending callback used during the loading of ACPI tables.
143 *
144 ****************************************************************************/
145
146ACPI_STATUS
147AcpiDsLoad1BeginOp (
148    UINT16                  Opcode,
149    ACPI_PARSE_OBJECT       *Op,
150    ACPI_WALK_STATE         *WalkState,
151    ACPI_PARSE_OBJECT       **OutOp)
152{
153    ACPI_NAMESPACE_NODE     *Node;
154    ACPI_STATUS             Status;
155    OBJECT_TYPE_INTERNAL    DataType;
156    NATIVE_CHAR             *Path;
157
158
159    DEBUG_PRINT (TRACE_DISPATCH,
160        ("Load1BeginOp: Op=%p State=%p\n", Op, WalkState));
161
162
163    /* We are only interested in opcodes that have an associated name */
164
165    if (!AcpiPsIsNamedOp (Opcode))
166    {
167        *OutOp = Op;
168        return (AE_OK);
169    }
170
171
172    /* Check if this object has already been installed in the namespace */
173
174    if (Op && Op->Node)
175    {
176        *OutOp = Op;
177        return (AE_OK);
178    }
179
180    Path = AcpiPsGetNextNamestring (WalkState->ParserState);
181
182    /* Map the raw opcode into an internal object type */
183
184    DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
185
186
187    DEBUG_PRINT (TRACE_DISPATCH,
188        ("Load1BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
189
190
191    if (Opcode == AML_SCOPE_OP)
192    {
193        DEBUG_PRINT (TRACE_DISPATCH,
194            ("Load1BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
195    }
196
197    /*
198     * Enter the named type into the internal namespace.  We enter the name
199     * as we go downward in the parse tree.  Any necessary subobjects that involve
200     * arguments to the opcode must be created as we go back up the parse tree later.
201     */
202    Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
203                            DataType, IMODE_LOAD_PASS1,
204                            NS_NO_UPSEARCH, WalkState, &(Node));
205
206    if (ACPI_FAILURE (Status))
207    {
208        return (Status);
209    }
210
211    if (!Op)
212    {
213        /* Create a new op */
214
215        Op = AcpiPsAllocOp (Opcode);
216        if (!Op)
217        {
218            return (AE_NO_MEMORY);
219        }
220    }
221
222    /* Initialize */
223
224    ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
225
226    /*
227     * Put the Node in the "op" object that the parser uses, so we
228     * can get it again quickly when this scope is closed
229     */
230    Op->Node = Node;
231
232
233    AcpiPsAppendArg (AcpiPsGetParentScope (WalkState->ParserState), Op);
234
235    *OutOp = Op;
236
237    return (Status);
238}
239
240
241/*****************************************************************************
242 *
243 * FUNCTION:    AcpiDsLoad1EndOp
244 *
245 * PARAMETERS:  WalkState       - Current state of the parse tree walk
246 *              Op              - Op that has been just been completed in the
247 *                                walk;  Arguments have now been evaluated.
248 *
249 * RETURN:      Status
250 *
251 * DESCRIPTION: Ascending callback used during the loading of the namespace,
252 *              both control methods and everything else.
253 *
254 ****************************************************************************/
255
256ACPI_STATUS
257AcpiDsLoad1EndOp (
258    ACPI_WALK_STATE         *WalkState,
259    ACPI_PARSE_OBJECT       *Op)
260{
261    OBJECT_TYPE_INTERNAL    DataType;
262
263
264    DEBUG_PRINT (TRACE_DISPATCH,
265        ("Load1EndOp: Op=%p State=%p\n", Op, WalkState));
266
267    /* We are only interested in opcodes that have an associated name */
268
269    if (!AcpiPsIsNamedOp (Op->Opcode))
270    {
271        return (AE_OK);
272    }
273
274
275    /* Get the type to determine if we should pop the scope */
276
277    DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode);
278
279    if (Op->Opcode == AML_NAME_OP)
280    {
281        /* For Name opcode, check the argument */
282
283        if (Op->Value.Arg)
284        {
285            DataType = AcpiDsMapOpcodeToDataType (
286                            (Op->Value.Arg)->Opcode, NULL);
287            ((ACPI_NAMESPACE_NODE *)Op->Node)->Type =
288                            (UINT8) DataType;
289        }
290    }
291
292
293    /* Pop the scope stack */
294
295    if (AcpiNsOpensScope (DataType))
296    {
297
298        DEBUG_PRINT (TRACE_DISPATCH,
299            ("Load1EndOp/%s: Popping scope for Op %p\n",
300            AcpiCmGetTypeName (DataType), Op));
301        AcpiDsScopeStackPop (WalkState);
302    }
303
304    return (AE_OK);
305
306}
307
308
309/*****************************************************************************
310 *
311 * FUNCTION:    AcpiDsLoad2BeginOp
312 *
313 * PARAMETERS:  WalkState       - Current state of the parse tree walk
314 *              Op              - Op that has been just been reached in the
315 *                                walk;  Arguments have not been evaluated yet.
316 *
317 * RETURN:      Status
318 *
319 * DESCRIPTION: Descending callback used during the loading of ACPI tables.
320 *
321 ****************************************************************************/
322
323ACPI_STATUS
324AcpiDsLoad2BeginOp (
325    UINT16                  Opcode,
326    ACPI_PARSE_OBJECT       *Op,
327    ACPI_WALK_STATE         *WalkState,
328    ACPI_PARSE_OBJECT       **OutOp)
329{
330    ACPI_NAMESPACE_NODE     *Node;
331    ACPI_STATUS             Status;
332    OBJECT_TYPE_INTERNAL    DataType;
333    NATIVE_CHAR             *BufferPtr;
334    void                    *Original = NULL;
335
336
337    DEBUG_PRINT (TRACE_DISPATCH,
338        ("Load2BeginOp: Op=%p State=%p\n", Op, WalkState));
339
340
341    /* We only care about Namespace opcodes here */
342
343    if (!AcpiPsIsNamespaceOp (Opcode) &&
344        Opcode != AML_NAMEPATH_OP)
345    {
346        return (AE_OK);
347    }
348
349
350    /* Temp! same code as in psparse */
351
352    if (!AcpiPsIsNamedOp (Opcode))
353    {
354        return (AE_OK);
355    }
356
357    if (Op)
358    {
359        /*
360         * Get the name we are going to enter or lookup in the namespace
361         */
362        if (Opcode == AML_NAMEPATH_OP)
363        {
364            /* For Namepath op, get the path string */
365
366            BufferPtr = Op->Value.String;
367            if (!BufferPtr)
368            {
369                /* No name, just exit */
370
371                return (AE_OK);
372            }
373        }
374
375        else
376        {
377            /* Get name from the op */
378
379            BufferPtr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Op)->Name;
380        }
381    }
382
383    else
384    {
385        BufferPtr = AcpiPsGetNextNamestring (WalkState->ParserState);
386    }
387
388
389    /* Map the raw opcode into an internal object type */
390
391    DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
392
393    DEBUG_PRINT (TRACE_DISPATCH,
394        ("Load2BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
395
396
397    if (Opcode == AML_DEF_FIELD_OP      ||
398        Opcode == AML_BANK_FIELD_OP     ||
399        Opcode == AML_INDEX_FIELD_OP)
400    {
401        Node = NULL;
402        Status = AE_OK;
403    }
404
405    else if (Opcode == AML_NAMEPATH_OP)
406    {
407        /*
408         * The NamePath is an object reference to an existing object.  Don't enter the
409         * name into the namespace, but look it up for use later
410         */
411        Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr,
412                                DataType, IMODE_EXECUTE,
413                                NS_SEARCH_PARENT, WalkState,
414                                &(Node));
415    }
416
417    else
418    {
419        if (Op && Op->Node)
420        {
421            Original = Op->Node;
422            Node = Op->Node;
423
424            if (AcpiNsOpensScope (DataType))
425            {
426                Status = AcpiDsScopeStackPush (Node,
427                                                DataType,
428                                                WalkState);
429                if (ACPI_FAILURE (Status))
430                {
431                    return (Status);
432                }
433
434            }
435            return (AE_OK);
436        }
437
438        /*
439         * Enter the named type into the internal namespace.  We enter the name
440         * as we go downward in the parse tree.  Any necessary subobjects that involve
441         * arguments to the opcode must be created as we go back up the parse tree later.
442         */
443        Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr,
444                                DataType, IMODE_EXECUTE,
445                                NS_NO_UPSEARCH, WalkState,
446                                &(Node));
447    }
448
449    if (ACPI_SUCCESS (Status))
450    {
451        if (!Op)
452        {
453            /* Create a new op */
454
455            Op = AcpiPsAllocOp (Opcode);
456            if (!Op)
457            {
458                return (AE_NO_MEMORY);
459            }
460
461            /* Initialize */
462
463            ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
464            *OutOp = Op;
465        }
466
467
468        /*
469         * Put the Node in the "op" object that the parser uses, so we
470         * can get it again quickly when this scope is closed
471         */
472        Op->Node = Node;
473
474        if (Original)
475        {
476            DEBUG_PRINT (ACPI_INFO,
477                ("Lookup: old %p new %p\n", Original, Node));
478
479            if (Original != Node)
480            {
481                DEBUG_PRINT (ACPI_INFO,
482                    ("Lookup match error: old %p new %p\n", Original, Node));
483            }
484        }
485    }
486
487
488    return (Status);
489}
490
491
492/*****************************************************************************
493 *
494 * FUNCTION:    AcpiDsLoad2EndOp
495 *
496 * PARAMETERS:  WalkState       - Current state of the parse tree walk
497 *              Op              - Op that has been just been completed in the
498 *                                walk;  Arguments have now been evaluated.
499 *
500 * RETURN:      Status
501 *
502 * DESCRIPTION: Ascending callback used during the loading of the namespace,
503 *              both control methods and everything else.
504 *
505 ****************************************************************************/
506
507ACPI_STATUS
508AcpiDsLoad2EndOp (
509    ACPI_WALK_STATE         *WalkState,
510    ACPI_PARSE_OBJECT       *Op)
511{
512    ACPI_STATUS             Status = AE_OK;
513    OBJECT_TYPE_INTERNAL    DataType;
514    ACPI_NAMESPACE_NODE     *Node;
515    ACPI_PARSE_OBJECT       *Arg;
516    ACPI_NAMESPACE_NODE     *NewNode;
517
518
519    DEBUG_PRINT (TRACE_DISPATCH, ("Load2EndOp: Op=%p State=%p\n", Op, WalkState));
520
521    if (!AcpiPsIsNamespaceObjectOp (Op->Opcode))
522    {
523        return (AE_OK);
524    }
525
526    if (Op->Opcode == AML_SCOPE_OP)
527    {
528        DEBUG_PRINT (TRACE_DISPATCH,
529            ("Load2EndOp: ending scope Op=%p State=%p\n", Op, WalkState));
530
531        if (((ACPI_PARSE2_OBJECT *)Op)->Name == -1)
532        {
533            DEBUG_PRINT (ACPI_ERROR,
534                ("Load2EndOp: Un-named scope! Op=%p State=%p\n", Op,
535                WalkState));
536            return (AE_OK);
537        }
538    }
539
540
541    DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode);
542
543    /*
544     * Get the Node/name from the earlier lookup
545     * (It was saved in the *op structure)
546     */
547    Node = Op->Node;
548
549    /*
550     * Put the Node on the object stack (Contains the ACPI Name of
551     * this object)
552     */
553
554    WalkState->Operands[0] = (void *) Node;
555    WalkState->NumOperands = 1;
556
557    /* Pop the scope stack */
558
559    if (AcpiNsOpensScope (DataType))
560    {
561
562        DEBUG_PRINT (TRACE_DISPATCH,
563            ("AmlEndNamespaceScope/%s: Popping scope for Op %p\n",
564            AcpiCmGetTypeName (DataType), Op));
565        AcpiDsScopeStackPop (WalkState);
566    }
567
568
569    /*
570     * Named operations are as follows:
571     *
572     * AML_SCOPE
573     * AML_DEVICE
574     * AML_THERMALZONE
575     * AML_METHOD
576     * AML_POWERRES
577     * AML_PROCESSOR
578     * AML_FIELD
579     * AML_INDEXFIELD
580     * AML_BANKFIELD
581     * AML_NAMEDFIELD
582     * AML_NAME
583     * AML_ALIAS
584     * AML_MUTEX
585     * AML_EVENT
586     * AML_OPREGION
587     * AML_CREATEFIELD
588     * AML_CREATEBITFIELD
589     * AML_CREATEBYTEFIELD
590     * AML_CREATEWORDFIELD
591     * AML_CREATEDWORDFIELD
592     * AML_METHODCALL
593     */
594
595
596    /* Decode the opcode */
597
598    Arg = Op->Value.Arg;
599
600    switch (Op->Opcode)
601    {
602
603    case AML_CREATE_FIELD_OP:
604    case AML_BIT_FIELD_OP:
605    case AML_BYTE_FIELD_OP:
606    case AML_WORD_FIELD_OP:
607    case AML_DWORD_FIELD_OP:
608
609        /*
610         * Create the field object, but the field buffer and index must
611         * be evaluated later during the execution phase
612         */
613
614        DEBUG_PRINT (TRACE_DISPATCH,
615            ("LOADING-CreateXxxField: State=%p Op=%p NamedObj=%p\n",
616            WalkState, Op, Node));
617
618        /* Get the NameString argument */
619
620        if (Op->Opcode == AML_CREATE_FIELD_OP)
621        {
622            Arg = AcpiPsGetArg (Op, 3);
623        }
624        else
625        {
626            /* Create Bit/Byte/Word/Dword field */
627
628            Arg = AcpiPsGetArg (Op, 2);
629        }
630
631        /*
632         * Enter the NameString into the namespace
633         */
634
635        Status = AcpiNsLookup (WalkState->ScopeInfo,
636                                Arg->Value.String,
637                                INTERNAL_TYPE_DEF_ANY,
638                                IMODE_LOAD_PASS1,
639                                NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
640                                WalkState, &(NewNode));
641
642        if (ACPI_SUCCESS (Status))
643        {
644            /* We could put the returned object (Node) on the object stack for later, but
645             * for now, we will put it in the "op" object that the parser uses, so we
646             * can get it again at the end of this scope
647             */
648            Op->Node = NewNode;
649
650            /*
651             * If there is no object attached to the node, this node was just created and
652             * we need to create the field object.  Otherwise, this was a lookup of an
653             * existing node and we don't want to create the field object again.
654             */
655            if (!NewNode->Object)
656            {
657                /*
658                 * The Field definition is not fully parsed at this time.
659                 * (We must save the address of the AML for the buffer and index operands)
660                 */
661                Status = AcpiAmlExecCreateField (((ACPI_PARSE2_OBJECT *) Op)->Data,
662                                                ((ACPI_PARSE2_OBJECT *) Op)->Length,
663                                                NewNode, WalkState);
664            }
665        }
666
667
668        break;
669
670
671    case AML_METHODCALL_OP:
672
673        DEBUG_PRINT (TRACE_DISPATCH,
674            ("RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
675            WalkState, Op, Node));
676
677        /*
678         * Lookup the method name and save the Node
679         */
680
681        Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
682                                ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
683                                NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
684                                WalkState, &(NewNode));
685
686        if (ACPI_SUCCESS (Status))
687        {
688
689/* has name already been resolved by here ??*/
690
691            /* TBD: [Restructure] Make sure that what we found is indeed a method! */
692            /* We didn't search for a method on purpose, to see if the name would resolve! */
693
694            /* We could put the returned object (Node) on the object stack for later, but
695             * for now, we will put it in the "op" object that the parser uses, so we
696             * can get it again at the end of this scope
697             */
698            Op->Node = NewNode;
699        }
700
701
702         break;
703
704
705    case AML_PROCESSOR_OP:
706
707        /* Nothing to do other than enter object into namespace */
708
709        DEBUG_PRINT (TRACE_DISPATCH,
710            ("LOADING-Processor: State=%p Op=%p NamedObj=%p\n",
711            WalkState, Op, Node));
712
713        Status = AcpiAmlExecCreateProcessor (Op, (ACPI_HANDLE) Node);
714        if (ACPI_FAILURE (Status))
715        {
716            goto Cleanup;
717        }
718
719        DEBUG_PRINT (TRACE_DISPATCH,
720            ("Completed Processor Init, Op=%p State=%p entry=%p\n",
721            Op, WalkState, Node));
722        break;
723
724
725    case AML_POWER_RES_OP:
726
727        /* Nothing to do other than enter object into namespace */
728
729        DEBUG_PRINT (TRACE_DISPATCH,
730            ("LOADING-PowerResource: State=%p Op=%p NamedObj=%p\n",
731            WalkState, Op, Node));
732
733        Status = AcpiAmlExecCreatePowerResource (Op, (ACPI_HANDLE) Node);
734        if (ACPI_FAILURE (Status))
735        {
736            goto Cleanup;
737        }
738
739        DEBUG_PRINT (TRACE_DISPATCH,
740            ("Completed PowerResource Init, Op=%p State=%p entry=%p\n",
741            Op, WalkState, Node));
742        break;
743
744
745    case AML_THERMAL_ZONE_OP:
746
747        /* Nothing to do other than enter object into namespace */
748
749        DEBUG_PRINT (TRACE_DISPATCH,
750            ("LOADING-ThermalZone: State=%p Op=%p NamedObj=%p\n",
751            WalkState, Op, Node));
752        break;
753
754
755    case AML_DEF_FIELD_OP:
756
757        DEBUG_PRINT (TRACE_DISPATCH,
758            ("LOADING-Field: State=%p Op=%p NamedObj=%p\n",
759            WalkState, Op, Node));
760
761        Arg = Op->Value.Arg;
762
763        Status = AcpiDsCreateField (Op,
764                                    Arg->Node,
765                                    WalkState);
766        break;
767
768
769    case AML_INDEX_FIELD_OP:
770
771        DEBUG_PRINT (TRACE_DISPATCH,
772            ("LOADING-IndexField: State=%p Op=%p NamedObj=%p\n",
773            WalkState, Op, Node));
774
775        Arg = Op->Value.Arg;
776
777        Status = AcpiDsCreateIndexField (Op,
778                                        (ACPI_HANDLE) Arg->Node,
779                                        WalkState);
780        break;
781
782
783    case AML_BANK_FIELD_OP:
784
785        DEBUG_PRINT (TRACE_DISPATCH,
786            ("LOADING-BankField: State=%p Op=%p NamedObj=%p\n",
787            WalkState, Op, Node));
788
789        Arg = Op->Value.Arg;
790        Status = AcpiDsCreateBankField (Op,
791                                        Arg->Node,
792                                        WalkState);
793        break;
794
795
796    /*
797     * MethodOp PkgLength NamesString MethodFlags TermList
798     */
799    case AML_METHOD_OP:
800
801        DEBUG_PRINT (TRACE_DISPATCH,
802            ("LOADING-Method: State=%p Op=%p NamedObj=%p\n",
803            WalkState, Op, Node));
804
805        if (!Node->Object)
806        {
807            Status = AcpiAmlExecCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data,
808                                ((ACPI_PARSE2_OBJECT *) Op)->Length,
809                                Arg->Value.Integer, (ACPI_HANDLE) Node);
810        }
811
812        break;
813
814
815    case AML_MUTEX_OP:
816
817        DEBUG_PRINT (TRACE_DISPATCH,
818            ("LOADING-Mutex: Op=%p State=%p\n", Op, WalkState));
819
820        Status = AcpiDsCreateOperands (WalkState, Arg);
821        if (ACPI_FAILURE (Status))
822        {
823            goto Cleanup;
824        }
825
826        Status = AcpiAmlExecCreateMutex (WalkState);
827        break;
828
829
830    case AML_EVENT_OP:
831
832        DEBUG_PRINT (TRACE_DISPATCH,
833            ("LOADING-Event: Op=%p State=%p\n", Op, WalkState));
834
835        Status = AcpiDsCreateOperands (WalkState, Arg);
836        if (ACPI_FAILURE (Status))
837        {
838            goto Cleanup;
839        }
840
841        Status = AcpiAmlExecCreateEvent (WalkState);
842        break;
843
844
845    case AML_REGION_OP:
846
847        if (Node->Object)
848        {
849            break;
850        }
851
852        DEBUG_PRINT (TRACE_DISPATCH,
853            ("LOADING-Opregion: Op=%p State=%p NamedObj=%p\n", Op, WalkState, Node));
854
855
856        /*
857         * The OpRegion is not fully parsed at this time.  Only valid argument is the SpaceId.
858         * (We must save the address of the AML of the address and length operands)
859         */
860
861        Status = AcpiAmlExecCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data,
862                                        ((ACPI_PARSE2_OBJECT *) Op)->Length,
863                                        (ACPI_ADDRESS_SPACE_TYPE) Arg->Value.Integer,
864                                        WalkState);
865
866        DEBUG_PRINT (TRACE_DISPATCH,
867            ("Completed OpRegion Init, Op=%p State=%p entry=%p\n",
868            Op, WalkState, Node));
869        break;
870
871
872    /* Namespace Modifier Opcodes */
873
874    case AML_ALIAS_OP:
875
876        DEBUG_PRINT (TRACE_DISPATCH,
877            ("LOADING-Alias: Op=%p State=%p\n", Op, WalkState));
878
879        Status = AcpiDsCreateOperands (WalkState, Arg);
880        if (ACPI_FAILURE (Status))
881        {
882            goto Cleanup;
883        }
884
885        Status = AcpiAmlExecCreateAlias (WalkState);
886        break;
887
888
889    case AML_NAME_OP:
890
891        DEBUG_PRINT (TRACE_DISPATCH,
892            ("LOADING-Name: Op=%p State=%p\n", Op, WalkState));
893
894        /*
895         * Because of the execution pass through the non-control-method
896         * parts of the table, we can arrive here twice.  Only init
897         * the named object node the first time through
898         */
899
900        if (!Node->Object)
901        {
902            Status = AcpiDsCreateNode (WalkState, Node, Op);
903        }
904
905        break;
906
907
908    case AML_NAMEPATH_OP:
909
910        DEBUG_PRINT (TRACE_DISPATCH,
911            ("LOADING-NamePath object: State=%p Op=%p NamedObj=%p\n",
912            WalkState, Op, Node));
913        break;
914
915
916    default:
917        break;
918    }
919
920
921Cleanup:
922
923    /* Remove the Node pushed at the very beginning */
924
925    AcpiDsObjStackPop (1, WalkState);
926    return (Status);
927}
928
929
930