1 /*******************************************************************************
3 * Module Name: nsxfeval - Public interfaces to the ACPI subsystem
4 * ACPI Object evaluation interfaces
6 ******************************************************************************/
9 * Copyright (C) 2000 - 2016, 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
53 #define _COMPONENT ACPI_NAMESPACE
54 ACPI_MODULE_NAME ("nsxfeval")
56 /* Local prototypes */
59 AcpiNsResolveReferences (
60 ACPI_EVALUATE_INFO
*Info
);
63 /*******************************************************************************
65 * FUNCTION: AcpiEvaluateObjectTyped
67 * PARAMETERS: Handle - Object handle (optional)
68 * Pathname - Object pathname (optional)
69 * ExternalParams - List of parameters to pass to method,
70 * terminated by NULL. May be NULL
71 * if no parameters are being passed.
72 * ReturnBuffer - Where to put method's return value (if
73 * any). If NULL, no value is returned.
74 * ReturnType - Expected type of return object
78 * DESCRIPTION: Find and evaluate the given object, passing the given
79 * parameters if necessary. One of "Handle" or "Pathname" must
82 ******************************************************************************/
85 AcpiEvaluateObjectTyped (
88 ACPI_OBJECT_LIST
*ExternalParams
,
89 ACPI_BUFFER
*ReturnBuffer
,
90 ACPI_OBJECT_TYPE ReturnType
)
93 BOOLEAN FreeBufferOnError
= FALSE
;
96 ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped
);
99 /* Return buffer must be valid */
103 return_ACPI_STATUS (AE_BAD_PARAMETER
);
106 if (ReturnBuffer
->Length
== ACPI_ALLOCATE_BUFFER
)
108 FreeBufferOnError
= TRUE
;
111 /* Evaluate the object */
113 Status
= AcpiEvaluateObject (Handle
, Pathname
,
114 ExternalParams
, ReturnBuffer
);
115 if (ACPI_FAILURE (Status
))
117 return_ACPI_STATUS (Status
);
120 /* Type ANY means "don't care" */
122 if (ReturnType
== ACPI_TYPE_ANY
)
124 return_ACPI_STATUS (AE_OK
);
127 if (ReturnBuffer
->Length
== 0)
129 /* Error because caller specifically asked for a return value */
131 ACPI_ERROR ((AE_INFO
, "No return value"));
132 return_ACPI_STATUS (AE_NULL_OBJECT
);
135 /* Examine the object type returned from EvaluateObject */
137 if (((ACPI_OBJECT
*) ReturnBuffer
->Pointer
)->Type
== ReturnType
)
139 return_ACPI_STATUS (AE_OK
);
142 /* Return object type does not match requested type */
144 ACPI_ERROR ((AE_INFO
,
145 "Incorrect return type [%s] requested [%s]",
146 AcpiUtGetTypeName (((ACPI_OBJECT
*) ReturnBuffer
->Pointer
)->Type
),
147 AcpiUtGetTypeName (ReturnType
)));
149 if (FreeBufferOnError
)
152 * Free a buffer created via ACPI_ALLOCATE_BUFFER.
153 * Note: We use AcpiOsFree here because AcpiOsAllocate was used
154 * to allocate the buffer. This purposefully bypasses the
155 * (optionally enabled) allocation tracking mechanism since we
156 * only want to track internal allocations.
158 AcpiOsFree (ReturnBuffer
->Pointer
);
159 ReturnBuffer
->Pointer
= NULL
;
162 ReturnBuffer
->Length
= 0;
163 return_ACPI_STATUS (AE_TYPE
);
166 ACPI_EXPORT_SYMBOL (AcpiEvaluateObjectTyped
)
169 /*******************************************************************************
171 * FUNCTION: AcpiEvaluateObject
173 * PARAMETERS: Handle - Object handle (optional)
174 * Pathname - Object pathname (optional)
175 * ExternalParams - List of parameters to pass to method,
176 * terminated by NULL. May be NULL
177 * if no parameters are being passed.
178 * ReturnBuffer - Where to put method's return value (if
179 * any). If NULL, no value is returned.
183 * DESCRIPTION: Find and evaluate the given object, passing the given
184 * parameters if necessary. One of "Handle" or "Pathname" must
185 * be valid (non-null)
187 ******************************************************************************/
192 ACPI_STRING Pathname
,
193 ACPI_OBJECT_LIST
*ExternalParams
,
194 ACPI_BUFFER
*ReturnBuffer
)
197 ACPI_EVALUATE_INFO
*Info
;
198 ACPI_SIZE BufferSpaceNeeded
;
202 ACPI_FUNCTION_TRACE (AcpiEvaluateObject
);
205 /* Allocate and initialize the evaluation information block */
207 Info
= ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO
));
210 return_ACPI_STATUS (AE_NO_MEMORY
);
213 /* Convert and validate the device handle */
215 Info
->PrefixNode
= AcpiNsValidateHandle (Handle
);
216 if (!Info
->PrefixNode
)
218 Status
= AE_BAD_PARAMETER
;
223 * Get the actual namespace node for the target object.
224 * Handles these cases:
226 * 1) Null node, valid pathname from root (absolute path)
227 * 2) Node and valid pathname (path relative to Node)
228 * 3) Node, Null pathname
231 (ACPI_IS_ROOT_PREFIX (Pathname
[0])))
233 /* The path is fully qualified, just evaluate by name */
235 Info
->PrefixNode
= NULL
;
240 * A handle is optional iff a fully qualified pathname is specified.
241 * Since we've already handled fully qualified names above, this is
246 ACPI_DEBUG_PRINT ((ACPI_DB_INFO
,
247 "Both Handle and Pathname are NULL"));
251 ACPI_DEBUG_PRINT ((ACPI_DB_INFO
,
252 "Null Handle with relative pathname [%s]", Pathname
));
255 Status
= AE_BAD_PARAMETER
;
259 Info
->RelativePathname
= Pathname
;
262 * Convert all external objects passed as arguments to the
263 * internal version(s).
265 if (ExternalParams
&& ExternalParams
->Count
)
267 Info
->ParamCount
= (UINT16
) ExternalParams
->Count
;
269 /* Warn on impossible argument count */
271 if (Info
->ParamCount
> ACPI_METHOD_NUM_ARGS
)
273 ACPI_WARN_PREDEFINED ((AE_INFO
, Pathname
, ACPI_WARN_ALWAYS
,
274 "Excess arguments (%u) - using only %u",
275 Info
->ParamCount
, ACPI_METHOD_NUM_ARGS
));
277 Info
->ParamCount
= ACPI_METHOD_NUM_ARGS
;
281 * Allocate a new parameter block for the internal objects
282 * Add 1 to count to allow for null terminated internal list
284 Info
->Parameters
= ACPI_ALLOCATE_ZEROED (
285 ((ACPI_SIZE
) Info
->ParamCount
+ 1) * sizeof (void *));
286 if (!Info
->Parameters
)
288 Status
= AE_NO_MEMORY
;
292 /* Convert each external object in the list to an internal object */
294 for (i
= 0; i
< Info
->ParamCount
; i
++)
296 Status
= AcpiUtCopyEobjectToIobject (
297 &ExternalParams
->Pointer
[i
], &Info
->Parameters
[i
]);
298 if (ACPI_FAILURE (Status
))
304 Info
->Parameters
[Info
->ParamCount
] = NULL
;
308 #ifdef _FUTURE_FEATURE
311 * Begin incoming argument count analysis. Check for too few args
314 switch (AcpiNsGetType (Info
->Node
))
316 case ACPI_TYPE_METHOD
:
318 /* Check incoming argument count against the method definition */
320 if (Info
->ObjDesc
->Method
.ParamCount
> Info
->ParamCount
)
322 ACPI_ERROR ((AE_INFO
,
323 "Insufficient arguments (%u) - %u are required",
325 Info
->ObjDesc
->Method
.ParamCount
));
327 Status
= AE_MISSING_ARGUMENTS
;
331 else if (Info
->ObjDesc
->Method
.ParamCount
< Info
->ParamCount
)
333 ACPI_WARNING ((AE_INFO
,
334 "Excess arguments (%u) - only %u are required",
336 Info
->ObjDesc
->Method
.ParamCount
));
338 /* Just pass the required number of arguments */
340 Info
->ParamCount
= Info
->ObjDesc
->Method
.ParamCount
;
344 * Any incoming external objects to be passed as arguments to the
345 * method must be converted to internal objects
347 if (Info
->ParamCount
)
350 * Allocate a new parameter block for the internal objects
351 * Add 1 to count to allow for null terminated internal list
353 Info
->Parameters
= ACPI_ALLOCATE_ZEROED (
354 ((ACPI_SIZE
) Info
->ParamCount
+ 1) * sizeof (void *));
355 if (!Info
->Parameters
)
357 Status
= AE_NO_MEMORY
;
361 /* Convert each external object in the list to an internal object */
363 for (i
= 0; i
< Info
->ParamCount
; i
++)
365 Status
= AcpiUtCopyEobjectToIobject (
366 &ExternalParams
->Pointer
[i
], &Info
->Parameters
[i
]);
367 if (ACPI_FAILURE (Status
))
373 Info
->Parameters
[Info
->ParamCount
] = NULL
;
379 /* Warn if arguments passed to an object that is not a method */
381 if (Info
->ParamCount
)
383 ACPI_WARNING ((AE_INFO
,
384 "%u arguments were passed to a non-method ACPI object",
393 /* Now we can evaluate the object */
395 Status
= AcpiNsEvaluate (Info
);
398 * If we are expecting a return value, and all went well above,
399 * copy the return value to an external object.
403 goto CleanupReturnObject
;
406 if (!Info
->ReturnObject
)
408 ReturnBuffer
->Length
= 0;
412 if (ACPI_GET_DESCRIPTOR_TYPE (Info
->ReturnObject
) ==
413 ACPI_DESC_TYPE_NAMED
)
416 * If we received a NS Node as a return object, this means that
417 * the object we are evaluating has nothing interesting to
418 * return (such as a mutex, etc.) We return an error because
419 * these types are essentially unsupported by this interface.
420 * We don't check up front because this makes it easier to add
421 * support for various types at a later date if necessary.
424 Info
->ReturnObject
= NULL
; /* No need to delete a NS Node */
425 ReturnBuffer
->Length
= 0;
428 if (ACPI_FAILURE (Status
))
430 goto CleanupReturnObject
;
433 /* Dereference Index and RefOf references */
435 AcpiNsResolveReferences (Info
);
437 /* Get the size of the returned object */
439 Status
= AcpiUtGetObjectSize (Info
->ReturnObject
,
441 if (ACPI_SUCCESS (Status
))
443 /* Validate/Allocate/Clear caller buffer */
445 Status
= AcpiUtInitializeBuffer (ReturnBuffer
,
447 if (ACPI_FAILURE (Status
))
450 * Caller's buffer is too small or a new one can't
453 ACPI_DEBUG_PRINT ((ACPI_DB_INFO
,
454 "Needed buffer size %X, %s\n",
455 (UINT32
) BufferSpaceNeeded
,
456 AcpiFormatException (Status
)));
460 /* We have enough space for the object, build it */
462 Status
= AcpiUtCopyIobjectToEobject (
463 Info
->ReturnObject
, ReturnBuffer
);
469 if (Info
->ReturnObject
)
472 * Delete the internal return object. NOTE: Interpreter must be
473 * locked to avoid race condition.
475 AcpiExEnterInterpreter ();
477 /* Remove one reference on the return object (should delete it) */
479 AcpiUtRemoveReference (Info
->ReturnObject
);
480 AcpiExExitInterpreter ();
486 /* Free the input parameter list (if we created one) */
488 if (Info
->Parameters
)
490 /* Free the allocated parameter block */
492 AcpiUtDeleteInternalObjectList (Info
->Parameters
);
496 return_ACPI_STATUS (Status
);
499 ACPI_EXPORT_SYMBOL (AcpiEvaluateObject
)
502 /*******************************************************************************
504 * FUNCTION: AcpiNsResolveReferences
506 * PARAMETERS: Info - Evaluation info block
508 * RETURN: Info->ReturnObject is replaced with the dereferenced object
510 * DESCRIPTION: Dereference certain reference objects. Called before an
511 * internal return object is converted to an external ACPI_OBJECT.
513 * Performs an automatic dereference of Index and RefOf reference objects.
514 * These reference objects are not supported by the ACPI_OBJECT, so this is a
515 * last resort effort to return something useful. Also, provides compatibility
516 * with other ACPI implementations.
518 * NOTE: does not handle references within returned package objects or nested
519 * references, but this support could be added later if found to be necessary.
521 ******************************************************************************/
524 AcpiNsResolveReferences (
525 ACPI_EVALUATE_INFO
*Info
)
527 ACPI_OPERAND_OBJECT
*ObjDesc
= NULL
;
528 ACPI_NAMESPACE_NODE
*Node
;
531 /* We are interested in reference objects only */
533 if ((Info
->ReturnObject
)->Common
.Type
!= ACPI_TYPE_LOCAL_REFERENCE
)
539 * Two types of references are supported - those created by Index and
540 * RefOf operators. A name reference (AML_NAMEPATH_OP) can be converted
541 * to an ACPI_OBJECT, so it is not dereferenced here. A DdbHandle
542 * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
545 switch (Info
->ReturnObject
->Reference
.Class
)
547 case ACPI_REFCLASS_INDEX
:
549 ObjDesc
= *(Info
->ReturnObject
->Reference
.Where
);
552 case ACPI_REFCLASS_REFOF
:
554 Node
= Info
->ReturnObject
->Reference
.Object
;
557 ObjDesc
= Node
->Object
;
566 /* Replace the existing reference object */
570 AcpiUtAddReference (ObjDesc
);
571 AcpiUtRemoveReference (Info
->ReturnObject
);
572 Info
->ReturnObject
= ObjDesc
;
579 /*******************************************************************************
581 * FUNCTION: AcpiWalkNamespace
583 * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
584 * StartObject - Handle in namespace where search begins
585 * MaxDepth - Depth to which search is to reach
586 * DescendingCallback - Called during tree descent
587 * when an object of "Type" is found
588 * AscendingCallback - Called during tree ascent
589 * when an object of "Type" is found
590 * Context - Passed to user function(s) above
591 * ReturnValue - Location where return value of
592 * UserFunction is put if terminated early
594 * RETURNS Return value from the UserFunction if terminated early.
595 * Otherwise, returns NULL.
597 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
598 * starting (and ending) at the object specified by StartHandle.
599 * The callback function is called whenever an object that matches
600 * the type parameter is found. If the callback function returns
601 * a non-zero value, the search is terminated immediately and this
602 * value is returned to the caller.
604 * The point of this procedure is to provide a generic namespace
605 * walk routine that can be called from multiple places to
606 * provide multiple services; the callback function(s) can be
607 * tailored to each task, whether it is a print function,
608 * a compare function, etc.
610 ******************************************************************************/
614 ACPI_OBJECT_TYPE Type
,
615 ACPI_HANDLE StartObject
,
617 ACPI_WALK_CALLBACK DescendingCallback
,
618 ACPI_WALK_CALLBACK AscendingCallback
,
625 ACPI_FUNCTION_TRACE (AcpiWalkNamespace
);
628 /* Parameter validation */
630 if ((Type
> ACPI_TYPE_LOCAL_MAX
) ||
632 (!DescendingCallback
&& !AscendingCallback
))
634 return_ACPI_STATUS (AE_BAD_PARAMETER
);
638 * Need to acquire the namespace reader lock to prevent interference
639 * with any concurrent table unloads (which causes the deletion of
640 * namespace objects). We cannot allow the deletion of a namespace node
641 * while the user function is using it. The exception to this are the
642 * nodes created and deleted during control method execution -- these
643 * nodes are marked as temporary nodes and are ignored by the namespace
644 * walk. Thus, control methods can be executed while holding the
645 * namespace deletion lock (and the user function can execute control
648 Status
= AcpiUtAcquireReadLock (&AcpiGbl_NamespaceRwLock
);
649 if (ACPI_FAILURE (Status
))
651 return_ACPI_STATUS (Status
);
655 * Lock the namespace around the walk. The namespace will be
656 * unlocked/locked around each call to the user function - since the user
657 * function must be allowed to make ACPICA calls itself (for example, it
658 * will typically execute control methods during device enumeration.)
660 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
661 if (ACPI_FAILURE (Status
))
666 /* Now we can validate the starting node */
668 if (!AcpiNsValidateHandle (StartObject
))
670 Status
= AE_BAD_PARAMETER
;
674 Status
= AcpiNsWalkNamespace (Type
, StartObject
, MaxDepth
,
675 ACPI_NS_WALK_UNLOCK
, DescendingCallback
,
676 AscendingCallback
, Context
, ReturnValue
);
679 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
682 (void) AcpiUtReleaseReadLock (&AcpiGbl_NamespaceRwLock
);
683 return_ACPI_STATUS (Status
);
686 ACPI_EXPORT_SYMBOL (AcpiWalkNamespace
)
689 /*******************************************************************************
691 * FUNCTION: AcpiNsGetDeviceCallback
693 * PARAMETERS: Callback from AcpiGetDevice
697 * DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non-
698 * present devices, or if they specified a HID, it filters based
701 ******************************************************************************/
704 AcpiNsGetDeviceCallback (
705 ACPI_HANDLE ObjHandle
,
710 ACPI_GET_DEVICES_INFO
*Info
= Context
;
712 ACPI_NAMESPACE_NODE
*Node
;
714 ACPI_PNP_DEVICE_ID
*Hid
;
715 ACPI_PNP_DEVICE_ID_LIST
*Cid
;
721 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
722 if (ACPI_FAILURE (Status
))
727 Node
= AcpiNsValidateHandle (ObjHandle
);
728 Status
= AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
729 if (ACPI_FAILURE (Status
))
736 return (AE_BAD_PARAMETER
);
740 * First, filter based on the device HID and CID.
742 * 01/2010: For this case where a specific HID is requested, we don't
743 * want to run _STA until we have an actual HID match. Thus, we will
744 * not unnecessarily execute _STA on devices for which the caller
745 * doesn't care about. Previously, _STA was executed unconditionally
746 * on all devices found here.
748 * A side-effect of this change is that now we will continue to search
749 * for a matching HID even under device trees where the parent device
750 * would have returned a _STA that indicates it is not present or
751 * not functioning (thus aborting the search on that branch).
753 if (Info
->Hid
!= NULL
)
755 Status
= AcpiUtExecute_HID (Node
, &Hid
);
756 if (Status
== AE_NOT_FOUND
)
760 else if (ACPI_FAILURE (Status
))
762 return (AE_CTRL_DEPTH
);
765 NoMatch
= strcmp (Hid
->String
, Info
->Hid
);
771 * HID does not match, attempt match within the
772 * list of Compatible IDs (CIDs)
774 Status
= AcpiUtExecute_CID (Node
, &Cid
);
775 if (Status
== AE_NOT_FOUND
)
779 else if (ACPI_FAILURE (Status
))
781 return (AE_CTRL_DEPTH
);
784 /* Walk the CID list */
787 for (i
= 0; i
< Cid
->Count
; i
++)
789 if (strcmp (Cid
->Ids
[i
].String
, Info
->Hid
) == 0)
791 /* Found a matching CID */
806 /* Run _STA to determine if device is present */
808 Status
= AcpiUtExecute_STA (Node
, &Flags
);
809 if (ACPI_FAILURE (Status
))
811 return (AE_CTRL_DEPTH
);
814 if (!(Flags
& ACPI_STA_DEVICE_PRESENT
) &&
815 !(Flags
& ACPI_STA_DEVICE_FUNCTIONING
))
818 * Don't examine the children of the device only when the
819 * device is neither present nor functional. See ACPI spec,
820 * description of _STA for more information.
822 return (AE_CTRL_DEPTH
);
825 /* We have a valid device, invoke the user function */
827 Status
= Info
->UserFunction (ObjHandle
, NestingLevel
,
828 Info
->Context
, ReturnValue
);
833 /*******************************************************************************
835 * FUNCTION: AcpiGetDevices
837 * PARAMETERS: HID - HID to search for. Can be NULL.
838 * UserFunction - Called when a matching object is found
839 * Context - Passed to user function
840 * ReturnValue - Location where return value of
841 * UserFunction is put if terminated early
843 * RETURNS Return value from the UserFunction if terminated early.
844 * Otherwise, returns NULL.
846 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
847 * starting (and ending) at the object specified by StartHandle.
848 * The UserFunction is called whenever an object of type
849 * Device is found. If the user function returns
850 * a non-zero value, the search is terminated immediately and this
851 * value is returned to the caller.
853 * This is a wrapper for WalkNamespace, but the callback performs
854 * additional filtering. Please see AcpiNsGetDeviceCallback.
856 ******************************************************************************/
861 ACPI_WALK_CALLBACK UserFunction
,
866 ACPI_GET_DEVICES_INFO Info
;
869 ACPI_FUNCTION_TRACE (AcpiGetDevices
);
872 /* Parameter validation */
876 return_ACPI_STATUS (AE_BAD_PARAMETER
);
880 * We're going to call their callback from OUR callback, so we need
881 * to know what it is, and their context parameter.
884 Info
.Context
= Context
;
885 Info
.UserFunction
= UserFunction
;
888 * Lock the namespace around the walk.
889 * The namespace will be unlocked/locked around each call
890 * to the user function - since this function
891 * must be allowed to make Acpi calls itself.
893 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
894 if (ACPI_FAILURE (Status
))
896 return_ACPI_STATUS (Status
);
899 Status
= AcpiNsWalkNamespace (ACPI_TYPE_DEVICE
, ACPI_ROOT_OBJECT
,
900 ACPI_UINT32_MAX
, ACPI_NS_WALK_UNLOCK
,
901 AcpiNsGetDeviceCallback
, NULL
, &Info
, ReturnValue
);
903 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
904 return_ACPI_STATUS (Status
);
907 ACPI_EXPORT_SYMBOL (AcpiGetDevices
)
910 /*******************************************************************************
912 * FUNCTION: AcpiAttachData
914 * PARAMETERS: ObjHandle - Namespace node
915 * Handler - Handler for this attachment
916 * Data - Pointer to data to be attached
920 * DESCRIPTION: Attach arbitrary data and handler to a namespace node.
922 ******************************************************************************/
926 ACPI_HANDLE ObjHandle
,
927 ACPI_OBJECT_HANDLER Handler
,
930 ACPI_NAMESPACE_NODE
*Node
;
934 /* Parameter validation */
940 return (AE_BAD_PARAMETER
);
943 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
944 if (ACPI_FAILURE (Status
))
949 /* Convert and validate the handle */
951 Node
= AcpiNsValidateHandle (ObjHandle
);
954 Status
= AE_BAD_PARAMETER
;
958 Status
= AcpiNsAttachData (Node
, Handler
, Data
);
961 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
965 ACPI_EXPORT_SYMBOL (AcpiAttachData
)
968 /*******************************************************************************
970 * FUNCTION: AcpiDetachData
972 * PARAMETERS: ObjHandle - Namespace node handle
973 * Handler - Handler used in call to AcpiAttachData
977 * DESCRIPTION: Remove data that was previously attached to a node.
979 ******************************************************************************/
983 ACPI_HANDLE ObjHandle
,
984 ACPI_OBJECT_HANDLER Handler
)
986 ACPI_NAMESPACE_NODE
*Node
;
990 /* Parameter validation */
995 return (AE_BAD_PARAMETER
);
998 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
999 if (ACPI_FAILURE (Status
))
1004 /* Convert and validate the handle */
1006 Node
= AcpiNsValidateHandle (ObjHandle
);
1009 Status
= AE_BAD_PARAMETER
;
1013 Status
= AcpiNsDetachData (Node
, Handler
);
1016 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
1020 ACPI_EXPORT_SYMBOL (AcpiDetachData
)
1023 /*******************************************************************************
1025 * FUNCTION: AcpiGetData
1027 * PARAMETERS: ObjHandle - Namespace node
1028 * Handler - Handler used in call to AttachData
1029 * Data - Where the data is returned
1033 * DESCRIPTION: Retrieve data that was previously attached to a namespace node.
1035 ******************************************************************************/
1039 ACPI_HANDLE ObjHandle
,
1040 ACPI_OBJECT_HANDLER Handler
,
1043 ACPI_NAMESPACE_NODE
*Node
;
1047 /* Parameter validation */
1053 return (AE_BAD_PARAMETER
);
1056 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
1057 if (ACPI_FAILURE (Status
))
1062 /* Convert and validate the handle */
1064 Node
= AcpiNsValidateHandle (ObjHandle
);
1067 Status
= AE_BAD_PARAMETER
;
1071 Status
= AcpiNsGetAttachedData (Node
, Handler
, Data
);
1074 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
1078 ACPI_EXPORT_SYMBOL (AcpiGetData
)