dswload.c revision 77424
1/******************************************************************************
2 *
3 * Module Name: dswload - Dispatcher namespace load callbacks
4 *              $Revision: 37 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights.  You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code.  No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision.  In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change.  Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee.  Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution.  In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government.  In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#define __DSWLOAD_C__
118
119#include "acpi.h"
120#include "acparser.h"
121#include "amlcode.h"
122#include "acdispat.h"
123#include "acinterp.h"
124#include "acnamesp.h"
125#include "acevents.h"
126
127
128#define _COMPONENT          ACPI_DISPATCHER
129        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    ACPI_OBJECT_TYPE8       DataType;
156    NATIVE_CHAR             *Path;
157
158
159    PROC_NAME ("DsLoad1BeginOp");
160    DEBUG_PRINTP (TRACE_DISPATCH, ("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_PRINTP (TRACE_DISPATCH,
188        ("State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
189
190
191    if (Opcode == AML_SCOPE_OP)
192    {
193        DEBUG_PRINTP (TRACE_DISPATCH,
194            ("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, DataType,
203                    IMODE_LOAD_PASS1, NS_NO_UPSEARCH, WalkState, &(Node));
204
205    if (ACPI_FAILURE (Status))
206    {
207        return (Status);
208    }
209
210    if (!Op)
211    {
212        /* Create a new op */
213
214        Op = AcpiPsAllocOp (Opcode);
215        if (!Op)
216        {
217            return (AE_NO_MEMORY);
218        }
219    }
220
221    /* Initialize */
222
223    ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
224
225    /*
226     * Put the Node in the "op" object that the parser uses, so we
227     * can get it again quickly when this scope is closed
228     */
229    Op->Node = Node;
230
231
232    AcpiPsAppendArg (AcpiPsGetParentScope (WalkState->ParserState), Op);
233
234    *OutOp = Op;
235
236    return (Status);
237}
238
239
240/*******************************************************************************
241 *
242 * FUNCTION:    AcpiDsLoad1EndOp
243 *
244 * PARAMETERS:  WalkState       - Current state of the parse tree walk
245 *              Op              - Op that has been just been completed in the
246 *                                walk;  Arguments have now been evaluated.
247 *
248 * RETURN:      Status
249 *
250 * DESCRIPTION: Ascending callback used during the loading of the namespace,
251 *              both control methods and everything else.
252 *
253 ******************************************************************************/
254
255ACPI_STATUS
256AcpiDsLoad1EndOp (
257    ACPI_WALK_STATE         *WalkState,
258    ACPI_PARSE_OBJECT       *Op)
259{
260    ACPI_OBJECT_TYPE8       DataType;
261
262
263    PROC_NAME ("DsLoad1EndOp");
264    DEBUG_PRINT (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState));
265
266    /* We are only interested in opcodes that have an associated name */
267
268    if (!AcpiPsIsNamedOp (Op->Opcode))
269    {
270        return (AE_OK);
271    }
272
273
274    /* Get the type to determine if we should pop the scope */
275
276    DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode);
277
278    if (Op->Opcode == AML_NAME_OP)
279    {
280        /* For Name opcode, check the argument */
281
282        if (Op->Value.Arg)
283        {
284            DataType = AcpiDsMapOpcodeToDataType (
285                            (Op->Value.Arg)->Opcode, NULL);
286            ((ACPI_NAMESPACE_NODE *)Op->Node)->Type =
287                            (UINT8) DataType;
288        }
289    }
290
291
292    /* Pop the scope stack */
293
294    if (AcpiNsOpensScope (DataType))
295    {
296        DEBUG_PRINTP (TRACE_DISPATCH, ("(%s): Popping scope for Op %p\n",
297            AcpiUtGetTypeName (DataType), Op));
298
299        AcpiDsScopeStackPop (WalkState);
300    }
301
302    return (AE_OK);
303
304}
305
306
307/*******************************************************************************
308 *
309 * FUNCTION:    AcpiDsLoad2BeginOp
310 *
311 * PARAMETERS:  WalkState       - Current state of the parse tree walk
312 *              Op              - Op that has been just been reached in the
313 *                                walk;  Arguments have not been evaluated yet.
314 *
315 * RETURN:      Status
316 *
317 * DESCRIPTION: Descending callback used during the loading of ACPI tables.
318 *
319 ******************************************************************************/
320
321ACPI_STATUS
322AcpiDsLoad2BeginOp (
323    UINT16                  Opcode,
324    ACPI_PARSE_OBJECT       *Op,
325    ACPI_WALK_STATE         *WalkState,
326    ACPI_PARSE_OBJECT       **OutOp)
327{
328    ACPI_NAMESPACE_NODE     *Node;
329    ACPI_STATUS             Status;
330    ACPI_OBJECT_TYPE8       DataType;
331    NATIVE_CHAR             *BufferPtr;
332    void                    *Original = NULL;
333
334
335    PROC_NAME ("DsLoad2BeginOp");
336    DEBUG_PRINTP (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState));
337
338
339    /* We only care about Namespace opcodes here */
340
341    if (!AcpiPsIsNamespaceOp (Opcode) &&
342        Opcode != AML_INT_NAMEPATH_OP)
343    {
344        return (AE_OK);
345    }
346
347
348    /* Temp! same code as in psparse */
349
350    if (!AcpiPsIsNamedOp (Opcode))
351    {
352        return (AE_OK);
353    }
354
355    if (Op)
356    {
357        /*
358         * Get the name we are going to enter or lookup in the namespace
359         */
360        if (Opcode == AML_INT_NAMEPATH_OP)
361        {
362            /* For Namepath op, get the path string */
363
364            BufferPtr = Op->Value.String;
365            if (!BufferPtr)
366            {
367                /* No name, just exit */
368
369                return (AE_OK);
370            }
371        }
372
373        else
374        {
375            /* Get name from the op */
376
377            BufferPtr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Op)->Name;
378        }
379    }
380
381    else
382    {
383        BufferPtr = AcpiPsGetNextNamestring (WalkState->ParserState);
384    }
385
386
387    /* Map the raw opcode into an internal object type */
388
389    DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
390
391    DEBUG_PRINTP (TRACE_DISPATCH,
392        ("State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
393
394
395    if (Opcode == AML_FIELD_OP          ||
396        Opcode == AML_BANK_FIELD_OP     ||
397        Opcode == AML_INDEX_FIELD_OP)
398    {
399        Node = NULL;
400        Status = AE_OK;
401    }
402
403    else if (Opcode == AML_INT_NAMEPATH_OP)
404    {
405        /*
406         * The NamePath is an object reference to an existing object.  Don't enter the
407         * name into the namespace, but look it up for use later
408         */
409        Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr,
410                                DataType, IMODE_EXECUTE,
411                                NS_SEARCH_PARENT, WalkState,
412                                &(Node));
413    }
414
415    else
416    {
417        if (Op && Op->Node)
418        {
419            Original = Op->Node;
420            Node = Op->Node;
421
422            if (AcpiNsOpensScope (DataType))
423            {
424                Status = AcpiDsScopeStackPush (Node,
425                                                DataType,
426                                                WalkState);
427                if (ACPI_FAILURE (Status))
428                {
429                    return (Status);
430                }
431
432            }
433            return (AE_OK);
434        }
435
436        /*
437         * Enter the named type into the internal namespace.  We enter the name
438         * as we go downward in the parse tree.  Any necessary subobjects that involve
439         * arguments to the opcode must be created as we go back up the parse tree later.
440         */
441        Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType,
442                        IMODE_EXECUTE, NS_NO_UPSEARCH, WalkState, &(Node));
443    }
444
445    if (ACPI_SUCCESS (Status))
446    {
447        if (!Op)
448        {
449            /* Create a new op */
450
451            Op = AcpiPsAllocOp (Opcode);
452            if (!Op)
453            {
454                return (AE_NO_MEMORY);
455            }
456
457            /* Initialize */
458
459            ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
460            *OutOp = Op;
461        }
462
463
464        /*
465         * Put the Node in the "op" object that the parser uses, so we
466         * can get it again quickly when this scope is closed
467         */
468        Op->Node = Node;
469
470        if (Original)
471        {
472            DEBUG_PRINTP (ACPI_INFO, ("old %p new %p\n", Original, Node));
473
474            if (Original != Node)
475            {
476                DEBUG_PRINTP (ACPI_INFO,
477                    ("Lookup match error: old %p new %p\n", Original, Node));
478            }
479        }
480    }
481
482    return (Status);
483}
484
485
486/*******************************************************************************
487 *
488 * FUNCTION:    AcpiDsLoad2EndOp
489 *
490 * PARAMETERS:  WalkState       - Current state of the parse tree walk
491 *              Op              - Op that has been just been completed in the
492 *                                walk;  Arguments have now been evaluated.
493 *
494 * RETURN:      Status
495 *
496 * DESCRIPTION: Ascending callback used during the loading of the namespace,
497 *              both control methods and everything else.
498 *
499 ******************************************************************************/
500
501ACPI_STATUS
502AcpiDsLoad2EndOp (
503    ACPI_WALK_STATE         *WalkState,
504    ACPI_PARSE_OBJECT       *Op)
505{
506    ACPI_STATUS             Status = AE_OK;
507    ACPI_OBJECT_TYPE8      DataType;
508    ACPI_NAMESPACE_NODE     *Node;
509    ACPI_PARSE_OBJECT       *Arg;
510    ACPI_NAMESPACE_NODE     *NewNode;
511
512
513    PROC_NAME ("DsLoad2EndOp");
514    DEBUG_PRINTP (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState));
515
516    if (!AcpiPsIsNamespaceObjectOp (Op->Opcode))
517    {
518        return (AE_OK);
519    }
520
521    if (Op->Opcode == AML_SCOPE_OP)
522    {
523        DEBUG_PRINTP (TRACE_DISPATCH,
524            ("Ending scope Op=%p State=%p\n", Op, WalkState));
525
526        if (((ACPI_PARSE2_OBJECT *)Op)->Name == -1)
527        {
528            DEBUG_PRINTP (ACPI_ERROR, ("Unnamed scope! Op=%p State=%p\n",
529                Op, WalkState));
530            return (AE_OK);
531        }
532    }
533
534
535    DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode);
536
537    /*
538     * Get the Node/name from the earlier lookup
539     * (It was saved in the *op structure)
540     */
541    Node = Op->Node;
542
543    /*
544     * Put the Node on the object stack (Contains the ACPI Name of
545     * this object)
546     */
547
548    WalkState->Operands[0] = (void *) Node;
549    WalkState->NumOperands = 1;
550
551    /* Pop the scope stack */
552
553    if (AcpiNsOpensScope (DataType))
554    {
555
556        DEBUG_PRINTP (TRACE_DISPATCH, ("(%s) Popping scope for Op %p\n",
557            AcpiUtGetTypeName (DataType), Op));
558        AcpiDsScopeStackPop (WalkState);
559    }
560
561
562    /*
563     * Named operations are as follows:
564     *
565     * AML_SCOPE
566     * AML_DEVICE
567     * AML_THERMALZONE
568     * AML_METHOD
569     * AML_POWERRES
570     * AML_PROCESSOR
571     * AML_FIELD
572     * AML_INDEXFIELD
573     * AML_BANKFIELD
574     * AML_NAMEDFIELD
575     * AML_NAME
576     * AML_ALIAS
577     * AML_MUTEX
578     * AML_EVENT
579     * AML_OPREGION
580     * AML_CREATEFIELD
581     * AML_CREATEBITFIELD
582     * AML_CREATEBYTEFIELD
583     * AML_CREATEWORDFIELD
584     * AML_CREATEDWORDFIELD
585     * AML_CREATEQWORDFIELD
586     * AML_METHODCALL
587     */
588
589
590    /* Decode the opcode */
591
592    Arg = Op->Value.Arg;
593
594    switch (Op->Opcode)
595    {
596
597    case AML_CREATE_FIELD_OP:
598    case AML_CREATE_BIT_FIELD_OP:
599    case AML_CREATE_BYTE_FIELD_OP:
600    case AML_CREATE_WORD_FIELD_OP:
601    case AML_CREATE_DWORD_FIELD_OP:
602    case AML_CREATE_QWORD_FIELD_OP:
603
604        /*
605         * Create the field object, but the field buffer and index must
606         * be evaluated later during the execution phase
607         */
608
609        DEBUG_PRINTP (TRACE_DISPATCH,
610            ("CreateXxxField: State=%p Op=%p NamedObj=%p\n",
611            WalkState, Op, Node));
612
613        /* Get the NameString argument */
614
615        if (Op->Opcode == AML_CREATE_FIELD_OP)
616        {
617            Arg = AcpiPsGetArg (Op, 3);
618        }
619        else
620        {
621            /* Create Bit/Byte/Word/Dword field */
622
623            Arg = AcpiPsGetArg (Op, 2);
624        }
625
626        if (!Arg)
627        {
628            Status = AE_AML_NO_OPERAND;
629            goto Cleanup;
630        }
631
632        /*
633         * Enter the NameString into the namespace
634         */
635        Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
636                                INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1,
637                                NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
638                                WalkState, &(NewNode));
639        if (ACPI_FAILURE (Status))
640        {
641            goto Cleanup;
642        }
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 = AcpiExCreateBufferField (((ACPI_PARSE2_OBJECT *) Op)->Data,
662                            ((ACPI_PARSE2_OBJECT *) Op)->Length,
663                            NewNode, WalkState);
664        }
665        break;
666
667
668    case AML_INT_METHODCALL_OP:
669
670        DEBUG_PRINTP (TRACE_DISPATCH,
671            ("RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
672            WalkState, Op, Node));
673
674        /*
675         * Lookup the method name and save the Node
676         */
677
678        Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
679                        ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
680                        NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
681                        WalkState, &(NewNode));
682
683        if (ACPI_SUCCESS (Status))
684        {
685
686            /* TBD: has name already been resolved by here ??*/
687
688            /* TBD: [Restructure] Make sure that what we found is indeed a method! */
689            /* We didn't search for a method on purpose, to see if the name would resolve! */
690
691            /* We could put the returned object (Node) on the object stack for later, but
692             * for now, we will put it in the "op" object that the parser uses, so we
693             * can get it again at the end of this scope
694             */
695            Op->Node = NewNode;
696        }
697
698
699         break;
700
701
702    case AML_PROCESSOR_OP:
703
704        /* Nothing to do other than enter object into namespace */
705
706        DEBUG_PRINTP (TRACE_DISPATCH,
707            ("LOADING-Processor: State=%p Op=%p NamedObj=%p\n",
708            WalkState, Op, Node));
709
710        Status = AcpiExCreateProcessor (Op, Node);
711        if (ACPI_FAILURE (Status))
712        {
713            goto Cleanup;
714        }
715
716        DEBUG_PRINT (TRACE_DISPATCH,
717            ("Completed Processor Init, Op=%p State=%p entry=%p\n",
718            Op, WalkState, Node));
719        break;
720
721
722    case AML_POWER_RES_OP:
723
724        /* Nothing to do other than enter object into namespace */
725
726        DEBUG_PRINTP (TRACE_DISPATCH,
727            ("LOADING-PowerResource: State=%p Op=%p NamedObj=%p\n",
728            WalkState, Op, Node));
729
730        Status = AcpiExCreatePowerResource (Op, Node);
731        if (ACPI_FAILURE (Status))
732        {
733            goto Cleanup;
734        }
735
736        DEBUG_PRINT (TRACE_DISPATCH,
737            ("Completed PowerResource Init, Op=%p State=%p entry=%p\n",
738            Op, WalkState, Node));
739        break;
740
741
742    case AML_THERMAL_ZONE_OP:
743
744        /* Nothing to do other than enter object into namespace */
745
746        DEBUG_PRINTP (TRACE_DISPATCH,
747            ("LOADING-ThermalZone: State=%p Op=%p NamedObj=%p\n",
748            WalkState, Op, Node));
749        break;
750
751
752    case AML_FIELD_OP:
753
754        DEBUG_PRINTP (TRACE_DISPATCH,
755            ("LOADING-Field: State=%p Op=%p NamedObj=%p\n",
756            WalkState, Op, Node));
757
758        Arg = Op->Value.Arg;
759
760        Status = AcpiDsCreateField (Op, Arg->Node, WalkState);
761        break;
762
763
764    case AML_INDEX_FIELD_OP:
765
766        DEBUG_PRINTP (TRACE_DISPATCH,
767            ("LOADING-IndexField: State=%p Op=%p NamedObj=%p\n",
768            WalkState, Op, Node));
769
770        Arg = Op->Value.Arg;
771
772        Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Node,
773                                        WalkState);
774        break;
775
776
777    case AML_BANK_FIELD_OP:
778
779        DEBUG_PRINTP (TRACE_DISPATCH,
780            ("LOADING-BankField: State=%p Op=%p NamedObj=%p\n",
781            WalkState, Op, Node));
782
783        Arg = Op->Value.Arg;
784        Status = AcpiDsCreateBankField (Op, Arg->Node, WalkState);
785        break;
786
787
788    /*
789     * MethodOp PkgLength NamesString MethodFlags TermList
790     */
791    case AML_METHOD_OP:
792
793        DEBUG_PRINTP (TRACE_DISPATCH,
794            ("LOADING-Method: State=%p Op=%p NamedObj=%p\n",
795            WalkState, Op, Node));
796
797        if (!Node->Object)
798        {
799            Status = AcpiExCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data,
800                                ((ACPI_PARSE2_OBJECT *) Op)->Length,
801                                Arg->Value.Integer, Node);
802        }
803        break;
804
805
806    case AML_MUTEX_OP:
807
808        DEBUG_PRINTP (TRACE_DISPATCH,
809            ("LOADING-Mutex: Op=%p State=%p\n", Op, WalkState));
810
811        Status = AcpiDsCreateOperands (WalkState, Arg);
812        if (ACPI_FAILURE (Status))
813        {
814            goto Cleanup;
815        }
816
817        Status = AcpiExCreateMutex (WalkState);
818        break;
819
820
821    case AML_EVENT_OP:
822
823        DEBUG_PRINTP (TRACE_DISPATCH,
824            ("LOADING-Event: Op=%p State=%p\n", Op, WalkState));
825
826        Status = AcpiDsCreateOperands (WalkState, Arg);
827        if (ACPI_FAILURE (Status))
828        {
829            goto Cleanup;
830        }
831
832        Status = AcpiExCreateEvent (WalkState);
833        break;
834
835
836    case AML_REGION_OP:
837
838        if (Node->Object)
839        {
840            break;
841        }
842
843        DEBUG_PRINTP (TRACE_DISPATCH,
844            ("LOADING-Opregion: Op=%p State=%p NamedObj=%p\n",
845            Op, WalkState, Node));
846
847        /*
848         * The OpRegion is not fully parsed at this time.  Only valid argument is the SpaceId.
849         * (We must save the address of the AML of the address and length operands)
850         */
851        Status = AcpiExCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data,
852                        ((ACPI_PARSE2_OBJECT *) Op)->Length,
853                         (ACPI_ADR_SPACE_TYPE) Arg->Value.Integer, WalkState);
854
855        DEBUG_PRINT (TRACE_DISPATCH,
856            ("Completed OpRegion Init, Op=%p State=%p entry=%p\n",
857            Op, WalkState, Node));
858        break;
859
860
861    /* Namespace Modifier Opcodes */
862
863    case AML_ALIAS_OP:
864
865        DEBUG_PRINTP (TRACE_DISPATCH,
866            ("LOADING-Alias: Op=%p State=%p\n", Op, WalkState));
867
868        Status = AcpiDsCreateOperands (WalkState, Arg);
869        if (ACPI_FAILURE (Status))
870        {
871            goto Cleanup;
872        }
873
874        Status = AcpiExCreateAlias (WalkState);
875        break;
876
877
878    case AML_NAME_OP:
879
880        DEBUG_PRINTP (TRACE_DISPATCH,
881            ("LOADING-Name: Op=%p State=%p\n", Op, WalkState));
882
883        /*
884         * Because of the execution pass through the non-control-method
885         * parts of the table, we can arrive here twice.  Only init
886         * the named object node the first time through
887         */
888
889        if (!Node->Object)
890        {
891            Status = AcpiDsCreateNode (WalkState, Node, Op);
892        }
893
894        break;
895
896
897    case AML_INT_NAMEPATH_OP:
898
899        DEBUG_PRINTP (TRACE_DISPATCH,
900            ("LOADING-NamePath object: State=%p Op=%p NamedObj=%p\n",
901            WalkState, Op, Node));
902        break;
903
904
905    default:
906        break;
907    }
908
909
910Cleanup:
911
912    /* Remove the Node pushed at the very beginning */
913
914    AcpiDsObjStackPop (1, WalkState);
915    return (Status);
916}
917
918
919