Lines Matching +full:control +full:- +full:parent

1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
4 * Module Name: psparse - Parser top level AML parse routines
6 * Copyright (C) 2000 - 2020, Intel Corp.
34 * PARAMETERS: opcode - An AML opcode
44 /* Extended (2-byte) opcode if > 255 */ in acpi_ps_get_opcode_size()
59 * PARAMETERS: parser_state - A parser state object
72 aml = parser_state->aml; in acpi_ps_peek_opcode()
90 * PARAMETERS: walk_state - Current State
91 * op - Op to complete
121 if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) != in acpi_ps_complete_this_op()
123 || (walk_state->op_info->class == AML_CLASS_ARGUMENT)) { in acpi_ps_complete_this_op()
129 if (op->common.parent) { in acpi_ps_complete_this_op()
130 prev = op->common.parent->common.value.arg; in acpi_ps_complete_this_op()
143 acpi_ps_get_opcode_info(op->common.parent->common. in acpi_ps_complete_this_op()
146 switch (parent_info->class) { in acpi_ps_complete_this_op()
158 op->common.aml); in acpi_ps_complete_this_op()
169 if ((op->common.parent->common.aml_opcode == in acpi_ps_complete_this_op()
171 || (op->common.parent->common.aml_opcode == in acpi_ps_complete_this_op()
173 || (op->common.parent->common.aml_opcode == in acpi_ps_complete_this_op()
175 || (op->common.parent->common.aml_opcode == in acpi_ps_complete_this_op()
177 || (op->common.parent->common.aml_opcode == in acpi_ps_complete_this_op()
179 || (op->common.parent->common.aml_opcode == in acpi_ps_complete_this_op()
183 op->common.aml); in acpi_ps_complete_this_op()
188 if ((op->common.parent->common.aml_opcode == in acpi_ps_complete_this_op()
190 && (walk_state->pass_number <= in acpi_ps_complete_this_op()
192 if ((op->common.aml_opcode == AML_BUFFER_OP) in acpi_ps_complete_this_op()
193 || (op->common.aml_opcode == AML_PACKAGE_OP) in acpi_ps_complete_this_op()
194 || (op->common.aml_opcode == in acpi_ps_complete_this_op()
197 acpi_ps_alloc_op(op->common. in acpi_ps_complete_this_op()
199 op->common.aml); in acpi_ps_complete_this_op()
203 replacement_op->named.data = in acpi_ps_complete_this_op()
204 op->named.data; in acpi_ps_complete_this_op()
205 replacement_op->named.length = in acpi_ps_complete_this_op()
206 op->named.length; in acpi_ps_complete_this_op()
216 op->common.aml); in acpi_ps_complete_this_op()
222 /* We must unlink this op from the parent tree */ in acpi_ps_complete_this_op()
229 replacement_op->common.parent = in acpi_ps_complete_this_op()
230 op->common.parent; in acpi_ps_complete_this_op()
231 replacement_op->common.value.arg = NULL; in acpi_ps_complete_this_op()
232 replacement_op->common.node = op->common.node; in acpi_ps_complete_this_op()
233 op->common.parent->common.value.arg = in acpi_ps_complete_this_op()
235 replacement_op->common.next = op->common.next; in acpi_ps_complete_this_op()
237 op->common.parent->common.value.arg = in acpi_ps_complete_this_op()
238 op->common.next; in acpi_ps_complete_this_op()
242 /* Search the parent list */ in acpi_ps_complete_this_op()
247 /* Traverse all siblings in the parent's argument list */ in acpi_ps_complete_this_op()
249 next = prev->common.next; in acpi_ps_complete_this_op()
252 replacement_op->common.parent = in acpi_ps_complete_this_op()
253 op->common.parent; in acpi_ps_complete_this_op()
254 replacement_op->common.value. in acpi_ps_complete_this_op()
256 replacement_op->common.node = in acpi_ps_complete_this_op()
257 op->common.node; in acpi_ps_complete_this_op()
258 prev->common.next = in acpi_ps_complete_this_op()
260 replacement_op->common.next = in acpi_ps_complete_this_op()
261 op->common.next; in acpi_ps_complete_this_op()
264 prev->common.next = in acpi_ps_complete_this_op()
265 op->common.next; in acpi_ps_complete_this_op()
285 * PARAMETERS: walk_state - Current state
286 * op - Current parse op
287 * callback_status - Status from previous operation
301 struct acpi_parse_state *parser_state = &walk_state->parser_state; in acpi_ps_next_parse_state()
309 * A control method was terminated via a RETURN statement. in acpi_ps_next_parse_state()
312 parser_state->aml = parser_state->aml_end; in acpi_ps_next_parse_state()
318 parser_state->aml = walk_state->aml_last_while; in acpi_ps_next_parse_state()
319 walk_state->control_state->common.value = FALSE; in acpi_ps_next_parse_state()
325 parser_state->aml = walk_state->aml_last_while; in acpi_ps_next_parse_state()
331 parser_state->aml = walk_state->aml_last_while; in acpi_ps_next_parse_state()
337 parser_state->aml = parser_state->scope->parse_scope.pkg_end; in acpi_ps_next_parse_state()
347 parser_state->aml = acpi_ps_get_next_package_end(parser_state); in acpi_ps_next_parse_state()
355 * package; We simply close out the parent (finishing the walk of in acpi_ps_next_parse_state()
356 * this branch of the tree) and continue execution at the parent in acpi_ps_next_parse_state()
359 parser_state->aml = parser_state->scope->parse_scope.pkg_end; in acpi_ps_next_parse_state()
363 walk_state->control_state->common.value = FALSE; in acpi_ps_next_parse_state()
369 /* A method call (invocation) -- transfer control */ in acpi_ps_next_parse_state()
372 walk_state->prev_op = op; in acpi_ps_next_parse_state()
373 walk_state->method_call_op = op; in acpi_ps_next_parse_state()
374 walk_state->method_call_node = in acpi_ps_next_parse_state()
375 (op->common.value.arg)->common.node; in acpi_ps_next_parse_state()
379 walk_state->return_used = in acpi_ps_next_parse_state()
399 * PARAMETERS: walk_state - Current state
419 walk_state, walk_state->parser_state.aml, in acpi_ps_parse_aml()
420 walk_state->parser_state.aml_size)); in acpi_ps_parse_aml()
422 if (!walk_state->parser_state.aml) { in acpi_ps_parse_aml()
430 if (walk_state->method_desc) { in acpi_ps_parse_aml()
432 /* Executing a control method - additional cleanup */ in acpi_ps_parse_aml()
434 acpi_ds_terminate_control_method(walk_state-> in acpi_ps_parse_aml()
443 walk_state->thread = thread; in acpi_ps_parse_aml()
449 if (walk_state->method_desc) { in acpi_ps_parse_aml()
450 walk_state->thread->current_sync_level = in acpi_ps_parse_aml()
451 walk_state->method_desc->method.sync_level; in acpi_ps_parse_aml()
458 * executing control method. in acpi_ps_parse_aml()
464 * handles nested control method invocations without recursion. in acpi_ps_parse_aml()
482 if (walk_state->method_pathname && walk_state->method_is_nested) { in acpi_ps_parse_aml()
487 "%-26s: %*s%s\n", in acpi_ps_parse_aml()
489 (walk_state-> in acpi_ps_parse_aml()
492 &walk_state->method_pathname[1])); in acpi_ps_parse_aml()
494 ACPI_FREE(walk_state->method_pathname); in acpi_ps_parse_aml()
495 walk_state->method_is_nested = FALSE; in acpi_ps_parse_aml()
500 * Transfer control to the called control method in acpi_ps_parse_aml()
512 * a new walk state was created -- get it in acpi_ps_parse_aml()
518 } else if ((status != AE_OK) && (walk_state->method_desc)) { in acpi_ps_parse_aml()
524 acpi_ns_print_node_pathname(walk_state-> in acpi_ps_parse_aml()
530 walk_state->method_node, NULL, in acpi_ps_parse_aml()
535 /* Check for possible multi-thread reentrancy problem */ in acpi_ps_parse_aml()
538 (!(walk_state->method_desc->method.info_flags & in acpi_ps_parse_aml()
546 walk_state->method_desc->method.info_flags |= in acpi_ps_parse_aml()
551 /* We are done with this walk, move on to the parent if any */ in acpi_ps_parse_aml()
560 * If we just returned from the execution of a control method or if we in acpi_ps_parse_aml()
564 if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == in acpi_ps_parse_aml()
566 !(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) || in acpi_ps_parse_aml()
568 acpi_ds_terminate_control_method(walk_state-> in acpi_ps_parse_aml()
573 /* Delete this walk state and all linked control states */ in acpi_ps_parse_aml()
575 acpi_ps_cleanup_scope(&walk_state->parser_state); in acpi_ps_parse_aml()
580 walk_state->return_desc, in acpi_ps_parse_aml()
581 walk_state->implicit_return_obj, walk_state)); in acpi_ps_parse_aml()
590 * If the method return value is not used by the parent, in acpi_ps_parse_aml()
593 if (!previous_walk_state->return_desc) { in acpi_ps_parse_aml()
599 !previous_walk_state-> in acpi_ps_parse_aml()
601 previous_walk_state-> in acpi_ps_parse_aml()
605 if (!previous_walk_state-> in acpi_ps_parse_aml()
612 /* Restart the calling control method */ in acpi_ps_parse_aml()
617 previous_walk_state-> in acpi_ps_parse_aml()
630 previous_walk_state->return_desc); in acpi_ps_parse_aml()
633 walk_state->walk_type |= in acpi_ps_parse_aml()
639 acpi_ut_remove_reference(previous_walk_state-> in acpi_ps_parse_aml()
647 * Just completed a 1st-level method, save the final internal return in acpi_ps_parse_aml()
650 else if (previous_walk_state->caller_return_desc) { in acpi_ps_parse_aml()
651 if (previous_walk_state->implicit_return_obj) { in acpi_ps_parse_aml()
652 *(previous_walk_state->caller_return_desc) = in acpi_ps_parse_aml()
653 previous_walk_state->implicit_return_obj; in acpi_ps_parse_aml()
657 *(previous_walk_state->caller_return_desc) = in acpi_ps_parse_aml()
658 previous_walk_state->return_desc; in acpi_ps_parse_aml()
661 if (previous_walk_state->return_desc) { in acpi_ps_parse_aml()
665 acpi_ut_remove_reference(previous_walk_state-> in acpi_ps_parse_aml()
668 if (previous_walk_state->implicit_return_obj) { in acpi_ps_parse_aml()
672 acpi_ut_remove_reference(previous_walk_state-> in acpi_ps_parse_aml()