]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - 6/sys/contrib/dev/acpica/dsutils.c
merge fix for boot-time hang on centos' xen
[FreeBSD/FreeBSD.git] / 6 / sys / contrib / dev / acpica / dsutils.c
1 /*******************************************************************************
2  *
3  * Module Name: dsutils - Dispatcher utilities
4  *              $Revision: 107 $
5  *
6  ******************************************************************************/
7
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2004, 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 __DSUTILS_C__
118
119 #include <contrib/dev/acpica/acpi.h>
120 #include <contrib/dev/acpica/acparser.h>
121 #include <contrib/dev/acpica/amlcode.h>
122 #include <contrib/dev/acpica/acdispat.h>
123 #include <contrib/dev/acpica/acinterp.h>
124 #include <contrib/dev/acpica/acnamesp.h>
125 #include <contrib/dev/acpica/acdebug.h>
126
127 #define _COMPONENT          ACPI_DISPATCHER
128         ACPI_MODULE_NAME    ("dsutils")
129
130
131 #ifndef ACPI_NO_METHOD_EXECUTION
132
133 /*******************************************************************************
134  *
135  * FUNCTION:    AcpiDsIsResultUsed
136  *
137  * PARAMETERS:  Op                  - Current Op
138  *              WalkState           - Current State
139  *
140  * RETURN:      TRUE if result is used, FALSE otherwise
141  *
142  * DESCRIPTION: Check if a result object will be used by the parent
143  *
144  ******************************************************************************/
145
146 BOOLEAN
147 AcpiDsIsResultUsed (
148     ACPI_PARSE_OBJECT       *Op,
149     ACPI_WALK_STATE         *WalkState)
150 {
151     const ACPI_OPCODE_INFO  *ParentInfo;
152
153
154     ACPI_FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
155
156
157     /* Must have both an Op and a Result Object */
158
159     if (!Op)
160     {
161         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
162         return_VALUE (TRUE);
163     }
164
165     /*
166      * If there is no parent, we are executing at the method level.
167      * An executing method typically has no parent, since each method
168      * is parsed separately.
169      */
170     if (!Op->Common.Parent ||
171         Op->Common.Parent->Common.AmlOpcode == AML_SCOPE_OP)
172     {
173         /*
174          * If this is the last statement in the method, we know it is not a
175          * Return() operator (would not come here.) The following code is the
176          * optional support for a so-called "implicit return". Some AML code
177          * assumes that the last value of the method is "implicitly" returned
178          * to the caller. Just save the last result as the return value.
179          * NOTE: this is optional because the ASL language does not actually
180          * support this behavior.
181          */
182         if ((AcpiGbl_EnableInterpreterSlack) &&
183             (WalkState->ParserState.Aml >= WalkState->ParserState.AmlEnd))
184         {
185             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
186                     "Result of [%s] will be implicitly returned\n",
187                     AcpiPsGetOpcodeName (Op->Common.AmlOpcode)));
188
189             /* Use the top of the result stack as the implicit return value */
190
191             WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc[0];
192             return_VALUE (TRUE);
193         }
194
195         /* No parent, the return value cannot possibly be used */
196
197         return_VALUE (FALSE);
198     }
199
200     /* Get info on the parent. The RootOp is AML_SCOPE */
201
202     ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
203     if (ParentInfo->Class == AML_CLASS_UNKNOWN)
204     {
205         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", Op));
206         return_VALUE (FALSE);
207     }
208
209     /*
210      * Decide what to do with the result based on the parent.  If
211      * the parent opcode will not use the result, delete the object.
212      * Otherwise leave it as is, it will be deleted when it is used
213      * as an operand later.
214      */
215     switch (ParentInfo->Class)
216     {
217     case AML_CLASS_CONTROL:
218
219         switch (Op->Common.Parent->Common.AmlOpcode)
220         {
221         case AML_RETURN_OP:
222
223             /* Never delete the return value associated with a return opcode */
224
225             goto ResultUsed;
226
227         case AML_IF_OP:
228         case AML_WHILE_OP:
229
230             /*
231              * If we are executing the predicate AND this is the predicate op,
232              * we will use the return value
233              */
234             if ((WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING) &&
235                 (WalkState->ControlState->Control.PredicateOp == Op))
236             {
237                 goto ResultUsed;
238             }
239             break;
240
241         default:
242             /* Ignore other control opcodes */
243             break;
244         }
245
246         /* The general control opcode returns no result */
247
248         goto ResultNotUsed;
249
250
251     case AML_CLASS_CREATE:
252
253         /*
254          * These opcodes allow TermArg(s) as operands and therefore
255          * the operands can be method calls.  The result is used.
256          */
257         goto ResultUsed;
258
259
260     case AML_CLASS_NAMED_OBJECT:
261
262         if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP)       ||
263             (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP)  ||
264             (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP)      ||
265             (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)  ||
266             (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP)       ||
267             (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP))
268         {
269             /*
270              * These opcodes allow TermArg(s) as operands and therefore
271              * the operands can be method calls.  The result is used.
272              */
273             goto ResultUsed;
274         }
275
276         goto ResultNotUsed;
277
278
279     default:
280
281         /*
282          * In all other cases. the parent will actually use the return
283          * object, so keep it.
284          */
285         goto ResultUsed;
286     }
287
288
289 ResultUsed:
290     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n",
291             AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
292             AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
293
294     return_VALUE (TRUE);
295
296
297 ResultNotUsed:
298     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n",
299             AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
300             AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
301
302     return_VALUE (FALSE);
303 }
304
305
306 /*******************************************************************************
307  *
308  * FUNCTION:    AcpiDsDeleteResultIfNotUsed
309  *
310  * PARAMETERS:  Op              - Current parse Op
311  *              ResultObj       - Result of the operation
312  *              WalkState       - Current state
313  *
314  * RETURN:      Status
315  *
316  * DESCRIPTION: Used after interpretation of an opcode.  If there is an internal
317  *              result descriptor, check if the parent opcode will actually use
318  *              this result.  If not, delete the result now so that it will
319  *              not become orphaned.
320  *
321  ******************************************************************************/
322
323 void
324 AcpiDsDeleteResultIfNotUsed (
325     ACPI_PARSE_OBJECT       *Op,
326     ACPI_OPERAND_OBJECT     *ResultObj,
327     ACPI_WALK_STATE         *WalkState)
328 {
329     ACPI_OPERAND_OBJECT     *ObjDesc;
330     ACPI_STATUS             Status;
331
332
333     ACPI_FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
334
335
336     if (!Op)
337     {
338         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
339         return_VOID;
340     }
341
342     if (!ResultObj)
343     {
344         return_VOID;
345     }
346
347     if (!AcpiDsIsResultUsed (Op, WalkState))
348     {
349         /*
350          * Must pop the result stack (ObjDesc should be equal to ResultObj)
351          */
352         Status = AcpiDsResultPop (&ObjDesc, WalkState);
353         if (ACPI_SUCCESS (Status))
354         {
355             AcpiUtRemoveReference (ResultObj);
356         }
357     }
358
359     return_VOID;
360 }
361
362
363 /*******************************************************************************
364  *
365  * FUNCTION:    AcpiDsResolveOperands
366  *
367  * PARAMETERS:  WalkState           - Current walk state with operands on stack
368  *
369  * RETURN:      Status
370  *
371  * DESCRIPTION: Resolve all operands to their values.  Used to prepare
372  *              arguments to a control method invocation (a call from one
373  *              method to another.)
374  *
375  ******************************************************************************/
376
377 ACPI_STATUS
378 AcpiDsResolveOperands (
379     ACPI_WALK_STATE         *WalkState)
380 {
381     UINT32                  i;
382     ACPI_STATUS             Status = AE_OK;
383
384
385     ACPI_FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
386
387
388     /*
389      * Attempt to resolve each of the valid operands
390      * Method arguments are passed by reference, not by value.  This means
391      * that the actual objects are passed, not copies of the objects.
392      */
393     for (i = 0; i < WalkState->NumOperands; i++)
394     {
395         Status = AcpiExResolveToValue (&WalkState->Operands[i], WalkState);
396         if (ACPI_FAILURE (Status))
397         {
398             break;
399         }
400     }
401
402     return_ACPI_STATUS (Status);
403 }
404
405
406 /*******************************************************************************
407  *
408  * FUNCTION:    AcpiDsClearOperands
409  *
410  * PARAMETERS:  WalkState           - Current walk state with operands on stack
411  *
412  * RETURN:      None
413  *
414  * DESCRIPTION: Clear all operands on the current walk state operand stack.
415  *
416  ******************************************************************************/
417
418 void
419 AcpiDsClearOperands (
420     ACPI_WALK_STATE         *WalkState)
421 {
422     UINT32                  i;
423
424
425     ACPI_FUNCTION_TRACE_PTR ("DsClearOperands", WalkState);
426
427
428     /*
429      * Remove a reference on each operand on the stack
430      */
431     for (i = 0; i < WalkState->NumOperands; i++)
432     {
433         /*
434          * Remove a reference to all operands, including both
435          * "Arguments" and "Targets".
436          */
437         AcpiUtRemoveReference (WalkState->Operands[i]);
438         WalkState->Operands[i] = NULL;
439     }
440
441     WalkState->NumOperands = 0;
442     return_VOID;
443 }
444 #endif
445
446
447 /*******************************************************************************
448  *
449  * FUNCTION:    AcpiDsCreateOperand
450  *
451  * PARAMETERS:  WalkState       - Current walk state
452  *              Arg             - Parse object for the argument
453  *              ArgIndex        - Which argument (zero based)
454  *
455  * RETURN:      Status
456  *
457  * DESCRIPTION: Translate a parse tree object that is an argument to an AML
458  *              opcode to the equivalent interpreter object.  This may include
459  *              looking up a name or entering a new name into the internal
460  *              namespace.
461  *
462  ******************************************************************************/
463
464 ACPI_STATUS
465 AcpiDsCreateOperand (
466     ACPI_WALK_STATE         *WalkState,
467     ACPI_PARSE_OBJECT       *Arg,
468     UINT32                  ArgIndex)
469 {
470     ACPI_STATUS             Status = AE_OK;
471     char                    *NameString;
472     UINT32                  NameLength;
473     ACPI_OPERAND_OBJECT     *ObjDesc;
474     ACPI_PARSE_OBJECT       *ParentOp;
475     UINT16                  Opcode;
476     ACPI_INTERPRETER_MODE   InterpreterMode;
477     const ACPI_OPCODE_INFO  *OpInfo;
478
479
480     ACPI_FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
481
482
483     /* A valid name must be looked up in the namespace */
484
485     if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
486         (Arg->Common.Value.String))
487     {
488         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg));
489
490         /* Get the entire name string from the AML stream */
491
492         Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Common.Value.Buffer,
493                         &NameString, &NameLength);
494
495         if (ACPI_FAILURE (Status))
496         {
497             return_ACPI_STATUS (Status);
498         }
499
500         /*
501          * All prefixes have been handled, and the name is
502          * in NameString
503          */
504
505
506         /*
507          * Special handling for BufferField declarations.  This is a deferred
508          * opcode that unfortunately defines the field name as the last
509          * parameter instead of the first.  We get here when we are performing
510          * the deferred execution, so the actual name of the field is already
511          * in the namespace.  We don't want to attempt to look it up again
512          * because we may be executing in a different scope than where the
513          * actual opcode exists.
514          */
515         if ((WalkState->DeferredNode) &&
516             (WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) &&
517             (ArgIndex != 0))
518         {
519             ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, WalkState->DeferredNode);
520             Status = AE_OK;
521         }
522         else    /* All other opcodes */
523         {
524             /*
525              * Differentiate between a namespace "create" operation
526              * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
527              * IMODE_EXECUTE) in order to support the creation of
528              * namespace objects during the execution of control methods.
529              */
530             ParentOp = Arg->Common.Parent;
531             OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode);
532             if ((OpInfo->Flags & AML_NSNODE) &&
533                 (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&
534                 (ParentOp->Common.AmlOpcode != AML_REGION_OP) &&
535                 (ParentOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
536             {
537                 /* Enter name into namespace if not found */
538
539                 InterpreterMode = ACPI_IMODE_LOAD_PASS2;
540             }
541             else
542             {
543                 /* Return a failure if name not found */
544
545                 InterpreterMode = ACPI_IMODE_EXECUTE;
546             }
547
548             Status = AcpiNsLookup (WalkState->ScopeInfo, NameString,
549                                     ACPI_TYPE_ANY, InterpreterMode,
550                                     ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
551                                     WalkState,
552                                     ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc));
553             /*
554              * The only case where we pass through (ignore) a NOT_FOUND
555              * error is for the CondRefOf opcode.
556              */
557             if (Status == AE_NOT_FOUND)
558             {
559                 if (ParentOp->Common.AmlOpcode == AML_COND_REF_OF_OP)
560                 {
561                     /*
562                      * For the Conditional Reference op, it's OK if
563                      * the name is not found;  We just need a way to
564                      * indicate this to the interpreter, set the
565                      * object to the root
566                      */
567                     ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, AcpiGbl_RootNode);
568                     Status = AE_OK;
569                 }
570                 else
571                 {
572                     /*
573                      * We just plain didn't find it -- which is a
574                      * very serious error at this point
575                      */
576                     Status = AE_AML_NAME_NOT_FOUND;
577                 }
578             }
579
580             if (ACPI_FAILURE (Status))
581             {
582                 ACPI_REPORT_NSERROR (NameString, Status);
583             }
584         }
585
586         /* Free the namestring created above */
587
588         ACPI_MEM_FREE (NameString);
589
590         /* Check status from the lookup */
591
592         if (ACPI_FAILURE (Status))
593         {
594             return_ACPI_STATUS (Status);
595         }
596
597         /* Put the resulting object onto the current object stack */
598
599         Status = AcpiDsObjStackPush (ObjDesc, WalkState);
600         if (ACPI_FAILURE (Status))
601         {
602             return_ACPI_STATUS (Status);
603         }
604         ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
605     }
606     else
607     {
608         /* Check for null name case */
609
610         if (Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
611         {
612             /*
613              * If the name is null, this means that this is an
614              * optional result parameter that was not specified
615              * in the original ASL.  Create a Zero Constant for a
616              * placeholder.  (Store to a constant is a Noop.)
617              */
618             Opcode = AML_ZERO_OP;       /* Has no arguments! */
619
620             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", Arg));
621         }
622         else
623         {
624             Opcode = Arg->Common.AmlOpcode;
625         }
626
627         /* Get the object type of the argument */
628
629         OpInfo = AcpiPsGetOpcodeInfo (Opcode);
630         if (OpInfo->ObjectType == ACPI_TYPE_INVALID)
631         {
632             return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
633         }
634
635         if (OpInfo->Flags & AML_HAS_RETVAL)
636         {
637             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
638                 "Argument previously created, already stacked \n"));
639
640             ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (
641                 WalkState->Operands [WalkState->NumOperands - 1], WalkState));
642
643             /*
644              * Use value that was already previously returned
645              * by the evaluation of this argument
646              */
647             Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState);
648             if (ACPI_FAILURE (Status))
649             {
650                 /*
651                  * Only error is underflow, and this indicates
652                  * a missing or null operand!
653                  */
654                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n",
655                     AcpiFormatException (Status)));
656                 return_ACPI_STATUS (Status);
657             }
658         }
659         else
660         {
661             /* Create an ACPI_INTERNAL_OBJECT for the argument */
662
663             ObjDesc = AcpiUtCreateInternalObject (OpInfo->ObjectType);
664             if (!ObjDesc)
665             {
666                 return_ACPI_STATUS (AE_NO_MEMORY);
667             }
668
669             /* Initialize the new object */
670
671             Status = AcpiDsInitObjectFromOp (WalkState, Arg,
672                                                 Opcode, &ObjDesc);
673             if (ACPI_FAILURE (Status))
674             {
675                 AcpiUtDeleteObjectDesc (ObjDesc);
676                 return_ACPI_STATUS (Status);
677             }
678         }
679
680         /* Put the operand object on the object stack */
681
682         Status = AcpiDsObjStackPush (ObjDesc, WalkState);
683         if (ACPI_FAILURE (Status))
684         {
685             return_ACPI_STATUS (Status);
686         }
687
688         ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
689     }
690
691     return_ACPI_STATUS (AE_OK);
692 }
693
694
695 /*******************************************************************************
696  *
697  * FUNCTION:    AcpiDsCreateOperands
698  *
699  * PARAMETERS:  FirstArg            - First argument of a parser argument tree
700  *
701  * RETURN:      Status
702  *
703  * DESCRIPTION: Convert an operator's arguments from a parse tree format to
704  *              namespace objects and place those argument object on the object
705  *              stack in preparation for evaluation by the interpreter.
706  *
707  ******************************************************************************/
708
709 ACPI_STATUS
710 AcpiDsCreateOperands (
711     ACPI_WALK_STATE         *WalkState,
712     ACPI_PARSE_OBJECT       *FirstArg)
713 {
714     ACPI_STATUS             Status = AE_OK;
715     ACPI_PARSE_OBJECT       *Arg;
716     UINT32                  ArgCount = 0;
717
718
719     ACPI_FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
720
721
722     /* For all arguments in the list... */
723
724     Arg = FirstArg;
725     while (Arg)
726     {
727         Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount);
728         if (ACPI_FAILURE (Status))
729         {
730             goto Cleanup;
731         }
732
733         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
734             ArgCount, Arg, FirstArg));
735
736         /* Move on to next argument, if any */
737
738         Arg = Arg->Common.Next;
739         ArgCount++;
740     }
741
742     return_ACPI_STATUS (Status);
743
744
745 Cleanup:
746     /*
747      * We must undo everything done above; meaning that we must
748      * pop everything off of the operand stack and delete those
749      * objects
750      */
751     (void) AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
752
753     ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
754         (ArgCount + 1), AcpiFormatException (Status)));
755     return_ACPI_STATUS (Status);
756 }
757
758