Source
x
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/*******************************************************************************
*
* Module Name: nseval - Object evaluation, includes control method execution
*
******************************************************************************/
ACPI_MODULE_NAME("nseval")
/* Local prototypes */
static void
acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
struct acpi_evaluate_info *info);
/*******************************************************************************
*
* FUNCTION: acpi_ns_evaluate
*
* PARAMETERS: info - Evaluation info block, contains these fields
* and more:
* prefix_node - Prefix or Method/Object Node to execute
* relative_path - Name of method to execute, If NULL, the
* Node is the object to execute
* parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
* parameter_type - Type of Parameter list
* return_object - Where to put method's return value (if
* any). If NULL, no value is returned.
* flags - ACPI_IGNORE_RETURN_VALUE to delete return
*
* RETURN: Status
*
* DESCRIPTION: Execute a control method or return the current value of an
* ACPI namespace object.
*
* MUTEX: Locks interpreter
*
******************************************************************************/
acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
{
acpi_status status;
ACPI_FUNCTION_TRACE(ns_evaluate);
if (!info) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
if (!info->node) {
/*
* Get the actual namespace node for the target object if we
* need to. Handles these cases:
*
* 1) Null node, valid pathname from root (absolute path)
* 2) Node and valid pathname (path relative to Node)
* 3) Node, Null pathname
*/
status =
acpi_ns_get_node(info->prefix_node, info->relative_pathname,
ACPI_NS_NO_UPSEARCH, &info->node);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
/*
* For a method alias, we must grab the actual method node so that
* proper scoping context will be established before execution.
*/
if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
info->node =
ACPI_CAST_PTR(struct acpi_namespace_node,
info->node->object);
}
/* Complete the info block initialization */
info->return_object = NULL;
info->node_flags = info->node->flags;
info->obj_desc = acpi_ns_get_attached_object(info->node);
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
info->relative_pathname, info->node,