diff options
Diffstat (limited to 'drivers/acpi/namespace/nsutils.c')
| -rw-r--r-- | drivers/acpi/namespace/nsutils.c | 167 | 
1 files changed, 94 insertions, 73 deletions
| diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 75da76cc0b1..c53b82e94ce 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c @@ -51,6 +51,18 @@  #define _COMPONENT          ACPI_NAMESPACE  	 ACPI_MODULE_NAME    ("nsutils") +/* Local prototypes */ + +static u8 +acpi_ns_valid_path_separator ( +	char                            sep); + +#ifdef ACPI_OBSOLETE_FUNCTIONS +acpi_name +acpi_ns_find_parent_name ( +	struct acpi_namespace_node      *node_to_search); +#endif +  /*******************************************************************************   * @@ -59,7 +71,8 @@   * PARAMETERS:  module_name         - Caller's module name (for error output)   *              line_number         - Caller's line number (for error output)   *              component_id        - Caller's component ID (for error output) - *              Message             - Error message to use on failure + *              internal_name       - Name or path of the namespace node + *              lookup_status       - Exception code from NS lookup   *   * RETURN:      None   * @@ -121,6 +134,9 @@ acpi_ns_report_error (   *              line_number         - Caller's line number (for error output)   *              component_id        - Caller's component ID (for error output)   *              Message             - Error message to use on failure + *              prefix_node         - Prefix relative to the path + *              Path                - Path to the node + *              method_status       - Execution status   *   * RETURN:      None   * @@ -161,8 +177,8 @@ acpi_ns_report_method_error (   *   * FUNCTION:    acpi_ns_print_node_pathname   * - * PARAMETERS:  Node                - Object - *              Msg                 - Prefix message + * PARAMETERS:  Node            - Object + *              Message         - Prefix message   *   * DESCRIPTION: Print an object's full namespace pathname   *              Manages allocation/freeing of a pathname buffer @@ -172,7 +188,7 @@ acpi_ns_report_method_error (  void  acpi_ns_print_node_pathname (  	struct acpi_namespace_node      *node, -	char                            *msg) +	char                            *message)  {  	struct acpi_buffer              buffer;  	acpi_status                     status; @@ -189,8 +205,8 @@ acpi_ns_print_node_pathname (  	status = acpi_ns_handle_to_pathname (node, &buffer);  	if (ACPI_SUCCESS (status)) { -		if (msg) { -			acpi_os_printf ("%s ", msg); +		if (message) { +			acpi_os_printf ("%s ", message);  		}  		acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); @@ -224,7 +240,7 @@ acpi_ns_valid_root_prefix (   *   * FUNCTION:    acpi_ns_valid_path_separator   * - * PARAMETERS:  Sep              - Character to be checked + * PARAMETERS:  Sep         - Character to be checked   *   * RETURN:      TRUE if a valid path separator   * @@ -232,7 +248,7 @@ acpi_ns_valid_root_prefix (   *   ******************************************************************************/ -u8 +static u8  acpi_ns_valid_path_separator (  	char                            sep)  { @@ -245,10 +261,12 @@ acpi_ns_valid_path_separator (   *   * FUNCTION:    acpi_ns_get_type   * - * PARAMETERS:  Handle              - Parent Node to be examined + * PARAMETERS:  Node        - Parent Node to be examined   *   * RETURN:      Type field from Node whose handle is passed   * + * DESCRIPTION: Return the type of a Namespace node + *   ******************************************************************************/  acpi_object_type @@ -271,11 +289,13 @@ acpi_ns_get_type (   *   * FUNCTION:    acpi_ns_local   * - * PARAMETERS:  Type            - A namespace object type + * PARAMETERS:  Type        - A namespace object type   *   * RETURN:      LOCAL if names must be found locally in objects of the   *              passed type, 0 if enclosing scopes should be searched   * + * DESCRIPTION: Returns scope rule for the given object type. + *   ******************************************************************************/  u32 @@ -303,7 +323,7 @@ acpi_ns_local (   * PARAMETERS:  Info            - Info struct initialized with the   *                                external name pointer.   * - * RETURN:      Status + * RETURN:      None   *   * DESCRIPTION: Calculate the length of the internal (AML) namestring   *              corresponding to the external (ASL) namestring. @@ -551,14 +571,16 @@ acpi_ns_internalize_name (   *   * FUNCTION:    acpi_ns_externalize_name   * - * PARAMETERS:  *internal_name         - Internal representation of name - *              **converted_name       - Where to return the resulting - *                                       external representation of name + * PARAMETERS:  internal_name_length - Lenth of the internal name below + *              internal_name       - Internal representation of name + *              converted_name_length - Where the length is returned + *              converted_name      - Where the resulting external name + *                                    is returned   *   * RETURN:      Status   *   * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) - *              to its external form (e.g. "\_PR_.CPU0") + *              to its external (printable) form (e.g. "\_PR_.CPU0")   *   ******************************************************************************/ @@ -717,8 +739,9 @@ acpi_ns_externalize_name (   *   * DESCRIPTION: Convert a namespace handle to a real Node   * - * Note: Real integer handles allow for more verification - *       and keep all pointers within this subsystem. + * Note: Real integer handles would allow for more verification + *       and keep all pointers within this subsystem - however this introduces + *       more (and perhaps unnecessary) overhead.   *   ******************************************************************************/ @@ -775,7 +798,7 @@ acpi_ns_convert_entry_to_handle (  	return ((acpi_handle) node); -/* --------------------------------------------------- +/* Example future implementation ---------------------  	if (!Node)  	{ @@ -801,12 +824,13 @@ acpi_ns_convert_entry_to_handle (   *   * RETURN:      none   * - * DESCRIPTION: free memory allocated for table storage. + * DESCRIPTION: free memory allocated for namespace and ACPI table storage.   *   ******************************************************************************/  void -acpi_ns_terminate (void) +acpi_ns_terminate ( +	void)  {  	union acpi_operand_object       *obj_desc; @@ -940,7 +964,6 @@ acpi_ns_get_node_by_path (  	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);  cleanup: -	/* Cleanup */  	if (internal_path) {  		ACPI_MEM_FREE (internal_path);  	} @@ -950,55 +973,6 @@ cleanup:  /*******************************************************************************   * - * FUNCTION:    acpi_ns_find_parent_name - * - * PARAMETERS:  *child_node            - Named Obj whose name is to be found - * - * RETURN:      The ACPI name - * - * DESCRIPTION: Search for the given obj in its parent scope and return the - *              name segment, or "????" if the parent name can't be found - *              (which "should not happen"). - * - ******************************************************************************/ -#ifdef ACPI_FUTURE_USAGE -acpi_name -acpi_ns_find_parent_name ( -	struct acpi_namespace_node      *child_node) -{ -	struct acpi_namespace_node      *parent_node; - - -	ACPI_FUNCTION_TRACE ("ns_find_parent_name"); - - -	if (child_node) { -		/* Valid entry.  Get the parent Node */ - -		parent_node = acpi_ns_get_parent_node (child_node); -		if (parent_node) { -			ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, -				"Parent of %p [%4.4s] is %p [%4.4s]\n", -				child_node, acpi_ut_get_node_name (child_node), -				parent_node, acpi_ut_get_node_name (parent_node))); - -			if (parent_node->name.integer) { -				return_VALUE ((acpi_name) parent_node->name.integer); -			} -		} - -		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, -			"Unable to find parent of %p (%4.4s)\n", -			child_node, acpi_ut_get_node_name (child_node))); -	} - -	return_VALUE (ACPI_UNKNOWN_NAME); -} -#endif - - -/******************************************************************************* - *   * FUNCTION:    acpi_ns_get_parent_node   *   * PARAMETERS:  Node       - Current table entry @@ -1009,7 +983,6 @@ acpi_ns_find_parent_name (   *   ******************************************************************************/ -  struct acpi_namespace_node *  acpi_ns_get_parent_node (  	struct acpi_namespace_node      *node) @@ -1030,7 +1003,6 @@ acpi_ns_get_parent_node (  		node = node->peer;  	} -  	return (node->peer);  } @@ -1049,7 +1021,6 @@ acpi_ns_get_parent_node (   *   ******************************************************************************/ -  struct acpi_namespace_node *  acpi_ns_get_next_valid_node (  	struct acpi_namespace_node      *node) @@ -1067,3 +1038,53 @@ acpi_ns_get_next_valid_node (  } +#ifdef ACPI_OBSOLETE_FUNCTIONS +/******************************************************************************* + * + * FUNCTION:    acpi_ns_find_parent_name + * + * PARAMETERS:  *child_node            - Named Obj whose name is to be found + * + * RETURN:      The ACPI name + * + * DESCRIPTION: Search for the given obj in its parent scope and return the + *              name segment, or "????" if the parent name can't be found + *              (which "should not happen"). + * + ******************************************************************************/ + +acpi_name +acpi_ns_find_parent_name ( +	struct acpi_namespace_node      *child_node) +{ +	struct acpi_namespace_node      *parent_node; + + +	ACPI_FUNCTION_TRACE ("ns_find_parent_name"); + + +	if (child_node) { +		/* Valid entry.  Get the parent Node */ + +		parent_node = acpi_ns_get_parent_node (child_node); +		if (parent_node) { +			ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, +				"Parent of %p [%4.4s] is %p [%4.4s]\n", +				child_node, acpi_ut_get_node_name (child_node), +				parent_node, acpi_ut_get_node_name (parent_node))); + +			if (parent_node->name.integer) { +				return_VALUE ((acpi_name) parent_node->name.integer); +			} +		} + +		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, +			"Unable to find parent of %p (%4.4s)\n", +			child_node, acpi_ut_get_node_name (child_node))); +	} + +	return_VALUE (ACPI_UNKNOWN_NAME); +} +#endif + + | 
