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: dsobject - Dispatcher object management routines
^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 "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define _COMPONENT          ACPI_DISPATCHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) ACPI_MODULE_NAME("dsobject")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * FUNCTION:    acpi_ds_build_internal_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * PARAMETERS:  walk_state      - Current walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *              op              - Parser object to be translated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *              obj_desc_ptr    - Where the ACPI internal object is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * DESCRIPTION: Translate a parser Op object to the equivalent namespace object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *              Simple objects are any objects other than a package object!
^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) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 			      union acpi_parse_object *op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 			      union acpi_operand_object **obj_desc_ptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	ACPI_FUNCTION_TRACE(ds_build_internal_object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	*obj_desc_ptr = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		 * This is a named object reference. If this name was
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		 * previously looked up in the namespace, it was stored in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		 * this op. Otherwise, go ahead and look it up now
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		if (!op->common.node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 			/* Check if we are resolving a named reference within a package */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 			if ((op->common.parent->common.aml_opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 			     AML_PACKAGE_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 			    || (op->common.parent->common.aml_opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 				AML_VARIABLE_PACKAGE_OP)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 				/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 				 * We won't resolve package elements here, we will do this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 				 * after all ACPI tables are loaded into the namespace. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 				 * behavior supports both forward references to named objects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 				 * and external references to objects in other tables.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 				 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 				goto create_new_object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 			} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 				status = acpi_ns_lookup(walk_state->scope_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 							op->common.value.string,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 							ACPI_TYPE_ANY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 							ACPI_IMODE_EXECUTE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 							ACPI_NS_SEARCH_PARENT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 							ACPI_NS_DONT_OPEN_SCOPE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 							NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 							ACPI_CAST_INDIRECT_PTR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 							(struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 							 acpi_namespace_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 							 &(op->common.node)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 				if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 					ACPI_ERROR_NAMESPACE(walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 							     scope_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 							     op->common.value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 							     string, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 					return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) create_new_object:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	/* Create and init a new internal ACPI object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 						   (op->common.aml_opcode))->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 						  object_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		return_ACPI_STATUS(AE_NO_MEMORY);
^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) 	status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	    acpi_ds_init_object_from_op(walk_state, op, op->common.aml_opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 					&obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	 * Handling for unresolved package reference elements.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	 * These are elements that are namepaths.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	if ((op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	    (op->common.parent->common.aml_opcode == AML_VARIABLE_PACKAGE_OP)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		obj_desc->reference.resolved = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		if ((op->common.aml_opcode == AML_INT_NAMEPATH_OP) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		    !obj_desc->reference.node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 			 * Name was unresolved above.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 			 * Get the prefix node for later lookup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 			obj_desc->reference.node =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 			    walk_state->scope_info->scope.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			obj_desc->reference.aml = op->common.aml;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 			obj_desc->reference.resolved = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	*obj_desc_ptr = obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * FUNCTION:    acpi_ds_build_internal_buffer_obj
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  * PARAMETERS:  walk_state      - Current walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  *              op              - Parser object to be translated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  *              buffer_length   - Length of the buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  *              obj_desc_ptr    - Where the ACPI internal object is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * DESCRIPTION: Translate a parser Op package object to the equivalent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  *              namespace object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 				  union acpi_parse_object *op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 				  u32 buffer_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 				  union acpi_operand_object **obj_desc_ptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	union acpi_parse_object *arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	union acpi_parse_object *byte_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	u32 byte_list_length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	ACPI_FUNCTION_TRACE(ds_build_internal_buffer_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	 * If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	 * The buffer object already exists (from the NS node), otherwise it must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	 * be created.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	obj_desc = *obj_desc_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 		/* Create a new buffer object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		*obj_desc_ptr = obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 			return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	 * Second arg is the buffer data (optional) byte_list can be either
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	 * individual bytes or a string initializer. In either case, a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	 * byte_list appears in the AML.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	arg = op->common.value.arg;	/* skip first arg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	byte_list = arg->named.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	if (byte_list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 			ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 				    "Expecting bytelist, found AML opcode 0x%X in op %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 				    byte_list->common.aml_opcode, byte_list));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 			acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 			return (AE_TYPE);
^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) 		byte_list_length = (u32) byte_list->common.value.integer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	 * The buffer length (number of bytes) will be the larger of:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	 * 1) The specified buffer length and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	 * 2) The length of the initializer byte list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	obj_desc->buffer.length = buffer_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	if (byte_list_length > buffer_length) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		obj_desc->buffer.length = byte_list_length;
^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) 	/* Allocate the buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	if (obj_desc->buffer.length == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		obj_desc->buffer.pointer = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 				  "Buffer defined with zero length in AML, creating\n"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		obj_desc->buffer.pointer =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		    ACPI_ALLOCATE_ZEROED(obj_desc->buffer.length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		if (!obj_desc->buffer.pointer) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 			acpi_ut_delete_object_desc(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 			return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		/* Initialize buffer from the byte_list (if present) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		if (byte_list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			memcpy(obj_desc->buffer.pointer, byte_list->named.data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 			       byte_list_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		}
^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) 	obj_desc->buffer.flags |= AOPOBJ_DATA_VALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	op->common.node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  * FUNCTION:    acpi_ds_create_node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  * PARAMETERS:  walk_state      - Current walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)  *              node            - NS Node to be initialized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)  *              op              - Parser object to be translated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)  * DESCRIPTION: Create the object to be associated with a namespace node
^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) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) acpi_ds_create_node(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		    struct acpi_namespace_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		    union acpi_parse_object *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	ACPI_FUNCTION_TRACE_PTR(ds_create_node, op);
^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) 	 * Because of the execution pass through the non-control-method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	 * parts of the table, we can arrive here twice. Only init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	 * the named object node the first time through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	if (acpi_ns_get_attached_object(node)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 		return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	if (!op->common.value.arg) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 		/* No arguments, there is nothing to do */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		return_ACPI_STATUS(AE_OK);
^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) 	/* Build an internal object for the argument(s) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	    acpi_ds_build_internal_object(walk_state, op->common.value.arg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 					  &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	/* Re-type the object according to its argument */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	node->type = obj_desc->common.type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	/* Attach obj to node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	status = acpi_ns_attach_object(node, obj_desc, node->type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	/* Remove local reference to the object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	acpi_ut_remove_reference(obj_desc);
^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)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)  * FUNCTION:    acpi_ds_init_object_from_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)  * PARAMETERS:  walk_state      - Current walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)  *              op              - Parser op used to init the internal object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  *              opcode          - AML opcode associated with the object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  *              ret_obj_desc    - Namespace object to be initialized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  * DESCRIPTION: Initialize a namespace object from a parser Op and its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)  *              associated arguments. The namespace object is a more compact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)  *              representation of the Op and its arguments.
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 			    union acpi_parse_object *op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 			    u16 opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 			    union acpi_operand_object **ret_obj_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	const struct acpi_opcode_info *op_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	ACPI_FUNCTION_TRACE(ds_init_object_from_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	obj_desc = *ret_obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	op_info = acpi_ps_get_opcode_info(opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	if (op_info->class == AML_CLASS_UNKNOWN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 		/* Unknown opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 		return_ACPI_STATUS(AE_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	/* Perform per-object initialization */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	switch (obj_desc->common.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 		 * Defer evaluation of Buffer term_arg operand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		obj_desc->buffer.node =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 		    ACPI_CAST_PTR(struct acpi_namespace_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 				  walk_state->operands[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 		obj_desc->buffer.aml_start = op->named.data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 		obj_desc->buffer.aml_length = op->named.length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 		 * Defer evaluation of Package term_arg operand and all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 		 * package elements. (01/2017): We defer the element
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 		 * resolution to allow forward references from the package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 		 * in order to provide compatibility with other ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 		 * implementations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 		obj_desc->package.node =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 		    ACPI_CAST_PTR(struct acpi_namespace_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 				  walk_state->operands[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		if (!op->named.data) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 			return_ACPI_STATUS(AE_OK);
^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) 		obj_desc->package.aml_start = op->named.data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 		obj_desc->package.aml_length = op->named.length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 		switch (op_info->type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 		case AML_TYPE_CONSTANT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 			 * Resolve AML Constants here - AND ONLY HERE!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 			 * All constants are integers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 			 * We mark the integer with a flag that indicates that it started
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 			 * life as a constant -- so that stores to constants will perform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 			 * as expected (noop). zero_op is used as a placeholder for optional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 			 * target operands.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 			obj_desc->common.flags = AOPOBJ_AML_CONSTANT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 			switch (opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 			case AML_ZERO_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 				obj_desc->integer.value = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 			case AML_ONE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 				obj_desc->integer.value = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 			case AML_ONES_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 				obj_desc->integer.value = ACPI_UINT64_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 				/* Truncate value if we are executing from a 32-bit ACPI table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 				(void)acpi_ex_truncate_for32bit_table(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 			case AML_REVISION_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 				obj_desc->integer.value = ACPI_CA_VERSION;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 			default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 				ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 					    "Unknown constant opcode 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 					    opcode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 				status = AE_AML_OPERAND_TYPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 		case AML_TYPE_LITERAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 			obj_desc->integer.value = op->common.value.integer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 			if (acpi_ex_truncate_for32bit_table(obj_desc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 				/* Warn if we found a 64-bit constant in a 32-bit table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 				ACPI_WARNING((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 					      "Truncated 64-bit constant found in 32-bit table: %8.8X%8.8X => %8.8X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 					      ACPI_FORMAT_UINT64(op->common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 								 value.integer),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 					      (u32)obj_desc->integer.value));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 			ACPI_ERROR((AE_INFO, "Unknown Integer type 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 				    op_info->type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 			status = AE_AML_OPERAND_TYPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 	case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 		obj_desc->string.pointer = op->common.value.string;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 		obj_desc->string.length = (u32)strlen(op->common.value.string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 		 * The string is contained in the ACPI table, don't ever try
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 		 * to delete it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 		obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	case ACPI_TYPE_METHOD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 	case ACPI_TYPE_LOCAL_REFERENCE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 		switch (op_info->type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 		case AML_TYPE_LOCAL_VARIABLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 			/* Local ID (0-7) is (AML opcode - base AML_FIRST_LOCAL_OP) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 			obj_desc->reference.value =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 			    ((u32)opcode) - AML_FIRST_LOCAL_OP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 			obj_desc->reference.class = ACPI_REFCLASS_LOCAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 			status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 			    acpi_ds_method_data_get_node(ACPI_REFCLASS_LOCAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 							 obj_desc->reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 							 value, walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 							 ACPI_CAST_INDIRECT_PTR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 							 (struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 							  acpi_namespace_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 							  &obj_desc->reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 							  object));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 		case AML_TYPE_METHOD_ARGUMENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 			/* Arg ID (0-6) is (AML opcode - base AML_FIRST_ARG_OP) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 			obj_desc->reference.value =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 			    ((u32)opcode) - AML_FIRST_ARG_OP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 			obj_desc->reference.class = ACPI_REFCLASS_ARG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 			status = acpi_ds_method_data_get_node(ACPI_REFCLASS_ARG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 							      obj_desc->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 							      reference.value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 							      walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 							      ACPI_CAST_INDIRECT_PTR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 							      (struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 							       acpi_namespace_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 							       &obj_desc->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 							       reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 							       object));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 		default:	/* Object name or Debug object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 			switch (op->common.aml_opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 			case AML_INT_NAMEPATH_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 				/* Node was saved in Op */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 				obj_desc->reference.node = op->common.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 				obj_desc->reference.class = ACPI_REFCLASS_NAME;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 				if (op->common.node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 					obj_desc->reference.object =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 					    op->common.node->object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 				}
^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) 			case AML_DEBUG_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 				obj_desc->reference.class = ACPI_REFCLASS_DEBUG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 			default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 				ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 					    "Unimplemented reference type for AML opcode: 0x%4.4X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 					    opcode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 				return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 		ACPI_ERROR((AE_INFO, "Unimplemented data type: 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 			    obj_desc->common.type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 		status = AE_AML_OPERAND_TYPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) }