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: nsaccess - Top-level functions for accessing ACPI namespace
^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 "amlcode.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 "acdispat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #ifdef ACPI_ASL_COMPILER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include "acdisasm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define _COMPONENT          ACPI_NAMESPACE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) ACPI_MODULE_NAME("nsaccess")
^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_ns_root_initialize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * PARAMETERS:  None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * DESCRIPTION: Allocate and initialize the default root named objects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * MUTEX:       Locks namespace for entire execution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) acpi_status acpi_ns_root_initialize(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	const struct acpi_predefined_names *init_val = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	struct acpi_namespace_node *new_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	struct acpi_namespace_node *prev_node = NULL;
^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_string val = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	ACPI_FUNCTION_TRACE(ns_root_initialize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	 * The global root ptr is initially NULL, so a non-NULL value indicates
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	 * that acpi_ns_root_initialize() has already been called; just return.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	if (acpi_gbl_root_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		goto unlock_and_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	 * Tell the rest of the subsystem that the root is initialized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	 * (This is OK because the namespace is locked)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	acpi_gbl_root_node = &acpi_gbl_root_node_struct;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	/* Enter the predefined names in the name table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 			  "Entering predefined entries into namespace\n"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	 * Create the initial (default) namespace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	 * This namespace looks like something similar to this:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	 *   ACPI Namespace (from Namespace Root):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	 *    0  _GPE Scope        00203160 00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	 *    0  _PR_ Scope        002031D0 00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	 *    0  _SB_ Device       00203240 00 Notify Object: 0020ADD8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	 *    0  _SI_ Scope        002032B0 00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	 *    0  _TZ_ Device       00203320 00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	 *    0  _REV Integer      00203390 00 = 0000000000000002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	 *    0  _OS_ String       00203488 00 Len 14 "Microsoft Windows NT"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	 *    0  _GL_ Mutex        00203580 00 Object 002035F0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	 *    0  _OSI Method       00203678 00 Args 1 Len 0000 Aml 00000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		/* _OSI is optional for now, will be permanent later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		if (!strcmp(init_val->name, "_OSI")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		    && !acpi_gbl_create_osi_method) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		 * Create, init, and link the new predefined name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		 * Note: No need to use acpi_ns_lookup here because all the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		 * predefined names are at the root level. It is much easier to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		 * just create and link the new node(s) here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		new_node =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		    acpi_ns_create_node(*ACPI_CAST_PTR(u32, init_val->name));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		if (!new_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 			status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 			goto unlock_and_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		new_node->descriptor_type = ACPI_DESC_TYPE_NAMED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		new_node->type = init_val->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		if (!prev_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 			acpi_gbl_root_node_struct.child = new_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 			prev_node->peer = new_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		new_node->parent = &acpi_gbl_root_node_struct;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		prev_node = new_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		 * Name entered successfully. If entry in pre_defined_names[] specifies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		 * an initial value, create the initial value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		if (init_val->val) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			status = acpi_os_predefined_override(init_val, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 			if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 				ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 					    "Could not override predefined %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 					    init_val->name));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 			if (!val) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 				val = init_val->val;
^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) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			 * Entry requests an initial value, allocate a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 			 * descriptor for it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 			obj_desc =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 			    acpi_ut_create_internal_object(init_val->type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 			if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 				status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 				goto unlock_and_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 			 * Convert value string from table entry to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 			 * internal representation. Only types actually
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 			 * used for initial values are implemented here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 			switch (init_val->type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 			case ACPI_TYPE_METHOD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 				obj_desc->method.param_count =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 				    (u8) ACPI_TO_INTEGER(val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 				obj_desc->common.flags |= AOPOBJ_DATA_VALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) #if defined (ACPI_ASL_COMPILER)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 				/* Save the parameter count for the iASL compiler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 				new_node->value = obj_desc->method.param_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 				/* Mark this as a very SPECIAL method (_OSI) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 				obj_desc->method.info_flags =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 				    ACPI_METHOD_INTERNAL_ONLY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 				obj_desc->method.dispatch.implementation =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 				    acpi_ut_osi_implementation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 			case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 				obj_desc->integer.value = ACPI_TO_INTEGER(val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 			case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 				/* Build an object around the static string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 				obj_desc->string.length = (u32)strlen(val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 				obj_desc->string.pointer = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 				obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 			case ACPI_TYPE_MUTEX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 				obj_desc->mutex.node = new_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 				obj_desc->mutex.sync_level =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 				    (u8) (ACPI_TO_INTEGER(val) - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 				/* Create a mutex */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 				status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 				    acpi_os_create_mutex(&obj_desc->mutex.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 							 os_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 				if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 					acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 					goto unlock_and_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 				/* Special case for ACPI Global Lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 				if (strcmp(init_val->name, "_GL_") == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 					acpi_gbl_global_lock_mutex = obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 					/* Create additional counting semaphore for global lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 					status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 					    acpi_os_create_semaphore(1, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 								     &acpi_gbl_global_lock_semaphore);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 					if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 						acpi_ut_remove_reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 						    (obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 						goto unlock_and_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 					}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 			default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 				ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 					    "Unsupported initial type value 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 					    init_val->type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 				acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 				obj_desc = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 				continue;
^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) 			/* Store pointer to value descriptor in the Node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			status = acpi_ns_attach_object(new_node, obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 						       obj_desc->common.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 			/* Remove local reference to the object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 			acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) unlock_and_exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	/* Save a handle to "_GPE", it is always present */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	if (ACPI_SUCCESS(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 		status = acpi_ns_get_node(NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 					  &acpi_gbl_fadt_gpe_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)  * FUNCTION:    acpi_ns_lookup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)  * PARAMETERS:  scope_info      - Current scope info block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)  *              pathname        - Search pathname, in internal format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)  *                                (as represented in the AML stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)  *              type            - Type associated with name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  *              interpreter_mode - IMODE_LOAD_PASS2 => add name if not found
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)  *              flags           - Flags describing the search restrictions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)  *              walk_state      - Current state of the walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)  *              return_node     - Where the Node is placed (if found
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)  *                                or created successfully)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)  * DESCRIPTION: Find or enter the passed name in the name space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)  *              Log an error if name not found in Exec mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)  * MUTEX:       Assumes namespace is locked.
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) acpi_ns_lookup(union acpi_generic_state *scope_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	       char *pathname,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	       acpi_object_type type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	       acpi_interpreter_mode interpreter_mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	       u32 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	       struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	       struct acpi_namespace_node **return_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	char *path = pathname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	char *external_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	struct acpi_namespace_node *prefix_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	struct acpi_namespace_node *current_node = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	struct acpi_namespace_node *this_node = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	u32 num_segments;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	u32 num_carats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	acpi_name simple_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	acpi_object_type type_to_check_for;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	acpi_object_type this_search_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	u32 local_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	acpi_interpreter_mode local_interpreter_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	ACPI_FUNCTION_TRACE(ns_lookup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	if (!return_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 		return_ACPI_STATUS(AE_BAD_PARAMETER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	local_flags = flags &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	    ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_OVERRIDE_IF_FOUND |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	      ACPI_NS_SEARCH_PARENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	*return_node = ACPI_ENTRY_NOT_FOUND;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	acpi_gbl_ns_lookup_count++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	if (!acpi_gbl_root_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 		return_ACPI_STATUS(AE_NO_NAMESPACE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	/* Get the prefix scope. A null scope means use the root scope */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	if ((!scope_info) || (!scope_info->scope.node)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 		ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 				  "Null scope prefix, using root node (%p)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 				  acpi_gbl_root_node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 		prefix_node = acpi_gbl_root_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 		prefix_node = scope_info->scope.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 		if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 		    ACPI_DESC_TYPE_NAMED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 			ACPI_ERROR((AE_INFO, "%p is not a namespace node [%s]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 				    prefix_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 				    acpi_ut_get_descriptor_name(prefix_node)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 			return_ACPI_STATUS(AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 		if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 			 * This node might not be a actual "scope" node (such as a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 			 * Device/Method, etc.)  It could be a Package or other object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 			 * node. Backup up the tree to find the containing scope node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 			while (!acpi_ns_opens_scope(prefix_node->type) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 			       prefix_node->type != ACPI_TYPE_ANY) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 				prefix_node = prefix_node->parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	/* Save type. TBD: may be no longer necessary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	type_to_check_for = type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	 * Begin examination of the actual pathname
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	if (!pathname) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 		/* A Null name_path is allowed and refers to the root */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 		num_segments = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 		this_node = acpi_gbl_root_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 		path = "";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 				  "Null Pathname (Zero segments), Flags=%X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 				  flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 		 * Name pointer is valid (and must be in internal name format)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 		 * Check for scope prefixes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 		 * As represented in the AML stream, a namepath consists of an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 		 * optional scope prefix followed by a name segment part.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 		 * If present, the scope prefix is either a Root Prefix (in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 		 * which case the name is fully qualified), or one or more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 		 * Parent Prefixes (in which case the name's scope is relative
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 		 * to the current scope).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 		if (*path == (u8) AML_ROOT_PREFIX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 			/* Pathname is fully qualified, start from the root */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 			this_node = acpi_gbl_root_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 			search_parent_flag = ACPI_NS_NO_UPSEARCH;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 			/* Point to name segment part */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 			path++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 					  "Path is absolute from root [%p]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 					  this_node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 			/* Pathname is relative to current scope, start there */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 					  "Searching relative to prefix scope [%4.4s] (%p)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 					  acpi_ut_get_node_name(prefix_node),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 					  prefix_node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 			 * Handle multiple Parent Prefixes (carat) by just getting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 			 * the parent node for each prefix instance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 			this_node = prefix_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 			num_carats = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 			while (*path == (u8) AML_PARENT_PREFIX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 				/* Name is fully qualified, no search rules apply */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 				search_parent_flag = ACPI_NS_NO_UPSEARCH;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 				/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 				 * Point past this prefix to the name segment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 				 * part or the next Parent Prefix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 				 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 				path++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 				/* Backup to the parent node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 				num_carats++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 				this_node = this_node->parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 				if (!this_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 					/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 					 * Current scope has no parent scope. Externalize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 					 * the internal path for error message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 					 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 					status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 					    acpi_ns_externalize_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 					    (ACPI_UINT32_MAX, pathname, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 					     &external_path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 					if (ACPI_SUCCESS(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 						ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 							    "%s: Path has too many parent prefixes (^)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 							    external_path));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 						ACPI_FREE(external_path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 					}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 					return_ACPI_STATUS(AE_NOT_FOUND);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 			if (search_parent_flag == ACPI_NS_NO_UPSEARCH) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 				ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 						  "Search scope is [%4.4s], path has %u carat(s)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 						  acpi_ut_get_node_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 						  (this_node), num_carats));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 			}
^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) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 		 * Determine the number of ACPI name segments in this pathname.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 		 * The segment part consists of either:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 		 *  - A Null name segment (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 		 *  - A dual_name_prefix followed by two 4-byte name segments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 		 *  - A multi_name_prefix followed by a byte indicating the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 		 *      number of segments and the segments themselves.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 		 *  - A single 4-byte name segment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 		 * Examine the name prefix opcode, if any, to determine the number of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 		 * segments.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 		switch (*path) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 		case 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 			 * Null name after a root or parent prefixes. We already
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 			 * have the correct target node and there are no name segments.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 			num_segments = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 			type = this_node->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 					  "Prefix-only Pathname (Zero name segments), Flags=%X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 					  flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 		case AML_DUAL_NAME_PREFIX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 			/* More than one name_seg, search rules do not apply */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 			search_parent_flag = ACPI_NS_NO_UPSEARCH;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 			/* Two segments, point to first name segment */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 			num_segments = 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 			path++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 					  "Dual Pathname (2 segments, Flags=%X)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 					  flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 		case AML_MULTI_NAME_PREFIX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 			/* More than one name_seg, search rules do not apply */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 			search_parent_flag = ACPI_NS_NO_UPSEARCH;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 			/* Extract segment count, point to first name segment */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 			path++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 			num_segments = (u32) (u8) * path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 			path++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 					  "Multi Pathname (%u Segments, Flags=%X)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 					  num_segments, flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 			 * Not a Null name, no Dual or Multi prefix, hence there is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 			 * only one name segment and Pathname is already pointing to it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 			num_segments = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 					  "Simple Pathname (1 segment, Flags=%X)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 					  flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 		ACPI_DEBUG_EXEC(acpi_ns_print_pathname(num_segments, path));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 	}
^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) 	 * Search namespace for each segment of the name. Loop through and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 	 * verify (or add to the namespace) each name segment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 	 * The object type is significant only at the last name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 	 * segment. (We don't care about the types along the path, only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 	 * the type of the final target object.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 	this_search_type = ACPI_TYPE_ANY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	current_node = this_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 	while (num_segments && current_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 		num_segments--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 		if (!num_segments) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 			/* This is the last segment, enable typechecking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 			this_search_type = type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 			 * Only allow automatic parent search (search rules) if the caller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) 			 * requested it AND we have a single, non-fully-qualified name_seg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 			if ((search_parent_flag != ACPI_NS_NO_UPSEARCH) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 			    (flags & ACPI_NS_SEARCH_PARENT)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 				local_flags |= ACPI_NS_SEARCH_PARENT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 			/* Set error flag according to caller */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 			if (flags & ACPI_NS_ERROR_IF_FOUND) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 				local_flags |= ACPI_NS_ERROR_IF_FOUND;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 			/* Set override flag according to caller */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 			if (flags & ACPI_NS_OVERRIDE_IF_FOUND) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 				local_flags |= ACPI_NS_OVERRIDE_IF_FOUND;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 		/* Handle opcodes that create a new name_seg via a full name_path */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 		local_interpreter_mode = interpreter_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 		if ((flags & ACPI_NS_PREFIX_MUST_EXIST) && (num_segments > 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 			/* Every element of the path must exist (except for the final name_seg) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 			local_interpreter_mode = ACPI_IMODE_EXECUTE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 		/* Extract one ACPI name from the front of the pathname */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 		ACPI_MOVE_32_TO_32(&simple_name, path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 		/* Try to find the single (4 character) ACPI name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 		status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 		    acpi_ns_search_and_enter(simple_name, walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 					     current_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 					     local_interpreter_mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 					     this_search_type, local_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 					     &this_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 		if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 			if (status == AE_NOT_FOUND) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) #if !defined ACPI_ASL_COMPILER	/* Note: iASL reports this error by itself, not needed here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 				if (flags & ACPI_NS_PREFIX_MUST_EXIST) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 					acpi_os_printf(ACPI_MSG_BIOS_ERROR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 						       "Object does not exist: %4.4s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 						       (char *)&simple_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 				/* Name not found in ACPI namespace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 				ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 						  "Name [%4.4s] not found in scope [%4.4s] %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 						  (char *)&simple_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) 						  (char *)&current_node->name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 						  current_node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) #ifdef ACPI_EXEC_APP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 			if ((status == AE_ALREADY_EXISTS) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 			    (this_node->flags & ANOBJ_NODE_EARLY_INIT)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) 				this_node->flags &= ~ANOBJ_NODE_EARLY_INIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 				status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) #ifdef ACPI_ASL_COMPILER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) 			 * If this ACPI name already exists within the namespace as an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) 			 * external declaration, then mark the external as a conflicting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) 			 * declaration and proceed to process the current node as if it did
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) 			 * not exist in the namespace. If this node is not processed as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) 			 * normal, then it could cause improper namespace resolution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) 			 * by failing to open a new scope.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 			if (acpi_gbl_disasm_flag &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) 			    (status == AE_ALREADY_EXISTS) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) 			    ((this_node->flags & ANOBJ_IS_EXTERNAL) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) 			     (walk_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) 			      && walk_state->opcode == AML_EXTERNAL_OP))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) 				this_node->flags &= ~ANOBJ_IS_EXTERNAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) 				this_node->type = (u8)this_search_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) 				if (walk_state->opcode != AML_EXTERNAL_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) 					acpi_dm_mark_external_conflict
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 					    (this_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 			*return_node = this_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) 			return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) 		/* More segments to follow? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 		if (num_segments > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) 			 * If we have an alias to an object that opens a scope (such as a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) 			 * device or processor), we need to dereference the alias here so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 			 * that we can access any children of the original node (via the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 			 * remaining segments).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 			if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 				if (!this_node->object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 					return_ACPI_STATUS(AE_NOT_EXIST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) 				if (acpi_ns_opens_scope
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) 				    (((struct acpi_namespace_node *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 				      this_node->object)->type)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) 					this_node =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 					    (struct acpi_namespace_node *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 					    this_node->object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) 		/* Special handling for the last segment (num_segments == 0) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) 		else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) 			 * Sanity typecheck of the target object:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 			 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) 			 * If 1) This is the last segment (num_segments == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) 			 *    2) And we are looking for a specific type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) 			 *       (Not checking for TYPE_ANY)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) 			 *    3) Which is not an alias
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) 			 *    4) Which is not a local type (TYPE_SCOPE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) 			 *    5) And the type of target object is known (not TYPE_ANY)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) 			 *    6) And target object does not match what we are looking for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) 			 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) 			 * Then we have a type mismatch. Just warn and ignore it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) 			if ((type_to_check_for != ACPI_TYPE_ANY) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) 			    (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) 			    (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) 			    && (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) 			    && (this_node->type != ACPI_TYPE_ANY)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) 			    && (this_node->type != type_to_check_for)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) 				/* Complain about a type mismatch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) 				ACPI_WARNING((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) 					      "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) 					      ACPI_CAST_PTR(char, &simple_name),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) 					      acpi_ut_get_type_name(this_node->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) 								    type),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) 					      acpi_ut_get_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) 					      (type_to_check_for)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) 			 * If this is the last name segment and we are not looking for a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) 			 * specific type, but the type of found object is known, use that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) 			 * type to (later) see if it opens a scope.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) 			if (type == ACPI_TYPE_ANY) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) 				type = this_node->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) 		/* Point to next name segment and make this node current */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) 		path += ACPI_NAMESEG_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) 		current_node = this_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) 	/* Always check if we need to open a new scope */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) 	if (!(flags & ACPI_NS_DONT_OPEN_SCOPE) && (walk_state)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) 		 * If entry is a type which opens a scope, push the new scope on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) 		 * scope stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) 		if (acpi_ns_opens_scope(type)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) 			status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) 			    acpi_ds_scope_stack_push(this_node, type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) 						     walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) 			if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) 				return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) #ifdef ACPI_EXEC_APP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) 	if (flags & ACPI_NS_EARLY_INIT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) 		this_node->flags |= ANOBJ_NODE_EARLY_INIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) 	*return_node = this_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) 	return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) }