dswexec.c revision 84491
1/******************************************************************************
2 *
3 * Module Name: dswexec - Dispatcher method execution callbacks;
4 *                        dispatch to interpreter.
5 *              $Revision: 71 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights.  You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.
22 *
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
29 *
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code.  No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
38 *
39 * The above copyright and patent license is granted only if the following
40 * conditions are met:
41 *
42 * 3. Conditions
43 *
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision.  In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change.  Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee.  Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
55 *
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution.  In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
66 * make.
67 *
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
72 * distribution.
73 *
74 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * Intel Code.
76 *
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
81 *
82 * 4. Disclaimer and Export Compliance
83 *
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * PARTICULAR PURPOSE.
91 *
92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * LIMITED REMEDY.
100 *
101 * 4.3. Licensee shall not export, either directly or indirectly, any of this
102 * software or system incorporating such software without first obtaining any
103 * required license or other approval from the U. S. Department of Commerce or
104 * any other agency or department of the United States Government.  In the
105 * event Licensee exports any such software from the United States or
106 * re-exports any such software from a foreign destination, Licensee shall
107 * ensure that the distribution and export/re-export of the software is in
108 * compliance with all laws, regulations, orders, or other restrictions of the
109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110 * any of its subsidiaries will export/re-export any technical data, process,
111 * software, or service, directly or indirectly, to any country for which the
112 * United States government or any agency thereof requires an export license,
113 * other governmental approval, or letter of assurance, without first obtaining
114 * such license, approval or letter.
115 *
116 *****************************************************************************/
117
118#define __DSWEXEC_C__
119
120#include "acpi.h"
121#include "acparser.h"
122#include "amlcode.h"
123#include "acdispat.h"
124#include "acinterp.h"
125#include "acnamesp.h"
126#include "acdebug.h"
127
128
129#define _COMPONENT          ACPI_DISPATCHER
130        MODULE_NAME         ("dswexec")
131
132
133/*****************************************************************************
134 *
135 * FUNCTION:    AcpiDsGetPredicateValue
136 *
137 * PARAMETERS:  WalkState       - Current state of the parse tree walk
138 *
139 * RETURN:      Status
140 *
141 * DESCRIPTION: Get the result of a predicate evaluation
142 *
143 ****************************************************************************/
144
145ACPI_STATUS
146AcpiDsGetPredicateValue (
147    ACPI_WALK_STATE         *WalkState,
148    UINT32                  HasResultObj)
149{
150    ACPI_STATUS             Status = AE_OK;
151    ACPI_OPERAND_OBJECT     *ObjDesc;
152
153
154    FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
155
156
157    WalkState->ControlState->Common.State = 0;
158
159    if (HasResultObj)
160    {
161        Status = AcpiDsResultPop (&ObjDesc, WalkState);
162        if (ACPI_FAILURE (Status))
163        {
164            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
165                "Could not get result from predicate evaluation, %s\n",
166                AcpiFormatException (Status)));
167
168            return_ACPI_STATUS (Status);
169        }
170    }
171
172    else
173    {
174        Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0);
175        if (ACPI_FAILURE (Status))
176        {
177            return_ACPI_STATUS (Status);
178        }
179
180        Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
181        if (ACPI_FAILURE (Status))
182        {
183            return_ACPI_STATUS (Status);
184        }
185
186        ObjDesc = WalkState->Operands [0];
187    }
188
189    if (!ObjDesc)
190    {
191        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate ObjDesc=%X State=%X\n",
192            ObjDesc, WalkState));
193
194        return_ACPI_STATUS (AE_AML_NO_OPERAND);
195    }
196
197
198    /*
199     * Result of predicate evaluation currently must
200     * be a number
201     */
202    if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
203    {
204        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
205            "Bad predicate (not a number) ObjDesc=%X State=%X Type=%X\n",
206            ObjDesc, WalkState, ObjDesc->Common.Type));
207
208        Status = AE_AML_OPERAND_TYPE;
209        goto Cleanup;
210    }
211
212
213    /* Truncate the predicate to 32-bits if necessary */
214
215    AcpiExTruncateFor32bitTable (ObjDesc, WalkState);
216
217    /*
218     * Save the result of the predicate evaluation on
219     * the control stack
220     */
221    if (ObjDesc->Integer.Value)
222    {
223        WalkState->ControlState->Common.Value = TRUE;
224    }
225
226    else
227    {
228        /*
229         * Predicate is FALSE, we will just toss the
230         * rest of the package
231         */
232        WalkState->ControlState->Common.Value = FALSE;
233        Status = AE_CTRL_FALSE;
234    }
235
236
237Cleanup:
238
239    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%X\n",
240        WalkState->ControlState->Common.Value, WalkState->Op));
241
242     /* Break to debugger to display result */
243
244    DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
245
246    /*
247     * Delete the predicate result object (we know that
248     * we don't need it anymore)
249     */
250    AcpiUtRemoveReference (ObjDesc);
251
252    WalkState->ControlState->Common.State = CONTROL_NORMAL;
253    return_ACPI_STATUS (Status);
254}
255
256
257/*****************************************************************************
258 *
259 * FUNCTION:    AcpiDsExecBeginOp
260 *
261 * PARAMETERS:  WalkState       - Current state of the parse tree walk
262 *              OutOp           - Return op if a new one is created
263 *
264 * RETURN:      Status
265 *
266 * DESCRIPTION: Descending callback used during the execution of control
267 *              methods.  This is where most operators and operands are
268 *              dispatched to the interpreter.
269 *
270 ****************************************************************************/
271
272ACPI_STATUS
273AcpiDsExecBeginOp (
274    ACPI_WALK_STATE         *WalkState,
275    ACPI_PARSE_OBJECT       **OutOp)
276{
277    ACPI_PARSE_OBJECT       *Op;
278    ACPI_STATUS             Status = AE_OK;
279    UINT8                   OpcodeClass;
280
281
282    FUNCTION_TRACE_PTR ("DsExecBeginOp", WalkState);
283
284
285    Op = WalkState->Op;
286    if (!Op)
287    {
288        Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
289        if (ACPI_FAILURE (Status))
290        {
291            return_ACPI_STATUS (Status);
292        }
293
294        Op = *OutOp;
295        WalkState->Op = Op;
296        WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
297        WalkState->Opcode = Op->Opcode;
298    }
299
300    if (Op == WalkState->Origin)
301    {
302        if (OutOp)
303        {
304            *OutOp = Op;
305        }
306
307        return_ACPI_STATUS (AE_OK);
308    }
309
310    /*
311     * If the previous opcode was a conditional, this opcode
312     * must be the beginning of the associated predicate.
313     * Save this knowledge in the current scope descriptor
314     */
315    if ((WalkState->ControlState) &&
316        (WalkState->ControlState->Common.State ==
317            CONTROL_CONDITIONAL_EXECUTING))
318    {
319        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%X State=%X\n",
320                        Op, WalkState));
321
322        WalkState->ControlState->Common.State = CONTROL_PREDICATE_EXECUTING;
323
324        /* Save start of predicate */
325
326        WalkState->ControlState->Control.PredicateOp = Op;
327    }
328
329
330    OpcodeClass = (UINT8) ACPI_GET_OP_CLASS (WalkState->OpInfo);
331
332    /* We want to send namepaths to the load code */
333
334    if (Op->Opcode == AML_INT_NAMEPATH_OP)
335    {
336        OpcodeClass = OPTYPE_NAMED_OBJECT;
337    }
338
339    /*
340     * Handle the opcode based upon the opcode type
341     */
342    switch (OpcodeClass)
343    {
344    case OPTYPE_CONTROL:
345
346        Status = AcpiDsResultStackPush (WalkState);
347        if (ACPI_FAILURE (Status))
348        {
349            return_ACPI_STATUS (Status);
350        }
351
352        Status = AcpiDsExecBeginControlOp (WalkState, Op);
353        break;
354
355
356    case OPTYPE_NAMED_OBJECT:
357
358        if (WalkState->WalkType == WALK_METHOD)
359        {
360            /*
361             * Found a named object declaration during method
362             * execution;  we must enter this object into the
363             * namespace.  The created object is temporary and
364             * will be deleted upon completion of the execution
365             * of this method.
366             */
367            Status = AcpiDsLoad2BeginOp (WalkState, NULL);
368        }
369
370
371        if (Op->Opcode == AML_REGION_OP)
372        {
373            Status = AcpiDsResultStackPush (WalkState);
374        }
375
376        break;
377
378
379    /* most operators with arguments */
380
381    case OPTYPE_MONADIC1:
382    case OPTYPE_DYADIC1:
383    case OPTYPE_MONADIC2:
384    case OPTYPE_MONADIC2R:
385    case OPTYPE_DYADIC2:
386    case OPTYPE_DYADIC2R:
387    case OPTYPE_DYADIC2S:
388    case OPTYPE_RECONFIGURATION:
389    case OPTYPE_TRIADIC:
390    case OPTYPE_QUADRADIC:
391    case OPTYPE_HEXADIC:
392    case OPTYPE_CREATE_FIELD:
393
394        /* Start a new result/operand state */
395
396        Status = AcpiDsResultStackPush (WalkState);
397        break;
398
399
400    default:
401        break;
402    }
403
404    /* Nothing to do here during method execution */
405
406    return_ACPI_STATUS (Status);
407}
408
409
410/*****************************************************************************
411 *
412 * FUNCTION:    AcpiDsExecEndOp
413 *
414 * PARAMETERS:  WalkState       - Current state of the parse tree walk
415 *              Op              - Op that has been just been completed in the
416 *                                walk;  Arguments have now been evaluated.
417 *
418 * RETURN:      Status
419 *
420 * DESCRIPTION: Ascending callback used during the execution of control
421 *              methods.  The only thing we really need to do here is to
422 *              notice the beginning of IF, ELSE, and WHILE blocks.
423 *
424 ****************************************************************************/
425
426ACPI_STATUS
427AcpiDsExecEndOp (
428    ACPI_WALK_STATE         *WalkState)
429{
430    ACPI_PARSE_OBJECT       *Op;
431    ACPI_STATUS             Status = AE_OK;
432    UINT8                   Optype;
433    ACPI_PARSE_OBJECT       *NextOp;
434    ACPI_PARSE_OBJECT       *FirstArg;
435    UINT32                  i;
436
437
438    FUNCTION_TRACE_PTR ("DsExecEndOp", WalkState);
439
440
441    Op = WalkState->Op;
442
443
444    if (ACPI_GET_OP_TYPE (WalkState->OpInfo) != ACPI_OP_TYPE_OPCODE)
445    {
446        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", Op->Opcode));
447        return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
448    }
449
450    Optype = (UINT8) ACPI_GET_OP_CLASS (WalkState->OpInfo);
451    FirstArg = Op->Value.Arg;
452
453    /* Init the walk state */
454
455    WalkState->NumOperands = 0;
456    WalkState->ReturnDesc = NULL;
457    WalkState->ResultObj = NULL;
458
459
460    /* Call debugger for single step support (DEBUG build only) */
461
462    DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, Optype));
463    DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);});
464
465
466    /* Decode the opcode */
467
468    switch (Optype)
469    {
470    case OPTYPE_UNDEFINED:
471
472        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%X\n", Op));
473        return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
474        break;
475
476
477    case OPTYPE_BOGUS:
478        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Internal opcode=%X type Op=%X\n",
479            WalkState->Opcode, Op));
480        break;
481
482    case OPTYPE_CONSTANT:           /* argument type only */
483    case OPTYPE_LITERAL:            /* argument type only */
484    case OPTYPE_DATA_TERM:          /* argument type only */
485    case OPTYPE_LOCAL_VARIABLE:     /* argument type only */
486    case OPTYPE_METHOD_ARGUMENT:    /* argument type only */
487        break;
488
489
490    /* most operators with arguments */
491
492    case OPTYPE_MONADIC1:
493    case OPTYPE_DYADIC1:
494    case OPTYPE_MONADIC2:
495    case OPTYPE_MONADIC2R:
496    case OPTYPE_DYADIC2:
497    case OPTYPE_DYADIC2R:
498    case OPTYPE_DYADIC2S:
499    case OPTYPE_RECONFIGURATION:
500    case OPTYPE_TRIADIC:
501    case OPTYPE_QUADRADIC:
502    case OPTYPE_HEXADIC:
503
504
505        /* Build resolved operand stack */
506
507        Status = AcpiDsCreateOperands (WalkState, FirstArg);
508        if (ACPI_FAILURE (Status))
509        {
510            goto Cleanup;
511        }
512
513        /* Done with this result state (Now that operand stack is built) */
514
515        Status = AcpiDsResultStackPop (WalkState);
516        if (ACPI_FAILURE (Status))
517        {
518            goto Cleanup;
519        }
520
521        /* Resolve all operands */
522
523        Status = AcpiExResolveOperands (WalkState->Opcode,
524                        &(WalkState->Operands [WalkState->NumOperands -1]),
525                        WalkState);
526        if (ACPI_FAILURE (Status))
527        {
528            /* TBD: must pop and delete operands */
529
530            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "[%s]: Could not resolve operands, %s\n",
531                AcpiPsGetOpcodeName (WalkState->Opcode), AcpiFormatException (Status)));
532
533            /*
534             * On error, we must delete all the operands and clear the
535             * operand stack
536             */
537            for (i = 0; i < WalkState->NumOperands; i++)
538            {
539                AcpiUtRemoveReference (WalkState->Operands[i]);
540                WalkState->Operands[i] = NULL;
541            }
542
543            WalkState->NumOperands = 0;
544            goto Cleanup;
545        }
546
547        DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (WalkState->Opcode),
548                        WalkState->NumOperands, "after ExResolveOperands");
549
550        switch (Optype)
551        {
552        case OPTYPE_MONADIC1:
553
554            /* 1 Operand, 0 ExternalResult, 0 InternalResult */
555
556            Status = AcpiExMonadic1 (WalkState);
557            break;
558
559
560        case OPTYPE_MONADIC2:
561
562            /* 1 Operand, 0 ExternalResult, 1 InternalResult */
563
564            Status = AcpiExMonadic2 (WalkState);
565            break;
566
567
568        case OPTYPE_MONADIC2R:
569
570            /* 1 Operand, 1 ExternalResult, 1 InternalResult */
571
572            Status = AcpiExMonadic2R (WalkState);
573            break;
574
575
576        case OPTYPE_DYADIC1:
577
578            /* 2 Operands, 0 ExternalResult, 0 InternalResult */
579
580            Status = AcpiExDyadic1 (WalkState);
581            break;
582
583
584        case OPTYPE_DYADIC2:
585
586            /* 2 Operands, 0 ExternalResult, 1 InternalResult */
587
588            Status = AcpiExDyadic2 (WalkState);
589            break;
590
591
592        case OPTYPE_DYADIC2R:
593
594            /* 2 Operands, 1 or 2 ExternalResults, 1 InternalResult */
595
596            Status = AcpiExDyadic2R (WalkState);
597            break;
598
599
600        case OPTYPE_DYADIC2S:   /* Synchronization Operator */
601
602            /* 2 Operands, 0 ExternalResult, 1 InternalResult */
603
604            Status = AcpiExDyadic2S (WalkState);
605            break;
606
607
608        case OPTYPE_TRIADIC:    /* WalkState->Opcode with 3 operands */
609
610            /* 3 Operands, 1 ExternalResult, 1 InternalResult */
611
612            Status = AcpiExTriadic (WalkState);
613            break;
614
615
616        case OPTYPE_QUADRADIC:  /* Opcode with 4 operands */
617            break;
618
619
620        case OPTYPE_HEXADIC:    /* Opcode with 6 operands */
621
622            /* 6 Operands, 0 ExternalResult, 1 InternalResult */
623
624            Status = AcpiExHexadic (WalkState);
625            break;
626
627
628        case OPTYPE_RECONFIGURATION:
629
630            /* 1 or 2 operands, 0 Internal Result */
631
632            Status = AcpiExReconfiguration (WalkState);
633            break;
634        }
635
636        /* Clear the operand stack */
637
638        for (i = 0; i < WalkState->NumOperands; i++)
639        {
640            WalkState->Operands[i] = NULL;
641        }
642        WalkState->NumOperands = 0;
643
644        /*
645         * If a result object was returned from above, push it on the
646         * current result stack
647         */
648        if (ACPI_SUCCESS (Status) &&
649            WalkState->ResultObj)
650        {
651            Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
652        }
653
654        break;
655
656
657    case OPTYPE_CONTROL:    /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
658
659        /* 1 Operand, 0 ExternalResult, 0 InternalResult */
660
661        Status = AcpiDsExecEndControlOp (WalkState, Op);
662
663        AcpiDsResultStackPop (WalkState);
664        break;
665
666
667    case OPTYPE_METHOD_CALL:
668
669        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%X\n", Op));
670
671        /*
672         * (AML_METHODCALL) Op->Value->Arg->Node contains
673         * the method Node pointer
674         */
675        /* NextOp points to the op that holds the method name */
676
677        NextOp = FirstArg;
678
679        /* NextOp points to first argument op */
680
681        NextOp = NextOp->Next;
682
683        /*
684         * Get the method's arguments and put them on the operand stack
685         */
686        Status = AcpiDsCreateOperands (WalkState, NextOp);
687        if (ACPI_FAILURE (Status))
688        {
689            break;
690        }
691
692        /*
693         * Since the operands will be passed to another
694         * control method, we must resolve all local
695         * references here (Local variables, arguments
696         * to *this* method, etc.)
697         */
698        Status = AcpiDsResolveOperands (WalkState);
699        if (ACPI_FAILURE (Status))
700        {
701            break;
702        }
703
704        /*
705         * Tell the walk loop to preempt this running method and
706         * execute the new method
707         */
708        Status = AE_CTRL_TRANSFER;
709
710        /*
711         * Return now; we don't want to disturb anything,
712         * especially the operand count!
713         */
714        return_ACPI_STATUS (Status);
715        break;
716
717
718    case OPTYPE_CREATE_FIELD:
719
720        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
721            "Executing CreateField Buffer/Index Op=%X\n", Op));
722
723        Status = AcpiDsLoad2EndOp (WalkState);
724        if (ACPI_FAILURE (Status))
725        {
726            break;
727        }
728
729        Status = AcpiDsEvalBufferFieldOperands (WalkState, Op);
730        break;
731
732
733    case OPTYPE_NAMED_OBJECT:
734
735        Status = AcpiDsLoad2EndOp (WalkState);
736        if (ACPI_FAILURE (Status))
737        {
738            break;
739        }
740
741        switch (Op->Opcode)
742        {
743        case AML_REGION_OP:
744
745            ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
746                "Executing OpRegion Address/Length Op=%X\n", Op));
747
748            Status = AcpiDsEvalRegionOperands (WalkState, Op);
749            if (ACPI_FAILURE (Status))
750            {
751                break;
752            }
753
754            Status = AcpiDsResultStackPop (WalkState);
755            break;
756
757
758        case AML_METHOD_OP:
759            break;
760
761
762        case AML_ALIAS_OP:
763
764            /* Alias creation was already handled by call
765            to psxload above */
766            break;
767
768
769        default:
770            /* Nothing needs to be done */
771
772            Status = AE_OK;
773            break;
774        }
775
776        break;
777
778    default:
779
780        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
781            "Unimplemented opcode, type=%X Opcode=%X Op=%X\n",
782            Optype, Op->Opcode, Op));
783
784        Status = AE_NOT_IMPLEMENTED;
785        break;
786    }
787
788
789    /*
790     * ACPI 2.0 support for 64-bit integers:
791     * Truncate numeric result value if we are executing from a 32-bit ACPI table
792     */
793    AcpiExTruncateFor32bitTable (WalkState->ResultObj, WalkState);
794
795    /*
796     * Check if we just completed the evaluation of a
797     * conditional predicate
798     */
799
800    if ((WalkState->ControlState) &&
801        (WalkState->ControlState->Common.State ==
802            CONTROL_PREDICATE_EXECUTING) &&
803        (WalkState->ControlState->Control.PredicateOp == Op))
804    {
805        Status = AcpiDsGetPredicateValue (WalkState, (UINT32) WalkState->ResultObj);
806        WalkState->ResultObj = NULL;
807    }
808
809
810Cleanup:
811    if (WalkState->ResultObj)
812    {
813        /* Break to debugger to display result */
814
815        DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, WalkState));
816
817        /*
818         * Delete the result op if and only if:
819         * Parent will not use the result -- such as any
820         * non-nested type2 op in a method (parent will be method)
821         */
822        AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
823    }
824
825    /* Always clear the object stack */
826
827    /* TBD: [Investigate] Clear stack of return value,
828    but don't delete it */
829    WalkState->NumOperands = 0;
830
831    return_ACPI_STATUS (Status);
832}
833
834
835