^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: exresolv - AML Interpreter 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 "acdispat.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("exresolv")
^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_resolve_object_to_value(union acpi_operand_object **stack_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct acpi_walk_state *walk_state);
^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_resolve_to_value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * PARAMETERS: **stack_ptr - Points to entry on obj_stack, which can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * be either an (union acpi_operand_object *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * or an acpi_handle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * walk_state - Current method state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * DESCRIPTION: Convert Reference objects to values
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) ACPI_FUNCTION_TRACE_PTR(ex_resolve_to_value, stack_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) if (!stack_ptr || !*stack_ptr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) ACPI_ERROR((AE_INFO, "Internal - null pointer"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) return_ACPI_STATUS(AE_AML_NO_OPERAND);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * The entity pointed to by the stack_ptr can be either
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * 1) A valid union acpi_operand_object, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * 2) A struct acpi_namespace_node (named_obj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_OPERAND) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) status = acpi_ex_resolve_object_to_value(stack_ptr, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) return_ACPI_STATUS(status);
^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) if (!*stack_ptr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) ACPI_ERROR((AE_INFO, "Internal - null pointer"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) return_ACPI_STATUS(AE_AML_NO_OPERAND);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) }
^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) * Object on the stack may have changed if acpi_ex_resolve_object_to_value()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * was called (i.e., we can't use an _else_ here.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) (struct acpi_namespace_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) stack_ptr), walk_state);
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^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) * FUNCTION: acpi_ex_resolve_object_to_value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * PARAMETERS: stack_ptr - Pointer to an internal object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * walk_state - Current method state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * DESCRIPTION: Retrieve the value from an internal object. The Reference type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * uses the associated AML opcode to determine the value.
^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) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) union acpi_operand_object *stack_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) union acpi_operand_object *obj_desc = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) u8 ref_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) ACPI_FUNCTION_TRACE(ex_resolve_object_to_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) stack_desc = *stack_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /* This is an object of type union acpi_operand_object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) switch (stack_desc->common.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) case ACPI_TYPE_LOCAL_REFERENCE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) ref_type = stack_desc->reference.class;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) switch (ref_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) case ACPI_REFCLASS_LOCAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) case ACPI_REFCLASS_ARG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * Get the local from the method's state info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * Note: this increments the local's object reference count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) status = acpi_ds_method_data_get_value(ref_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) stack_desc->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) reference.value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) "[Arg/Local %X] ValueObj is %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) stack_desc->reference.value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * Now we can delete the original Reference Object and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * replace it with the resolved value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) acpi_ut_remove_reference(stack_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) *stack_ptr = obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) case ACPI_REFCLASS_INDEX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) switch (stack_desc->reference.target_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) case ACPI_TYPE_BUFFER_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) /* Just return - do not dereference */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) /* If method call or copy_object - do not dereference */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) if ((walk_state->opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) AML_INT_METHODCALL_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) || (walk_state->opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) AML_COPY_OBJECT_OP)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) /* Otherwise, dereference the package_index to a package element */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) obj_desc = *stack_desc->reference.where;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) if (obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * Valid object descriptor, copy pointer to return value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * (i.e., dereference the package index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * Delete the ref object, increment the returned object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) acpi_ut_add_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) *stack_ptr = obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * A NULL object descriptor means an uninitialized element of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * the package, can't dereference it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) "Attempt to dereference an Index to "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) "NULL package element Idx=%p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) stack_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) status = AE_AML_UNINITIALIZED_ELEMENT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /* Invalid reference object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) "Unknown TargetType 0x%X in Index/Reference object %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) stack_desc->reference.target_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) stack_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) status = AE_AML_INTERNAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) case ACPI_REFCLASS_REFOF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) case ACPI_REFCLASS_DEBUG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) case ACPI_REFCLASS_TABLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) /* Just leave the object as-is, do not dereference */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) case ACPI_REFCLASS_NAME: /* Reference to a named object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /* Dereference the name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if ((stack_desc->reference.node->type ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) ACPI_TYPE_DEVICE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) || (stack_desc->reference.node->type ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) ACPI_TYPE_THERMAL)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) /* These node types do not have 'real' subobjects */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) *stack_ptr = (void *)stack_desc->reference.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) /* Get the object pointed to by the namespace node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) *stack_ptr =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) (stack_desc->reference.node)->object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) acpi_ut_add_reference(*stack_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) acpi_ut_remove_reference(stack_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) "Unknown Reference type 0x%X in %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) ref_type, stack_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) status = AE_AML_INTERNAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) status = acpi_ds_get_buffer_arguments(stack_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) status = acpi_ds_get_package_arguments(stack_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) case ACPI_TYPE_BUFFER_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) case ACPI_TYPE_LOCAL_REGION_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) case ACPI_TYPE_LOCAL_BANK_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) case ACPI_TYPE_LOCAL_INDEX_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) "FieldRead SourceDesc=%p Type=%X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) stack_desc, stack_desc->common.type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) acpi_ex_read_data_from_field(walk_state, stack_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) /* Remove a reference to the original operand, then override */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) acpi_ut_remove_reference(*stack_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) *stack_ptr = (void *)obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^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) * FUNCTION: acpi_ex_resolve_multiple
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) * PARAMETERS: walk_state - Current state (contains AML opcode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) * operand - Starting point for resolution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) * return_type - Where the object type is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) * return_desc - Where the resolved object is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) * DESCRIPTION: Return the base object and type. Traverse a reference list if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) * necessary to get to the base object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) union acpi_operand_object *operand,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) acpi_object_type *return_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) union acpi_operand_object **return_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) union acpi_operand_object *obj_desc = ACPI_CAST_PTR(void, operand);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) struct acpi_namespace_node *node =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) ACPI_CAST_PTR(struct acpi_namespace_node, operand);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) acpi_object_type type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) ACPI_FUNCTION_TRACE(acpi_ex_resolve_multiple);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) /* Operand can be either a namespace node or an operand descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) case ACPI_DESC_TYPE_OPERAND:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) type = obj_desc->common.type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) case ACPI_DESC_TYPE_NAMED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) type = ((struct acpi_namespace_node *)obj_desc)->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) obj_desc = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) /* If we had an Alias node, use the attached object for type info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) if (type == ACPI_TYPE_LOCAL_ALIAS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) type = ((struct acpi_namespace_node *)obj_desc)->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) obj_desc = acpi_ns_get_attached_object((struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) acpi_namespace_node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) *)obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) switch (type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) case ACPI_TYPE_DEVICE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) case ACPI_TYPE_THERMAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /* These types have no attached subobject */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) /* All other types require a subobject */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) "[%4.4s] Node is unresolved or uninitialized",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) acpi_ut_get_node_name(node)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) return_ACPI_STATUS(AE_AML_UNINITIALIZED_NODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) /* If type is anything other than a reference, we are done */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) if (type != ACPI_TYPE_LOCAL_REFERENCE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) goto exit;
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) * For reference objects created via the ref_of, Index, or Load/load_table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) * operators, we need to get to the base object (as per the ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) * specification of the object_type and size_of operators). This means
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) * traversing the list of possibly many nested references.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) while (obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) switch (obj_desc->reference.class) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) case ACPI_REFCLASS_REFOF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) case ACPI_REFCLASS_NAME:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) /* Dereference the reference pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) if (obj_desc->reference.class == ACPI_REFCLASS_REFOF) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) node = obj_desc->reference.object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) } else { /* AML_INT_NAMEPATH_OP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) node = obj_desc->reference.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) /* All "References" point to a NS node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) ACPI_DESC_TYPE_NAMED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) "Not a namespace node %p [%s]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) acpi_ut_get_descriptor_name(node)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) return_ACPI_STATUS(AE_AML_INTERNAL);
^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) /* Get the attached object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) obj_desc = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) /* No object, use the NS node type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) type = acpi_ns_get_type(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) /* Check for circular references */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) if (obj_desc == operand) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) case ACPI_REFCLASS_INDEX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) /* Get the type of this reference (index into another object) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) type = obj_desc->reference.target_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) if (type != ACPI_TYPE_PACKAGE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) * The main object is a package, we want to get the type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) * of the individual package element that is referenced by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * the index.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * This could of course in turn be another reference object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) obj_desc = *(obj_desc->reference.where);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) /* NULL package elements are allowed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) type = 0; /* Uninitialized */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) case ACPI_REFCLASS_TABLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) type = ACPI_TYPE_DDB_HANDLE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) case ACPI_REFCLASS_LOCAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) case ACPI_REFCLASS_ARG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) if (return_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) acpi_ds_method_data_get_value(obj_desc->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) class,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) obj_desc->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) acpi_ds_method_data_get_node(obj_desc->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) class,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) obj_desc->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) &node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) obj_desc = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) type = ACPI_TYPE_ANY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) goto exit;
^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) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) case ACPI_REFCLASS_DEBUG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) /* The Debug Object is of type "DebugObject" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) type = ACPI_TYPE_DEBUG_OBJECT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) "Unknown Reference Class 0x%2.2X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) obj_desc->reference.class));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) return_ACPI_STATUS(AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) * Now we are guaranteed to have an object that has not been created
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) * via the ref_of or Index operators.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) type = obj_desc->common.type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) /* Convert internal types to external types */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) switch (type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) case ACPI_TYPE_LOCAL_REGION_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) case ACPI_TYPE_LOCAL_BANK_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) case ACPI_TYPE_LOCAL_INDEX_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) type = ACPI_TYPE_FIELD_UNIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) case ACPI_TYPE_LOCAL_SCOPE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) /* Per ACPI Specification, Scope is untyped */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) type = ACPI_TYPE_ANY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) /* No change to Type required */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) *return_type = type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) if (return_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) *return_desc = obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) }