^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: exresop - AML Interpreter operand/object resolution
^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 "amlcode.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 "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define _COMPONENT ACPI_EXECUTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) ACPI_MODULE_NAME("exresop")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) acpi_ex_check_object_type(acpi_object_type type_needed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) acpi_object_type this_type, void *object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^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) * FUNCTION: acpi_ex_check_object_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * PARAMETERS: type_needed Object type needed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * this_type Actual object type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * Object Object pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * DESCRIPTION: Check required type against actual type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) acpi_ex_check_object_type(acpi_object_type type_needed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) acpi_object_type this_type, void *object)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) ACPI_FUNCTION_ENTRY();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) if (type_needed == ACPI_TYPE_ANY) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /* All types OK, so we don't perform any typechecks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) if (type_needed == ACPI_TYPE_LOCAL_REFERENCE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * objects and thus allow them to be targets. (As per the ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * specification, a store to a constant is a noop.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) if ((this_type == ACPI_TYPE_INTEGER) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) (((union acpi_operand_object *)object)->common.flags &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) AOPOBJ_AML_CONSTANT)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) if (type_needed != this_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) "Needed type [%s], found [%s] %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) acpi_ut_get_type_name(type_needed),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) acpi_ut_get_type_name(this_type), object));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) return (AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * FUNCTION: acpi_ex_resolve_operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * PARAMETERS: opcode - Opcode being interpreted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * stack_ptr - Pointer to the operand stack to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * resolved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * walk_state - Current state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * DESCRIPTION: Convert multiple input operands to the types required by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * target operator.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * Each 5-bit group in arg_types represents one required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * operand and indicates the required Type. The corresponding operand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * will be converted to the required type if possible, otherwise we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * abort with an exception.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) acpi_ex_resolve_operands(u16 opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) union acpi_operand_object **stack_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) u8 object_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) u32 arg_types;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) const struct acpi_opcode_info *op_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) u32 this_arg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) acpi_object_type type_needed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) u16 target_op = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) ACPI_FUNCTION_TRACE_U32(ex_resolve_operands, opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) op_info = acpi_ps_get_opcode_info(opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) if (op_info->class == AML_CLASS_UNKNOWN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) return_ACPI_STATUS(AE_AML_BAD_OPCODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) arg_types = op_info->runtime_args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) if (arg_types == ARGI_INVALID_OPCODE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", opcode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) return_ACPI_STATUS(AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) opcode, op_info->name, arg_types));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * Normal exit is with (arg_types == 0) at end of argument list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * Function will return an exception from within the loop upon
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * finding an entry which is not (or cannot be converted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * to) the required type; if stack underflows; or upon
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * finding a NULL stack entry (which should not happen).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) while (GET_CURRENT_ARG_TYPE(arg_types)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) if (!stack_ptr || !*stack_ptr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) ACPI_ERROR((AE_INFO, "Null stack entry at %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) stack_ptr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) return_ACPI_STATUS(AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) /* Extract useful items */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) obj_desc = *stack_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) /* Decode the descriptor type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) case ACPI_DESC_TYPE_NAMED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /* Namespace Node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) object_type =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) ((struct acpi_namespace_node *)obj_desc)->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * Resolve an alias object. The construction of these objects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * guarantees that there is only one level of alias indirection;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * thus, the attached object is always the aliased namespace node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) if (object_type == ACPI_TYPE_LOCAL_ALIAS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) obj_desc = acpi_ns_get_attached_object((struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) acpi_namespace_node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) *stack_ptr = obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) object_type =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) ((struct acpi_namespace_node *)obj_desc)->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) case ACPI_DESC_TYPE_OPERAND:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) /* ACPI internal object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) object_type = obj_desc->common.type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /* Check for bad acpi_object_type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) if (!acpi_ut_valid_object_type(object_type)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) "Bad operand object type [0x%X]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) object_type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) /* Validate the Reference */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) switch (obj_desc->reference.class) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) case ACPI_REFCLASS_DEBUG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) target_op = AML_DEBUG_OP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) /*lint -fallthrough */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) case ACPI_REFCLASS_ARG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) case ACPI_REFCLASS_LOCAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) case ACPI_REFCLASS_INDEX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) case ACPI_REFCLASS_REFOF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) case ACPI_REFCLASS_TABLE: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) case ACPI_REFCLASS_NAME: /* Reference to a named object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) "Operand is a Reference, Class [%s] %2.2X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) acpi_ut_get_reference_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) (obj_desc),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) obj_desc->reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) class));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) "Unknown Reference Class 0x%2.2X in %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) obj_desc->reference.class,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^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) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) /* Invalid descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) ACPI_ERROR((AE_INFO, "Invalid descriptor %p [%s]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) acpi_ut_get_descriptor_name(obj_desc)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) /* Get one argument type, point to the next */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) this_arg_type = GET_CURRENT_ARG_TYPE(arg_types);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) INCREMENT_ARG_LIST(arg_types);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) * Handle cases where the object does not need to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) * resolved to a value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) switch (this_arg_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) case ARGI_REF_OR_STRING: /* Can be a String or Reference */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) ACPI_DESC_TYPE_OPERAND) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) (obj_desc->common.type == ACPI_TYPE_STRING)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * String found - the string references a named object and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * must be resolved to a node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) goto next_operand;
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) * Else not a string - fall through to the normal Reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) * case below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) /*lint -fallthrough */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) case ARGI_REFERENCE: /* References: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) case ARGI_INTEGER_REF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) case ARGI_OBJECT_REF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) case ARGI_DEVICE_REF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) case ARGI_SIMPLE_TARGET: /* Name, Local, or arg - no implicit conversion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) case ARGI_STORE_TARGET:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) * A Namespace Node is OK as-is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) ACPI_DESC_TYPE_NAMED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) object_type, obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) case ARGI_DATAREFOBJ: /* Store operator only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) * We don't want to resolve index_op reference objects during
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) * a store because this would be an implicit de_ref_of operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) * Instead, we just want to store the reference object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) * -- All others must be resolved below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) if ((opcode == AML_STORE_OP) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) ((*stack_ptr)->common.type ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) ACPI_TYPE_LOCAL_REFERENCE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) && ((*stack_ptr)->reference.class ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) ACPI_REFCLASS_INDEX)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) /* All cases covered above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) * Resolve this object to a value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) status = acpi_ex_resolve_to_value(stack_ptr, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) return_ACPI_STATUS(status);
^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) /* Get the resolved object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) obj_desc = *stack_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) * Check the resulting object (value) type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) switch (this_arg_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) * For the simple cases, only one type of resolved object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) * is allowed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) case ARGI_MUTEX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) /* Need an operand of type ACPI_TYPE_MUTEX */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) type_needed = ACPI_TYPE_MUTEX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) case ARGI_EVENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) /* Need an operand of type ACPI_TYPE_EVENT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) type_needed = ACPI_TYPE_EVENT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) case ARGI_PACKAGE: /* Package */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) /* Need an operand of type ACPI_TYPE_PACKAGE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) type_needed = ACPI_TYPE_PACKAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) case ARGI_ANYTYPE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) /* Any operand type will do */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) type_needed = ACPI_TYPE_ANY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) case ARGI_DDBHANDLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) type_needed = ACPI_TYPE_LOCAL_REFERENCE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) * The more complex cases allow multiple resolved object types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) case ARGI_INTEGER:
^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) * Need an operand of type ACPI_TYPE_INTEGER, but we can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) * implicitly convert from a STRING or BUFFER.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) * Known as "Implicit Source Operand Conversion"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) status = acpi_ex_convert_to_integer(obj_desc, stack_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) ACPI_IMPLICIT_CONVERSION);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) if (status == AE_TYPE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) "Needed [Integer/String/Buffer], found [%s] %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) acpi_ut_get_object_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) (obj_desc), obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) if (obj_desc != *stack_ptr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) case ARGI_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) * Need an operand of type ACPI_TYPE_BUFFER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) * But we can implicitly convert from a STRING or INTEGER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) * aka - "Implicit Source Operand Conversion"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) if (status == AE_TYPE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) "Needed [Integer/String/Buffer], found [%s] %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) acpi_ut_get_object_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) (obj_desc), obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) if (obj_desc != *stack_ptr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) case ARGI_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * Need an operand of type ACPI_TYPE_STRING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * But we can implicitly convert from a BUFFER or INTEGER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * aka - "Implicit Source Operand Conversion"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) acpi_ex_convert_to_string(obj_desc, stack_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) ACPI_IMPLICIT_CONVERT_HEX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) if (status == AE_TYPE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) "Needed [Integer/String/Buffer], found [%s] %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) acpi_ut_get_object_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) (obj_desc), obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) if (obj_desc != *stack_ptr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) case ARGI_COMPUTEDATA:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) /* Need an operand of type INTEGER, STRING or BUFFER */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) switch (obj_desc->common.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) /* Valid operand */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) "Needed [Integer/String/Buffer], found [%s] %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) acpi_ut_get_object_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) (obj_desc), obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) case ARGI_BUFFER_OR_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) /* Need an operand of type STRING or BUFFER */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) switch (obj_desc->common.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) /* Valid operand */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) /* Highest priority conversion is to type Buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) acpi_ex_convert_to_buffer(obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) stack_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) if (obj_desc != *stack_ptr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) "Needed [Integer/String/Buffer], found [%s] %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) acpi_ut_get_object_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) (obj_desc), obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) case ARGI_DATAOBJECT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) * ARGI_DATAOBJECT is only used by the size_of operator.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) * Need a buffer, string, package, or ref_of reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) * The only reference allowed here is a direct reference to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) * a namespace node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) switch (obj_desc->common.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) case ACPI_TYPE_LOCAL_REFERENCE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) /* Valid operand */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) "Needed [Buffer/String/Package/Reference], found [%s] %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) acpi_ut_get_object_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) (obj_desc), obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) case ARGI_COMPLEXOBJ:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) /* Need a buffer or package or (ACPI 2.0) String */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) switch (obj_desc->common.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) /* Valid operand */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) "Needed [Buffer/String/Package], found [%s] %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) acpi_ut_get_object_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) (obj_desc), obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) * Need an operand of type REGION or a BUFFER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) * (which could be a resolved region field)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) switch (obj_desc->common.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) case ACPI_TYPE_REGION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) /* Valid operand */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) "Needed [Region/Buffer], found [%s] %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) acpi_ut_get_object_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) (obj_desc), obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) case ARGI_DATAREFOBJ:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) /* Used by the Store() operator only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) switch (obj_desc->common.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) case ACPI_TYPE_BUFFER_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) case ACPI_TYPE_LOCAL_REFERENCE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) case ACPI_TYPE_LOCAL_REGION_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) case ACPI_TYPE_LOCAL_BANK_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) case ACPI_TYPE_LOCAL_INDEX_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) case ACPI_TYPE_DDB_HANDLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) /* Valid operand */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) if (acpi_gbl_enable_interpreter_slack) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) * Enable original behavior of Store(), allowing any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) * and all objects as the source operand. The ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) * spec does not allow this, however.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) if (target_op == AML_DEBUG_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) /* Allow store of any object to the Debug object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) "Needed Integer/Buffer/String/Package/Ref/Ddb]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) ", found [%s] %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) acpi_ut_get_object_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) (obj_desc), obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) goto next_operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) /* Unknown type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) "Internal - Unknown ARGI (required operand) type 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) this_arg_type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) return_ACPI_STATUS(AE_BAD_PARAMETER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) * Make sure that the original object was resolved to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) * required object type (Simple cases only).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) acpi_ex_check_object_type(type_needed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) (*stack_ptr)->common.type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) *stack_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) next_operand:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) * If more operands needed, decrement stack_ptr to point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) * to next operand on stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) if (GET_CURRENT_ARG_TYPE(arg_types)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) stack_ptr--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) ACPI_DUMP_OPERANDS(walk_state->operands,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) acpi_ps_get_opcode_name(opcode),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) walk_state->num_operands);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) }