diff options
Diffstat (limited to 'drivers/acpi/acpica/nsxfname.c')
| -rw-r--r-- | drivers/acpi/acpica/nsxfname.c | 118 | 
1 files changed, 72 insertions, 46 deletions
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index b01e45a415e..8c6c11ce976 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c @@ -6,7 +6,7 @@   *****************************************************************************/  /* - * Copyright (C) 2000 - 2010, Intel Corp. + * Copyright (C) 2000 - 2014, Intel Corp.   * All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -42,6 +42,8 @@   * POSSIBILITY OF SUCH DAMAGES.   */ +#define EXPORT_ACPI_INTERFACES +  #include <acpi/acpi.h>  #include "accommon.h"  #include "acnamesp.h" @@ -52,24 +54,24 @@  ACPI_MODULE_NAME("nsxfname")  /* Local prototypes */ -static char *acpi_ns_copy_device_id(struct acpica_device_id *dest, -				    struct acpica_device_id *source, +static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, +				    struct acpi_pnp_device_id *source,  				    char *string_area);  /******************************************************************************   *   * FUNCTION:    acpi_get_handle   * - * PARAMETERS:  Parent          - Object to search under (search scope). - *              Pathname        - Pointer to an asciiz string containing the + * PARAMETERS:  parent          - Object to search under (search scope). + *              pathname        - Pointer to an asciiz string containing the   *                                name   *              ret_handle      - Where the return handle is returned   *   * RETURN:      Status   *   * DESCRIPTION: This routine will search for a caller specified name in the - *              name space.  The caller can restrict the search region by - *              specifying a non NULL parent.  The parent value is itself a + *              name space. The caller can restrict the search region by + *              specifying a non NULL parent. The parent value is itself a   *              namespace handle.   *   ******************************************************************************/ @@ -106,7 +108,7 @@ acpi_get_handle(acpi_handle parent,  	 *  	 * Error for <null Parent + relative path>  	 */ -	if (acpi_ns_valid_root_prefix(pathname[0])) { +	if (ACPI_IS_ROOT_PREFIX(pathname[0])) {  		/* Pathname is fully qualified (starts with '\') */ @@ -141,14 +143,14 @@ ACPI_EXPORT_SYMBOL(acpi_get_handle)   *   * FUNCTION:    acpi_get_name   * - * PARAMETERS:  Handle          - Handle to be converted to a pathname + * PARAMETERS:  handle          - Handle to be converted to a pathname   *              name_type       - Full pathname or single segment - *              Buffer          - Buffer for returned path + *              buffer          - Buffer for returned path   *   * RETURN:      Pointer to a string containing the fully qualified Name.   *   * DESCRIPTION: This routine returns the fully qualified name associated with - *              the Handle parameter.  This and the acpi_pathname_to_handle are + *              the Handle parameter. This and the acpi_pathname_to_handle are   *              complementary functions.   *   ******************************************************************************/ @@ -157,6 +159,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)  {  	acpi_status status;  	struct acpi_namespace_node *node; +	char *node_name;  	/* Parameter validation */ @@ -201,12 +204,12 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)  	/* Just copy the ACPI name from the Node and zero terminate it */ -	ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node), -		     ACPI_NAME_SIZE); +	node_name = acpi_ut_get_node_name(node); +	ACPI_MOVE_NAME(buffer->pointer, node_name);  	((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;  	status = AE_OK; -      unlock_and_exit: +unlock_and_exit:  	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);  	return (status); @@ -218,20 +221,21 @@ ACPI_EXPORT_SYMBOL(acpi_get_name)   *   * FUNCTION:    acpi_ns_copy_device_id   * - * PARAMETERS:  Dest                - Pointer to the destination DEVICE_ID - *              Source              - Pointer to the source DEVICE_ID + * PARAMETERS:  dest                - Pointer to the destination PNP_DEVICE_ID + *              source              - Pointer to the source PNP_DEVICE_ID   *              string_area         - Pointer to where to copy the dest string   *   * RETURN:      Pointer to the next string area   * - * DESCRIPTION: Copy a single DEVICE_ID, including the string data. + * DESCRIPTION: Copy a single PNP_DEVICE_ID, including the string data.   *   ******************************************************************************/ -static char *acpi_ns_copy_device_id(struct acpica_device_id *dest, -				    struct acpica_device_id *source, +static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, +				    struct acpi_pnp_device_id *source,  				    char *string_area)  { -	/* Create the destination DEVICE_ID */ + +	/* Create the destination PNP_DEVICE_ID */  	dest->string = string_area;  	dest->length = source->length; @@ -246,7 +250,7 @@ static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,   *   * FUNCTION:    acpi_get_object_info   * - * PARAMETERS:  Handle              - Object Handle + * PARAMETERS:  handle              - Object Handle   *              return_buffer       - Where the info is returned   *   * RETURN:      Status @@ -255,8 +259,8 @@ static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,   *              namespace node and possibly by running several standard   *              control methods (Such as in the case of a device.)   * - * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA, - * _ADR, _sx_w, and _sx_d methods. + * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, + * _STA, _ADR, _sx_w, and _sx_d methods.   *   * Note: Allocates the return buffer, must be freed by the caller.   * @@ -268,9 +272,10 @@ acpi_get_object_info(acpi_handle handle,  {  	struct acpi_namespace_node *node;  	struct acpi_device_info *info; -	struct acpica_device_id_list *cid_list = NULL; -	struct acpica_device_id *hid = NULL; -	struct acpica_device_id *uid = NULL; +	struct acpi_pnp_device_id_list *cid_list = NULL; +	struct acpi_pnp_device_id *hid = NULL; +	struct acpi_pnp_device_id *uid = NULL; +	struct acpi_pnp_device_id *sub = NULL;  	char *next_id_string;  	acpi_object_type type;  	acpi_name name; @@ -288,7 +293,7 @@ acpi_get_object_info(acpi_handle handle,  	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);  	if (ACPI_FAILURE(status)) { -		goto cleanup; +		return (status);  	}  	node = acpi_ns_validate_handle(handle); @@ -315,7 +320,7 @@ acpi_get_object_info(acpi_handle handle,  	if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {  		/*  		 * Get extra info for ACPI Device/Processor objects only: -		 * Run the Device _HID, _UID, and _CID methods. +		 * Run the Device _HID, _UID, _SUB, and _CID methods.  		 *  		 * Note: none of these methods are required, so they may or may  		 * not be present for this device. The Info->Valid bitfield is used @@ -338,6 +343,14 @@ acpi_get_object_info(acpi_handle handle,  			valid |= ACPI_VALID_UID;  		} +		/* Execute the Device._SUB method */ + +		status = acpi_ut_execute_SUB(node, &sub); +		if (ACPI_SUCCESS(status)) { +			info_size += sub->length; +			valid |= ACPI_VALID_SUB; +		} +  		/* Execute the Device._CID method */  		status = acpi_ut_execute_CID(node, &cid_list); @@ -347,7 +360,7 @@ acpi_get_object_info(acpi_handle handle,  			info_size +=  			    (cid_list->list_size - -			     sizeof(struct acpica_device_id_list)); +			     sizeof(struct acpi_pnp_device_id_list));  			valid |= ACPI_VALID_CID;  		}  	} @@ -369,9 +382,14 @@ acpi_get_object_info(acpi_handle handle,  		 * Get extra info for ACPI Device/Processor objects only:  		 * Run the _STA, _ADR and, sx_w, and _sx_d methods.  		 * -		 * Note: none of these methods are required, so they may or may +		 * Notes: none of these methods are required, so they may or may  		 * not be present for this device. The Info->Valid bitfield is used  		 * to indicate which methods were found and run successfully. +		 * +		 * For _STA, if the method does not exist, then (as per the ACPI +		 * specification), the returned current_status flags will indicate +		 * that the device is present/functional/enabled. Otherwise, the +		 * current_status flags reflect the value returned from _STA.  		 */  		/* Execute the Device._STA method */ @@ -417,16 +435,17 @@ acpi_get_object_info(acpi_handle handle,  	next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids);  	if (cid_list) { -		/* Point past the CID DEVICE_ID array */ +		/* Point past the CID PNP_DEVICE_ID array */  		next_id_string +=  		    ((acpi_size) cid_list->count * -		     sizeof(struct acpica_device_id)); +		     sizeof(struct acpi_pnp_device_id));  	}  	/* -	 * Copy the HID, UID, and CIDs to the return buffer. The variable-length -	 * strings are copied to the reserved area at the end of the buffer. +	 * Copy the HID, UID, SUB, and CIDs to the return buffer. +	 * The variable-length strings are copied to the reserved area +	 * at the end of the buffer.  	 *  	 * For HID and CID, check if the ID is a PCI Root Bridge.  	 */ @@ -444,6 +463,11 @@ acpi_get_object_info(acpi_handle handle,  							uid, next_id_string);  	} +	if (sub) { +		next_id_string = acpi_ns_copy_device_id(&info->subsystem_id, +							sub, next_id_string); +	} +  	if (cid_list) {  		info->compatible_id_list.count = cid_list->count;  		info->compatible_id_list.list_size = cid_list->list_size; @@ -473,13 +497,16 @@ acpi_get_object_info(acpi_handle handle,  	*return_buffer = info;  	status = AE_OK; -      cleanup: +cleanup:  	if (hid) {  		ACPI_FREE(hid);  	}  	if (uid) {  		ACPI_FREE(uid);  	} +	if (sub) { +		ACPI_FREE(sub); +	}  	if (cid_list) {  		ACPI_FREE(cid_list);  	} @@ -492,7 +519,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_object_info)   *   * FUNCTION:    acpi_install_method   * - * PARAMETERS:  Buffer         - An ACPI table containing one control method + * PARAMETERS:  buffer         - An ACPI table containing one control method   *   * RETURN:      Status   * @@ -520,14 +547,14 @@ acpi_status acpi_install_method(u8 *buffer)  	/* Parameter validation */  	if (!buffer) { -		return AE_BAD_PARAMETER; +		return (AE_BAD_PARAMETER);  	}  	/* Table must be a DSDT or SSDT */  	if (!ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) &&  	    !ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) { -		return AE_BAD_HEADER; +		return (AE_BAD_HEADER);  	}  	/* First AML opcode in the table must be a control method */ @@ -535,7 +562,7 @@ acpi_status acpi_install_method(u8 *buffer)  	parser_state.aml = buffer + sizeof(struct acpi_table_header);  	opcode = acpi_ps_peek_opcode(&parser_state);  	if (opcode != AML_METHOD_OP) { -		return AE_BAD_PARAMETER; +		return (AE_BAD_PARAMETER);  	}  	/* Extract method information from the raw AML */ @@ -553,13 +580,13 @@ acpi_status acpi_install_method(u8 *buffer)  	 */  	aml_buffer = ACPI_ALLOCATE(aml_length);  	if (!aml_buffer) { -		return AE_NO_MEMORY; +		return (AE_NO_MEMORY);  	}  	method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);  	if (!method_obj) {  		ACPI_FREE(aml_buffer); -		return AE_NO_MEMORY; +		return (AE_NO_MEMORY);  	}  	/* Lock namespace for acpi_ns_lookup, we may be creating a new node */ @@ -603,10 +630,9 @@ acpi_status acpi_install_method(u8 *buffer)  	method_obj->method.param_count = (u8)  	    (method_flags & AML_METHOD_ARG_COUNT); -	method_obj->method.method_flags = (u8) -	    (method_flags & ~AML_METHOD_ARG_COUNT); -  	if (method_flags & AML_METHOD_SERIALIZED) { +		method_obj->method.info_flags = ACPI_METHOD_SERIALIZED; +  		method_obj->method.sync_level = (u8)  		    ((method_flags & AML_METHOD_SYNC_LEVEL) >> 4);  	} @@ -626,12 +652,12 @@ acpi_status acpi_install_method(u8 *buffer)  	/* Remove local reference to the method object */  	acpi_ut_remove_reference(method_obj); -	return status; +	return (status);  error_exit:  	ACPI_FREE(aml_buffer);  	ACPI_FREE(method_obj); -	return status; +	return (status);  }  ACPI_EXPORT_SYMBOL(acpi_install_method)  | 
