^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Module Name: dswexec - Dispatcher method execution callbacks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * dispatch to interpreter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (C) 2000 - 2020, Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "acparser.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "amlcode.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "acdispat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "acdebug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #ifdef ACPI_EXEC_APP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "aecommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define _COMPONENT ACPI_DISPATCHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) ACPI_MODULE_NAME("dswexec")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * Dispatch table for opcode classes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static acpi_execute_op acpi_gbl_op_type_dispatch[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) acpi_ex_opcode_0A_0T_1R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) acpi_ex_opcode_1A_0T_0R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) acpi_ex_opcode_1A_0T_1R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) acpi_ex_opcode_1A_1T_0R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) acpi_ex_opcode_1A_1T_1R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) acpi_ex_opcode_2A_0T_0R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) acpi_ex_opcode_2A_0T_1R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) acpi_ex_opcode_2A_1T_1R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) acpi_ex_opcode_2A_2T_1R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) acpi_ex_opcode_3A_0T_0R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) acpi_ex_opcode_3A_1T_1R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) acpi_ex_opcode_6A_0T_1R
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * FUNCTION: acpi_ds_get_predicate_value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * PARAMETERS: walk_state - Current state of the parse tree walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * result_obj - if non-zero, pop result from result stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * DESCRIPTION: Get the result of a predicate evaluation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) union acpi_operand_object *result_obj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) union acpi_operand_object *local_obj_desc = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) ACPI_FUNCTION_TRACE_PTR(ds_get_predicate_value, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) walk_state->control_state->common.state = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) if (result_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) status = acpi_ds_result_pop(&obj_desc, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) ACPI_EXCEPTION((AE_INFO, status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) "Could not get result from predicate evaluation"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) status = acpi_ds_create_operand(walk_state, walk_state->op, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) acpi_ex_resolve_to_value(&walk_state->operands[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) obj_desc = walk_state->operands[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) "No predicate ObjDesc=%p State=%p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) obj_desc, walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) return_ACPI_STATUS(AE_AML_NO_OPERAND);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * Result of predicate evaluation must be an Integer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * object. Implicitly convert the argument if necessary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) ACPI_IMPLICIT_CONVERSION);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) if (local_obj_desc->common.type != ACPI_TYPE_INTEGER) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) obj_desc, walk_state, obj_desc->common.type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) status = AE_AML_OPERAND_TYPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /* Truncate the predicate to 32-bits if necessary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) (void)acpi_ex_truncate_for32bit_table(local_obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * Save the result of the predicate evaluation on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * the control stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) if (local_obj_desc->integer.value) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) walk_state->control_state->common.value = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * Predicate is FALSE, we will just toss the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * rest of the package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) walk_state->control_state->common.value = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) status = AE_CTRL_FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /* Predicate can be used for an implicit return value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) (void)acpi_ds_do_implicit_return(local_obj_desc, walk_state, TRUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) "Completed a predicate eval=%X Op=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) walk_state->control_state->common.value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) walk_state->op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) /* Break to debugger to display result */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) acpi_db_display_result_object(local_obj_desc, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * Delete the predicate result object (we know that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) * we don't need it anymore)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) if (local_obj_desc != obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) acpi_ut_remove_reference(local_obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) * FUNCTION: acpi_ds_exec_begin_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) * PARAMETERS: walk_state - Current state of the parse tree walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * out_op - Where to return op if a new one is created
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * DESCRIPTION: Descending callback used during the execution of control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * methods. This is where most operators and operands are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * dispatched to the interpreter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) union acpi_parse_object **out_op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) union acpi_parse_object *op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) u32 opcode_class;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) ACPI_FUNCTION_TRACE_PTR(ds_exec_begin_op, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) op = walk_state->op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) if (!op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) status = acpi_ds_load2_begin_op(walk_state, out_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) goto error_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) op = *out_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) walk_state->op = op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) walk_state->opcode = op->common.aml_opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) walk_state->op_info =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) acpi_ps_get_opcode_info(op->common.aml_opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) if (acpi_ns_opens_scope(walk_state->op_info->object_type)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) "(%s) Popping scope for Op %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) acpi_ut_get_type_name(walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) op_info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) object_type),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) status = acpi_ds_scope_stack_pop(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) goto error_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) if (op == walk_state->origin) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) if (out_op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) *out_op = op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) * If the previous opcode was a conditional, this opcode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) * must be the beginning of the associated predicate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) * Save this knowledge in the current scope descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) if ((walk_state->control_state) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) (walk_state->control_state->common.state ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) "Exec predicate Op=%p State=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) op, walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) walk_state->control_state->common.state =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) ACPI_CONTROL_PREDICATE_EXECUTING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) /* Save start of predicate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) walk_state->control_state->control.predicate_op = op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) opcode_class = walk_state->op_info->class;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) /* We want to send namepaths to the load code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) opcode_class = AML_CLASS_NAMED_OBJECT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * Handle the opcode based upon the opcode type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) switch (opcode_class) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) case AML_CLASS_CONTROL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) status = acpi_ds_exec_begin_control_op(walk_state, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) case AML_CLASS_NAMED_OBJECT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) if (walk_state->walk_type & ACPI_WALK_METHOD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) * Found a named object declaration during method execution;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) * we must enter this object into the namespace. The created
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) * object is temporary and will be deleted upon completion of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) * the execution of this method.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) * Note 10/2010: Except for the Scope() op. This opcode does
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) * not actually create a new object, it refers to an existing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) * object. However, for Scope(), we want to indeed open a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) * new scope.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) if (op->common.aml_opcode != AML_SCOPE_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) acpi_ds_load2_begin_op(walk_state, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) acpi_ds_scope_stack_push(op->named.node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) op->named.node->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) type, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) case AML_CLASS_EXECUTE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) case AML_CLASS_CREATE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) /* Nothing to do here during method execution */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) error_exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) status = acpi_ds_method_error(status, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) * FUNCTION: acpi_ds_exec_end_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) * PARAMETERS: walk_state - Current state of the parse tree walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) * DESCRIPTION: Ascending callback used during the execution of control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) * methods. The only thing we really need to do here is to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) * notice the beginning of IF, ELSE, and WHILE blocks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) union acpi_parse_object *op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) u32 op_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) u32 op_class;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) union acpi_parse_object *next_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) union acpi_parse_object *first_arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) #ifdef ACPI_EXEC_APP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) char *namepath;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) op = walk_state->op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) op_type = walk_state->op_info->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) op_class = walk_state->op_info->class;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) if (op_class == AML_CLASS_UNKNOWN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) ACPI_ERROR((AE_INFO, "Unknown opcode 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) op->common.aml_opcode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) first_arg = op->common.value.arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) /* Init the walk state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) walk_state->num_operands = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) walk_state->operand_index = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) walk_state->return_desc = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) walk_state->result_obj = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) /* Call debugger for single step support (DEBUG build only) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) status = acpi_db_single_step(walk_state, op, op_class);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) /* Decode the Opcode Class */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) switch (op_class) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) status = acpi_ds_evaluate_name_path(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) case AML_CLASS_EXECUTE: /* Most operators with arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) /* Build resolved operand stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) status = acpi_ds_create_operands(walk_state, first_arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) * All opcodes require operand resolution, with the only exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) * being the object_type and size_of operators.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) /* Resolve all operands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) status = acpi_ex_resolve_operands(walk_state->opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) &(walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) [walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) num_operands - 1]),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) if (ACPI_SUCCESS(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) * Dispatch the request to the appropriate interpreter handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) * routine. There is one routine per opcode "type" based upon the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) * number of opcode arguments and return type.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) acpi_gbl_op_type_dispatch[op_type] (walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) * Local is uninitialized.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) (walk_state->opcode == AML_STORE_OP) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) (walk_state->operands[0]->common.type ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) ACPI_TYPE_LOCAL_REFERENCE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) && (walk_state->operands[1]->common.type ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) ACPI_TYPE_LOCAL_REFERENCE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) && (walk_state->operands[0]->reference.class ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) walk_state->operands[1]->reference.class)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) && (walk_state->operands[0]->reference.value ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) walk_state->operands[1]->reference.value)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) ACPI_EXCEPTION((AE_INFO, status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) "While resolving operands for [%s]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) acpi_ps_get_opcode_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) (walk_state->opcode)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) /* Always delete the argument objects and clear the operand stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) acpi_ds_clear_operands(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) * If a result object was returned from above, push it on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) * current result stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) if (ACPI_SUCCESS(status) && walk_state->result_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) acpi_ds_result_push(walk_state->result_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) switch (op_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) /* 1 Operand, 0 external_result, 0 internal_result */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) status = acpi_ds_exec_end_control_op(walk_state, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) case AML_TYPE_METHOD_CALL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) * If the method is referenced from within a package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) * declaration, it is not a invocation of the method, just
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) * a reference to it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) if ((op->asl.parent) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) || (op->asl.parent->asl.aml_opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) AML_VARIABLE_PACKAGE_OP))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) "Method Reference in a Package, Op=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) op->common.node = (struct acpi_namespace_node *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) op->asl.value.arg->asl.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) acpi_ut_add_reference(op->asl.value.arg->asl.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) node->object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) "Method invocation, Op=%p\n", op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) * the method Node pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) /* next_op points to the op that holds the method name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) next_op = first_arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) /* next_op points to first argument op */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) next_op = next_op->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) * Get the method's arguments and put them on the operand stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) status = acpi_ds_create_operands(walk_state, next_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) * Since the operands will be passed to another control method,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) * we must resolve all local references here (Local variables,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) * arguments to *this* method, etc.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) status = acpi_ds_resolve_operands(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) /* On error, clear all resolved operands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) acpi_ds_clear_operands(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) * Tell the walk loop to preempt this running method and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) * execute the new method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) status = AE_CTRL_TRANSFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) * Return now; we don't want to disturb anything,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) * especially the operand count!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) case AML_TYPE_CREATE_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) "Executing CreateField Buffer/Index Op=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) status = acpi_ds_load2_end_op(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) acpi_ds_eval_buffer_field_operands(walk_state, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) #ifdef ACPI_EXEC_APP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) * acpi_exec support for namespace initialization file (initialize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) * buffer_fields in this code.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) namepath =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) acpi_ns_get_external_pathname(op->common.node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) status = ae_lookup_init_file_entry(namepath, &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) if (ACPI_SUCCESS(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) acpi_ex_write_data_to_field(obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) op->common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) node->object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) if ACPI_FAILURE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) (status) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) ACPI_EXCEPTION((AE_INFO, status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) "While writing to buffer field"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) ACPI_FREE(namepath);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) case AML_TYPE_CREATE_OBJECT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) "Executing CreateObject (Buffer/Package) Op=%p Child=%p ParentOpcode=%4.4X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) op, op->named.value.arg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) op->common.parent->common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) aml_opcode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) switch (op->common.parent->common.aml_opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) case AML_NAME_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) * Put the Node on the object stack (Contains the ACPI Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) * of this object)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) walk_state->operands[0] = (void *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) op->common.parent->common.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) walk_state->num_operands = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) status = acpi_ds_create_node(walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) op->common.parent->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) common.node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) op->common.parent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) /* Fall through */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) /*lint -fallthrough */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) case AML_INT_EVAL_SUBTREE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) acpi_ds_eval_data_object_operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) (walk_state, op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) acpi_ns_get_attached_object(op->common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) parent->common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) acpi_ds_eval_data_object_operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) (walk_state, op, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) * If a result object was returned from above, push it on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) * current result stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) if (walk_state->result_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) acpi_ds_result_push(walk_state->result_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) case AML_TYPE_NAMED_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) case AML_TYPE_NAMED_COMPLEX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) case AML_TYPE_NAMED_SIMPLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) case AML_TYPE_NAMED_NO_OBJ:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) status = acpi_ds_load2_end_op(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) if (op->common.aml_opcode == AML_REGION_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) "Executing OpRegion Address/Length Op=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) acpi_ds_eval_region_operands(walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) } else if (op->common.aml_opcode == AML_DATA_REGION_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) "Executing DataTableRegion Strings Op=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) acpi_ds_eval_table_region_operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) (walk_state, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) } else if (op->common.aml_opcode == AML_BANK_FIELD_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) "Executing BankField Op=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) acpi_ds_eval_bank_field_operands(walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) case AML_TYPE_UNDEFINED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) "Undefined opcode type Op=%p", op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) case AML_TYPE_BOGUS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) "Internal opcode=%X type Op=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) walk_state->opcode, op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) "Unimplemented opcode, class=0x%X "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) "type=0x%X Opcode=0x%X Op=%p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) op_class, op_type, op->common.aml_opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) status = AE_NOT_IMPLEMENTED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) * ACPI 2.0 support for 64-bit integers: Truncate numeric
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) * result value if we are executing from a 32-bit ACPI table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) (void)acpi_ex_truncate_for32bit_table(walk_state->result_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) * Check if we just completed the evaluation of a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) * conditional predicate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) if ((ACPI_SUCCESS(status)) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) (walk_state->control_state) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) (walk_state->control_state->common.state ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) ACPI_CONTROL_PREDICATE_EXECUTING) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) (walk_state->control_state->control.predicate_op == op)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) acpi_ds_get_predicate_value(walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) walk_state->result_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) walk_state->result_obj = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) if (walk_state->result_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) /* Break to debugger to display result */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) acpi_db_display_result_object(walk_state->result_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) * Delete the result op if and only if:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) * Parent will not use the result -- such as any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) * non-nested type2 op in a method (parent will be method)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) acpi_ds_delete_result_if_not_used(op, walk_state->result_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) #ifdef _UNDER_DEVELOPMENT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) acpi_db_method_end(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) /* Invoke exception handler on error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) status = acpi_ds_method_error(status, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) /* Always clear the object stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) walk_state->num_operands = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) }