aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/namespace/nsaccess.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/namespace/nsaccess.c')
-rw-r--r--drivers/acpi/namespace/nsaccess.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c
index 1149bc18fb35..48fadade52e2 100644
--- a/drivers/acpi/namespace/nsaccess.c
+++ b/drivers/acpi/namespace/nsaccess.c
@@ -70,7 +70,7 @@ acpi_status acpi_ns_root_initialize(void)
70 union acpi_operand_object *obj_desc; 70 union acpi_operand_object *obj_desc;
71 acpi_string val = NULL; 71 acpi_string val = NULL;
72 72
73 ACPI_FUNCTION_TRACE("ns_root_initialize"); 73 ACPI_FUNCTION_TRACE(ns_root_initialize);
74 74
75 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 75 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
76 if (ACPI_FAILURE(status)) { 76 if (ACPI_FAILURE(status)) {
@@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void)
98 "Entering predefined entries into namespace\n")); 98 "Entering predefined entries into namespace\n"));
99 99
100 for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { 100 for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
101
101 /* _OSI is optional for now, will be permanent later */ 102 /* _OSI is optional for now, will be permanent later */
102 103
103 if (!ACPI_STRCMP(init_val->name, "_OSI") 104 if (!ACPI_STRCMP(init_val->name, "_OSI")
@@ -156,7 +157,7 @@ acpi_status acpi_ns_root_initialize(void)
156 157
157#if defined (ACPI_ASL_COMPILER) 158#if defined (ACPI_ASL_COMPILER)
158 159
159 /* save the parameter count for the i_aSL compiler */ 160 /* Save the parameter count for the i_aSL compiler */
160 161
161 new_node->value = obj_desc->method.param_count; 162 new_node->value = obj_desc->method.param_count;
162#else 163#else
@@ -258,10 +259,8 @@ acpi_status acpi_ns_root_initialize(void)
258 /* Save a handle to "_GPE", it is always present */ 259 /* Save a handle to "_GPE", it is always present */
259 260
260 if (ACPI_SUCCESS(status)) { 261 if (ACPI_SUCCESS(status)) {
261 status = 262 status = acpi_ns_get_node(NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH,
262 acpi_ns_get_node_by_path("\\_GPE", NULL, 263 &acpi_gbl_fadt_gpe_device);
263 ACPI_NS_NO_UPSEARCH,
264 &acpi_gbl_fadt_gpe_device);
265 } 264 }
266 265
267 return_ACPI_STATUS(status); 266 return_ACPI_STATUS(status);
@@ -310,17 +309,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
310 acpi_object_type type_to_check_for; 309 acpi_object_type type_to_check_for;
311 acpi_object_type this_search_type; 310 acpi_object_type this_search_type;
312 u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; 311 u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
313 u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | 312 u32 local_flags;
314 ACPI_NS_SEARCH_PARENT);
315 313
316 ACPI_FUNCTION_TRACE("ns_lookup"); 314 ACPI_FUNCTION_TRACE(ns_lookup);
317 315
318 if (!return_node) { 316 if (!return_node) {
319 return_ACPI_STATUS(AE_BAD_PARAMETER); 317 return_ACPI_STATUS(AE_BAD_PARAMETER);
320 } 318 }
321 319
322 acpi_gbl_ns_lookup_count++; 320 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
323 *return_node = ACPI_ENTRY_NOT_FOUND; 321 *return_node = ACPI_ENTRY_NOT_FOUND;
322 acpi_gbl_ns_lookup_count++;
324 323
325 if (!acpi_gbl_root_node) { 324 if (!acpi_gbl_root_node) {
326 return_ACPI_STATUS(AE_NO_NAMESPACE); 325 return_ACPI_STATUS(AE_NO_NAMESPACE);
@@ -346,14 +345,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
346 return_ACPI_STATUS(AE_AML_INTERNAL); 345 return_ACPI_STATUS(AE_AML_INTERNAL);
347 } 346 }
348 347
349 /* 348 if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) {
350 * This node might not be a actual "scope" node (such as a 349 /*
351 * Device/Method, etc.) It could be a Package or other object node. 350 * This node might not be a actual "scope" node (such as a
352 * Backup up the tree to find the containing scope node. 351 * Device/Method, etc.) It could be a Package or other object node.
353 */ 352 * Backup up the tree to find the containing scope node.
354 while (!acpi_ns_opens_scope(prefix_node->type) && 353 */
355 prefix_node->type != ACPI_TYPE_ANY) { 354 while (!acpi_ns_opens_scope(prefix_node->type) &&
356 prefix_node = acpi_ns_get_parent_node(prefix_node); 355 prefix_node->type != ACPI_TYPE_ANY) {
356 prefix_node =
357 acpi_ns_get_parent_node(prefix_node);
358 }
357 } 359 }
358 } 360 }
359 361
@@ -365,6 +367,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
365 * Begin examination of the actual pathname 367 * Begin examination of the actual pathname
366 */ 368 */
367 if (!pathname) { 369 if (!pathname) {
370
368 /* A Null name_path is allowed and refers to the root */ 371 /* A Null name_path is allowed and refers to the root */
369 372
370 num_segments = 0; 373 num_segments = 0;
@@ -389,6 +392,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
389 * to the current scope). 392 * to the current scope).
390 */ 393 */
391 if (*path == (u8) AML_ROOT_PREFIX) { 394 if (*path == (u8) AML_ROOT_PREFIX) {
395
392 /* Pathname is fully qualified, start from the root */ 396 /* Pathname is fully qualified, start from the root */
393 397
394 this_node = acpi_gbl_root_node; 398 this_node = acpi_gbl_root_node;
@@ -416,6 +420,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
416 this_node = prefix_node; 420 this_node = prefix_node;
417 num_carats = 0; 421 num_carats = 0;
418 while (*path == (u8) AML_PARENT_PREFIX) { 422 while (*path == (u8) AML_PARENT_PREFIX) {
423
419 /* Name is fully qualified, no search rules apply */ 424 /* Name is fully qualified, no search rules apply */
420 425
421 search_parent_flag = ACPI_NS_NO_UPSEARCH; 426 search_parent_flag = ACPI_NS_NO_UPSEARCH;
@@ -430,6 +435,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
430 num_carats++; 435 num_carats++;
431 this_node = acpi_ns_get_parent_node(this_node); 436 this_node = acpi_ns_get_parent_node(this_node);
432 if (!this_node) { 437 if (!this_node) {
438
433 /* Current scope has no parent scope */ 439 /* Current scope has no parent scope */
434 440
435 ACPI_ERROR((AE_INFO, 441 ACPI_ERROR((AE_INFO,
@@ -569,6 +575,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
569 &this_node); 575 &this_node);
570 if (ACPI_FAILURE(status)) { 576 if (ACPI_FAILURE(status)) {
571 if (status == AE_NOT_FOUND) { 577 if (status == AE_NOT_FOUND) {
578
572 /* Name not found in ACPI namespace */ 579 /* Name not found in ACPI namespace */
573 580
574 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 581 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
@@ -602,10 +609,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
602 (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && 609 (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
603 (this_node->type != ACPI_TYPE_ANY) && 610 (this_node->type != ACPI_TYPE_ANY) &&
604 (this_node->type != type_to_check_for)) { 611 (this_node->type != type_to_check_for)) {
612
605 /* Complain about a type mismatch */ 613 /* Complain about a type mismatch */
606 614
607 ACPI_WARNING((AE_INFO, 615 ACPI_WARNING((AE_INFO,
608 "ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)", 616 "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
609 ACPI_CAST_PTR(char, &simple_name), 617 ACPI_CAST_PTR(char, &simple_name),
610 acpi_ut_get_type_name(this_node->type), 618 acpi_ut_get_type_name(this_node->type),
611 acpi_ut_get_type_name 619 acpi_ut_get_type_name