1 /*******************************************************************************
3 * Module Name: nsxfeval - Public interfaces to the ACPI subsystem
4 * ACPI Object evaluation interfaces
6 ******************************************************************************/
9 * Copyright (C) 2000 - 2017, 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
;
94 ACPI_HANDLE TargetHandle
;
98 ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped
);
101 /* Return buffer must be valid */
105 return_ACPI_STATUS (AE_BAD_PARAMETER
);
108 if (ReturnBuffer
->Length
== ACPI_ALLOCATE_BUFFER
)
110 FreeBufferOnError
= TRUE
;
113 Status
= AcpiGetHandle (Handle
, Pathname
, &TargetHandle
);
114 if (ACPI_FAILURE (Status
))
116 return_ACPI_STATUS (Status
);
119 FullPathname
= AcpiNsGetExternalPathname (TargetHandle
);
122 return_ACPI_STATUS (AE_NO_MEMORY
);
125 /* Evaluate the object */
127 Status
= AcpiEvaluateObject (TargetHandle
, NULL
, ExternalParams
,
129 if (ACPI_FAILURE (Status
))
134 /* Type ANY means "don't care about return value type" */
136 if (ReturnType
== ACPI_TYPE_ANY
)
141 if (ReturnBuffer
->Length
== 0)
143 /* Error because caller specifically asked for a return value */
145 ACPI_ERROR ((AE_INFO
, "%s did not return any object",
147 Status
= AE_NULL_OBJECT
;
151 /* Examine the object type returned from EvaluateObject */
153 if (((ACPI_OBJECT
*) ReturnBuffer
->Pointer
)->Type
== ReturnType
)
158 /* Return object type does not match requested type */
160 ACPI_ERROR ((AE_INFO
,
161 "Incorrect return type from %s - received [%s], requested [%s]",
163 AcpiUtGetTypeName (((ACPI_OBJECT
*) ReturnBuffer
->Pointer
)->Type
),
164 AcpiUtGetTypeName (ReturnType
)));
166 if (FreeBufferOnError
)
169 * Free a buffer created via ACPI_ALLOCATE_BUFFER.
170 * Note: We use AcpiOsFree here because AcpiOsAllocate was used
171 * to allocate the buffer. This purposefully bypasses the
172 * (optionally enabled) allocation tracking mechanism since we
173 * only want to track internal allocations.
175 AcpiOsFree (ReturnBuffer
->Pointer
);
176 ReturnBuffer
->Pointer
= NULL
;
179 ReturnBuffer
->Length
= 0;
183 ACPI_FREE (FullPathname
);
184 return_ACPI_STATUS (Status
);
187 ACPI_EXPORT_SYMBOL (AcpiEvaluateObjectTyped
)
190 /*******************************************************************************
192 * FUNCTION: AcpiEvaluateObject
194 * PARAMETERS: Handle - Object handle (optional)
195 * Pathname - Object pathname (optional)
196 * ExternalParams - List of parameters to pass to method,
197 * terminated by NULL. May be NULL
198 * if no parameters are being passed.
199 * ReturnBuffer - Where to put method's return value (if
200 * any). If NULL, no value is returned.
204 * DESCRIPTION: Find and evaluate the given object, passing the given
205 * parameters if necessary. One of "Handle" or "Pathname" must
206 * be valid (non-null)
208 ******************************************************************************/
213 ACPI_STRING Pathname
,
214 ACPI_OBJECT_LIST
*ExternalParams
,
215 ACPI_BUFFER
*ReturnBuffer
)
218 ACPI_EVALUATE_INFO
*Info
;
219 ACPI_SIZE BufferSpaceNeeded
;
223 ACPI_FUNCTION_TRACE (AcpiEvaluateObject
);
226 /* Allocate and initialize the evaluation information block */
228 Info
= ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO
));
231 return_ACPI_STATUS (AE_NO_MEMORY
);
234 /* Convert and validate the device handle */
236 Info
->PrefixNode
= AcpiNsValidateHandle (Handle
);
237 if (!Info
->PrefixNode
)
239 Status
= AE_BAD_PARAMETER
;
244 * Get the actual namespace node for the target object.
245 * Handles these cases:
247 * 1) Null node, valid pathname from root (absolute path)
248 * 2) Node and valid pathname (path relative to Node)
249 * 3) Node, Null pathname
252 (ACPI_IS_ROOT_PREFIX (Pathname
[0])))
254 /* The path is fully qualified, just evaluate by name */
256 Info
->PrefixNode
= NULL
;
261 * A handle is optional iff a fully qualified pathname is specified.
262 * Since we've already handled fully qualified names above, this is
267 ACPI_DEBUG_PRINT ((ACPI_DB_INFO
,
268 "Both Handle and Pathname are NULL"));
272 ACPI_DEBUG_PRINT ((ACPI_DB_INFO
,
273 "Null Handle with relative pathname [%s]", Pathname
));
276 Status
= AE_BAD_PARAMETER
;
280 Info
->RelativePathname
= Pathname
;
283 * Convert all external objects passed as arguments to the
284 * internal version(s).
286 if (ExternalParams
&& ExternalParams
->Count
)
288 Info
->ParamCount
= (UINT16
) ExternalParams
->Count
;
290 /* Warn on impossible argument count */
292 if (Info
->ParamCount
> ACPI_METHOD_NUM_ARGS
)
294 ACPI_WARN_PREDEFINED ((AE_INFO
, Pathname
, ACPI_WARN_ALWAYS
,
295 "Excess arguments (%u) - using only %u",
296 Info
->ParamCount
, ACPI_METHOD_NUM_ARGS
));
298 Info
->ParamCount
= ACPI_METHOD_NUM_ARGS
;
302 * Allocate a new parameter block for the internal objects
303 * Add 1 to count to allow for null terminated internal list
305 Info
->Parameters
= ACPI_ALLOCATE_ZEROED (
306 ((ACPI_SIZE
) Info
->ParamCount
+ 1) * sizeof (void *));
307 if (!Info
->Parameters
)
309 Status
= AE_NO_MEMORY
;
313 /* Convert each external object in the list to an internal object */
315 for (i
= 0; i
< Info
->ParamCount
; i
++)
317 Status
= AcpiUtCopyEobjectToIobject (
318 &ExternalParams
->Pointer
[i
], &Info
->Parameters
[i
]);
319 if (ACPI_FAILURE (Status
))
325 Info
->Parameters
[Info
->ParamCount
] = NULL
;
329 #ifdef _FUTURE_FEATURE
332 * Begin incoming argument count analysis. Check for too few args
335 switch (AcpiNsGetType (Info
->Node
))
337 case ACPI_TYPE_METHOD
:
339 /* Check incoming argument count against the method definition */
341 if (Info
->ObjDesc
->Method
.ParamCount
> Info
->ParamCount
)
343 ACPI_ERROR ((AE_INFO
,
344 "Insufficient arguments (%u) - %u are required",
346 Info
->ObjDesc
->Method
.ParamCount
));
348 Status
= AE_MISSING_ARGUMENTS
;
352 else if (Info
->ObjDesc
->Method
.ParamCount
< Info
->ParamCount
)
354 ACPI_WARNING ((AE_INFO
,
355 "Excess arguments (%u) - only %u are required",
357 Info
->ObjDesc
->Method
.ParamCount
));
359 /* Just pass the required number of arguments */
361 Info
->ParamCount
= Info
->ObjDesc
->Method
.ParamCount
;
365 * Any incoming external objects to be passed as arguments to the
366 * method must be converted to internal objects
368 if (Info
->ParamCount
)
371 * Allocate a new parameter block for the internal objects
372 * Add 1 to count to allow for null terminated internal list
374 Info
->Parameters
= ACPI_ALLOCATE_ZEROED (
375 ((ACPI_SIZE
) Info
->ParamCount
+ 1) * sizeof (void *));
376 if (!Info
->Parameters
)
378 Status
= AE_NO_MEMORY
;
382 /* Convert each external object in the list to an internal object */
384 for (i
= 0; i
< Info
->ParamCount
; i
++)
386 Status
= AcpiUtCopyEobjectToIobject (
387 &ExternalParams
->Pointer
[i
], &Info
->Parameters
[i
]);
388 if (ACPI_FAILURE (Status
))
394 Info
->Parameters
[Info
->ParamCount
] = NULL
;
400 /* Warn if arguments passed to an object that is not a method */
402 if (Info
->ParamCount
)
404 ACPI_WARNING ((AE_INFO
,
405 "%u arguments were passed to a non-method ACPI object",
414 /* Now we can evaluate the object */
416 Status
= AcpiNsEvaluate (Info
);
419 * If we are expecting a return value, and all went well above,
420 * copy the return value to an external object.
424 goto CleanupReturnObject
;
427 if (!Info
->ReturnObject
)
429 ReturnBuffer
->Length
= 0;
433 if (ACPI_GET_DESCRIPTOR_TYPE (Info
->ReturnObject
) ==
434 ACPI_DESC_TYPE_NAMED
)
437 * If we received a NS Node as a return object, this means that
438 * the object we are evaluating has nothing interesting to
439 * return (such as a mutex, etc.) We return an error because
440 * these types are essentially unsupported by this interface.
441 * We don't check up front because this makes it easier to add
442 * support for various types at a later date if necessary.
445 Info
->ReturnObject
= NULL
; /* No need to delete a NS Node */
446 ReturnBuffer
->Length
= 0;
449 if (ACPI_FAILURE (Status
))
451 goto CleanupReturnObject
;
454 /* Dereference Index and RefOf references */
456 AcpiNsResolveReferences (Info
);
458 /* Get the size of the returned object */
460 Status
= AcpiUtGetObjectSize (Info
->ReturnObject
,
462 if (ACPI_SUCCESS (Status
))
464 /* Validate/Allocate/Clear caller buffer */
466 Status
= AcpiUtInitializeBuffer (ReturnBuffer
,
468 if (ACPI_FAILURE (Status
))
471 * Caller's buffer is too small or a new one can't
474 ACPI_DEBUG_PRINT ((ACPI_DB_INFO
,
475 "Needed buffer size %X, %s\n",
476 (UINT32
) BufferSpaceNeeded
,
477 AcpiFormatException (Status
)));
481 /* We have enough space for the object, build it */
483 Status
= AcpiUtCopyIobjectToEobject (
484 Info
->ReturnObject
, ReturnBuffer
);
490 if (Info
->ReturnObject
)
493 * Delete the internal return object. NOTE: Interpreter must be
494 * locked to avoid race condition.
496 AcpiExEnterInterpreter ();
498 /* Remove one reference on the return object (should delete it) */
500 AcpiUtRemoveReference (Info
->ReturnObject
);
501 AcpiExExitInterpreter ();
507 /* Free the input parameter list (if we created one) */
509 if (Info
->Parameters
)
511 /* Free the allocated parameter block */
513 AcpiUtDeleteInternalObjectList (Info
->Parameters
);
517 return_ACPI_STATUS (Status
);
520 ACPI_EXPORT_SYMBOL (AcpiEvaluateObject
)
523 /*******************************************************************************
525 * FUNCTION: AcpiNsResolveReferences
527 * PARAMETERS: Info - Evaluation info block
529 * RETURN: Info->ReturnObject is replaced with the dereferenced object
531 * DESCRIPTION: Dereference certain reference objects. Called before an
532 * internal return object is converted to an external ACPI_OBJECT.
534 * Performs an automatic dereference of Index and RefOf reference objects.
535 * These reference objects are not supported by the ACPI_OBJECT, so this is a
536 * last resort effort to return something useful. Also, provides compatibility
537 * with other ACPI implementations.
539 * NOTE: does not handle references within returned package objects or nested
540 * references, but this support could be added later if found to be necessary.
542 ******************************************************************************/
545 AcpiNsResolveReferences (
546 ACPI_EVALUATE_INFO
*Info
)
548 ACPI_OPERAND_OBJECT
*ObjDesc
= NULL
;
549 ACPI_NAMESPACE_NODE
*Node
;
552 /* We are interested in reference objects only */
554 if ((Info
->ReturnObject
)->Common
.Type
!= ACPI_TYPE_LOCAL_REFERENCE
)
560 * Two types of references are supported - those created by Index and
561 * RefOf operators. A name reference (AML_NAMEPATH_OP) can be converted
562 * to an ACPI_OBJECT, so it is not dereferenced here. A DdbHandle
563 * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
566 switch (Info
->ReturnObject
->Reference
.Class
)
568 case ACPI_REFCLASS_INDEX
:
570 ObjDesc
= *(Info
->ReturnObject
->Reference
.Where
);
573 case ACPI_REFCLASS_REFOF
:
575 Node
= Info
->ReturnObject
->Reference
.Object
;
578 ObjDesc
= Node
->Object
;
587 /* Replace the existing reference object */
591 AcpiUtAddReference (ObjDesc
);
592 AcpiUtRemoveReference (Info
->ReturnObject
);
593 Info
->ReturnObject
= ObjDesc
;
600 /*******************************************************************************
602 * FUNCTION: AcpiWalkNamespace
604 * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
605 * StartObject - Handle in namespace where search begins
606 * MaxDepth - Depth to which search is to reach
607 * DescendingCallback - Called during tree descent
608 * when an object of "Type" is found
609 * AscendingCallback - Called during tree ascent
610 * when an object of "Type" is found
611 * Context - Passed to user function(s) above
612 * ReturnValue - Location where return value of
613 * UserFunction is put if terminated early
615 * RETURNS Return value from the UserFunction if terminated early.
616 * Otherwise, returns NULL.
618 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
619 * starting (and ending) at the object specified by StartHandle.
620 * The callback function is called whenever an object that matches
621 * the type parameter is found. If the callback function returns
622 * a non-zero value, the search is terminated immediately and this
623 * value is returned to the caller.
625 * The point of this procedure is to provide a generic namespace
626 * walk routine that can be called from multiple places to
627 * provide multiple services; the callback function(s) can be
628 * tailored to each task, whether it is a print function,
629 * a compare function, etc.
631 ******************************************************************************/
635 ACPI_OBJECT_TYPE Type
,
636 ACPI_HANDLE StartObject
,
638 ACPI_WALK_CALLBACK DescendingCallback
,
639 ACPI_WALK_CALLBACK AscendingCallback
,
646 ACPI_FUNCTION_TRACE (AcpiWalkNamespace
);
649 /* Parameter validation */
651 if ((Type
> ACPI_TYPE_LOCAL_MAX
) ||
653 (!DescendingCallback
&& !AscendingCallback
))
655 return_ACPI_STATUS (AE_BAD_PARAMETER
);
659 * Need to acquire the namespace reader lock to prevent interference
660 * with any concurrent table unloads (which causes the deletion of
661 * namespace objects). We cannot allow the deletion of a namespace node
662 * while the user function is using it. The exception to this are the
663 * nodes created and deleted during control method execution -- these
664 * nodes are marked as temporary nodes and are ignored by the namespace
665 * walk. Thus, control methods can be executed while holding the
666 * namespace deletion lock (and the user function can execute control
669 Status
= AcpiUtAcquireReadLock (&AcpiGbl_NamespaceRwLock
);
670 if (ACPI_FAILURE (Status
))
672 return_ACPI_STATUS (Status
);
676 * Lock the namespace around the walk. The namespace will be
677 * unlocked/locked around each call to the user function - since the user
678 * function must be allowed to make ACPICA calls itself (for example, it
679 * will typically execute control methods during device enumeration.)
681 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
682 if (ACPI_FAILURE (Status
))
687 /* Now we can validate the starting node */
689 if (!AcpiNsValidateHandle (StartObject
))
691 Status
= AE_BAD_PARAMETER
;
695 Status
= AcpiNsWalkNamespace (Type
, StartObject
, MaxDepth
,
696 ACPI_NS_WALK_UNLOCK
, DescendingCallback
,
697 AscendingCallback
, Context
, ReturnValue
);
700 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
703 (void) AcpiUtReleaseReadLock (&AcpiGbl_NamespaceRwLock
);
704 return_ACPI_STATUS (Status
);
707 ACPI_EXPORT_SYMBOL (AcpiWalkNamespace
)
710 /*******************************************************************************
712 * FUNCTION: AcpiNsGetDeviceCallback
714 * PARAMETERS: Callback from AcpiGetDevice
718 * DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non-
719 * present devices, or if they specified a HID, it filters based
722 ******************************************************************************/
725 AcpiNsGetDeviceCallback (
726 ACPI_HANDLE ObjHandle
,
731 ACPI_GET_DEVICES_INFO
*Info
= Context
;
733 ACPI_NAMESPACE_NODE
*Node
;
735 ACPI_PNP_DEVICE_ID
*Hid
;
736 ACPI_PNP_DEVICE_ID_LIST
*Cid
;
742 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
743 if (ACPI_FAILURE (Status
))
748 Node
= AcpiNsValidateHandle (ObjHandle
);
749 Status
= AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
750 if (ACPI_FAILURE (Status
))
757 return (AE_BAD_PARAMETER
);
761 * First, filter based on the device HID and CID.
763 * 01/2010: For this case where a specific HID is requested, we don't
764 * want to run _STA until we have an actual HID match. Thus, we will
765 * not unnecessarily execute _STA on devices for which the caller
766 * doesn't care about. Previously, _STA was executed unconditionally
767 * on all devices found here.
769 * A side-effect of this change is that now we will continue to search
770 * for a matching HID even under device trees where the parent device
771 * would have returned a _STA that indicates it is not present or
772 * not functioning (thus aborting the search on that branch).
774 if (Info
->Hid
!= NULL
)
776 Status
= AcpiUtExecute_HID (Node
, &Hid
);
777 if (Status
== AE_NOT_FOUND
)
781 else if (ACPI_FAILURE (Status
))
783 return (AE_CTRL_DEPTH
);
786 NoMatch
= strcmp (Hid
->String
, Info
->Hid
);
792 * HID does not match, attempt match within the
793 * list of Compatible IDs (CIDs)
795 Status
= AcpiUtExecute_CID (Node
, &Cid
);
796 if (Status
== AE_NOT_FOUND
)
800 else if (ACPI_FAILURE (Status
))
802 return (AE_CTRL_DEPTH
);
805 /* Walk the CID list */
808 for (i
= 0; i
< Cid
->Count
; i
++)
810 if (strcmp (Cid
->Ids
[i
].String
, Info
->Hid
) == 0)
812 /* Found a matching CID */
827 /* Run _STA to determine if device is present */
829 Status
= AcpiUtExecute_STA (Node
, &Flags
);
830 if (ACPI_FAILURE (Status
))
832 return (AE_CTRL_DEPTH
);
835 if (!(Flags
& ACPI_STA_DEVICE_PRESENT
) &&
836 !(Flags
& ACPI_STA_DEVICE_FUNCTIONING
))
839 * Don't examine the children of the device only when the
840 * device is neither present nor functional. See ACPI spec,
841 * description of _STA for more information.
843 return (AE_CTRL_DEPTH
);
846 /* We have a valid device, invoke the user function */
848 Status
= Info
->UserFunction (ObjHandle
, NestingLevel
,
849 Info
->Context
, ReturnValue
);
854 /*******************************************************************************
856 * FUNCTION: AcpiGetDevices
858 * PARAMETERS: HID - HID to search for. Can be NULL.
859 * UserFunction - Called when a matching object is found
860 * Context - Passed to user function
861 * ReturnValue - Location where return value of
862 * UserFunction is put if terminated early
864 * RETURNS Return value from the UserFunction if terminated early.
865 * Otherwise, returns NULL.
867 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
868 * starting (and ending) at the object specified by StartHandle.
869 * The UserFunction is called whenever an object of type
870 * Device is found. If the user function returns
871 * a non-zero value, the search is terminated immediately and this
872 * value is returned to the caller.
874 * This is a wrapper for WalkNamespace, but the callback performs
875 * additional filtering. Please see AcpiNsGetDeviceCallback.
877 ******************************************************************************/
882 ACPI_WALK_CALLBACK UserFunction
,
887 ACPI_GET_DEVICES_INFO Info
;
890 ACPI_FUNCTION_TRACE (AcpiGetDevices
);
893 /* Parameter validation */
897 return_ACPI_STATUS (AE_BAD_PARAMETER
);
901 * We're going to call their callback from OUR callback, so we need
902 * to know what it is, and their context parameter.
905 Info
.Context
= Context
;
906 Info
.UserFunction
= UserFunction
;
909 * Lock the namespace around the walk.
910 * The namespace will be unlocked/locked around each call
911 * to the user function - since this function
912 * must be allowed to make Acpi calls itself.
914 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
915 if (ACPI_FAILURE (Status
))
917 return_ACPI_STATUS (Status
);
920 Status
= AcpiNsWalkNamespace (ACPI_TYPE_DEVICE
, ACPI_ROOT_OBJECT
,
921 ACPI_UINT32_MAX
, ACPI_NS_WALK_UNLOCK
,
922 AcpiNsGetDeviceCallback
, NULL
, &Info
, ReturnValue
);
924 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
925 return_ACPI_STATUS (Status
);
928 ACPI_EXPORT_SYMBOL (AcpiGetDevices
)
931 /*******************************************************************************
933 * FUNCTION: AcpiAttachData
935 * PARAMETERS: ObjHandle - Namespace node
936 * Handler - Handler for this attachment
937 * Data - Pointer to data to be attached
941 * DESCRIPTION: Attach arbitrary data and handler to a namespace node.
943 ******************************************************************************/
947 ACPI_HANDLE ObjHandle
,
948 ACPI_OBJECT_HANDLER Handler
,
951 ACPI_NAMESPACE_NODE
*Node
;
955 /* Parameter validation */
961 return (AE_BAD_PARAMETER
);
964 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
965 if (ACPI_FAILURE (Status
))
970 /* Convert and validate the handle */
972 Node
= AcpiNsValidateHandle (ObjHandle
);
975 Status
= AE_BAD_PARAMETER
;
979 Status
= AcpiNsAttachData (Node
, Handler
, Data
);
982 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
986 ACPI_EXPORT_SYMBOL (AcpiAttachData
)
989 /*******************************************************************************
991 * FUNCTION: AcpiDetachData
993 * PARAMETERS: ObjHandle - Namespace node handle
994 * Handler - Handler used in call to AcpiAttachData
998 * DESCRIPTION: Remove data that was previously attached to a node.
1000 ******************************************************************************/
1004 ACPI_HANDLE ObjHandle
,
1005 ACPI_OBJECT_HANDLER Handler
)
1007 ACPI_NAMESPACE_NODE
*Node
;
1011 /* Parameter validation */
1016 return (AE_BAD_PARAMETER
);
1019 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
1020 if (ACPI_FAILURE (Status
))
1025 /* Convert and validate the handle */
1027 Node
= AcpiNsValidateHandle (ObjHandle
);
1030 Status
= AE_BAD_PARAMETER
;
1034 Status
= AcpiNsDetachData (Node
, Handler
);
1037 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
1041 ACPI_EXPORT_SYMBOL (AcpiDetachData
)
1044 /*******************************************************************************
1046 * FUNCTION: AcpiGetData
1048 * PARAMETERS: ObjHandle - Namespace node
1049 * Handler - Handler used in call to AttachData
1050 * Data - Where the data is returned
1054 * DESCRIPTION: Retrieve data that was previously attached to a namespace node.
1056 ******************************************************************************/
1060 ACPI_HANDLE ObjHandle
,
1061 ACPI_OBJECT_HANDLER Handler
,
1064 ACPI_NAMESPACE_NODE
*Node
;
1068 /* Parameter validation */
1074 return (AE_BAD_PARAMETER
);
1077 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
1078 if (ACPI_FAILURE (Status
))
1083 /* Convert and validate the handle */
1085 Node
= AcpiNsValidateHandle (ObjHandle
);
1088 Status
= AE_BAD_PARAMETER
;
1092 Status
= AcpiNsGetAttachedData (Node
, Handler
, Data
);
1095 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
1099 ACPI_EXPORT_SYMBOL (AcpiGetData
)