1 /*******************************************************************************
3 * Module Name: nsxfeval - Public interfaces to the ACPI subsystem
4 * ACPI Object evaluation interfaces
6 ******************************************************************************/
9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
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.
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.
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.
45 #define EXPORT_ACPI_INTERFACES
47 #include <acpi/acpi.h>
52 #define _COMPONENT ACPI_NAMESPACE
53 ACPI_MODULE_NAME("nsxfeval")
55 /* Local prototypes */
56 static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);
58 /*******************************************************************************
60 * FUNCTION: acpi_evaluate_object_typed
62 * PARAMETERS: handle - Object handle (optional)
63 * pathname - Object pathname (optional)
64 * external_params - List of parameters to pass to method,
65 * terminated by NULL. May be NULL
66 * if no parameters are being passed.
67 * return_buffer - Where to put method's return value (if
68 * any). If NULL, no value is returned.
69 * return_type - Expected type of return object
73 * DESCRIPTION: Find and evaluate the given object, passing the given
74 * parameters if necessary. One of "Handle" or "Pathname" must
77 ******************************************************************************/
80 acpi_evaluate_object_typed(acpi_handle handle,
82 struct acpi_object_list *external_params,
83 struct acpi_buffer *return_buffer,
84 acpi_object_type return_type)
89 ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed);
91 /* Return buffer must be valid */
94 return_ACPI_STATUS(AE_BAD_PARAMETER);
97 if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
101 /* Evaluate the object */
104 acpi_evaluate_object(handle, pathname, external_params,
106 if (ACPI_FAILURE(status)) {
107 return_ACPI_STATUS(status);
110 /* Type ANY means "don't care" */
112 if (return_type == ACPI_TYPE_ANY) {
113 return_ACPI_STATUS(AE_OK);
116 if (return_buffer->length == 0) {
118 /* Error because caller specifically asked for a return value */
120 ACPI_ERROR((AE_INFO, "No return value"));
121 return_ACPI_STATUS(AE_NULL_OBJECT);
124 /* Examine the object type returned from evaluate_object */
126 if (((union acpi_object *)return_buffer->pointer)->type == return_type) {
127 return_ACPI_STATUS(AE_OK);
130 /* Return object type does not match requested type */
133 "Incorrect return type [%s] requested [%s]",
134 acpi_ut_get_type_name(((union acpi_object *)return_buffer->
136 acpi_ut_get_type_name(return_type)));
140 /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
142 ACPI_FREE_BUFFER(*return_buffer);
143 return_buffer->pointer = NULL;
146 return_buffer->length = 0;
147 return_ACPI_STATUS(AE_TYPE);
150 ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed)
152 /*******************************************************************************
154 * FUNCTION: acpi_evaluate_object
156 * PARAMETERS: handle - Object handle (optional)
157 * pathname - Object pathname (optional)
158 * external_params - List of parameters to pass to method,
159 * terminated by NULL. May be NULL
160 * if no parameters are being passed.
161 * return_buffer - Where to put method's return value (if
162 * any). If NULL, no value is returned.
166 * DESCRIPTION: Find and evaluate the given object, passing the given
167 * parameters if necessary. One of "Handle" or "Pathname" must
168 * be valid (non-null)
170 ******************************************************************************/
172 acpi_evaluate_object(acpi_handle handle,
173 acpi_string pathname,
174 struct acpi_object_list *external_params,
175 struct acpi_buffer *return_buffer)
178 struct acpi_evaluate_info *info;
179 acpi_size buffer_space_needed;
182 ACPI_FUNCTION_TRACE(acpi_evaluate_object);
184 /* Allocate and initialize the evaluation information block */
186 info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
188 return_ACPI_STATUS(AE_NO_MEMORY);
191 /* Convert and validate the device handle */
193 info->prefix_node = acpi_ns_validate_handle(handle);
194 if (!info->prefix_node) {
195 status = AE_BAD_PARAMETER;
200 * Get the actual namespace node for the target object.
201 * Handles these cases:
203 * 1) Null node, valid pathname from root (absolute path)
204 * 2) Node and valid pathname (path relative to Node)
205 * 3) Node, Null pathname
207 if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) {
209 /* The path is fully qualified, just evaluate by name */
211 info->prefix_node = NULL;
212 } else if (!handle) {
214 * A handle is optional iff a fully qualified pathname is specified.
215 * Since we've already handled fully qualified names above, this is
219 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
220 "Both Handle and Pathname are NULL"));
222 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
223 "Null Handle with relative pathname [%s]",
227 status = AE_BAD_PARAMETER;
231 info->relative_pathname = pathname;
234 * Convert all external objects passed as arguments to the
235 * internal version(s).
237 if (external_params && external_params->count) {
238 info->param_count = (u16)external_params->count;
240 /* Warn on impossible argument count */
242 if (info->param_count > ACPI_METHOD_NUM_ARGS) {
243 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
245 "Excess arguments (%u) - using only %u",
247 ACPI_METHOD_NUM_ARGS));
249 info->param_count = ACPI_METHOD_NUM_ARGS;
253 * Allocate a new parameter block for the internal objects
254 * Add 1 to count to allow for null terminated internal list
256 info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) info->
258 1) * sizeof(void *));
259 if (!info->parameters) {
260 status = AE_NO_MEMORY;
264 /* Convert each external object in the list to an internal object */
266 for (i = 0; i < info->param_count; i++) {
268 acpi_ut_copy_eobject_to_iobject(&external_params->
272 if (ACPI_FAILURE(status)) {
277 info->parameters[info->param_count] = NULL;
283 * Begin incoming argument count analysis. Check for too few args
287 switch (acpi_ns_get_type(info->node)) {
288 case ACPI_TYPE_METHOD:
290 /* Check incoming argument count against the method definition */
292 if (info->obj_desc->method.param_count > info->param_count) {
294 "Insufficient arguments (%u) - %u are required",
296 info->obj_desc->method.param_count));
298 status = AE_MISSING_ARGUMENTS;
302 else if (info->obj_desc->method.param_count < info->param_count) {
303 ACPI_WARNING((AE_INFO,
304 "Excess arguments (%u) - only %u are required",
306 info->obj_desc->method.param_count));
308 /* Just pass the required number of arguments */
310 info->param_count = info->obj_desc->method.param_count;
314 * Any incoming external objects to be passed as arguments to the
315 * method must be converted to internal objects
317 if (info->param_count) {
319 * Allocate a new parameter block for the internal objects
320 * Add 1 to count to allow for null terminated internal list
322 info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size)
327 if (!info->parameters) {
328 status = AE_NO_MEMORY;
332 /* Convert each external object in the list to an internal object */
334 for (i = 0; i < info->param_count; i++) {
336 acpi_ut_copy_eobject_to_iobject
337 (&external_params->pointer[i],
338 &info->parameters[i]);
339 if (ACPI_FAILURE(status)) {
344 info->parameters[info->param_count] = NULL;
350 /* Warn if arguments passed to an object that is not a method */
352 if (info->param_count) {
353 ACPI_WARNING((AE_INFO,
354 "%u arguments were passed to a non-method ACPI object",
362 /* Now we can evaluate the object */
364 status = acpi_ns_evaluate(info);
367 * If we are expecting a return value, and all went well above,
368 * copy the return value to an external object.
371 if (!info->return_object) {
372 return_buffer->length = 0;
374 if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) ==
375 ACPI_DESC_TYPE_NAMED) {
377 * If we received a NS Node as a return object, this means that
378 * the object we are evaluating has nothing interesting to
379 * return (such as a mutex, etc.) We return an error because
380 * these types are essentially unsupported by this interface.
381 * We don't check up front because this makes it easier to add
382 * support for various types at a later date if necessary.
385 info->return_object = NULL; /* No need to delete a NS Node */
386 return_buffer->length = 0;
389 if (ACPI_SUCCESS(status)) {
391 /* Dereference Index and ref_of references */
393 acpi_ns_resolve_references(info);
395 /* Get the size of the returned object */
398 acpi_ut_get_object_size(info->return_object,
399 &buffer_space_needed);
400 if (ACPI_SUCCESS(status)) {
402 /* Validate/Allocate/Clear caller buffer */
405 acpi_ut_initialize_buffer
407 buffer_space_needed);
408 if (ACPI_FAILURE(status)) {
410 * Caller's buffer is too small or a new one can't
413 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
414 "Needed buffer size %X, %s\n",
417 acpi_format_exception
420 /* We have enough space for the object, build it */
423 acpi_ut_copy_iobject_to_eobject
424 (info->return_object,
432 if (info->return_object) {
434 * Delete the internal return object. NOTE: Interpreter must be
435 * locked to avoid race condition.
437 acpi_ex_enter_interpreter();
439 /* Remove one reference on the return object (should delete it) */
441 acpi_ut_remove_reference(info->return_object);
442 acpi_ex_exit_interpreter();
447 /* Free the input parameter list (if we created one) */
449 if (info->parameters) {
451 /* Free the allocated parameter block */
453 acpi_ut_delete_internal_object_list(info->parameters);
457 return_ACPI_STATUS(status);
460 ACPI_EXPORT_SYMBOL(acpi_evaluate_object)
462 /*******************************************************************************
464 * FUNCTION: acpi_ns_resolve_references
466 * PARAMETERS: info - Evaluation info block
468 * RETURN: Info->return_object is replaced with the dereferenced object
470 * DESCRIPTION: Dereference certain reference objects. Called before an
471 * internal return object is converted to an external union acpi_object.
473 * Performs an automatic dereference of Index and ref_of reference objects.
474 * These reference objects are not supported by the union acpi_object, so this is a
475 * last resort effort to return something useful. Also, provides compatibility
476 * with other ACPI implementations.
478 * NOTE: does not handle references within returned package objects or nested
479 * references, but this support could be added later if found to be necessary.
481 ******************************************************************************/
482 static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
484 union acpi_operand_object *obj_desc = NULL;
485 struct acpi_namespace_node *node;
487 /* We are interested in reference objects only */
489 if ((info->return_object)->common.type != ACPI_TYPE_LOCAL_REFERENCE) {
494 * Two types of references are supported - those created by Index and
495 * ref_of operators. A name reference (AML_NAMEPATH_OP) can be converted
496 * to an union acpi_object, so it is not dereferenced here. A ddb_handle
497 * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
498 * an union acpi_object.
500 switch (info->return_object->reference.class) {
501 case ACPI_REFCLASS_INDEX:
503 obj_desc = *(info->return_object->reference.where);
506 case ACPI_REFCLASS_REFOF:
508 node = info->return_object->reference.object;
510 obj_desc = node->object;
519 /* Replace the existing reference object */
522 acpi_ut_add_reference(obj_desc);
523 acpi_ut_remove_reference(info->return_object);
524 info->return_object = obj_desc;
530 /*******************************************************************************
532 * FUNCTION: acpi_walk_namespace
534 * PARAMETERS: type - acpi_object_type to search for
535 * start_object - Handle in namespace where search begins
536 * max_depth - Depth to which search is to reach
537 * descending_callback - Called during tree descent
538 * when an object of "Type" is found
539 * ascending_callback - Called during tree ascent
540 * when an object of "Type" is found
541 * context - Passed to user function(s) above
542 * return_value - Location where return value of
543 * user_function is put if terminated early
545 * RETURNS Return value from the user_function if terminated early.
546 * Otherwise, returns NULL.
548 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
549 * starting (and ending) at the object specified by start_handle.
550 * The callback function is called whenever an object that matches
551 * the type parameter is found. If the callback function returns
552 * a non-zero value, the search is terminated immediately and this
553 * value is returned to the caller.
555 * The point of this procedure is to provide a generic namespace
556 * walk routine that can be called from multiple places to
557 * provide multiple services; the callback function(s) can be
558 * tailored to each task, whether it is a print function,
559 * a compare function, etc.
561 ******************************************************************************/
564 acpi_walk_namespace(acpi_object_type type,
565 acpi_handle start_object,
567 acpi_walk_callback descending_callback,
568 acpi_walk_callback ascending_callback,
569 void *context, void **return_value)
573 ACPI_FUNCTION_TRACE(acpi_walk_namespace);
575 /* Parameter validation */
577 if ((type > ACPI_TYPE_LOCAL_MAX) ||
578 (!max_depth) || (!descending_callback && !ascending_callback)) {
579 return_ACPI_STATUS(AE_BAD_PARAMETER);
583 * Need to acquire the namespace reader lock to prevent interference
584 * with any concurrent table unloads (which causes the deletion of
585 * namespace objects). We cannot allow the deletion of a namespace node
586 * while the user function is using it. The exception to this are the
587 * nodes created and deleted during control method execution -- these
588 * nodes are marked as temporary nodes and are ignored by the namespace
589 * walk. Thus, control methods can be executed while holding the
590 * namespace deletion lock (and the user function can execute control
593 status = acpi_ut_acquire_read_lock(&acpi_gbl_namespace_rw_lock);
594 if (ACPI_FAILURE(status)) {
595 return_ACPI_STATUS(status);
599 * Lock the namespace around the walk. The namespace will be
600 * unlocked/locked around each call to the user function - since the user
601 * function must be allowed to make ACPICA calls itself (for example, it
602 * will typically execute control methods during device enumeration.)
604 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
605 if (ACPI_FAILURE(status)) {
606 goto unlock_and_exit;
609 /* Now we can validate the starting node */
611 if (!acpi_ns_validate_handle(start_object)) {
612 status = AE_BAD_PARAMETER;
613 goto unlock_and_exit2;
616 status = acpi_ns_walk_namespace(type, start_object, max_depth,
618 descending_callback, ascending_callback,
619 context, return_value);
622 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
625 (void)acpi_ut_release_read_lock(&acpi_gbl_namespace_rw_lock);
626 return_ACPI_STATUS(status);
629 ACPI_EXPORT_SYMBOL(acpi_walk_namespace)
631 /*******************************************************************************
633 * FUNCTION: acpi_ns_get_device_callback
635 * PARAMETERS: Callback from acpi_get_device
639 * DESCRIPTION: Takes callbacks from walk_namespace and filters out all non-
640 * present devices, or if they specified a HID, it filters based
643 ******************************************************************************/
645 acpi_ns_get_device_callback(acpi_handle obj_handle,
647 void *context, void **return_value)
649 struct acpi_get_devices_info *info = context;
651 struct acpi_namespace_node *node;
653 struct acpi_pnp_device_id *hid;
654 struct acpi_pnp_device_id_list *cid;
659 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
660 if (ACPI_FAILURE(status)) {
664 node = acpi_ns_validate_handle(obj_handle);
665 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
666 if (ACPI_FAILURE(status)) {
671 return (AE_BAD_PARAMETER);
675 * First, filter based on the device HID and CID.
677 * 01/2010: For this case where a specific HID is requested, we don't
678 * want to run _STA until we have an actual HID match. Thus, we will
679 * not unnecessarily execute _STA on devices for which the caller
680 * doesn't care about. Previously, _STA was executed unconditionally
681 * on all devices found here.
683 * A side-effect of this change is that now we will continue to search
684 * for a matching HID even under device trees where the parent device
685 * would have returned a _STA that indicates it is not present or
686 * not functioning (thus aborting the search on that branch).
688 if (info->hid != NULL) {
689 status = acpi_ut_execute_HID(node, &hid);
690 if (status == AE_NOT_FOUND) {
692 } else if (ACPI_FAILURE(status)) {
693 return (AE_CTRL_DEPTH);
696 no_match = ACPI_STRCMP(hid->string, info->hid);
701 * HID does not match, attempt match within the
702 * list of Compatible IDs (CIDs)
704 status = acpi_ut_execute_CID(node, &cid);
705 if (status == AE_NOT_FOUND) {
707 } else if (ACPI_FAILURE(status)) {
708 return (AE_CTRL_DEPTH);
711 /* Walk the CID list */
714 for (i = 0; i < cid->count; i++) {
715 if (ACPI_STRCMP(cid->ids[i].string, info->hid)
718 /* Found a matching CID */
732 /* Run _STA to determine if device is present */
734 status = acpi_ut_execute_STA(node, &flags);
735 if (ACPI_FAILURE(status)) {
736 return (AE_CTRL_DEPTH);
739 if (!(flags & ACPI_STA_DEVICE_PRESENT) &&
740 !(flags & ACPI_STA_DEVICE_FUNCTIONING)) {
742 * Don't examine the children of the device only when the
743 * device is neither present nor functional. See ACPI spec,
744 * description of _STA for more information.
746 return (AE_CTRL_DEPTH);
749 /* We have a valid device, invoke the user function */
751 status = info->user_function(obj_handle, nesting_level, info->context,
756 /*******************************************************************************
758 * FUNCTION: acpi_get_devices
760 * PARAMETERS: HID - HID to search for. Can be NULL.
761 * user_function - Called when a matching object is found
762 * context - Passed to user function
763 * return_value - Location where return value of
764 * user_function is put if terminated early
766 * RETURNS Return value from the user_function if terminated early.
767 * Otherwise, returns NULL.
769 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
770 * starting (and ending) at the object specified by start_handle.
771 * The user_function is called whenever an object of type
772 * Device is found. If the user function returns
773 * a non-zero value, the search is terminated immediately and this
774 * value is returned to the caller.
776 * This is a wrapper for walk_namespace, but the callback performs
777 * additional filtering. Please see acpi_ns_get_device_callback.
779 ******************************************************************************/
782 acpi_get_devices(const char *HID,
783 acpi_walk_callback user_function,
784 void *context, void **return_value)
787 struct acpi_get_devices_info info;
789 ACPI_FUNCTION_TRACE(acpi_get_devices);
791 /* Parameter validation */
793 if (!user_function) {
794 return_ACPI_STATUS(AE_BAD_PARAMETER);
798 * We're going to call their callback from OUR callback, so we need
799 * to know what it is, and their context parameter.
802 info.context = context;
803 info.user_function = user_function;
806 * Lock the namespace around the walk.
807 * The namespace will be unlocked/locked around each call
808 * to the user function - since this function
809 * must be allowed to make Acpi calls itself.
811 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
812 if (ACPI_FAILURE(status)) {
813 return_ACPI_STATUS(status);
816 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
817 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
818 acpi_ns_get_device_callback, NULL,
819 &info, return_value);
821 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
822 return_ACPI_STATUS(status);
825 ACPI_EXPORT_SYMBOL(acpi_get_devices)
827 /*******************************************************************************
829 * FUNCTION: acpi_attach_data
831 * PARAMETERS: obj_handle - Namespace node
832 * handler - Handler for this attachment
833 * data - Pointer to data to be attached
837 * DESCRIPTION: Attach arbitrary data and handler to a namespace node.
839 ******************************************************************************/
841 acpi_attach_data(acpi_handle obj_handle,
842 acpi_object_handler handler, void *data)
844 struct acpi_namespace_node *node;
847 /* Parameter validation */
849 if (!obj_handle || !handler || !data) {
850 return (AE_BAD_PARAMETER);
853 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
854 if (ACPI_FAILURE(status)) {
858 /* Convert and validate the handle */
860 node = acpi_ns_validate_handle(obj_handle);
862 status = AE_BAD_PARAMETER;
863 goto unlock_and_exit;
866 status = acpi_ns_attach_data(node, handler, data);
869 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
873 ACPI_EXPORT_SYMBOL(acpi_attach_data)
875 /*******************************************************************************
877 * FUNCTION: acpi_detach_data
879 * PARAMETERS: obj_handle - Namespace node handle
880 * handler - Handler used in call to acpi_attach_data
884 * DESCRIPTION: Remove data that was previously attached to a node.
886 ******************************************************************************/
888 acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
890 struct acpi_namespace_node *node;
893 /* Parameter validation */
895 if (!obj_handle || !handler) {
896 return (AE_BAD_PARAMETER);
899 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
900 if (ACPI_FAILURE(status)) {
904 /* Convert and validate the handle */
906 node = acpi_ns_validate_handle(obj_handle);
908 status = AE_BAD_PARAMETER;
909 goto unlock_and_exit;
912 status = acpi_ns_detach_data(node, handler);
915 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
919 ACPI_EXPORT_SYMBOL(acpi_detach_data)
921 /*******************************************************************************
923 * FUNCTION: acpi_get_data
925 * PARAMETERS: obj_handle - Namespace node
926 * handler - Handler used in call to attach_data
927 * data - Where the data is returned
931 * DESCRIPTION: Retrieve data that was previously attached to a namespace node.
933 ******************************************************************************/
935 acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
937 struct acpi_namespace_node *node;
940 /* Parameter validation */
942 if (!obj_handle || !handler || !data) {
943 return (AE_BAD_PARAMETER);
946 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
947 if (ACPI_FAILURE(status)) {
951 /* Convert and validate the handle */
953 node = acpi_ns_validate_handle(obj_handle);
955 status = AE_BAD_PARAMETER;
956 goto unlock_and_exit;
959 status = acpi_ns_get_attached_data(node, handler, data);
962 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
966 ACPI_EXPORT_SYMBOL(acpi_get_data)