^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: dswload2 - Dispatcher second pass namespace load callbacks
^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 "acparser.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "amlcode.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "acdispat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "acevents.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #ifdef ACPI_EXEC_APP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include "aecommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define _COMPONENT ACPI_DISPATCHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) ACPI_MODULE_NAME("dswload2")
^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_ds_load2_begin_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * PARAMETERS: walk_state - Current state of the parse tree walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * out_op - Where to return op if a new one is created
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * DESCRIPTION: Descending callback used during the loading of ACPI tables.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) union acpi_parse_object **out_op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) union acpi_parse_object *op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) acpi_object_type object_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) char *buffer_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) ACPI_FUNCTION_TRACE(ds_load2_begin_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) op = walk_state->op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) if (op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) if ((walk_state->control_state) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) (walk_state->control_state->common.state ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) /* We are executing a while loop outside of a method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) status = acpi_ds_exec_begin_op(walk_state, out_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) return_ACPI_STATUS(status);
^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) /* We only care about Namespace opcodes here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) (!(walk_state->op_info->flags & AML_NAMED))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) /* Get the name we are going to enter or lookup in the namespace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /* For Namepath op, get the path string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) buffer_ptr = op->common.value.string;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) if (!buffer_ptr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /* No name, just exit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) /* Get name from the op */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) buffer_ptr = ACPI_CAST_PTR(char, &op->named.name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) /* Get the namestring from the raw AML */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) buffer_ptr =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) acpi_ps_get_next_namestring(&walk_state->parser_state);
^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) /* Map the opcode into an internal object type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) object_type = walk_state->op_info->object_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) "State=%p Op=%p Type=%X\n", walk_state, op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) object_type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) switch (walk_state->opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) case AML_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) case AML_BANK_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) case AML_INDEX_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) node = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) case AML_INT_NAMEPATH_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * The name_path is an object reference to an existing object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * Don't enter the name into the namespace, but look it up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * for use later.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) object_type, ACPI_IMODE_EXECUTE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) ACPI_NS_SEARCH_PARENT, walk_state, &(node));
^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 AML_SCOPE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) /* Special case for Scope(\) -> refers to the Root node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) if (op && (op->named.node == acpi_gbl_root_node)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) node = op->named.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) acpi_ds_scope_stack_push(node, object_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * The Path is an object reference to an existing object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * Don't enter the name into the namespace, but look it up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * for use later.
^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_ns_lookup(walk_state->scope_info, buffer_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) object_type, ACPI_IMODE_EXECUTE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) ACPI_NS_SEARCH_PARENT, walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) &(node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) #ifdef ACPI_ASL_COMPILER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) if (status == AE_NOT_FOUND) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) ACPI_ERROR_NAMESPACE(walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) scope_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) buffer_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) ACPI_ERROR_NAMESPACE(walk_state->scope_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) buffer_ptr, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) * We must check to make sure that the target is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) * one of the opcodes that actually opens a scope
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) switch (node->type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) case ACPI_TYPE_ANY:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) case ACPI_TYPE_DEVICE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) case ACPI_TYPE_POWER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) case ACPI_TYPE_PROCESSOR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) case ACPI_TYPE_THERMAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) /* These are acceptable types */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * These types we will allow, but we will change the type.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * This enables some existing code of the form:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * Name (DEB, 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * Scope (DEB) { ... }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) ACPI_WARNING((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) "Type override - [%4.4s] had invalid type (%s) "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) "for Scope operator, changed to type ANY",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) acpi_ut_get_node_name(node),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) acpi_ut_get_type_name(node->type)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) node->type = ACPI_TYPE_ANY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) walk_state->scope_info->common.value = ACPI_TYPE_ANY;
^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) case ACPI_TYPE_METHOD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) * Allow scope change to root during execution of module-level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * code. Root is typed METHOD during this time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) if ((node == acpi_gbl_root_node) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) (walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /*lint -fallthrough */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) /* All other types are an error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) "Invalid type (%s) for target of "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) "Scope operator [%4.4s] (Cannot override)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) acpi_ut_get_type_name(node->type),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) acpi_ut_get_node_name(node)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) /* All other opcodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) if (op && op->common.node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) /* This op/node was previously entered into the namespace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) node = op->common.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) if (acpi_ns_opens_scope(object_type)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) acpi_ds_scope_stack_push(node, object_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) * Enter the named type into the internal namespace. We enter the name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * as we go downward in the parse tree. Any necessary subobjects that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * involve arguments to the opcode must be created as we go back up the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) * parse tree later.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) * Note: Name may already exist if we are executing a deferred opcode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) if (walk_state->deferred_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) /* This name is already in the namespace, get the node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) node = walk_state->deferred_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) flags = ACPI_NS_NO_UPSEARCH;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) if (walk_state->pass_number == ACPI_IMODE_EXECUTE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) /* Execution mode, node cannot already exist, node is temporary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) flags |= ACPI_NS_ERROR_IF_FOUND;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) if (!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) (walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) flags |= ACPI_NS_TEMPORARY;
^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) #ifdef ACPI_ASL_COMPILER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) * Do not open a scope for AML_EXTERNAL_OP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) * acpi_ns_lookup can open a new scope based on the object type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) * of this op. AML_EXTERNAL_OP is a declaration rather than a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) * definition. In the case that this external is a method object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) * acpi_ns_lookup will open a new scope. However, an AML_EXTERNAL_OP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) * associated with the ACPI_TYPE_METHOD is a declaration, rather than
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) * a definition. Flags is set to avoid opening a scope for any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) * AML_EXTERNAL_OP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) if (walk_state->opcode == AML_EXTERNAL_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) flags |= ACPI_NS_DONT_OPEN_SCOPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) * For name creation opcodes, the full namepath prefix must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) * exist, except for the final (new) nameseg.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) if (walk_state->op_info->flags & AML_NAMED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) flags |= ACPI_NS_PREFIX_MUST_EXIST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) /* Add new entry or lookup existing entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) object_type, ACPI_IMODE_LOAD_PASS2, flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) walk_state, &node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) if (ACPI_SUCCESS(status) && (flags & ACPI_NS_TEMPORARY)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) "***New Node [%4.4s] %p is temporary\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) acpi_ut_get_node_name(node), node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) ACPI_ERROR_NAMESPACE(walk_state->scope_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) buffer_ptr, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) return_ACPI_STATUS(status);
^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) if (!op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) /* Create a new op */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) op = acpi_ps_alloc_op(walk_state->opcode, walk_state->aml);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) if (!op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) /* Initialize the new op */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) if (node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) op->named.name = node->name.integer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) *out_op = op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) * Put the Node in the "op" object that the parser uses, so we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) * can get it again quickly when this scope is closed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) op->common.node = node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) * FUNCTION: acpi_ds_load2_end_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) * PARAMETERS: walk_state - Current state of the parse tree walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) * DESCRIPTION: Ascending callback used during the loading of the namespace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) * both control methods and everything else.
^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) acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) union acpi_parse_object *op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) acpi_object_type object_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) union acpi_parse_object *arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) struct acpi_namespace_node *new_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) u8 region_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) #ifdef ACPI_EXEC_APP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) char *namepath;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) ACPI_FUNCTION_TRACE(ds_load2_end_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) op = walk_state->op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) walk_state->op_info->name, op, walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) /* Check if opcode had an associated namespace object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) return_ACPI_STATUS(AE_OK);
^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) if (op->common.aml_opcode == AML_SCOPE_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) "Ending scope Op=%p State=%p\n", op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) object_type = walk_state->op_info->object_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) * Get the Node/name from the earlier lookup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) * (It was saved in the *op structure)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) node = op->common.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) * Put the Node on the object stack (Contains the ACPI Name of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) * this object)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) walk_state->operands[0] = (void *)node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) walk_state->num_operands = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) /* Pop the scope stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) if (acpi_ns_opens_scope(object_type) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) (op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) "(%s) Popping scope for Op %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) acpi_ut_get_type_name(object_type), op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) status = acpi_ds_scope_stack_pop(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * Named operations are as follows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * AML_ALIAS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) * AML_BANKFIELD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) * AML_CREATEBITFIELD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) * AML_CREATEBYTEFIELD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) * AML_CREATEDWORDFIELD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) * AML_CREATEFIELD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) * AML_CREATEQWORDFIELD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) * AML_CREATEWORDFIELD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) * AML_DATA_REGION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) * AML_DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) * AML_EVENT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) * AML_FIELD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) * AML_INDEXFIELD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) * AML_METHOD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) * AML_METHODCALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) * AML_MUTEX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) * AML_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) * AML_NAMEDFIELD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) * AML_OPREGION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) * AML_POWERRES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) * AML_PROCESSOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) * AML_SCOPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) * AML_THERMALZONE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) acpi_ps_get_opcode_name(op->common.aml_opcode),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) walk_state, op, node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) /* Decode the opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) arg = op->common.value.arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) switch (walk_state->op_info->type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) case AML_TYPE_CREATE_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) * Create the field object, but the field buffer and index must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) * be evaluated later during the execution phase
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) status = acpi_ds_create_buffer_field(op, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) ACPI_EXCEPTION((AE_INFO, status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) "CreateBufferField failure"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) case AML_TYPE_NAMED_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) * If we are executing a method, initialize the field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) if (walk_state->method_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) status = acpi_ds_init_field_objects(op, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) switch (op->common.aml_opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) case AML_INDEX_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) acpi_ds_create_index_field(op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) (acpi_handle)arg->common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) node, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) case AML_BANK_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) acpi_ds_create_bank_field(op, arg->common.node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) case AML_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) acpi_ds_create_field(op, arg->common.node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) /* All NAMED_FIELD opcodes must be handled above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) case AML_TYPE_NAMED_SIMPLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) status = acpi_ds_create_operands(walk_state, arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) switch (op->common.aml_opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) case AML_PROCESSOR_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) status = acpi_ex_create_processor(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) case AML_POWER_RESOURCE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) status = acpi_ex_create_power_resource(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) case AML_MUTEX_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) status = acpi_ex_create_mutex(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) case AML_EVENT_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) status = acpi_ex_create_event(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) case AML_ALIAS_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) status = acpi_ex_create_alias(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) /* Unknown opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) /* Delete operands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) for (i = 1; i < walk_state->num_operands; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) acpi_ut_remove_reference(walk_state->operands[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) walk_state->operands[i] = NULL;
^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) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) case AML_TYPE_NAMED_COMPLEX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) switch (op->common.aml_opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) case AML_REGION_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) case AML_DATA_REGION_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) if (op->common.aml_opcode == AML_REGION_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) region_space = (acpi_adr_space_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) ((op->common.value.arg)->common.value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) integer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) region_space = ACPI_ADR_SPACE_DATA_TABLE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) * The op_region is not fully parsed at this time. The only valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) * argument is the space_id. (We must save the address of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) * AML of the address and length operands)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) * If we have a valid region, initialize it. The namespace is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) * unlocked at this point.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) * Need to unlock interpreter if it is locked (if we are running
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) * a control method), in order to allow _REG methods to be run
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) * during acpi_ev_initialize_region.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) if (walk_state->method_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) * Executing a method: initialize the region and unlock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) * the interpreter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) status = acpi_ex_create_region(op->named.data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) op->named.length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) region_space,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) acpi_ev_initialize_region
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) (acpi_ns_get_attached_object(node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) case AML_NAME_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) status = acpi_ds_create_node(walk_state, node, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) #ifdef ACPI_EXEC_APP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) * acpi_exec support for namespace initialization file (initialize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) * Name opcodes in this code.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) namepath = acpi_ns_get_external_pathname(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) status = ae_lookup_init_file_entry(namepath, &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) if (ACPI_SUCCESS(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) /* Detach any existing object, attach new object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) if (node->object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) acpi_ns_detach_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) acpi_ns_attach_object(node, obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) obj_desc->common.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) ACPI_FREE(namepath);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) case AML_METHOD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) * method_op pkg_length name_string method_flags term_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) * Note: We must create the method node/object pair as soon as we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) * see the method declaration. This allows later pass1 parsing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) * of invocations of the method (need to know the number of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) * arguments.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) walk_state, op, op->named.node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) if (!acpi_ns_get_attached_object(op->named.node)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) walk_state->operands[0] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) ACPI_CAST_PTR(void, op->named.node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) walk_state->num_operands = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) acpi_ds_create_operands(walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) op->common.value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) if (ACPI_SUCCESS(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) acpi_ex_create_method(op->named.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) op->named.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) walk_state->operands[0] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) walk_state->num_operands = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) /* All NAMED_COMPLEX opcodes must be handled above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) case AML_CLASS_INTERNAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) /* case AML_INT_NAMEPATH_OP: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) case AML_CLASS_METHOD_CALL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) walk_state, op, node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) * Lookup the method name and save the Node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) acpi_ns_lookup(walk_state->scope_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) arg->common.value.string, ACPI_TYPE_ANY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) ACPI_IMODE_LOAD_PASS2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) ACPI_NS_SEARCH_PARENT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) ACPI_NS_DONT_OPEN_SCOPE, walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) &(new_node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) if (ACPI_SUCCESS(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) * Make sure that what we found is indeed a method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) * We didn't search for a method on purpose, to see if the name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) * would resolve
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) if (new_node->type != ACPI_TYPE_METHOD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) status = AE_AML_OPERAND_TYPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) /* We could put the returned object (Node) on the object stack for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) * later, but for now, we will put it in the "op" object that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) * parser uses, so we can get it again at the end of this scope
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) op->common.node = new_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) ACPI_ERROR_NAMESPACE(walk_state->scope_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) arg->common.value.string, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) /* Remove the Node pushed at the very beginning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) walk_state->operands[0] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) walk_state->num_operands = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) }