📄 nsaccess.c
字号:
/* Def_field_defn defines fields in a Region */ type_to_check_for = ACPI_TYPE_REGION; } else if (INTERNAL_TYPE_BANK_FIELD_DEFN == type) { /* Bank_field_defn defines data fields in a Field Object */ type_to_check_for = ACPI_TYPE_ANY; } else { type_to_check_for = type; } /* TBD: [Restructure] - Move the pathname stuff into a new procedure */ /* Examine the name pointer */ if (!pathname) { /* 8-12-98 ASL Grammar Update supports null Name_path */ null_name_path = TRUE; num_segments = 0; this_node = acpi_gbl_root_node; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Null Pathname (Zero segments), Flags=%x\n", flags)); } else { /* * Valid name pointer (Internal name format) * * Check for prefixes. As represented in the AML stream, a * Pathname consists of an optional scope prefix followed by * a segment part. * * If present, the scope prefix is either a Root_prefix (in * which case the name is fully qualified), or zero or more * Parent_prefixes (in which case the name's scope is relative * to the current scope). * * The segment part consists of either: * - A single 4-byte name segment, or * - A Dual_name_prefix followed by two 4-byte name segments, or * - A Multi_name_prefix_op, followed by a byte indicating the * number of segments and the segments themselves. */ if (*pathname == AML_ROOT_PREFIX) { /* Pathname is fully qualified, look in root name table */ current_node = acpi_gbl_root_node; /* point to segment part */ pathname++; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching from root [%p]\n", current_node)); /* Direct reference to root, "\" */ if (!(*pathname)) { this_node = acpi_gbl_root_node; goto check_for_new_scope_and_exit; } } else { /* Pathname is relative to current scope, start there */ current_node = prefix_node; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching relative to pfx scope [%p]\n", prefix_node)); /* * Handle up-prefix (carat). More than one prefix * is supported */ while (*pathname == AML_PARENT_PREFIX) { /* Point to segment part or next Parent_prefix */ pathname++; /* Backup to the parent's scope */ this_node = acpi_ns_get_parent_object (current_node); if (!this_node) { /* Current scope has no parent scope */ REPORT_ERROR ( ("Too many parent prefixes (^) - reached root\n")); return_ACPI_STATUS (AE_NOT_FOUND); } current_node = this_node; } } /* * Examine the name prefix opcode, if any, * to determine the number of segments */ if (*pathname == AML_DUAL_NAME_PREFIX) { num_segments = 2; /* point to first segment */ pathname++; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Dual Pathname (2 segments, Flags=%X)\n", flags)); } else if (*pathname == AML_MULTI_NAME_PREFIX_OP) { num_segments = (u32)* (u8 *) ++pathname; /* point to first segment */ pathname++; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Multi Pathname (%d Segments, Flags=%X) \n", num_segments, flags)); } else { /* * No Dual or Multi prefix, hence there is only one * segment and Pathname is already pointing to it. */ num_segments = 1; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Simple Pathname (1 segment, Flags=%X)\n", flags)); }#ifdef ACPI_DEBUG /* TBD: [Restructure] Make this a procedure */ /* Debug only: print the entire name that we are about to lookup */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); for (i = 0; i < num_segments; i++) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%4.4s/", (char*)&pathname[i * 4])); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "]\n"));#endif } /* * Search namespace for each segment of the name. * Loop through and verify/add each name segment. */ while (num_segments-- && current_node) { /* * Search for the current name segment under the current * named object. The Type is significant only at the last (topmost) * level. (We don't care about the types along the path, only * the type of the final target object.) */ this_search_type = ACPI_TYPE_ANY; if (!num_segments) { this_search_type = type; local_flags = flags; } /* Pluck one ACPI name from the front of the pathname */ MOVE_UNALIGNED32_TO_32 (&simple_name, pathname); /* Try to find the ACPI name */ status = acpi_ns_search_and_enter (simple_name, walk_state, current_node, interpreter_mode, this_search_type, local_flags, &this_node); if (ACPI_FAILURE (status)) { if (status == AE_NOT_FOUND) { /* Name not found in ACPI namespace */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name [%4.4s] not found in scope %p\n", (char*)&simple_name, current_node)); } return_ACPI_STATUS (status); } /* * If 1) This is the last segment (Num_segments == 0) * 2) and looking for a specific type * (Not checking for TYPE_ANY) * 3) Which is not an alias * 4) which is not a local type (TYPE_DEF_ANY) * 5) which is not a local type (TYPE_SCOPE) * 6) which is not a local type (TYPE_INDEX_FIELD_DEFN) * 7) and type of object is known (not TYPE_ANY) * 8) and object does not match request * * Then we have a type mismatch. Just warn and ignore it. */ if ((num_segments == 0) && (type_to_check_for != ACPI_TYPE_ANY) && (type_to_check_for != INTERNAL_TYPE_ALIAS) && (type_to_check_for != INTERNAL_TYPE_DEF_ANY) && (type_to_check_for != INTERNAL_TYPE_SCOPE) && (type_to_check_for != INTERNAL_TYPE_INDEX_FIELD_DEFN) && (this_node->type != ACPI_TYPE_ANY) && (this_node->type != type_to_check_for)) { /* Complain about a type mismatch */ REPORT_WARNING ( ("Ns_lookup: %4.4s, type %X, checking for type %X\n", (char*)&simple_name, this_node->type, type_to_check_for)); } /* * If this is the last name segment and we are not looking for a * specific type, but the type of found object is known, use that type * to see if it opens a scope. */ if ((0 == num_segments) && (ACPI_TYPE_ANY == type)) { type = this_node->type; } if ((num_segments || acpi_ns_opens_scope (type)) && (this_node->child == NULL)) { /* * More segments or the type implies enclosed scope, * and the next scope has not been allocated. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Load mode=%X This_node=%p\n", interpreter_mode, this_node)); } current_node = this_node; /* point to next name segment */ pathname += ACPI_NAME_SIZE; } /* * Always check if we need to open a new scope */check_for_new_scope_and_exit: if (!(flags & NS_DONT_OPEN_SCOPE) && (walk_state)) { /* * If entry is a type which opens a scope, * push the new scope on the scope stack. */ if (acpi_ns_opens_scope (type_to_check_for)) { /* 8-12-98 ASL Grammar Update supports null Name_path */ if (null_name_path) { /* TBD: [Investigate] - is this the correct thing to do? */ scope_to_push = NULL; } else { scope_to_push = this_node; } status = acpi_ds_scope_stack_push (scope_to_push, type, walk_state); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Set global scope to %p\n", scope_to_push)); } } *return_node = this_node; return_ACPI_STATUS (AE_OK);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -