1 /*******************************************************************************
3 * Module Name: nsxfeval - Public interfaces to the ACPI subsystem
4 * ACPI Object evaluation interfaces
6 ******************************************************************************/
9 * Copyright (C) 2000 - 2014, 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 __NSXFEVAL_C__
46 #define EXPORT_ACPI_INTERFACES
54 #define _COMPONENT ACPI_NAMESPACE
55 ACPI_MODULE_NAME ("nsxfeval")
57 /* Local prototypes */
60 AcpiNsResolveReferences (
61 ACPI_EVALUATE_INFO *Info);
64 /*******************************************************************************
66 * FUNCTION: AcpiEvaluateObjectTyped
68 * PARAMETERS: Handle - Object handle (optional)
69 * Pathname - Object pathname (optional)
70 * ExternalParams - List of parameters to pass to method,
71 * terminated by NULL. May be NULL
72 * if no parameters are being passed.
73 * ReturnBuffer - Where to put method's return value (if
74 * any). If NULL, no value is returned.
75 * ReturnType - Expected type of return object
79 * DESCRIPTION: Find and evaluate the given object, passing the given
80 * parameters if necessary. One of "Handle" or "Pathname" must
83 ******************************************************************************/
86 AcpiEvaluateObjectTyped (
89 ACPI_OBJECT_LIST *ExternalParams,
90 ACPI_BUFFER *ReturnBuffer,
91 ACPI_OBJECT_TYPE ReturnType)
94 BOOLEAN FreeBufferOnError = FALSE;
97 ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped);
100 /* Return buffer must be valid */
104 return_ACPI_STATUS (AE_BAD_PARAMETER);
107 if (ReturnBuffer->Length == ACPI_ALLOCATE_BUFFER)
109 FreeBufferOnError = TRUE;
112 /* Evaluate the object */
114 Status = AcpiEvaluateObject (Handle, Pathname,
115 ExternalParams, ReturnBuffer);
116 if (ACPI_FAILURE (Status))
118 return_ACPI_STATUS (Status);
121 /* Type ANY means "don't care" */
123 if (ReturnType == ACPI_TYPE_ANY)
125 return_ACPI_STATUS (AE_OK);
128 if (ReturnBuffer->Length == 0)
130 /* Error because caller specifically asked for a return value */
132 ACPI_ERROR ((AE_INFO, "No return value"));
133 return_ACPI_STATUS (AE_NULL_OBJECT);
136 /* Examine the object type returned from EvaluateObject */
138 if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType)
140 return_ACPI_STATUS (AE_OK);
143 /* Return object type does not match requested type */
145 ACPI_ERROR ((AE_INFO,
146 "Incorrect return type [%s] requested [%s]",
147 AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type),
148 AcpiUtGetTypeName (ReturnType)));
150 if (FreeBufferOnError)
153 * Free a buffer created via ACPI_ALLOCATE_BUFFER.
154 * Note: We use AcpiOsFree here because AcpiOsAllocate was used
155 * to allocate the buffer. This purposefully bypasses the
156 * (optionally enabled) allocation tracking mechanism since we
157 * only want to track internal allocations.
159 AcpiOsFree (ReturnBuffer->Pointer);
160 ReturnBuffer->Pointer = NULL;
163 ReturnBuffer->Length = 0;
164 return_ACPI_STATUS (AE_TYPE);
167 ACPI_EXPORT_SYMBOL (AcpiEvaluateObjectTyped)
170 /*******************************************************************************
172 * FUNCTION: AcpiEvaluateObject
174 * PARAMETERS: Handle - Object handle (optional)
175 * Pathname - Object pathname (optional)
176 * ExternalParams - List of parameters to pass to method,
177 * terminated by NULL. May be NULL
178 * if no parameters are being passed.
179 * ReturnBuffer - Where to put method's return value (if
180 * any). If NULL, no value is returned.
184 * DESCRIPTION: Find and evaluate the given object, passing the given
185 * parameters if necessary. One of "Handle" or "Pathname" must
186 * be valid (non-null)
188 ******************************************************************************/
193 ACPI_STRING Pathname,
194 ACPI_OBJECT_LIST *ExternalParams,
195 ACPI_BUFFER *ReturnBuffer)
198 ACPI_EVALUATE_INFO *Info;
199 ACPI_SIZE BufferSpaceNeeded;
203 ACPI_FUNCTION_TRACE (AcpiEvaluateObject);
206 /* Allocate and initialize the evaluation information block */
208 Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
211 return_ACPI_STATUS (AE_NO_MEMORY);
214 /* Convert and validate the device handle */
216 Info->PrefixNode = AcpiNsValidateHandle (Handle);
217 if (!Info->PrefixNode)
219 Status = AE_BAD_PARAMETER;
224 * Get the actual namespace node for the target object.
225 * Handles these cases:
227 * 1) Null node, valid pathname from root (absolute path)
228 * 2) Node and valid pathname (path relative to Node)
229 * 3) Node, Null pathname
232 (ACPI_IS_ROOT_PREFIX (Pathname[0])))
234 /* The path is fully qualified, just evaluate by name */
236 Info->PrefixNode = NULL;
241 * A handle is optional iff a fully qualified pathname is specified.
242 * Since we've already handled fully qualified names above, this is
247 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
248 "Both Handle and Pathname are NULL"));
252 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
253 "Null Handle with relative pathname [%s]", Pathname));
256 Status = AE_BAD_PARAMETER;
260 Info->RelativePathname = Pathname;
263 * Convert all external objects passed as arguments to the
264 * internal version(s).
266 if (ExternalParams && ExternalParams->Count)
268 Info->ParamCount = (UINT16) ExternalParams->Count;
270 /* Warn on impossible argument count */
272 if (Info->ParamCount > ACPI_METHOD_NUM_ARGS)
274 ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
275 "Excess arguments (%u) - using only %u",
276 Info->ParamCount, ACPI_METHOD_NUM_ARGS));
278 Info->ParamCount = ACPI_METHOD_NUM_ARGS;
282 * Allocate a new parameter block for the internal objects
283 * Add 1 to count to allow for null terminated internal list
285 Info->Parameters = ACPI_ALLOCATE_ZEROED (
286 ((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *));
287 if (!Info->Parameters)
289 Status = AE_NO_MEMORY;
293 /* Convert each external object in the list to an internal object */
295 for (i = 0; i < Info->ParamCount; i++)
297 Status = AcpiUtCopyEobjectToIobject (
298 &ExternalParams->Pointer[i], &Info->Parameters[i]);
299 if (ACPI_FAILURE (Status))
305 Info->Parameters[Info->ParamCount] = NULL;
312 * Begin incoming argument count analysis. Check for too few args
316 switch (AcpiNsGetType (Info->Node))
318 case ACPI_TYPE_METHOD:
320 /* Check incoming argument count against the method definition */
322 if (Info->ObjDesc->Method.ParamCount > Info->ParamCount)
324 ACPI_ERROR ((AE_INFO,
325 "Insufficient arguments (%u) - %u are required",
327 Info->ObjDesc->Method.ParamCount));
329 Status = AE_MISSING_ARGUMENTS;
333 else if (Info->ObjDesc->Method.ParamCount < Info->ParamCount)
335 ACPI_WARNING ((AE_INFO,
336 "Excess arguments (%u) - only %u are required",
338 Info->ObjDesc->Method.ParamCount));
340 /* Just pass the required number of arguments */
342 Info->ParamCount = Info->ObjDesc->Method.ParamCount;
346 * Any incoming external objects to be passed as arguments to the
347 * method must be converted to internal objects
349 if (Info->ParamCount)
352 * Allocate a new parameter block for the internal objects
353 * Add 1 to count to allow for null terminated internal list
355 Info->Parameters = ACPI_ALLOCATE_ZEROED (
356 ((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *));
357 if (!Info->Parameters)
359 Status = AE_NO_MEMORY;
363 /* Convert each external object in the list to an internal object */
365 for (i = 0; i < Info->ParamCount; i++)
367 Status = AcpiUtCopyEobjectToIobject (
368 &ExternalParams->Pointer[i], &Info->Parameters[i]);
369 if (ACPI_FAILURE (Status))
375 Info->Parameters[Info->ParamCount] = NULL;
381 /* Warn if arguments passed to an object that is not a method */
383 if (Info->ParamCount)
385 ACPI_WARNING ((AE_INFO,
386 "%u arguments were passed to a non-method ACPI object",
395 /* Now we can evaluate the object */
397 Status = AcpiNsEvaluate (Info);
400 * If we are expecting a return value, and all went well above,
401 * copy the return value to an external object.
405 if (!Info->ReturnObject)
407 ReturnBuffer->Length = 0;
411 if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) ==
412 ACPI_DESC_TYPE_NAMED)
415 * If we received a NS Node as a return object, this means that
416 * the object we are evaluating has nothing interesting to
417 * return (such as a mutex, etc.) We return an error because
418 * these types are essentially unsupported by this interface.
419 * We don't check up front because this makes it easier to add
420 * support for various types at a later date if necessary.
423 Info->ReturnObject = NULL; /* No need to delete a NS Node */
424 ReturnBuffer->Length = 0;
427 if (ACPI_SUCCESS (Status))
429 /* Dereference Index and RefOf references */
431 AcpiNsResolveReferences (Info);
433 /* Get the size of the returned object */
435 Status = AcpiUtGetObjectSize (Info->ReturnObject,
437 if (ACPI_SUCCESS (Status))
439 /* Validate/Allocate/Clear caller buffer */
441 Status = AcpiUtInitializeBuffer (ReturnBuffer,
443 if (ACPI_FAILURE (Status))
446 * Caller's buffer is too small or a new one can't
449 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
450 "Needed buffer size %X, %s\n",
451 (UINT32) BufferSpaceNeeded,
452 AcpiFormatException (Status)));
456 /* We have enough space for the object, build it */
458 Status = AcpiUtCopyIobjectToEobject (Info->ReturnObject,
466 if (Info->ReturnObject)
469 * Delete the internal return object. NOTE: Interpreter must be
470 * locked to avoid race condition.
472 AcpiExEnterInterpreter ();
474 /* Remove one reference on the return object (should delete it) */
476 AcpiUtRemoveReference (Info->ReturnObject);
477 AcpiExExitInterpreter ();
483 /* Free the input parameter list (if we created one) */
485 if (Info->Parameters)
487 /* Free the allocated parameter block */
489 AcpiUtDeleteInternalObjectList (Info->Parameters);
493 return_ACPI_STATUS (Status);
496 ACPI_EXPORT_SYMBOL (AcpiEvaluateObject)
499 /*******************************************************************************
501 * FUNCTION: AcpiNsResolveReferences
503 * PARAMETERS: Info - Evaluation info block
505 * RETURN: Info->ReturnObject is replaced with the dereferenced object
507 * DESCRIPTION: Dereference certain reference objects. Called before an
508 * internal return object is converted to an external ACPI_OBJECT.
510 * Performs an automatic dereference of Index and RefOf reference objects.
511 * These reference objects are not supported by the ACPI_OBJECT, so this is a
512 * last resort effort to return something useful. Also, provides compatibility
513 * with other ACPI implementations.
515 * NOTE: does not handle references within returned package objects or nested
516 * references, but this support could be added later if found to be necessary.
518 ******************************************************************************/
521 AcpiNsResolveReferences (
522 ACPI_EVALUATE_INFO *Info)
524 ACPI_OPERAND_OBJECT *ObjDesc = NULL;
525 ACPI_NAMESPACE_NODE *Node;
528 /* We are interested in reference objects only */
530 if ((Info->ReturnObject)->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
536 * Two types of references are supported - those created by Index and
537 * RefOf operators. A name reference (AML_NAMEPATH_OP) can be converted
538 * to an ACPI_OBJECT, so it is not dereferenced here. A DdbHandle
539 * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
542 switch (Info->ReturnObject->Reference.Class)
544 case ACPI_REFCLASS_INDEX:
546 ObjDesc = *(Info->ReturnObject->Reference.Where);
549 case ACPI_REFCLASS_REFOF:
551 Node = Info->ReturnObject->Reference.Object;
554 ObjDesc = Node->Object;
563 /* Replace the existing reference object */
567 AcpiUtAddReference (ObjDesc);
568 AcpiUtRemoveReference (Info->ReturnObject);
569 Info->ReturnObject = ObjDesc;
576 /*******************************************************************************
578 * FUNCTION: AcpiWalkNamespace
580 * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
581 * StartObject - Handle in namespace where search begins
582 * MaxDepth - Depth to which search is to reach
583 * DescendingCallback - Called during tree descent
584 * when an object of "Type" is found
585 * AscendingCallback - Called during tree ascent
586 * when an object of "Type" is found
587 * Context - Passed to user function(s) above
588 * ReturnValue - Location where return value of
589 * UserFunction is put if terminated early
591 * RETURNS Return value from the UserFunction if terminated early.
592 * Otherwise, returns NULL.
594 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
595 * starting (and ending) at the object specified by StartHandle.
596 * The callback function is called whenever an object that matches
597 * the type parameter is found. If the callback function returns
598 * a non-zero value, the search is terminated immediately and this
599 * value is returned to the caller.
601 * The point of this procedure is to provide a generic namespace
602 * walk routine that can be called from multiple places to
603 * provide multiple services; the callback function(s) can be
604 * tailored to each task, whether it is a print function,
605 * a compare function, etc.
607 ******************************************************************************/
611 ACPI_OBJECT_TYPE Type,
612 ACPI_HANDLE StartObject,
614 ACPI_WALK_CALLBACK DescendingCallback,
615 ACPI_WALK_CALLBACK AscendingCallback,
622 ACPI_FUNCTION_TRACE (AcpiWalkNamespace);
625 /* Parameter validation */
627 if ((Type > ACPI_TYPE_LOCAL_MAX) ||
629 (!DescendingCallback && !AscendingCallback))
631 return_ACPI_STATUS (AE_BAD_PARAMETER);
635 * Need to acquire the namespace reader lock to prevent interference
636 * with any concurrent table unloads (which causes the deletion of
637 * namespace objects). We cannot allow the deletion of a namespace node
638 * while the user function is using it. The exception to this are the
639 * nodes created and deleted during control method execution -- these
640 * nodes are marked as temporary nodes and are ignored by the namespace
641 * walk. Thus, control methods can be executed while holding the
642 * namespace deletion lock (and the user function can execute control
645 Status = AcpiUtAcquireReadLock (&AcpiGbl_NamespaceRwLock);
646 if (ACPI_FAILURE (Status))
648 return_ACPI_STATUS (Status);
652 * Lock the namespace around the walk. The namespace will be
653 * unlocked/locked around each call to the user function - since the user
654 * function must be allowed to make ACPICA calls itself (for example, it
655 * will typically execute control methods during device enumeration.)
657 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
658 if (ACPI_FAILURE (Status))
663 /* Now we can validate the starting node */
665 if (!AcpiNsValidateHandle (StartObject))
667 Status = AE_BAD_PARAMETER;
671 Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth,
672 ACPI_NS_WALK_UNLOCK, DescendingCallback,
673 AscendingCallback, Context, ReturnValue);
676 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
679 (void) AcpiUtReleaseReadLock (&AcpiGbl_NamespaceRwLock);
680 return_ACPI_STATUS (Status);
683 ACPI_EXPORT_SYMBOL (AcpiWalkNamespace)
686 /*******************************************************************************
688 * FUNCTION: AcpiNsGetDeviceCallback
690 * PARAMETERS: Callback from AcpiGetDevice
694 * DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non-
695 * present devices, or if they specified a HID, it filters based
698 ******************************************************************************/
701 AcpiNsGetDeviceCallback (
702 ACPI_HANDLE ObjHandle,
707 ACPI_GET_DEVICES_INFO *Info = Context;
709 ACPI_NAMESPACE_NODE *Node;
711 ACPI_PNP_DEVICE_ID *Hid;
712 ACPI_PNP_DEVICE_ID_LIST *Cid;
718 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
719 if (ACPI_FAILURE (Status))
724 Node = AcpiNsValidateHandle (ObjHandle);
725 Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
726 if (ACPI_FAILURE (Status))
733 return (AE_BAD_PARAMETER);
737 * First, filter based on the device HID and CID.
739 * 01/2010: For this case where a specific HID is requested, we don't
740 * want to run _STA until we have an actual HID match. Thus, we will
741 * not unnecessarily execute _STA on devices for which the caller
742 * doesn't care about. Previously, _STA was executed unconditionally
743 * on all devices found here.
745 * A side-effect of this change is that now we will continue to search
746 * for a matching HID even under device trees where the parent device
747 * would have returned a _STA that indicates it is not present or
748 * not functioning (thus aborting the search on that branch).
750 if (Info->Hid != NULL)
752 Status = AcpiUtExecute_HID (Node, &Hid);
753 if (Status == AE_NOT_FOUND)
757 else if (ACPI_FAILURE (Status))
759 return (AE_CTRL_DEPTH);
762 NoMatch = ACPI_STRCMP (Hid->String, Info->Hid);
768 * HID does not match, attempt match within the
769 * list of Compatible IDs (CIDs)
771 Status = AcpiUtExecute_CID (Node, &Cid);
772 if (Status == AE_NOT_FOUND)
776 else if (ACPI_FAILURE (Status))
778 return (AE_CTRL_DEPTH);
781 /* Walk the CID list */
784 for (i = 0; i < Cid->Count; i++)
786 if (ACPI_STRCMP (Cid->Ids[i].String, Info->Hid) == 0)
788 /* Found a matching CID */
803 /* Run _STA to determine if device is present */
805 Status = AcpiUtExecute_STA (Node, &Flags);
806 if (ACPI_FAILURE (Status))
808 return (AE_CTRL_DEPTH);
811 if (!(Flags & ACPI_STA_DEVICE_PRESENT) &&
812 !(Flags & ACPI_STA_DEVICE_FUNCTIONING))
815 * Don't examine the children of the device only when the
816 * device is neither present nor functional. See ACPI spec,
817 * description of _STA for more information.
819 return (AE_CTRL_DEPTH);
822 /* We have a valid device, invoke the user function */
824 Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context,
830 /*******************************************************************************
832 * FUNCTION: AcpiGetDevices
834 * PARAMETERS: HID - HID to search for. Can be NULL.
835 * UserFunction - Called when a matching object is found
836 * Context - Passed to user function
837 * ReturnValue - Location where return value of
838 * UserFunction is put if terminated early
840 * RETURNS Return value from the UserFunction if terminated early.
841 * Otherwise, returns NULL.
843 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
844 * starting (and ending) at the object specified by StartHandle.
845 * The UserFunction is called whenever an object of type
846 * Device is found. If the user function returns
847 * a non-zero value, the search is terminated immediately and this
848 * value is returned to the caller.
850 * This is a wrapper for WalkNamespace, but the callback performs
851 * additional filtering. Please see AcpiNsGetDeviceCallback.
853 ******************************************************************************/
858 ACPI_WALK_CALLBACK UserFunction,
863 ACPI_GET_DEVICES_INFO Info;
866 ACPI_FUNCTION_TRACE (AcpiGetDevices);
869 /* Parameter validation */
873 return_ACPI_STATUS (AE_BAD_PARAMETER);
877 * We're going to call their callback from OUR callback, so we need
878 * to know what it is, and their context parameter.
881 Info.Context = Context;
882 Info.UserFunction = UserFunction;
885 * Lock the namespace around the walk.
886 * The namespace will be unlocked/locked around each call
887 * to the user function - since this function
888 * must be allowed to make Acpi calls itself.
890 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
891 if (ACPI_FAILURE (Status))
893 return_ACPI_STATUS (Status);
896 Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
897 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
898 AcpiNsGetDeviceCallback, NULL, &Info, ReturnValue);
900 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
901 return_ACPI_STATUS (Status);
904 ACPI_EXPORT_SYMBOL (AcpiGetDevices)
907 /*******************************************************************************
909 * FUNCTION: AcpiAttachData
911 * PARAMETERS: ObjHandle - Namespace node
912 * Handler - Handler for this attachment
913 * Data - Pointer to data to be attached
917 * DESCRIPTION: Attach arbitrary data and handler to a namespace node.
919 ******************************************************************************/
923 ACPI_HANDLE ObjHandle,
924 ACPI_OBJECT_HANDLER Handler,
927 ACPI_NAMESPACE_NODE *Node;
931 /* Parameter validation */
937 return (AE_BAD_PARAMETER);
940 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
941 if (ACPI_FAILURE (Status))
946 /* Convert and validate the handle */
948 Node = AcpiNsValidateHandle (ObjHandle);
951 Status = AE_BAD_PARAMETER;
955 Status = AcpiNsAttachData (Node, Handler, Data);
958 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
962 ACPI_EXPORT_SYMBOL (AcpiAttachData)
965 /*******************************************************************************
967 * FUNCTION: AcpiDetachData
969 * PARAMETERS: ObjHandle - Namespace node handle
970 * Handler - Handler used in call to AcpiAttachData
974 * DESCRIPTION: Remove data that was previously attached to a node.
976 ******************************************************************************/
980 ACPI_HANDLE ObjHandle,
981 ACPI_OBJECT_HANDLER Handler)
983 ACPI_NAMESPACE_NODE *Node;
987 /* Parameter validation */
992 return (AE_BAD_PARAMETER);
995 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
996 if (ACPI_FAILURE (Status))
1001 /* Convert and validate the handle */
1003 Node = AcpiNsValidateHandle (ObjHandle);
1006 Status = AE_BAD_PARAMETER;
1010 Status = AcpiNsDetachData (Node, Handler);
1013 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
1017 ACPI_EXPORT_SYMBOL (AcpiDetachData)
1020 /*******************************************************************************
1022 * FUNCTION: AcpiGetData
1024 * PARAMETERS: ObjHandle - Namespace node
1025 * Handler - Handler used in call to AttachData
1026 * Data - Where the data is returned
1030 * DESCRIPTION: Retrieve data that was previously attached to a namespace node.
1032 ******************************************************************************/
1036 ACPI_HANDLE ObjHandle,
1037 ACPI_OBJECT_HANDLER Handler,
1040 ACPI_NAMESPACE_NODE *Node;
1044 /* Parameter validation */
1050 return (AE_BAD_PARAMETER);
1053 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
1054 if (ACPI_FAILURE (Status))
1059 /* Convert and validate the handle */
1061 Node = AcpiNsValidateHandle (ObjHandle);
1064 Status = AE_BAD_PARAMETER;
1068 Status = AcpiNsGetAttachedData (Node, Handler, Data);
1071 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
1075 ACPI_EXPORT_SYMBOL (AcpiGetData)