diff options
Diffstat (limited to 'drivers/acpi/acpica/nsaccess.c')
| -rw-r--r-- | drivers/acpi/acpica/nsaccess.c | 92 |
1 files changed, 44 insertions, 48 deletions
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index 88303ebe924..f1249e3463b 100644 --- a/drivers/acpi/acpica/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2014, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -110,17 +110,16 @@ acpi_status acpi_ns_root_initialize(void) status = acpi_ns_lookup(NULL, init_val->name, init_val->type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, NULL, &new_node); - - if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */ + if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Could not create predefined name %s", init_val->name)); + continue; } /* - * Name entered successfully. - * If entry in pre_defined_names[] specifies an - * initial value, create the initial value. + * Name entered successfully. If entry in pre_defined_names[] specifies + * an initial value, create the initial value. */ if (init_val->val) { status = acpi_os_predefined_override(init_val, &val); @@ -152,21 +151,22 @@ acpi_status acpi_ns_root_initialize(void) */ switch (init_val->type) { case ACPI_TYPE_METHOD: + obj_desc->method.param_count = (u8) ACPI_TO_INTEGER(val); obj_desc->common.flags |= AOPOBJ_DATA_VALID; #if defined (ACPI_ASL_COMPILER) - /* Save the parameter count for the i_aSL compiler */ + /* Save the parameter count for the iASL compiler */ new_node->value = obj_desc->method.param_count; #else /* Mark this as a very SPECIAL method */ - obj_desc->method.method_flags = - AML_METHOD_INTERNAL_ONLY; - obj_desc->method.implementation = + obj_desc->method.info_flags = + ACPI_METHOD_INTERNAL_ONLY; + obj_desc->method.dispatch.implementation = acpi_ut_osi_implementation; #endif break; @@ -178,11 +178,9 @@ acpi_status acpi_ns_root_initialize(void) case ACPI_TYPE_STRING: - /* - * Build an object around the static string - */ - obj_desc->string.length = - (u32) ACPI_STRLEN(val); + /* Build an object around the static string */ + + obj_desc->string.length = (u32)ACPI_STRLEN(val); obj_desc->string.pointer = val; obj_desc->common.flags |= AOPOBJ_STATIC_POINTER; break; @@ -224,7 +222,7 @@ acpi_status acpi_ns_root_initialize(void) default: ACPI_ERROR((AE_INFO, - "Unsupported initial type value %X", + "Unsupported initial type value 0x%X", init_val->type)); acpi_ut_remove_reference(obj_desc); obj_desc = NULL; @@ -234,8 +232,7 @@ acpi_status acpi_ns_root_initialize(void) /* Store pointer to value descriptor in the Node */ status = acpi_ns_attach_object(new_node, obj_desc, - ACPI_GET_OBJECT_TYPE - (obj_desc)); + obj_desc->common.type); /* Remove local reference to the object */ @@ -243,7 +240,7 @@ acpi_status acpi_ns_root_initialize(void) } } - unlock_and_exit: +unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); /* Save a handle to "_GPE", it is always present */ @@ -261,11 +258,11 @@ acpi_status acpi_ns_root_initialize(void) * FUNCTION: acpi_ns_lookup * * PARAMETERS: scope_info - Current scope info block - * Pathname - Search pathname, in internal format + * pathname - Search pathname, in internal format * (as represented in the AML stream) - * Type - Type associated with name + * type - Type associated with name * interpreter_mode - IMODE_LOAD_PASS2 => add name if not found - * Flags - Flags describing the search restrictions + * flags - Flags describing the search restrictions * walk_state - Current state of the walk * return_node - Where the Node is placed (if found * or created successfully) @@ -315,10 +312,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, return_ACPI_STATUS(AE_NO_NAMESPACE); } - /* - * Get the prefix scope. - * A null scope means use the root scope - */ + /* Get the prefix scope. A null scope means use the root scope */ + if ((!scope_info) || (!scope_info->scope.node)) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Null scope prefix, using root node (%p)\n", @@ -338,18 +333,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) { /* * This node might not be a actual "scope" node (such as a - * Device/Method, etc.) It could be a Package or other object node. - * Backup up the tree to find the containing scope node. + * Device/Method, etc.) It could be a Package or other object + * node. Backup up the tree to find the containing scope node. */ while (!acpi_ns_opens_scope(prefix_node->type) && prefix_node->type != ACPI_TYPE_ANY) { - prefix_node = - acpi_ns_get_parent_node(prefix_node); + prefix_node = prefix_node->parent; } } } - /* Save type TBD: may be no longer necessary */ + /* Save type. TBD: may be no longer necessary */ type_to_check_for = type; @@ -414,6 +408,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, /* Name is fully qualified, no search rules apply */ search_parent_flag = ACPI_NS_NO_UPSEARCH; + /* * Point past this prefix to the name segment * part or the next Parent Prefix @@ -423,20 +418,22 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, /* Backup to the parent node */ num_carats++; - this_node = acpi_ns_get_parent_node(this_node); + this_node = this_node->parent; if (!this_node) { /* Current scope has no parent scope */ ACPI_ERROR((AE_INFO, - "ACPI path has too many parent prefixes (^) - reached beyond root node")); + "%s: Path has too many parent prefixes (^) " + "- reached beyond root node", + pathname)); return_ACPI_STATUS(AE_NOT_FOUND); } } if (search_parent_flag == ACPI_NS_NO_UPSEARCH) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, - "Search scope is [%4.4s], path has %d carat(s)\n", + "Search scope is [%4.4s], path has %u carat(s)\n", acpi_ut_get_node_name (this_node), num_carats)); } @@ -498,7 +495,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, path++; ACPI_DEBUG_PRINT((ACPI_DB_NAMES, - "Multi Pathname (%d Segments, Flags=%X)\n", + "Multi Pathname (%u Segments, Flags=%X)\n", num_segments, flags)); break; @@ -531,9 +528,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, while (num_segments && current_node) { num_segments--; if (!num_segments) { - /* - * This is the last segment, enable typechecking - */ + + /* This is the last segment, enable typechecking */ + this_search_type = type; /* @@ -584,9 +581,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, if (num_segments > 0) { /* * If we have an alias to an object that opens a scope (such as a - * device or processor), we need to dereference the alias here so that - * we can access any children of the original node (via the remaining - * segments). + * device or processor), we need to dereference the alias here so + * that we can access any children of the original node (via the + * remaining segments). */ if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) { if (!this_node->object) { @@ -594,8 +591,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, } if (acpi_ns_opens_scope - (((struct acpi_namespace_node *)this_node-> - object)->type)) { + (((struct acpi_namespace_node *) + this_node->object)->type)) { this_node = (struct acpi_namespace_node *) this_node->object; @@ -639,8 +636,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, /* * 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 (later) see if it opens a scope. + * specific type, but the type of found object is known, use that + * type to (later) see if it opens a scope. */ if (type == ACPI_TYPE_ANY) { type = this_node->type; @@ -653,9 +650,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, current_node = this_node; } - /* - * Always check if we need to open a new scope - */ + /* Always check if we need to open a new scope */ + if (!(flags & ACPI_NS_DONT_OPEN_SCOPE) && (walk_state)) { /* * If entry is a type which opens a scope, push the new scope on the |
