// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables * ******************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acdispat.h" #include "acnamesp.h" #include "acinterp.h" #define _COMPONENT … ACPI_MODULE_NAME("dsmthdat") /* Local prototypes */ static void acpi_ds_method_data_delete_value(u8 type, u32 index, struct acpi_walk_state *walk_state); static acpi_status acpi_ds_method_data_set_value(u8 type, u32 index, union acpi_operand_object *object, struct acpi_walk_state *walk_state); #ifdef ACPI_OBSOLETE_FUNCTIONS acpi_object_type acpi_ds_method_data_get_type(u16 opcode, u32 index, struct acpi_walk_state *walk_state); #endif /******************************************************************************* * * FUNCTION: acpi_ds_method_data_init * * PARAMETERS: walk_state - Current walk state object * * RETURN: Status * * DESCRIPTION: Initialize the data structures that hold the method's arguments * and locals. The data struct is an array of namespace nodes for * each - this allows ref_of and de_ref_of to work properly for these * special data types. * * NOTES: walk_state fields are initialized to zero by the * ACPI_ALLOCATE_ZEROED(). * * A pseudo-Namespace Node is assigned to each argument and local * so that ref_of() can return a pointer to the Node. * ******************************************************************************/ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) { … } /******************************************************************************* * * FUNCTION: acpi_ds_method_data_delete_all * * PARAMETERS: walk_state - Current walk state object * * RETURN: None * * DESCRIPTION: Delete method locals and arguments. Arguments are only * deleted if this method was called from another method. * ******************************************************************************/ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state) { … } /******************************************************************************* * * FUNCTION: acpi_ds_method_data_init_args * * PARAMETERS: *params - Pointer to a parameter list for the method * max_param_count - The arg count for this method * walk_state - Current walk state object * * RETURN: Status * * DESCRIPTION: Initialize arguments for a method. The parameter list is a list * of ACPI operand objects, either null terminated or whose length * is defined by max_param_count. * ******************************************************************************/ acpi_status acpi_ds_method_data_init_args(union acpi_operand_object **params, u32 max_param_count, struct acpi_walk_state *walk_state) { … } /******************************************************************************* * * FUNCTION: acpi_ds_method_data_get_node * * PARAMETERS: type - Either ACPI_REFCLASS_LOCAL or * ACPI_REFCLASS_ARG * index - Which Local or Arg whose type to get * walk_state - Current walk state object * node - Where the node is returned. * * RETURN: Status and node * * DESCRIPTION: Get the Node associated with a local or arg. * ******************************************************************************/ acpi_status acpi_ds_method_data_get_node(u8 type, u32 index, struct acpi_walk_state *walk_state, struct acpi_namespace_node **node) { … } /******************************************************************************* * * FUNCTION: acpi_ds_method_data_set_value * * PARAMETERS: type - Either ACPI_REFCLASS_LOCAL or * ACPI_REFCLASS_ARG * index - Which Local or Arg to get * object - Object to be inserted into the stack entry * walk_state - Current walk state object * * RETURN: Status * * DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index. * Note: There is no "implicit conversion" for locals. * ******************************************************************************/ static acpi_status acpi_ds_method_data_set_value(u8 type, u32 index, union acpi_operand_object *object, struct acpi_walk_state *walk_state) { … } /******************************************************************************* * * FUNCTION: acpi_ds_method_data_get_value * * PARAMETERS: type - Either ACPI_REFCLASS_LOCAL or * ACPI_REFCLASS_ARG * index - Which localVar or argument to get * walk_state - Current walk state object * dest_desc - Where Arg or Local value is returned * * RETURN: Status * * DESCRIPTION: Retrieve value of selected Arg or Local for this method * Used only in acpi_ex_resolve_to_value(). * ******************************************************************************/ acpi_status acpi_ds_method_data_get_value(u8 type, u32 index, struct acpi_walk_state *walk_state, union acpi_operand_object **dest_desc) { … } /******************************************************************************* * * FUNCTION: acpi_ds_method_data_delete_value * * PARAMETERS: type - Either ACPI_REFCLASS_LOCAL or * ACPI_REFCLASS_ARG * index - Which localVar or argument to delete * walk_state - Current walk state object * * RETURN: None * * DESCRIPTION: Delete the entry at Opcode:Index. Inserts * a null into the stack slot after the object is deleted. * ******************************************************************************/ static void acpi_ds_method_data_delete_value(u8 type, u32 index, struct acpi_walk_state *walk_state) { … } /******************************************************************************* * * FUNCTION: acpi_ds_store_object_to_local * * PARAMETERS: type - Either ACPI_REFCLASS_LOCAL or * ACPI_REFCLASS_ARG * index - Which Local or Arg to set * obj_desc - Value to be stored * walk_state - Current walk state * * RETURN: Status * * DESCRIPTION: Store a value in an Arg or Local. The obj_desc is installed * as the new value for the Arg or Local and the reference count * for obj_desc is incremented. * ******************************************************************************/ acpi_status acpi_ds_store_object_to_local(u8 type, u32 index, union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { … } #ifdef ACPI_OBSOLETE_FUNCTIONS /******************************************************************************* * * FUNCTION: acpi_ds_method_data_get_type * * PARAMETERS: opcode - Either AML_FIRST LOCAL_OP or * AML_FIRST_ARG_OP * index - Which Local or Arg whose type to get * walk_state - Current walk state object * * RETURN: Data type of current value of the selected Arg or Local * * DESCRIPTION: Get the type of the object stored in the Local or Arg * ******************************************************************************/ acpi_object_type acpi_ds_method_data_get_type(u16 opcode, u32 index, struct acpi_walk_state *walk_state) { acpi_status status; struct acpi_namespace_node *node; union acpi_operand_object *object; ACPI_FUNCTION_TRACE(ds_method_data_get_type); /* Get the namespace node for the arg/local */ status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); if (ACPI_FAILURE(status)) { return_VALUE((ACPI_TYPE_NOT_FOUND)); } /* Get the object */ object = acpi_ns_get_attached_object(node); if (!object) { /* Uninitialized local/arg, return TYPE_ANY */ return_VALUE(ACPI_TYPE_ANY); } /* Get the object type */ return_VALUE(object->type); } #endif