^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: exoparg6 - AML execution - opcodes with 6 arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2000 - 2020, Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^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) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "acinterp.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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define _COMPONENT ACPI_EXECUTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) ACPI_MODULE_NAME("exoparg6")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /*!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * Naming convention for AML interpreter execution routines.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * The routines that begin execution of AML opcodes are named with a common
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * convention based upon the number of arguments, the number of target operands,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * and whether or not a value is returned:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * AcpiExOpcode_xA_yT_zR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * Where:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * xA - ARGUMENTS: The number of arguments (input operands) that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * required for this opcode type (1 through 6 args).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * yT - TARGETS: The number of targets (output operands) that are required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * for this opcode type (0, 1, or 2 targets).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * zR - RETURN VALUE: Indicates whether this opcode type returns a value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * as the function return (0 or 1).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * The AcpiExOpcode* functions are called via the Dispatcher component with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * fully resolved operands.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) !*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static u8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) acpi_ex_do_match(u32 match_op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) union acpi_operand_object *package_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) union acpi_operand_object *match_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * FUNCTION: acpi_ex_do_match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * PARAMETERS: match_op - The AML match operand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * package_obj - Object from the target package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * match_obj - Object to be matched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * RETURN: TRUE if the match is successful, FALSE otherwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * DESCRIPTION: Implements the low-level match for the ASL Match operator.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * Package elements will be implicitly converted to the type of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * the match object (Integer/Buffer/String).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) static u8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) acpi_ex_do_match(u32 match_op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) union acpi_operand_object *package_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) union acpi_operand_object *match_obj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) u8 logical_result = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * Note: Since the package_obj/match_obj ordering is opposite to that of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * the standard logical operators, we have to reverse them when we call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * do_logical_op in order to make the implicit conversion rules work
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * correctly. However, this means we have to flip the entire equation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * also. A bit ugly perhaps, but overall, better than fussing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * parameters around at runtime, over and over again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * Below, P[i] refers to the package element, M refers to the Match object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) switch (match_op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) case MATCH_MTR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* Always true */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) case MATCH_MEQ:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * True if equal: (P[i] == M)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * Change to: (M == P[i])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) acpi_ex_do_logical_op(AML_LOGICAL_EQUAL_OP, match_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) package_obj, &logical_result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) return (FALSE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) case MATCH_MLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * True if less than or equal: (P[i] <= M) (P[i] not_greater than M)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * Change to: (M >= P[i]) (M not_less than P[i])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) acpi_ex_do_logical_op(AML_LOGICAL_LESS_OP, match_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) package_obj, &logical_result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) return (FALSE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) logical_result = (u8) ! logical_result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) case MATCH_MLT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) * True if less than: (P[i] < M)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * Change to: (M > P[i])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) acpi_ex_do_logical_op(AML_LOGICAL_GREATER_OP, match_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) package_obj, &logical_result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) return (FALSE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) case MATCH_MGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * True if greater than or equal: (P[i] >= M) (P[i] not_less than M)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * Change to: (M <= P[i]) (M not_greater than P[i])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) acpi_ex_do_logical_op(AML_LOGICAL_GREATER_OP, match_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) package_obj, &logical_result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) return (FALSE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) logical_result = (u8) ! logical_result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) case MATCH_MGT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * True if greater than: (P[i] > M)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * Change to: (M < P[i])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) acpi_ex_do_logical_op(AML_LOGICAL_LESS_OP, match_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) package_obj, &logical_result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) return (FALSE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) /* Undefined */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) return (FALSE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) return (logical_result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) * FUNCTION: acpi_ex_opcode_6A_0T_1R
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) * PARAMETERS: walk_state - Current walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * DESCRIPTION: Execute opcode with 6 arguments, no target, and a return value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) union acpi_operand_object **operand = &walk_state->operands[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) union acpi_operand_object *return_desc = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) u64 index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) union acpi_operand_object *this_element;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) acpi_ps_get_opcode_name(walk_state->opcode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) switch (walk_state->opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) case AML_MATCH_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * Match (search_pkg[0], match_op1[1], match_obj1[2],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * match_op2[3], match_obj2[4], start_index[5])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) /* Validate both Match Term Operators (MTR, MEQ, etc.) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) (operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) ACPI_ERROR((AE_INFO, "Match operator out of range"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) status = AE_AML_OPERAND_VALUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) /* Get the package start_index, validate against the package length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) index = operand[5]->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) if (index >= operand[0]->package.count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) "Index (0x%8.8X%8.8X) beyond package end (0x%X)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) ACPI_FORMAT_UINT64(index),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) operand[0]->package.count));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) status = AE_AML_PACKAGE_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) /* Create an integer for the return value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) /* Default return value is ACPI_UINT64_MAX if no match found */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) return_desc = acpi_ut_create_integer_object(ACPI_UINT64_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (!return_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) * Examine each element until a match is found. Both match conditions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) * must be satisfied for a match to occur. Within the loop,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) * "continue" signifies that the current element does not match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) * and the next should be examined.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) * Upon finding a match, the loop will terminate via "break" at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) * the bottom. If it terminates "normally", match_value will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) * match was found.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) for (; index < operand[0]->package.count; index++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) /* Get the current package element */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) this_element = operand[0]->package.elements[index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) /* Treat any uninitialized (NULL) elements as non-matching */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) if (!this_element) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) continue;
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) * Both match conditions must be satisfied. Execution of a continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) * (proceed to next iteration of enclosing for loop) signifies a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) * non-match.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) if (!acpi_ex_do_match((u32) operand[1]->integer.value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) this_element, operand[2])) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) if (!acpi_ex_do_match((u32) operand[3]->integer.value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) this_element, operand[4])) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) /* Match found: Index is the return value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) return_desc->integer.value = index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) case AML_LOAD_TABLE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) status = acpi_ex_load_table_op(walk_state, &return_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) walk_state->opcode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) status = AE_AML_BAD_OPCODE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) /* Delete return object on error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) acpi_ut_remove_reference(return_desc);
^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) /* Save return object on success */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) walk_state->result_obj = return_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) }