Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^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: dsmthdat - control method arguments and local variables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include "acdispat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define _COMPONENT          ACPI_DISPATCHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) ACPI_MODULE_NAME("dsmthdat")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) static void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) acpi_ds_method_data_delete_value(u8 type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 				 u32 index, struct acpi_walk_state *walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) acpi_ds_method_data_set_value(u8 type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 			      u32 index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 			      union acpi_operand_object *object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 			      struct acpi_walk_state *walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #ifdef ACPI_OBSOLETE_FUNCTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) acpi_object_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) acpi_ds_method_data_get_type(u16 opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 			     u32 index, struct acpi_walk_state *walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * FUNCTION:    acpi_ds_method_data_init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  * PARAMETERS:  walk_state          - Current walk state object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * DESCRIPTION: Initialize the data structures that hold the method's arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  *              and locals. The data struct is an array of namespace nodes for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  *              each - this allows ref_of and de_ref_of to work properly for these
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  *              special data types.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * NOTES:       walk_state fields are initialized to zero by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  *              ACPI_ALLOCATE_ZEROED().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  *              A pseudo-Namespace Node is assigned to each argument and local
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  *              so that ref_of() can return a pointer to the Node.
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	ACPI_FUNCTION_TRACE(ds_method_data_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	/* Init the method arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 				   NAMEOF_ARG_NTE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		walk_state->arguments[i].name.integer |= (i << 24);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		walk_state->arguments[i].type = ACPI_TYPE_ANY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		walk_state->arguments[i].flags = ANOBJ_METHOD_ARG;
^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) 	/* Init the method locals */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		ACPI_MOVE_32_TO_32(&walk_state->local_variables[i].name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 				   NAMEOF_LOCAL_NTE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		walk_state->local_variables[i].name.integer |= (i << 24);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		walk_state->local_variables[i].descriptor_type =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		    ACPI_DESC_TYPE_NAMED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		walk_state->local_variables[i].type = ACPI_TYPE_ANY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		walk_state->local_variables[i].flags = ANOBJ_METHOD_LOCAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	return_VOID;
^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)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  * FUNCTION:    acpi_ds_method_data_delete_all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * PARAMETERS:  walk_state          - Current walk state object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  * RETURN:      None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  * DESCRIPTION: Delete method locals and arguments. Arguments are only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  *              deleted if this method was called from another method.
^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) void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	u32 index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	ACPI_FUNCTION_TRACE(ds_method_data_delete_all);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	/* Detach the locals */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		if (walk_state->local_variables[index].object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 			ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Local%u=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 					  index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 					  walk_state->local_variables[index].
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 					  object));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 			/* Detach object (if present) and remove a reference */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			acpi_ns_detach_object(&walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 					      local_variables[index]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	/* Detach the arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		if (walk_state->arguments[index].object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 			ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Arg%u=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 					  index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 					  walk_state->arguments[index].object));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 			/* Detach object (if present) and remove a reference */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			acpi_ns_detach_object(&walk_state->arguments[index]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		}
^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) 	return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  * FUNCTION:    acpi_ds_method_data_init_args
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * PARAMETERS:  *params         - Pointer to a parameter list for the method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  *              max_param_count - The arg count for this method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  *              walk_state      - Current walk state object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  * DESCRIPTION: Initialize arguments for a method. The parameter list is a list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)  *              of ACPI operand objects, either null terminated or whose length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  *              is defined by max_param_count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) acpi_ds_method_data_init_args(union acpi_operand_object **params,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 			      u32 max_param_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 			      struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	u32 index = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	ACPI_FUNCTION_TRACE_PTR(ds_method_data_init_args, params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	if (!params) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 				  "No parameter list passed to method\n"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	/* Copy passed parameters into the new method stack frame */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	while ((index < ACPI_METHOD_NUM_ARGS) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	       (index < max_param_count) && params[index]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 		 * A valid parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		 * Store the argument in the method/walk descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		 * Do not copy the arg in order to implement call by reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		    acpi_ds_method_data_set_value(ACPI_REFCLASS_ARG, index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 						  params[index], walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 			return_ACPI_STATUS(status);
^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) 		index++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%u args passed to method\n", index));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  * FUNCTION:    acpi_ds_method_data_get_node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  * PARAMETERS:  type                - Either ACPI_REFCLASS_LOCAL or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  *                                    ACPI_REFCLASS_ARG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  *              index               - Which Local or Arg whose type to get
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  *              walk_state          - Current walk state object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  *              node                - Where the node is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  * RETURN:      Status and node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * DESCRIPTION: Get the Node associated with a local or arg.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) acpi_ds_method_data_get_node(u8 type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 			     u32 index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 			     struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 			     struct acpi_namespace_node **node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	ACPI_FUNCTION_TRACE(ds_method_data_get_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	 * Method Locals and Arguments are supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	switch (type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	case ACPI_REFCLASS_LOCAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		if (index > ACPI_METHOD_MAX_LOCAL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 			ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 				    "Local index %u is invalid (max %u)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 				    index, ACPI_METHOD_MAX_LOCAL));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 			return_ACPI_STATUS(AE_AML_INVALID_INDEX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		/* Return a pointer to the pseudo-node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 		*node = &walk_state->local_variables[index];
^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) 	case ACPI_REFCLASS_ARG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		if (index > ACPI_METHOD_MAX_ARG) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 			ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 				    "Arg index %u is invalid (max %u)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 				    index, ACPI_METHOD_MAX_ARG));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 			return_ACPI_STATUS(AE_AML_INVALID_INDEX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 		/* Return a pointer to the pseudo-node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 		*node = &walk_state->arguments[index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		ACPI_ERROR((AE_INFO, "Type %u is invalid", type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		return_ACPI_STATUS(AE_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)  * FUNCTION:    acpi_ds_method_data_set_value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)  * PARAMETERS:  type                - Either ACPI_REFCLASS_LOCAL or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)  *                                    ACPI_REFCLASS_ARG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)  *              index               - Which Local or Arg to get
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)  *              object              - Object to be inserted into the stack entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)  *              walk_state          - Current walk state object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)  * DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)  *              Note: There is no "implicit conversion" for locals.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) acpi_ds_method_data_set_value(u8 type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 			      u32 index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 			      union acpi_operand_object *object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 			      struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	ACPI_FUNCTION_TRACE(ds_method_data_set_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 			  "NewObj %p Type %2.2X, Refs=%u [%s]\n", object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 			  type, object->common.reference_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 			  acpi_ut_get_type_name(object->common.type)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	/* Get the namespace node for the arg/local */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 		return_ACPI_STATUS(status);
^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) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	 * Increment ref count so object can't be deleted while installed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	 * NOTE: We do not copy the object in order to preserve the call by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	 * reference semantics of ACPI Control Method invocation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	 * (See ACPI Specification 2.0C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	acpi_ut_add_reference(object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	/* Install the object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	node->object = object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)  * FUNCTION:    acpi_ds_method_data_get_value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)  * PARAMETERS:  type                - Either ACPI_REFCLASS_LOCAL or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)  *                                    ACPI_REFCLASS_ARG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)  *              index               - Which localVar or argument to get
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)  *              walk_state          - Current walk state object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  *              dest_desc           - Where Arg or Local value is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)  * DESCRIPTION: Retrieve value of selected Arg or Local for this method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)  *              Used only in acpi_ex_resolve_to_value().
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) acpi_ds_method_data_get_value(u8 type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 			      u32 index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 			      struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 			      union acpi_operand_object **dest_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	union acpi_operand_object *object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	ACPI_FUNCTION_TRACE(ds_method_data_get_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	/* Validate the object descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	if (!dest_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 		ACPI_ERROR((AE_INFO, "Null object descriptor pointer"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 		return_ACPI_STATUS(AE_BAD_PARAMETER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	/* Get the namespace node for the arg/local */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 		return_ACPI_STATUS(status);
^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) 	/* Get the object from the node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	object = node->object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	/* Examine the returned object, it must be valid. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	if (!object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 		 * Index points to uninitialized object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 		 * This means that either 1) The expected argument was
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 		 * not passed to the method, or 2) A local variable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 		 * was referenced by the method (via the ASL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 		 * before it was initialized. Either case is an error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 		/* If slack enabled, init the local_x/arg_x to an Integer of value zero */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 		if (acpi_gbl_enable_interpreter_slack) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 			object = acpi_ut_create_integer_object((u64) 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 			if (!object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 				return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 			node->object = object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 		/* Otherwise, return the error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 			switch (type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 			case ACPI_REFCLASS_ARG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 				ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 					    "Uninitialized Arg[%u] at node %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 					    index, node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 				return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 			case ACPI_REFCLASS_LOCAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 				/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 				 * No error message for this case, will be trapped again later to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 				 * detect and ignore cases of Store(local_x,local_x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 				 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 				return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 			default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 				ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 					    "Not a Arg/Local opcode: 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 					    type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 				return_ACPI_STATUS(AE_AML_INTERNAL);
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	 * The Index points to an initialized and valid object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	 * Return an additional reference to the object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	*dest_desc = object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	acpi_ut_add_reference(object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)  * FUNCTION:    acpi_ds_method_data_delete_value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)  * PARAMETERS:  type                - Either ACPI_REFCLASS_LOCAL or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)  *                                    ACPI_REFCLASS_ARG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)  *              index               - Which localVar or argument to delete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)  *              walk_state          - Current walk state object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)  * RETURN:      None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)  * DESCRIPTION: Delete the entry at Opcode:Index. Inserts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)  *              a null into the stack slot after the object is deleted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) static void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) acpi_ds_method_data_delete_value(u8 type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 				 u32 index, struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 	union acpi_operand_object *object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	ACPI_FUNCTION_TRACE(ds_method_data_delete_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 	/* Get the namespace node for the arg/local */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 		return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 	/* Get the associated object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 	object = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 	 * Undefine the Arg or Local by setting its descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 	 * pointer to NULL. Locals/Args can contain both
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 	 * ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 	node->object = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 	if ((object) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 	    (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_OPERAND)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 		 * There is a valid object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 		 * Decrement the reference count by one to balance the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 		 * increment when the object was stored.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 		acpi_ut_remove_reference(object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 	return_VOID;
^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) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)  * FUNCTION:    acpi_ds_store_object_to_local
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)  * PARAMETERS:  type                - Either ACPI_REFCLASS_LOCAL or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)  *                                    ACPI_REFCLASS_ARG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)  *              index               - Which Local or Arg to set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)  *              obj_desc            - Value to be stored
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487)  *              walk_state          - Current walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)  * DESCRIPTION: Store a value in an Arg or Local. The obj_desc is installed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)  *              as the new value for the Arg or Local and the reference count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)  *              for obj_desc is incremented.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) acpi_ds_store_object_to_local(u8 type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 			      u32 index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 			      union acpi_operand_object *obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 			      struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 	union acpi_operand_object *current_obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 	union acpi_operand_object *new_obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 	ACPI_FUNCTION_TRACE(ds_store_object_to_local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%u Obj=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 			  type, index, obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 	/* Parameter validation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 	if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 		return_ACPI_STATUS(AE_BAD_PARAMETER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 	/* Get the namespace node for the arg/local */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 	status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 	current_obj_desc = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 	if (current_obj_desc == obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 		ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p already installed!\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 				  obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 	 * If the reference count on the object is more than one, we must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 	 * take a copy of the object before we store. A reference count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 	 * of exactly 1 means that the object was just created during the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 	 * evaluation of an expression, and we can safely use it since it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 	 * is not used anywhere else.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 	new_obj_desc = obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	if (obj_desc->common.reference_count > 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 		status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 		    acpi_ut_copy_iobject_to_iobject(obj_desc, &new_obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 						    walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 		if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) 			return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 	 * If there is an object already in this slot, we either
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 	 * have to delete it, or if this is an argument and there
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) 	 * is an object reference stored there, we have to do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 	 * an indirect store!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 	if (current_obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 		 * Check for an indirect store if an argument
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 		 * contains an object reference (stored as an Node).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 		 * We don't allow this automatic dereferencing for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 		 * locals, since a store to a local should overwrite
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 		 * anything there, including an object reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 		 * If both Arg0 and Local0 contain ref_of (Local4):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 		 * Store (1, Arg0)             - Causes indirect store to local4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 		 * Store (1, Local0)           - Stores 1 in local0, overwriting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 		 *                                  the reference to local4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 		 * Store (1, de_refof (Local0)) - Causes indirect store to local4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 		 * Weird, but true.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 		if (type == ACPI_REFCLASS_ARG) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 			 * If we have a valid reference object that came from ref_of(),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 			 * do the indirect store
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 			if ((ACPI_GET_DESCRIPTOR_TYPE(current_obj_desc) ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 			     ACPI_DESC_TYPE_OPERAND) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 			    (current_obj_desc->common.type ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 			     ACPI_TYPE_LOCAL_REFERENCE) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 			    (current_obj_desc->reference.class ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 			     ACPI_REFCLASS_REFOF)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 				ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 						  "Arg (%p) is an ObjRef(Node), storing in node %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 						  new_obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 						  current_obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 				/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 				 * Store this object to the Node (perform the indirect store)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 				 * NOTE: No implicit conversion is performed, as per the ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 				 * specification rules on storing to Locals/Args.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 				 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 				status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 				    acpi_ex_store_object_to_node(new_obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 								 current_obj_desc->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 								 reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 								 object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 								 walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 								 ACPI_NO_IMPLICIT_CONVERSION);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 				/* Remove local reference if we copied the object above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 				if (new_obj_desc != obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 					acpi_ut_remove_reference(new_obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 
^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) 		/* Delete the existing object before storing the new one */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 		acpi_ds_method_data_delete_value(type, index, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) 	 * Install the Obj descriptor (*new_obj_desc) into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 	 * the descriptor for the Arg or Local.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) 	 * (increments the object reference count by one)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) 	status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) 	    acpi_ds_method_data_set_value(type, index, new_obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) 					  walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) 	/* Remove local reference if we copied the object above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) 	if (new_obj_desc != obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 		acpi_ut_remove_reference(new_obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) #ifdef ACPI_OBSOLETE_FUNCTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637)  * FUNCTION:    acpi_ds_method_data_get_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)  * PARAMETERS:  opcode              - Either AML_FIRST LOCAL_OP or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640)  *                                    AML_FIRST_ARG_OP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641)  *              index               - Which Local or Arg whose type to get
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642)  *              walk_state          - Current walk state object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644)  * RETURN:      Data type of current value of the selected Arg or Local
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646)  * DESCRIPTION: Get the type of the object stored in the Local or Arg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) acpi_object_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) acpi_ds_method_data_get_type(u16 opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) 			     u32 index, struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 	union acpi_operand_object *object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 	ACPI_FUNCTION_TRACE(ds_method_data_get_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) 	/* Get the namespace node for the arg/local */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) 	status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) 		return_VALUE((ACPI_TYPE_NOT_FOUND));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 	/* Get the object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 	object = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) 	if (!object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) 		/* Uninitialized local/arg, return TYPE_ANY */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) 		return_VALUE(ACPI_TYPE_ANY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) 	/* Get the object type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) 	return_VALUE(object->type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) #endif