| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** | 
 | 2 |  * | 
 | 3 |  * Module Name: nsxfname - Public interfaces to the ACPI subsystem | 
 | 4 |  *                         ACPI Namespace oriented interfaces | 
 | 5 |  * | 
 | 6 |  *****************************************************************************/ | 
 | 7 |  | 
 | 8 | /* | 
| Len Brown | 75a44ce | 2008-04-23 23:00:13 -0400 | [diff] [blame] | 9 |  * Copyright (C) 2000 - 2008, Intel Corp. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 |  * All rights reserved. | 
 | 11 |  * | 
 | 12 |  * Redistribution and use in source and binary forms, with or without | 
 | 13 |  * modification, are permitted provided that the following conditions | 
 | 14 |  * are met: | 
 | 15 |  * 1. Redistributions of source code must retain the above copyright | 
 | 16 |  *    notice, this list of conditions, and the following disclaimer, | 
 | 17 |  *    without modification. | 
 | 18 |  * 2. Redistributions in binary form must reproduce at minimum a disclaimer | 
 | 19 |  *    substantially similar to the "NO WARRANTY" disclaimer below | 
 | 20 |  *    ("Disclaimer") and any redistribution must be conditioned upon | 
 | 21 |  *    including a substantially similar Disclaimer requirement for further | 
 | 22 |  *    binary redistribution. | 
 | 23 |  * 3. Neither the names of the above-listed copyright holders nor the names | 
 | 24 |  *    of any contributors may be used to endorse or promote products derived | 
 | 25 |  *    from this software without specific prior written permission. | 
 | 26 |  * | 
 | 27 |  * Alternatively, this software may be distributed under the terms of the | 
 | 28 |  * GNU General Public License ("GPL") version 2 as published by the Free | 
 | 29 |  * Software Foundation. | 
 | 30 |  * | 
 | 31 |  * NO WARRANTY | 
 | 32 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
 | 33 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
 | 34 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | 
 | 35 |  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
 | 36 |  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 
 | 37 |  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 
 | 38 |  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 
 | 39 |  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 
 | 40 |  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 
 | 41 |  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 
 | 42 |  * POSSIBILITY OF SUCH DAMAGES. | 
 | 43 |  */ | 
 | 44 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #include <acpi/acpi.h> | 
 | 46 | #include <acpi/acnamesp.h> | 
 | 47 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | #define _COMPONENT          ACPI_NAMESPACE | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 49 | ACPI_MODULE_NAME("nsxfname") | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 |  | 
 | 51 | /****************************************************************************** | 
 | 52 |  * | 
 | 53 |  * FUNCTION:    acpi_get_handle | 
 | 54 |  * | 
 | 55 |  * PARAMETERS:  Parent          - Object to search under (search scope). | 
| Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 56 |  *              Pathname        - Pointer to an asciiz string containing the | 
 | 57 |  *                                name | 
 | 58 |  *              ret_handle      - Where the return handle is returned | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 |  * | 
 | 60 |  * RETURN:      Status | 
 | 61 |  * | 
 | 62 |  * DESCRIPTION: This routine will search for a caller specified name in the | 
 | 63 |  *              name space.  The caller can restrict the search region by | 
 | 64 |  *              specifying a non NULL parent.  The parent value is itself a | 
 | 65 |  *              namespace handle. | 
 | 66 |  * | 
 | 67 |  ******************************************************************************/ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | acpi_status | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 69 | acpi_get_handle(acpi_handle parent, | 
 | 70 | 		acpi_string pathname, acpi_handle * ret_handle) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 72 | 	acpi_status status; | 
 | 73 | 	struct acpi_namespace_node *node = NULL; | 
 | 74 | 	struct acpi_namespace_node *prefix_node = NULL; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 76 | 	ACPI_FUNCTION_ENTRY(); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 |  | 
 | 78 | 	/* Parameter Validation */ | 
 | 79 |  | 
 | 80 | 	if (!ret_handle || !pathname) { | 
 | 81 | 		return (AE_BAD_PARAMETER); | 
 | 82 | 	} | 
 | 83 |  | 
 | 84 | 	/* Convert a parent handle to a prefix node */ | 
 | 85 |  | 
 | 86 | 	if (parent) { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 87 | 		prefix_node = acpi_ns_map_handle_to_node(parent); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | 		if (!prefix_node) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | 			return (AE_BAD_PARAMETER); | 
 | 90 | 		} | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | 	} | 
 | 92 |  | 
 | 93 | 	/* | 
| Bob Moore | f1c2b1d | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 94 | 	 * Valid cases are: | 
 | 95 | 	 * 1) Fully qualified pathname | 
 | 96 | 	 * 2) Parent + Relative pathname | 
 | 97 | 	 * | 
 | 98 | 	 * Error for <null Parent + relative path> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | 	 */ | 
| Bob Moore | f1c2b1d | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 100 | 	if (acpi_ns_valid_root_prefix(pathname[0])) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 |  | 
| Bob Moore | f1c2b1d | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 102 | 		/* Pathname is fully qualified (starts with '\') */ | 
 | 103 |  | 
 | 104 | 		/* Special case for root-only, since we can't search for it */ | 
 | 105 |  | 
 | 106 | 		if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) { | 
 | 107 | 			*ret_handle = | 
 | 108 | 			    acpi_ns_convert_entry_to_handle(acpi_gbl_root_node); | 
 | 109 | 			return (AE_OK); | 
 | 110 | 		} | 
 | 111 | 	} else if (!prefix_node) { | 
 | 112 |  | 
 | 113 | 		/* Relative path with null prefix is disallowed */ | 
 | 114 |  | 
 | 115 | 		return (AE_BAD_PARAMETER); | 
 | 116 | 	} | 
 | 117 |  | 
 | 118 | 	/* Find the Node and convert to a handle */ | 
 | 119 |  | 
 | 120 | 	status = | 
 | 121 | 	    acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, &node); | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 122 | 	if (ACPI_SUCCESS(status)) { | 
 | 123 | 		*ret_handle = acpi_ns_convert_entry_to_handle(node); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | 	} | 
 | 125 |  | 
 | 126 | 	return (status); | 
 | 127 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 |  | 
| Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 129 | ACPI_EXPORT_SYMBOL(acpi_get_handle) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 |  | 
 | 131 | /****************************************************************************** | 
 | 132 |  * | 
 | 133 |  * FUNCTION:    acpi_get_name | 
 | 134 |  * | 
 | 135 |  * PARAMETERS:  Handle          - Handle to be converted to a pathname | 
 | 136 |  *              name_type       - Full pathname or single segment | 
 | 137 |  *              Buffer          - Buffer for returned path | 
 | 138 |  * | 
 | 139 |  * RETURN:      Pointer to a string containing the fully qualified Name. | 
 | 140 |  * | 
 | 141 |  * DESCRIPTION: This routine returns the fully qualified name associated with | 
 | 142 |  *              the Handle parameter.  This and the acpi_pathname_to_handle are | 
 | 143 |  *              complementary functions. | 
 | 144 |  * | 
 | 145 |  ******************************************************************************/ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | acpi_status | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 147 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 149 | 	acpi_status status; | 
 | 150 | 	struct acpi_namespace_node *node; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 |  | 
 | 152 | 	/* Parameter validation */ | 
 | 153 |  | 
 | 154 | 	if (name_type > ACPI_NAME_TYPE_MAX) { | 
 | 155 | 		return (AE_BAD_PARAMETER); | 
 | 156 | 	} | 
 | 157 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 158 | 	status = acpi_ut_validate_buffer(buffer); | 
 | 159 | 	if (ACPI_FAILURE(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | 		return (status); | 
 | 161 | 	} | 
 | 162 |  | 
 | 163 | 	if (name_type == ACPI_FULL_PATHNAME) { | 
| Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 164 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | 		/* Get the full pathname (From the namespace root) */ | 
 | 166 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 167 | 		status = acpi_ns_handle_to_pathname(handle, buffer); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | 		return (status); | 
 | 169 | 	} | 
 | 170 |  | 
 | 171 | 	/* | 
 | 172 | 	 * Wants the single segment ACPI name. | 
 | 173 | 	 * Validate handle and convert to a namespace Node | 
 | 174 | 	 */ | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 175 | 	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 
 | 176 | 	if (ACPI_FAILURE(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | 		return (status); | 
 | 178 | 	} | 
 | 179 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 180 | 	node = acpi_ns_map_handle_to_node(handle); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | 	if (!node) { | 
 | 182 | 		status = AE_BAD_PARAMETER; | 
 | 183 | 		goto unlock_and_exit; | 
 | 184 | 	} | 
 | 185 |  | 
 | 186 | 	/* Validate/Allocate/Clear caller buffer */ | 
 | 187 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 188 | 	status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH); | 
 | 189 | 	if (ACPI_FAILURE(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | 		goto unlock_and_exit; | 
 | 191 | 	} | 
 | 192 |  | 
 | 193 | 	/* Just copy the ACPI name from the Node and zero terminate it */ | 
 | 194 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 195 | 	ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node), | 
 | 196 | 		     ACPI_NAME_SIZE); | 
 | 197 | 	((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | 	status = AE_OK; | 
 | 199 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 200 |       unlock_and_exit: | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 202 | 	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | 	return (status); | 
 | 204 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 |  | 
| Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 206 | ACPI_EXPORT_SYMBOL(acpi_get_name) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 |  | 
 | 208 | /****************************************************************************** | 
 | 209 |  * | 
 | 210 |  * FUNCTION:    acpi_get_object_info | 
 | 211 |  * | 
 | 212 |  * PARAMETERS:  Handle          - Object Handle | 
| Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 213 |  *              Buffer          - Where the info is returned | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 |  * | 
 | 215 |  * RETURN:      Status | 
 | 216 |  * | 
 | 217 |  * DESCRIPTION: Returns information about an object as gleaned from the | 
 | 218 |  *              namespace node and possibly by running several standard | 
 | 219 |  *              control methods (Such as in the case of a device.) | 
 | 220 |  * | 
 | 221 |  ******************************************************************************/ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | acpi_status | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 223 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 225 | 	acpi_status status; | 
 | 226 | 	struct acpi_namespace_node *node; | 
 | 227 | 	struct acpi_device_info *info; | 
 | 228 | 	struct acpi_device_info *return_info; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | 	struct acpi_compatible_id_list *cid_list = NULL; | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 230 | 	acpi_size size; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 |  | 
 | 232 | 	/* Parameter validation */ | 
 | 233 |  | 
 | 234 | 	if (!handle || !buffer) { | 
 | 235 | 		return (AE_BAD_PARAMETER); | 
 | 236 | 	} | 
 | 237 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 238 | 	status = acpi_ut_validate_buffer(buffer); | 
 | 239 | 	if (ACPI_FAILURE(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | 		return (status); | 
 | 241 | 	} | 
 | 242 |  | 
| Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 243 | 	info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info)); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | 	if (!info) { | 
 | 245 | 		return (AE_NO_MEMORY); | 
 | 246 | 	} | 
 | 247 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 248 | 	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 
 | 249 | 	if (ACPI_FAILURE(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | 		goto cleanup; | 
 | 251 | 	} | 
 | 252 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 253 | 	node = acpi_ns_map_handle_to_node(handle); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | 	if (!node) { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 255 | 		(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 
| Fiodor Suietov | 237a927 | 2008-07-04 10:18:34 +0800 | [diff] [blame] | 256 | 		status = AE_BAD_PARAMETER; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | 		goto cleanup; | 
 | 258 | 	} | 
 | 259 |  | 
 | 260 | 	/* Init return structure */ | 
 | 261 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 262 | 	size = sizeof(struct acpi_device_info); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 264 | 	info->type = node->type; | 
 | 265 | 	info->name = node->name.integer; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | 	info->valid = 0; | 
 | 267 |  | 
| Bob Moore | 0a1fbf2 | 2008-07-04 10:53:58 +0800 | [diff] [blame] | 268 | 	if (node->type == ACPI_TYPE_METHOD) { | 
 | 269 | 		info->param_count = node->object->method.param_count; | 
 | 270 | 	} | 
 | 271 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 272 | 	status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 
 | 273 | 	if (ACPI_FAILURE(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | 		goto cleanup; | 
 | 275 | 	} | 
 | 276 |  | 
 | 277 | 	/* If not a device, we are all done */ | 
 | 278 |  | 
 | 279 | 	if (info->type == ACPI_TYPE_DEVICE) { | 
 | 280 | 		/* | 
 | 281 | 		 * Get extra info for ACPI Devices objects only: | 
 | 282 | 		 * Run the Device _HID, _UID, _CID, _STA, _ADR and _sx_d methods. | 
 | 283 | 		 * | 
 | 284 | 		 * Note: none of these methods are required, so they may or may | 
 | 285 | 		 * not be present for this device.  The Info->Valid bitfield is used | 
 | 286 | 		 * to indicate which methods were found and ran successfully. | 
 | 287 | 		 */ | 
 | 288 |  | 
 | 289 | 		/* Execute the Device._HID method */ | 
 | 290 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 291 | 		status = acpi_ut_execute_HID(node, &info->hardware_id); | 
 | 292 | 		if (ACPI_SUCCESS(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | 			info->valid |= ACPI_VALID_HID; | 
 | 294 | 		} | 
 | 295 |  | 
 | 296 | 		/* Execute the Device._UID method */ | 
 | 297 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 298 | 		status = acpi_ut_execute_UID(node, &info->unique_id); | 
 | 299 | 		if (ACPI_SUCCESS(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | 			info->valid |= ACPI_VALID_UID; | 
 | 301 | 		} | 
 | 302 |  | 
 | 303 | 		/* Execute the Device._CID method */ | 
 | 304 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 305 | 		status = acpi_ut_execute_CID(node, &cid_list); | 
 | 306 | 		if (ACPI_SUCCESS(status)) { | 
| Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 307 | 			size += cid_list->size; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | 			info->valid |= ACPI_VALID_CID; | 
 | 309 | 		} | 
 | 310 |  | 
 | 311 | 		/* Execute the Device._STA method */ | 
 | 312 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 313 | 		status = acpi_ut_execute_STA(node, &info->current_status); | 
 | 314 | 		if (ACPI_SUCCESS(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | 			info->valid |= ACPI_VALID_STA; | 
 | 316 | 		} | 
 | 317 |  | 
 | 318 | 		/* Execute the Device._ADR method */ | 
 | 319 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 320 | 		status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node, | 
 | 321 | 							 &info->address); | 
 | 322 | 		if (ACPI_SUCCESS(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | 			info->valid |= ACPI_VALID_ADR; | 
 | 324 | 		} | 
 | 325 |  | 
 | 326 | 		/* Execute the Device._sx_d methods */ | 
 | 327 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 328 | 		status = acpi_ut_execute_sxds(node, info->highest_dstates); | 
 | 329 | 		if (ACPI_SUCCESS(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | 			info->valid |= ACPI_VALID_SXDS; | 
 | 331 | 		} | 
 | 332 | 	} | 
 | 333 |  | 
 | 334 | 	/* Validate/Allocate/Clear caller buffer */ | 
 | 335 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 336 | 	status = acpi_ut_initialize_buffer(buffer, size); | 
 | 337 | 	if (ACPI_FAILURE(status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | 		goto cleanup; | 
 | 339 | 	} | 
 | 340 |  | 
 | 341 | 	/* Populate the return buffer */ | 
 | 342 |  | 
 | 343 | 	return_info = buffer->pointer; | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 344 | 	ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info)); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 |  | 
 | 346 | 	if (cid_list) { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 347 | 		ACPI_MEMCPY(&return_info->compatibility_id, cid_list, | 
 | 348 | 			    cid_list->size); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | 	} | 
 | 350 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 351 |       cleanup: | 
| Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 352 | 	ACPI_FREE(info); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | 	if (cid_list) { | 
| Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 354 | 		ACPI_FREE(cid_list); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | 	} | 
 | 356 | 	return (status); | 
 | 357 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 |  | 
| Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 359 | ACPI_EXPORT_SYMBOL(acpi_get_object_info) |