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 a method,
70 * terminated by NULL. May be NULL
71 * if no parameters are being passed.
72 * ReturnBuffer - Where to put the object return value (if
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 /* Get a handle here, in order to build an error message if needed */
115 TargetHandle
= Handle
;
118 Status
= AcpiGetHandle (Handle
, Pathname
, &TargetHandle
);
119 if (ACPI_FAILURE (Status
))
121 return_ACPI_STATUS (Status
);
125 FullPathname
= AcpiNsGetExternalPathname (TargetHandle
);
128 return_ACPI_STATUS (AE_NO_MEMORY
);
131 /* Evaluate the object */
133 Status
= AcpiEvaluateObject (TargetHandle
, NULL
, ExternalParams
,
135 if (ACPI_FAILURE (Status
))
140 /* Type ANY means "don't care about return value type" */
142 if (ReturnType
== ACPI_TYPE_ANY
)
147 if (ReturnBuffer
->Length
== 0)
149 /* Error because caller specifically asked for a return value */
151 ACPI_ERROR ((AE_INFO
, "%s did not return any object",
153 Status
= AE_NULL_OBJECT
;
157 /* Examine the object type returned from EvaluateObject */
159 if (((ACPI_OBJECT
*) ReturnBuffer
->Pointer
)->Type
== ReturnType
)
164 /* Return object type does not match requested type */
166 ACPI_ERROR ((AE_INFO
,
167 "Incorrect return type from %s - received [%s], requested [%s]",
169 AcpiUtGetTypeName (((ACPI_OBJECT
*) ReturnBuffer
->Pointer
)->Type
),
170 AcpiUtGetTypeName (ReturnType
)));
172 if (FreeBufferOnError
)
175 * Free a buffer created via ACPI_ALLOCATE_BUFFER.
176 * Note: We use AcpiOsFree here because AcpiOsAllocate was used
177 * to allocate the buffer. This purposefully bypasses the
178 * (optionally enabled) allocation tracking mechanism since we
179 * only want to track internal allocations.
181 AcpiOsFree (ReturnBuffer
->Pointer
);
182 ReturnBuffer
->Pointer
= NULL
;
185 ReturnBuffer
->Length
= 0;
189 ACPI_FREE (FullPathname
);
190 return_ACPI_STATUS (Status
);
193 ACPI_EXPORT_SYMBOL (AcpiEvaluateObjectTyped
)
196 /*******************************************************************************
198 * FUNCTION: AcpiEvaluateObject
200 * PARAMETERS: Handle - Object handle (optional)
201 * Pathname - Object pathname (optional)
202 * ExternalParams - List of parameters to pass to method,
203 * terminated by NULL. May be NULL
204 * if no parameters are being passed.
205 * ReturnBuffer - Where to put method's return value (if
206 * any). If NULL, no value is returned.
210 * DESCRIPTION: Find and evaluate the given object, passing the given
211 * parameters if necessary. One of "Handle" or "Pathname" must
212 * be valid (non-null)
214 ******************************************************************************/
219 ACPI_STRING Pathname
,
220 ACPI_OBJECT_LIST
*ExternalParams
,
221 ACPI_BUFFER
*ReturnBuffer
)
224 ACPI_EVALUATE_INFO
*Info
;
225 ACPI_SIZE BufferSpaceNeeded
;
229 ACPI_FUNCTION_TRACE (AcpiEvaluateObject
);
232 /* Allocate and initialize the evaluation information block */
234 Info
= ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO
));
237 return_ACPI_STATUS (AE_NO_MEMORY
);
240 /* Convert and validate the device handle */
242 Info
->PrefixNode
= AcpiNsValidateHandle (Handle
);
243 if (!Info
->PrefixNode
)
245 Status
= AE_BAD_PARAMETER
;
250 * Get the actual namespace node for the target object.
251 * Handles these cases:
253 * 1) Null node, valid pathname from root (absolute path)
254 * 2) Node and valid pathname (path relative to Node)
255 * 3) Node, Null pathname
258 (ACPI_IS_ROOT_PREFIX (Pathname
[0])))
260 /* The path is fully qualified, just evaluate by name */
262 Info
->PrefixNode
= NULL
;
267 * A handle is optional iff a fully qualified pathname is specified.
268 * Since we've already handled fully qualified names above, this is
273 ACPI_DEBUG_PRINT ((ACPI_DB_INFO
,
274 "Both Handle and Pathname are NULL"));
278 ACPI_DEBUG_PRINT ((ACPI_DB_INFO
,
279 "Null Handle with relative pathname [%s]", Pathname
));
282 Status
= AE_BAD_PARAMETER
;
286 Info
->RelativePathname
= Pathname
;
289 * Convert all external objects passed as arguments to the
290 * internal version(s).
292 if (ExternalParams
&& ExternalParams
->Count
)
294 Info
->ParamCount
= (UINT16
) ExternalParams
->Count
;
296 /* Warn on impossible argument count */
298 if (Info
->ParamCount
> ACPI_METHOD_NUM_ARGS
)
300 ACPI_WARN_PREDEFINED ((AE_INFO
, Pathname
, ACPI_WARN_ALWAYS
,
301 "Excess arguments (%u) - using only %u",
302 Info
->ParamCount
, ACPI_METHOD_NUM_ARGS
));
304 Info
->ParamCount
= ACPI_METHOD_NUM_ARGS
;
308 * Allocate a new parameter block for the internal objects
309 * Add 1 to count to allow for null terminated internal list
311 Info
->Parameters
= ACPI_ALLOCATE_ZEROED (
312 ((ACPI_SIZE
) Info
->ParamCount
+ 1) * sizeof (void *));
313 if (!Info
->Parameters
)
315 Status
= AE_NO_MEMORY
;
319 /* Convert each external object in the list to an internal object */
321 for (i
= 0; i
< Info
->ParamCount
; i
++)
323 Status
= AcpiUtCopyEobjectToIobject (
324 &ExternalParams
->Pointer
[i
], &Info
->Parameters
[i
]);
325 if (ACPI_FAILURE (Status
))
331 Info
->Parameters
[Info
->ParamCount
] = NULL
;
335 #ifdef _FUTURE_FEATURE
338 * Begin incoming argument count analysis. Check for too few args
341 switch (AcpiNsGetType (Info
->Node
))
343 case ACPI_TYPE_METHOD
:
345 /* Check incoming argument count against the method definition */
347 if (Info
->ObjDesc
->Method
.ParamCount
> Info
->ParamCount
)
349 ACPI_ERROR ((AE_INFO
,
350 "Insufficient arguments (%u) - %u are required",
352 Info
->ObjDesc
->Method
.ParamCount
));
354 Status
= AE_MISSING_ARGUMENTS
;
358 else if (Info
->ObjDesc
->Method
.ParamCount
< Info
->ParamCount
)
360 ACPI_WARNING ((AE_INFO
,
361 "Excess arguments (%u) - only %u are required",
363 Info
->ObjDesc
->Method
.ParamCount
));
365 /* Just pass the required number of arguments */
367 Info
->ParamCount
= Info
->ObjDesc
->Method
.ParamCount
;
371 * Any incoming external objects to be passed as arguments to the
372 * method must be converted to internal objects
374 if (Info
->ParamCount
)
377 * Allocate a new parameter block for the internal objects
378 * Add 1 to count to allow for null terminated internal list
380 Info
->Parameters
= ACPI_ALLOCATE_ZEROED (
381 ((ACPI_SIZE
) Info
->ParamCount
+ 1) * sizeof (void *));
382 if (!Info
->Parameters
)
384 Status
= AE_NO_MEMORY
;
388 /* Convert each external object in the list to an internal object */
390 for (i
= 0; i
< Info
->ParamCount
; i
++)
392 Status
= AcpiUtCopyEobjectToIobject (
393 &ExternalParams
->Pointer
[i
], &Info
->Parameters
[i
]);
394 if (ACPI_FAILURE (Status
))
400 Info
->Parameters
[Info
->ParamCount
] = NULL
;
406 /* Warn if arguments passed to an object that is not a method */
408 if (Info
->ParamCount
)
410 ACPI_WARNING ((AE_INFO
,
411 "%u arguments were passed to a non-method ACPI object",
420 /* Now we can evaluate the object */
422 Status
= AcpiNsEvaluate (Info
);
425 * If we are expecting a return value, and all went well above,
426 * copy the return value to an external object.
430 goto CleanupReturnObject
;
433 if (!Info
->ReturnObject
)
435 ReturnBuffer
->Length
= 0;
439 if (ACPI_GET_DESCRIPTOR_TYPE (Info
->ReturnObject
) ==
440 ACPI_DESC_TYPE_NAMED
)
443 * If we received a NS Node as a return object, this means that
444 * the object we are evaluating has nothing interesting to
445 * return (such as a mutex, etc.) We return an error because
446 * these types are essentially unsupported by this interface.
447 * We don't check up front because this makes it easier to add
448 * support for various types at a later date if necessary.
451 Info
->ReturnObject
= NULL
; /* No need to delete a NS Node */
452 ReturnBuffer
->Length
= 0;
455 if (ACPI_FAILURE (Status
))
457 goto CleanupReturnObject
;
460 /* Dereference Index and RefOf references */
462 AcpiNsResolveReferences (Info
);
464 /* Get the size of the returned object */
466 Status
= AcpiUtGetObjectSize (Info
->ReturnObject
,
468 if (ACPI_SUCCESS (Status
))
470 /* Validate/Allocate/Clear caller buffer */
472 Status
= AcpiUtInitializeBuffer (ReturnBuffer
,
474 if (ACPI_FAILURE (Status
))
477 * Caller's buffer is too small or a new one can't
480 ACPI_DEBUG_PRINT ((ACPI_DB_INFO
,
481 "Needed buffer size %X, %s\n",
482 (UINT32
) BufferSpaceNeeded
,
483 AcpiFormatException (Status
)));
487 /* We have enough space for the object, build it */
489 Status
= AcpiUtCopyIobjectToEobject (
490 Info
->ReturnObject
, ReturnBuffer
);
496 if (Info
->ReturnObject
)
499 * Delete the internal return object. NOTE: Interpreter must be
500 * locked to avoid race condition.
502 AcpiExEnterInterpreter ();
504 /* Remove one reference on the return object (should delete it) */
506 AcpiUtRemoveReference (Info
->ReturnObject
);
507 AcpiExExitInterpreter ();
513 /* Free the input parameter list (if we created one) */
515 if (Info
->Parameters
)
517 /* Free the allocated parameter block */
519 AcpiUtDeleteInternalObjectList (Info
->Parameters
);
523 return_ACPI_STATUS (Status
);
526 ACPI_EXPORT_SYMBOL (AcpiEvaluateObject
)
529 /*******************************************************************************
531 * FUNCTION: AcpiNsResolveReferences
533 * PARAMETERS: Info - Evaluation info block
535 * RETURN: Info->ReturnObject is replaced with the dereferenced object
537 * DESCRIPTION: Dereference certain reference objects. Called before an
538 * internal return object is converted to an external ACPI_OBJECT.
540 * Performs an automatic dereference of Index and RefOf reference objects.
541 * These reference objects are not supported by the ACPI_OBJECT, so this is a
542 * last resort effort to return something useful. Also, provides compatibility
543 * with other ACPI implementations.
545 * NOTE: does not handle references within returned package objects or nested
546 * references, but this support could be added later if found to be necessary.
548 ******************************************************************************/
551 AcpiNsResolveReferences (
552 ACPI_EVALUATE_INFO
*Info
)
554 ACPI_OPERAND_OBJECT
*ObjDesc
= NULL
;
555 ACPI_NAMESPACE_NODE
*Node
;
558 /* We are interested in reference objects only */
560 if ((Info
->ReturnObject
)->Common
.Type
!= ACPI_TYPE_LOCAL_REFERENCE
)
566 * Two types of references are supported - those created by Index and
567 * RefOf operators. A name reference (AML_NAMEPATH_OP) can be converted
568 * to an ACPI_OBJECT, so it is not dereferenced here. A DdbHandle
569 * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
572 switch (Info
->ReturnObject
->Reference
.Class
)
574 case ACPI_REFCLASS_INDEX
:
576 ObjDesc
= *(Info
->ReturnObject
->Reference
.Where
);
579 case ACPI_REFCLASS_REFOF
:
581 Node
= Info
->ReturnObject
->Reference
.Object
;
584 ObjDesc
= Node
->Object
;
593 /* Replace the existing reference object */
597 AcpiUtAddReference (ObjDesc
);
598 AcpiUtRemoveReference (Info
->ReturnObject
);
599 Info
->ReturnObject
= ObjDesc
;
606 /*******************************************************************************
608 * FUNCTION: AcpiWalkNamespace
610 * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
611 * StartObject - Handle in namespace where search begins
612 * MaxDepth - Depth to which search is to reach
613 * DescendingCallback - Called during tree descent
614 * when an object of "Type" is found
615 * AscendingCallback - Called during tree ascent
616 * when an object of "Type" is found
617 * Context - Passed to user function(s) above
618 * ReturnValue - Location where return value of
619 * UserFunction is put if terminated early
621 * RETURNS Return value from the UserFunction if terminated early.
622 * Otherwise, returns NULL.
624 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
625 * starting (and ending) at the object specified by StartHandle.
626 * The callback function is called whenever an object that matches
627 * the type parameter is found. If the callback function returns
628 * a non-zero value, the search is terminated immediately and this
629 * value is returned to the caller.
631 * The point of this procedure is to provide a generic namespace
632 * walk routine that can be called from multiple places to
633 * provide multiple services; the callback function(s) can be
634 * tailored to each task, whether it is a print function,
635 * a compare function, etc.
637 ******************************************************************************/
641 ACPI_OBJECT_TYPE Type
,
642 ACPI_HANDLE StartObject
,
644 ACPI_WALK_CALLBACK DescendingCallback
,
645 ACPI_WALK_CALLBACK AscendingCallback
,
652 ACPI_FUNCTION_TRACE (AcpiWalkNamespace
);
655 /* Parameter validation */
657 if ((Type
> ACPI_TYPE_LOCAL_MAX
) ||
659 (!DescendingCallback
&& !AscendingCallback
))
661 return_ACPI_STATUS (AE_BAD_PARAMETER
);
665 * Need to acquire the namespace reader lock to prevent interference
666 * with any concurrent table unloads (which causes the deletion of
667 * namespace objects). We cannot allow the deletion of a namespace node
668 * while the user function is using it. The exception to this are the
669 * nodes created and deleted during control method execution -- these
670 * nodes are marked as temporary nodes and are ignored by the namespace
671 * walk. Thus, control methods can be executed while holding the
672 * namespace deletion lock (and the user function can execute control
675 Status
= AcpiUtAcquireReadLock (&AcpiGbl_NamespaceRwLock
);
676 if (ACPI_FAILURE (Status
))
678 return_ACPI_STATUS (Status
);
682 * Lock the namespace around the walk. The namespace will be
683 * unlocked/locked around each call to the user function - since the user
684 * function must be allowed to make ACPICA calls itself (for example, it
685 * will typically execute control methods during device enumeration.)
687 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
688 if (ACPI_FAILURE (Status
))
693 /* Now we can validate the starting node */
695 if (!AcpiNsValidateHandle (StartObject
))
697 Status
= AE_BAD_PARAMETER
;
701 Status
= AcpiNsWalkNamespace (Type
, StartObject
, MaxDepth
,
702 ACPI_NS_WALK_UNLOCK
, DescendingCallback
,
703 AscendingCallback
, Context
, ReturnValue
);
706 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
709 (void) AcpiUtReleaseReadLock (&AcpiGbl_NamespaceRwLock
);
710 return_ACPI_STATUS (Status
);
713 ACPI_EXPORT_SYMBOL (AcpiWalkNamespace
)
716 /*******************************************************************************
718 * FUNCTION: AcpiNsGetDeviceCallback
720 * PARAMETERS: Callback from AcpiGetDevice
724 * DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non-
725 * present devices, or if they specified a HID, it filters based
728 ******************************************************************************/
731 AcpiNsGetDeviceCallback (
732 ACPI_HANDLE ObjHandle
,
737 ACPI_GET_DEVICES_INFO
*Info
= Context
;
739 ACPI_NAMESPACE_NODE
*Node
;
741 ACPI_PNP_DEVICE_ID
*Hid
;
742 ACPI_PNP_DEVICE_ID_LIST
*Cid
;
748 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
749 if (ACPI_FAILURE (Status
))
754 Node
= AcpiNsValidateHandle (ObjHandle
);
755 Status
= AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
756 if (ACPI_FAILURE (Status
))
763 return (AE_BAD_PARAMETER
);
767 * First, filter based on the device HID and CID.
769 * 01/2010: For this case where a specific HID is requested, we don't
770 * want to run _STA until we have an actual HID match. Thus, we will
771 * not unnecessarily execute _STA on devices for which the caller
772 * doesn't care about. Previously, _STA was executed unconditionally
773 * on all devices found here.
775 * A side-effect of this change is that now we will continue to search
776 * for a matching HID even under device trees where the parent device
777 * would have returned a _STA that indicates it is not present or
778 * not functioning (thus aborting the search on that branch).
780 if (Info
->Hid
!= NULL
)
782 Status
= AcpiUtExecute_HID (Node
, &Hid
);
783 if (Status
== AE_NOT_FOUND
)
787 else if (ACPI_FAILURE (Status
))
789 return (AE_CTRL_DEPTH
);
792 NoMatch
= strcmp (Hid
->String
, Info
->Hid
);
798 * HID does not match, attempt match within the
799 * list of Compatible IDs (CIDs)
801 Status
= AcpiUtExecute_CID (Node
, &Cid
);
802 if (Status
== AE_NOT_FOUND
)
806 else if (ACPI_FAILURE (Status
))
808 return (AE_CTRL_DEPTH
);
811 /* Walk the CID list */
814 for (i
= 0; i
< Cid
->Count
; i
++)
816 if (strcmp (Cid
->Ids
[i
].String
, Info
->Hid
) == 0)
818 /* Found a matching CID */
833 /* Run _STA to determine if device is present */
835 Status
= AcpiUtExecute_STA (Node
, &Flags
);
836 if (ACPI_FAILURE (Status
))
838 return (AE_CTRL_DEPTH
);
841 if (!(Flags
& ACPI_STA_DEVICE_PRESENT
) &&
842 !(Flags
& ACPI_STA_DEVICE_FUNCTIONING
))
845 * Don't examine the children of the device only when the
846 * device is neither present nor functional. See ACPI spec,
847 * description of _STA for more information.
849 return (AE_CTRL_DEPTH
);
852 /* We have a valid device, invoke the user function */
854 Status
= Info
->UserFunction (ObjHandle
, NestingLevel
,
855 Info
->Context
, ReturnValue
);
860 /*******************************************************************************
862 * FUNCTION: AcpiGetDevices
864 * PARAMETERS: HID - HID to search for. Can be NULL.
865 * UserFunction - Called when a matching object is found
866 * Context - Passed to user function
867 * ReturnValue - Location where return value of
868 * UserFunction is put if terminated early
870 * RETURNS Return value from the UserFunction if terminated early.
871 * Otherwise, returns NULL.
873 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
874 * starting (and ending) at the object specified by StartHandle.
875 * The UserFunction is called whenever an object of type
876 * Device is found. If the user function returns
877 * a non-zero value, the search is terminated immediately and this
878 * value is returned to the caller.
880 * This is a wrapper for WalkNamespace, but the callback performs
881 * additional filtering. Please see AcpiNsGetDeviceCallback.
883 ******************************************************************************/
888 ACPI_WALK_CALLBACK UserFunction
,
893 ACPI_GET_DEVICES_INFO Info
;
896 ACPI_FUNCTION_TRACE (AcpiGetDevices
);
899 /* Parameter validation */
903 return_ACPI_STATUS (AE_BAD_PARAMETER
);
907 * We're going to call their callback from OUR callback, so we need
908 * to know what it is, and their context parameter.
911 Info
.Context
= Context
;
912 Info
.UserFunction
= UserFunction
;
915 * Lock the namespace around the walk.
916 * The namespace will be unlocked/locked around each call
917 * to the user function - since this function
918 * must be allowed to make Acpi calls itself.
920 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
921 if (ACPI_FAILURE (Status
))
923 return_ACPI_STATUS (Status
);
926 Status
= AcpiNsWalkNamespace (ACPI_TYPE_DEVICE
, ACPI_ROOT_OBJECT
,
927 ACPI_UINT32_MAX
, ACPI_NS_WALK_UNLOCK
,
928 AcpiNsGetDeviceCallback
, NULL
, &Info
, ReturnValue
);
930 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
931 return_ACPI_STATUS (Status
);
934 ACPI_EXPORT_SYMBOL (AcpiGetDevices
)
937 /*******************************************************************************
939 * FUNCTION: AcpiAttachData
941 * PARAMETERS: ObjHandle - Namespace node
942 * Handler - Handler for this attachment
943 * Data - Pointer to data to be attached
947 * DESCRIPTION: Attach arbitrary data and handler to a namespace node.
949 ******************************************************************************/
953 ACPI_HANDLE ObjHandle
,
954 ACPI_OBJECT_HANDLER Handler
,
957 ACPI_NAMESPACE_NODE
*Node
;
961 /* Parameter validation */
967 return (AE_BAD_PARAMETER
);
970 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
971 if (ACPI_FAILURE (Status
))
976 /* Convert and validate the handle */
978 Node
= AcpiNsValidateHandle (ObjHandle
);
981 Status
= AE_BAD_PARAMETER
;
985 Status
= AcpiNsAttachData (Node
, Handler
, Data
);
988 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
992 ACPI_EXPORT_SYMBOL (AcpiAttachData
)
995 /*******************************************************************************
997 * FUNCTION: AcpiDetachData
999 * PARAMETERS: ObjHandle - Namespace node handle
1000 * Handler - Handler used in call to AcpiAttachData
1004 * DESCRIPTION: Remove data that was previously attached to a node.
1006 ******************************************************************************/
1010 ACPI_HANDLE ObjHandle
,
1011 ACPI_OBJECT_HANDLER Handler
)
1013 ACPI_NAMESPACE_NODE
*Node
;
1017 /* Parameter validation */
1022 return (AE_BAD_PARAMETER
);
1025 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
1026 if (ACPI_FAILURE (Status
))
1031 /* Convert and validate the handle */
1033 Node
= AcpiNsValidateHandle (ObjHandle
);
1036 Status
= AE_BAD_PARAMETER
;
1040 Status
= AcpiNsDetachData (Node
, Handler
);
1043 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
1047 ACPI_EXPORT_SYMBOL (AcpiDetachData
)
1050 /*******************************************************************************
1052 * FUNCTION: AcpiGetData
1054 * PARAMETERS: ObjHandle - Namespace node
1055 * Handler - Handler used in call to AttachData
1056 * Data - Where the data is returned
1060 * DESCRIPTION: Retrieve data that was previously attached to a namespace node.
1062 ******************************************************************************/
1066 ACPI_HANDLE ObjHandle
,
1067 ACPI_OBJECT_HANDLER Handler
,
1070 ACPI_NAMESPACE_NODE
*Node
;
1074 /* Parameter validation */
1080 return (AE_BAD_PARAMETER
);
1083 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
1084 if (ACPI_FAILURE (Status
))
1089 /* Convert and validate the handle */
1091 Node
= AcpiNsValidateHandle (ObjHandle
);
1094 Status
= AE_BAD_PARAMETER
;
1098 Status
= AcpiNsGetAttachedData (Node
, Handler
, Data
);
1101 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
1105 ACPI_EXPORT_SYMBOL (AcpiGetData
)