aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher/dsutils.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/acpi/dispatcher/dsutils.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/acpi/dispatcher/dsutils.c')
-rw-r--r--drivers/acpi/dispatcher/dsutils.c744
1 files changed, 744 insertions, 0 deletions
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c
new file mode 100644
index 000000000000..462c5d83e747
--- /dev/null
+++ b/drivers/acpi/dispatcher/dsutils.c
@@ -0,0 +1,744 @@
1/*******************************************************************************
2 *
3 * Module Name: dsutils - Dispatcher utilities
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44
45#include <acpi/acpi.h>
46#include <acpi/acparser.h>
47#include <acpi/amlcode.h>
48#include <acpi/acdispat.h>
49#include <acpi/acinterp.h>
50#include <acpi/acnamesp.h>
51#include <acpi/acdebug.h>
52
53#define _COMPONENT ACPI_DISPATCHER
54 ACPI_MODULE_NAME ("dsutils")
55
56
57/*******************************************************************************
58 *
59 * FUNCTION: acpi_ds_clear_implicit_return
60 *
61 * PARAMETERS: walk_state - Current State
62 *
63 * RETURN: None.
64 *
65 * DESCRIPTION: Clear and remove a reference on an implicit return value. Used
66 * to delete "stale" return values (if enabled, the return value
67 * from every operator is saved at least momentarily, in case the
68 * parent method exits.)
69 *
70 ******************************************************************************/
71
72void
73acpi_ds_clear_implicit_return (
74 struct acpi_walk_state *walk_state)
75{
76 ACPI_FUNCTION_NAME ("ds_clear_implicit_return");
77
78
79 /*
80 * Slack must be enabled for this feature
81 */
82 if (!acpi_gbl_enable_interpreter_slack) {
83 return;
84 }
85
86 if (walk_state->implicit_return_obj) {
87 /*
88 * Delete any "stale" implicit return. However, in
89 * complex statements, the implicit return value can be
90 * bubbled up several levels.
91 */
92 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
93 "Removing reference on stale implicit return obj %p\n",
94 walk_state->implicit_return_obj));
95
96 acpi_ut_remove_reference (walk_state->implicit_return_obj);
97 walk_state->implicit_return_obj = NULL;
98 }
99}
100
101
102#ifndef ACPI_NO_METHOD_EXECUTION
103
104/*******************************************************************************
105 *
106 * FUNCTION: acpi_ds_do_implicit_return
107 *
108 * PARAMETERS: return_desc - The return value
109 * walk_state - Current State
110 * add_reference - True if a reference should be added to the
111 * return object
112 *
113 * RETURN: TRUE if implicit return enabled, FALSE otherwise
114 *
115 * DESCRIPTION: Implements the optional "implicit return". We save the result
116 * of every ASL operator and control method invocation in case the
117 * parent method exit. Before storing a new return value, we
118 * delete the previous return value.
119 *
120 ******************************************************************************/
121
122u8
123acpi_ds_do_implicit_return (
124 union acpi_operand_object *return_desc,
125 struct acpi_walk_state *walk_state,
126 u8 add_reference)
127{
128 ACPI_FUNCTION_NAME ("ds_do_implicit_return");
129
130
131 /*
132 * Slack must be enabled for this feature, and we must
133 * have a valid return object
134 */
135 if ((!acpi_gbl_enable_interpreter_slack) ||
136 (!return_desc)) {
137 return (FALSE);
138 }
139
140 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
141 "Result %p will be implicitly returned; Prev=%p\n",
142 return_desc,
143 walk_state->implicit_return_obj));
144
145 /*
146 * Delete any "stale" implicit return value first. However, in
147 * complex statements, the implicit return value can be
148 * bubbled up several levels, so we don't clear the value if it
149 * is the same as the return_desc.
150 */
151 if (walk_state->implicit_return_obj) {
152 if (walk_state->implicit_return_obj == return_desc) {
153 return (TRUE);
154 }
155 acpi_ds_clear_implicit_return (walk_state);
156 }
157
158 /* Save the implicit return value, add a reference if requested */
159
160 walk_state->implicit_return_obj = return_desc;
161 if (add_reference) {
162 acpi_ut_add_reference (return_desc);
163 }
164
165 return (TRUE);
166}
167
168
169/*******************************************************************************
170 *
171 * FUNCTION: acpi_ds_is_result_used
172 *
173 * PARAMETERS: Op - Current Op
174 * walk_state - Current State
175 *
176 * RETURN: TRUE if result is used, FALSE otherwise
177 *
178 * DESCRIPTION: Check if a result object will be used by the parent
179 *
180 ******************************************************************************/
181
182u8
183acpi_ds_is_result_used (
184 union acpi_parse_object *op,
185 struct acpi_walk_state *walk_state)
186{
187 const struct acpi_opcode_info *parent_info;
188
189 ACPI_FUNCTION_TRACE_PTR ("ds_is_result_used", op);
190
191
192 /* Must have both an Op and a Result Object */
193
194 if (!op) {
195 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
196 return_VALUE (TRUE);
197 }
198
199 /*
200 * We know that this operator is not a
201 * Return() operator (would not come here.) The following code is the
202 * optional support for a so-called "implicit return". Some AML code
203 * assumes that the last value of the method is "implicitly" returned
204 * to the caller. Just save the last result as the return value.
205 * NOTE: this is optional because the ASL language does not actually
206 * support this behavior.
207 */
208 acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE);
209
210 /*
211 * Now determine if the parent will use the result
212 *
213 * If there is no parent, or the parent is a scope_op, we are executing
214 * at the method level. An executing method typically has no parent,
215 * since each method is parsed separately. A method invoked externally
216 * via execute_control_method has a scope_op as the parent.
217 */
218 if ((!op->common.parent) ||
219 (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
220 /* No parent, the return value cannot possibly be used */
221
222 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "At Method level, result of [%s] not used\n",
223 acpi_ps_get_opcode_name (op->common.aml_opcode)));
224 return_VALUE (FALSE);
225 }
226
227 /* Get info on the parent. The root_op is AML_SCOPE */
228
229 parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
230 if (parent_info->class == AML_CLASS_UNKNOWN) {
231 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op));
232 return_VALUE (FALSE);
233 }
234
235 /*
236 * Decide what to do with the result based on the parent. If
237 * the parent opcode will not use the result, delete the object.
238 * Otherwise leave it as is, it will be deleted when it is used
239 * as an operand later.
240 */
241 switch (parent_info->class) {
242 case AML_CLASS_CONTROL:
243
244 switch (op->common.parent->common.aml_opcode) {
245 case AML_RETURN_OP:
246
247 /* Never delete the return value associated with a return opcode */
248
249 goto result_used;
250
251 case AML_IF_OP:
252 case AML_WHILE_OP:
253
254 /*
255 * If we are executing the predicate AND this is the predicate op,
256 * we will use the return value
257 */
258 if ((walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING) &&
259 (walk_state->control_state->control.predicate_op == op)) {
260 goto result_used;
261 }
262 break;
263
264 default:
265 /* Ignore other control opcodes */
266 break;
267 }
268
269 /* The general control opcode returns no result */
270
271 goto result_not_used;
272
273
274 case AML_CLASS_CREATE:
275
276 /*
277 * These opcodes allow term_arg(s) as operands and therefore
278 * the operands can be method calls. The result is used.
279 */
280 goto result_used;
281
282
283 case AML_CLASS_NAMED_OBJECT:
284
285 if ((op->common.parent->common.aml_opcode == AML_REGION_OP) ||
286 (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
287 (op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
288 (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP) ||
289 (op->common.parent->common.aml_opcode == AML_BUFFER_OP) ||
290 (op->common.parent->common.aml_opcode == AML_INT_EVAL_SUBTREE_OP)) {
291 /*
292 * These opcodes allow term_arg(s) as operands and therefore
293 * the operands can be method calls. The result is used.
294 */
295 goto result_used;
296 }
297
298 goto result_not_used;
299
300
301 default:
302
303 /*
304 * In all other cases. the parent will actually use the return
305 * object, so keep it.
306 */
307 goto result_used;
308 }
309
310
311result_used:
312 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n",
313 acpi_ps_get_opcode_name (op->common.aml_opcode),
314 acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
315
316 return_VALUE (TRUE);
317
318
319result_not_used:
320 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n",
321 acpi_ps_get_opcode_name (op->common.aml_opcode),
322 acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
323
324 return_VALUE (FALSE);
325}
326
327
328/*******************************************************************************
329 *
330 * FUNCTION: acpi_ds_delete_result_if_not_used
331 *
332 * PARAMETERS: Op - Current parse Op
333 * result_obj - Result of the operation
334 * walk_state - Current state
335 *
336 * RETURN: Status
337 *
338 * DESCRIPTION: Used after interpretation of an opcode. If there is an internal
339 * result descriptor, check if the parent opcode will actually use
340 * this result. If not, delete the result now so that it will
341 * not become orphaned.
342 *
343 ******************************************************************************/
344
345void
346acpi_ds_delete_result_if_not_used (
347 union acpi_parse_object *op,
348 union acpi_operand_object *result_obj,
349 struct acpi_walk_state *walk_state)
350{
351 union acpi_operand_object *obj_desc;
352 acpi_status status;
353
354
355 ACPI_FUNCTION_TRACE_PTR ("ds_delete_result_if_not_used", result_obj);
356
357
358 if (!op) {
359 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
360 return_VOID;
361 }
362
363 if (!result_obj) {
364 return_VOID;
365 }
366
367 if (!acpi_ds_is_result_used (op, walk_state)) {
368 /* Must pop the result stack (obj_desc should be equal to result_obj) */
369
370 status = acpi_ds_result_pop (&obj_desc, walk_state);
371 if (ACPI_SUCCESS (status)) {
372 acpi_ut_remove_reference (result_obj);
373 }
374 }
375
376 return_VOID;
377}
378
379
380/*******************************************************************************
381 *
382 * FUNCTION: acpi_ds_resolve_operands
383 *
384 * PARAMETERS: walk_state - Current walk state with operands on stack
385 *
386 * RETURN: Status
387 *
388 * DESCRIPTION: Resolve all operands to their values. Used to prepare
389 * arguments to a control method invocation (a call from one
390 * method to another.)
391 *
392 ******************************************************************************/
393
394acpi_status
395acpi_ds_resolve_operands (
396 struct acpi_walk_state *walk_state)
397{
398 u32 i;
399 acpi_status status = AE_OK;
400
401
402 ACPI_FUNCTION_TRACE_PTR ("ds_resolve_operands", walk_state);
403
404
405 /*
406 * Attempt to resolve each of the valid operands
407 * Method arguments are passed by reference, not by value. This means
408 * that the actual objects are passed, not copies of the objects.
409 */
410 for (i = 0; i < walk_state->num_operands; i++) {
411 status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
412 if (ACPI_FAILURE (status)) {
413 break;
414 }
415 }
416
417 return_ACPI_STATUS (status);
418}
419
420
421/*******************************************************************************
422 *
423 * FUNCTION: acpi_ds_clear_operands
424 *
425 * PARAMETERS: walk_state - Current walk state with operands on stack
426 *
427 * RETURN: None
428 *
429 * DESCRIPTION: Clear all operands on the current walk state operand stack.
430 *
431 ******************************************************************************/
432
433void
434acpi_ds_clear_operands (
435 struct acpi_walk_state *walk_state)
436{
437 u32 i;
438
439
440 ACPI_FUNCTION_TRACE_PTR ("ds_clear_operands", walk_state);
441
442
443 /* Remove a reference on each operand on the stack */
444
445 for (i = 0; i < walk_state->num_operands; i++) {
446 /*
447 * Remove a reference to all operands, including both
448 * "Arguments" and "Targets".
449 */
450 acpi_ut_remove_reference (walk_state->operands[i]);
451 walk_state->operands[i] = NULL;
452 }
453
454 walk_state->num_operands = 0;
455 return_VOID;
456}
457#endif
458
459
460/*******************************************************************************
461 *
462 * FUNCTION: acpi_ds_create_operand
463 *
464 * PARAMETERS: walk_state - Current walk state
465 * Arg - Parse object for the argument
466 * arg_index - Which argument (zero based)
467 *
468 * RETURN: Status
469 *
470 * DESCRIPTION: Translate a parse tree object that is an argument to an AML
471 * opcode to the equivalent interpreter object. This may include
472 * looking up a name or entering a new name into the internal
473 * namespace.
474 *
475 ******************************************************************************/
476
477acpi_status
478acpi_ds_create_operand (
479 struct acpi_walk_state *walk_state,
480 union acpi_parse_object *arg,
481 u32 arg_index)
482{
483 acpi_status status = AE_OK;
484 char *name_string;
485 u32 name_length;
486 union acpi_operand_object *obj_desc;
487 union acpi_parse_object *parent_op;
488 u16 opcode;
489 acpi_interpreter_mode interpreter_mode;
490 const struct acpi_opcode_info *op_info;
491
492
493 ACPI_FUNCTION_TRACE_PTR ("ds_create_operand", arg);
494
495
496 /* A valid name must be looked up in the namespace */
497
498 if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) &&
499 (arg->common.value.string)) {
500 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg));
501
502 /* Get the entire name string from the AML stream */
503
504 status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->common.value.buffer,
505 &name_string, &name_length);
506
507 if (ACPI_FAILURE (status)) {
508 return_ACPI_STATUS (status);
509 }
510
511 /* All prefixes have been handled, and the name is in name_string */
512
513 /*
514 * Special handling for buffer_field declarations. This is a deferred
515 * opcode that unfortunately defines the field name as the last
516 * parameter instead of the first. We get here when we are performing
517 * the deferred execution, so the actual name of the field is already
518 * in the namespace. We don't want to attempt to look it up again
519 * because we may be executing in a different scope than where the
520 * actual opcode exists.
521 */
522 if ((walk_state->deferred_node) &&
523 (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) &&
524 (arg_index != 0)) {
525 obj_desc = ACPI_CAST_PTR (union acpi_operand_object, walk_state->deferred_node);
526 status = AE_OK;
527 }
528 else /* All other opcodes */ {
529 /*
530 * Differentiate between a namespace "create" operation
531 * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
532 * IMODE_EXECUTE) in order to support the creation of
533 * namespace objects during the execution of control methods.
534 */
535 parent_op = arg->common.parent;
536 op_info = acpi_ps_get_opcode_info (parent_op->common.aml_opcode);
537 if ((op_info->flags & AML_NSNODE) &&
538 (parent_op->common.aml_opcode != AML_INT_METHODCALL_OP) &&
539 (parent_op->common.aml_opcode != AML_REGION_OP) &&
540 (parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) {
541 /* Enter name into namespace if not found */
542
543 interpreter_mode = ACPI_IMODE_LOAD_PASS2;
544 }
545 else {
546 /* Return a failure if name not found */
547
548 interpreter_mode = ACPI_IMODE_EXECUTE;
549 }
550
551 status = acpi_ns_lookup (walk_state->scope_info, name_string,
552 ACPI_TYPE_ANY, interpreter_mode,
553 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
554 walk_state,
555 ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &obj_desc));
556 /*
557 * The only case where we pass through (ignore) a NOT_FOUND
558 * error is for the cond_ref_of opcode.
559 */
560 if (status == AE_NOT_FOUND) {
561 if (parent_op->common.aml_opcode == AML_COND_REF_OF_OP) {
562 /*
563 * For the Conditional Reference op, it's OK if
564 * the name is not found; We just need a way to
565 * indicate this to the interpreter, set the
566 * object to the root
567 */
568 obj_desc = ACPI_CAST_PTR (union acpi_operand_object, acpi_gbl_root_node);
569 status = AE_OK;
570 }
571 else {
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 ACPI_REPORT_NSERROR (name_string, status);
582 }
583 }
584
585 /* Free the namestring created above */
586
587 ACPI_MEM_FREE (name_string);
588
589 /* Check status from the lookup */
590
591 if (ACPI_FAILURE (status)) {
592 return_ACPI_STATUS (status);
593 }
594
595 /* Put the resulting object onto the current object stack */
596
597 status = acpi_ds_obj_stack_push (obj_desc, walk_state);
598 if (ACPI_FAILURE (status)) {
599 return_ACPI_STATUS (status);
600 }
601 ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
602 }
603 else {
604 /* Check for null name case */
605
606 if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) {
607 /*
608 * If the name is null, this means that this is an
609 * optional result parameter that was not specified
610 * in the original ASL. Create a Zero Constant for a
611 * placeholder. (Store to a constant is a Noop.)
612 */
613 opcode = AML_ZERO_OP; /* Has no arguments! */
614
615 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg));
616 }
617 else {
618 opcode = arg->common.aml_opcode;
619 }
620
621 /* Get the object type of the argument */
622
623 op_info = acpi_ps_get_opcode_info (opcode);
624 if (op_info->object_type == ACPI_TYPE_INVALID) {
625 return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
626 }
627
628 if (op_info->flags & AML_HAS_RETVAL) {
629 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
630 "Argument previously created, already stacked \n"));
631
632 ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (
633 walk_state->operands [walk_state->num_operands - 1], walk_state));
634
635 /*
636 * Use value that was already previously returned
637 * by the evaluation of this argument
638 */
639 status = acpi_ds_result_pop_from_bottom (&obj_desc, walk_state);
640 if (ACPI_FAILURE (status)) {
641 /*
642 * Only error is underflow, and this indicates
643 * a missing or null operand!
644 */
645 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n",
646 acpi_format_exception (status)));
647 return_ACPI_STATUS (status);
648 }
649 }
650 else {
651 /* Create an ACPI_INTERNAL_OBJECT for the argument */
652
653 obj_desc = acpi_ut_create_internal_object (op_info->object_type);
654 if (!obj_desc) {
655 return_ACPI_STATUS (AE_NO_MEMORY);
656 }
657
658 /* Initialize the new object */
659
660 status = acpi_ds_init_object_from_op (walk_state, arg,
661 opcode, &obj_desc);
662 if (ACPI_FAILURE (status)) {
663 acpi_ut_delete_object_desc (obj_desc);
664 return_ACPI_STATUS (status);
665 }
666 }
667
668 /* Put the operand object on the object stack */
669
670 status = acpi_ds_obj_stack_push (obj_desc, walk_state);
671 if (ACPI_FAILURE (status)) {
672 return_ACPI_STATUS (status);
673 }
674
675 ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
676 }
677
678 return_ACPI_STATUS (AE_OK);
679}
680
681
682/*******************************************************************************
683 *
684 * FUNCTION: acpi_ds_create_operands
685 *
686 * PARAMETERS: walk_state - Current state
687 * first_arg - First argument of a parser argument tree
688 *
689 * RETURN: Status
690 *
691 * DESCRIPTION: Convert an operator's arguments from a parse tree format to
692 * namespace objects and place those argument object on the object
693 * stack in preparation for evaluation by the interpreter.
694 *
695 ******************************************************************************/
696
697acpi_status
698acpi_ds_create_operands (
699 struct acpi_walk_state *walk_state,
700 union acpi_parse_object *first_arg)
701{
702 acpi_status status = AE_OK;
703 union acpi_parse_object *arg;
704 u32 arg_count = 0;
705
706
707 ACPI_FUNCTION_TRACE_PTR ("ds_create_operands", first_arg);
708
709
710 /* For all arguments in the list... */
711
712 arg = first_arg;
713 while (arg) {
714 status = acpi_ds_create_operand (walk_state, arg, arg_count);
715 if (ACPI_FAILURE (status)) {
716 goto cleanup;
717 }
718
719 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
720 arg_count, arg, first_arg));
721
722 /* Move on to next argument, if any */
723
724 arg = arg->common.next;
725 arg_count++;
726 }
727
728 return_ACPI_STATUS (status);
729
730
731cleanup:
732 /*
733 * We must undo everything done above; meaning that we must
734 * pop everything off of the operand stack and delete those
735 * objects
736 */
737 (void) acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state);
738
739 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
740 (arg_count + 1), acpi_format_exception (status)));
741 return_ACPI_STATUS (status);
742}
743
744