1 /*******************************************************************************
3 * Module Name: nsxfeval - Public interfaces to the ACPI subsystem
4 * ACPI Object evaluation interfaces
6 ******************************************************************************/
9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
46 #define __NSXFEVAL_C__
48 #include <contrib/dev/acpica/include/acpi.h>
49 #include <contrib/dev/acpica/include/accommon.h>
50 #include <contrib/dev/acpica/include/acnamesp.h>
51 #include <contrib/dev/acpica/include/acinterp.h>
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 MustFree = 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)
112 /* Evaluate the object */
114 Status = AcpiEvaluateObject (Handle, Pathname, 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)));
151 /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
153 AcpiOsFree (ReturnBuffer->Pointer);
154 ReturnBuffer->Pointer = NULL;
157 ReturnBuffer->Length = 0;
158 return_ACPI_STATUS (AE_TYPE);
161 ACPI_EXPORT_SYMBOL (AcpiEvaluateObjectTyped)
164 /*******************************************************************************
166 * FUNCTION: AcpiEvaluateObject
168 * PARAMETERS: Handle - Object handle (optional)
169 * Pathname - Object pathname (optional)
170 * ExternalParams - List of parameters to pass to method,
171 * terminated by NULL. May be NULL
172 * if no parameters are being passed.
173 * ReturnBuffer - Where to put method's return value (if
174 * any). If NULL, no value is returned.
178 * DESCRIPTION: Find and evaluate the given object, passing the given
179 * parameters if necessary. One of "Handle" or "Pathname" must
180 * be valid (non-null)
182 ******************************************************************************/
187 ACPI_STRING Pathname,
188 ACPI_OBJECT_LIST *ExternalParams,
189 ACPI_BUFFER *ReturnBuffer)
192 ACPI_EVALUATE_INFO *Info;
193 ACPI_SIZE BufferSpaceNeeded;
197 ACPI_FUNCTION_TRACE (AcpiEvaluateObject);
200 /* Allocate and initialize the evaluation information block */
202 Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
205 return_ACPI_STATUS (AE_NO_MEMORY);
208 /* Convert and validate the device handle */
210 Info->PrefixNode = AcpiNsValidateHandle (Handle);
211 if (!Info->PrefixNode)
213 Status = AE_BAD_PARAMETER;
218 * Get the actual namespace node for the target object.
219 * Handles these cases:
221 * 1) Null node, valid pathname from root (absolute path)
222 * 2) Node and valid pathname (path relative to Node)
223 * 3) Node, Null pathname
226 (ACPI_IS_ROOT_PREFIX (Pathname[0])))
228 /* The path is fully qualified, just evaluate by name */
230 Info->PrefixNode = NULL;
235 * A handle is optional iff a fully qualified pathname is specified.
236 * Since we've already handled fully qualified names above, this is
241 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
242 "Both Handle and Pathname are NULL"));
246 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
247 "Null Handle with relative pathname [%s]", Pathname));
250 Status = AE_BAD_PARAMETER;
254 Info->RelativePathname = Pathname;
257 * Convert all external objects passed as arguments to the
258 * internal version(s).
260 if (ExternalParams && ExternalParams->Count)
262 Info->ParamCount = (UINT16) ExternalParams->Count;
264 /* Warn on impossible argument count */
266 if (Info->ParamCount > ACPI_METHOD_NUM_ARGS)
268 ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
269 "Excess arguments (%u) - using only %u",
270 Info->ParamCount, ACPI_METHOD_NUM_ARGS));
272 Info->ParamCount = ACPI_METHOD_NUM_ARGS;
276 * Allocate a new parameter block for the internal objects
277 * Add 1 to count to allow for null terminated internal list
279 Info->Parameters = ACPI_ALLOCATE_ZEROED (
280 ((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *));
281 if (!Info->Parameters)
283 Status = AE_NO_MEMORY;
287 /* Convert each external object in the list to an internal object */
289 for (i = 0; i < Info->ParamCount; i++)
291 Status = AcpiUtCopyEobjectToIobject (
292 &ExternalParams->Pointer[i], &Info->Parameters[i]);
293 if (ACPI_FAILURE (Status))
299 Info->Parameters[Info->ParamCount] = NULL;
306 * Begin incoming argument count analysis. Check for too few args
310 switch (AcpiNsGetType (Info->Node))
312 case ACPI_TYPE_METHOD:
314 /* Check incoming argument count against the method definition */
316 if (Info->ObjDesc->Method.ParamCount > Info->ParamCount)
318 ACPI_ERROR ((AE_INFO,
319 "Insufficient arguments (%u) - %u are required",
321 Info->ObjDesc->Method.ParamCount));
323 Status = AE_MISSING_ARGUMENTS;
327 else if (Info->ObjDesc->Method.ParamCount < Info->ParamCount)
329 ACPI_WARNING ((AE_INFO,
330 "Excess arguments (%u) - only %u are required",
332 Info->ObjDesc->Method.ParamCount));
334 /* Just pass the required number of arguments */
336 Info->ParamCount = Info->ObjDesc->Method.ParamCount;
340 * Any incoming external objects to be passed as arguments to the
341 * method must be converted to internal objects
343 if (Info->ParamCount)
346 * Allocate a new parameter block for the internal objects
347 * Add 1 to count to allow for null terminated internal list
349 Info->Parameters = ACPI_ALLOCATE_ZEROED (
350 ((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *));
351 if (!Info->Parameters)
353 Status = AE_NO_MEMORY;
357 /* Convert each external object in the list to an internal object */
359 for (i = 0; i < Info->ParamCount; i++)
361 Status = AcpiUtCopyEobjectToIobject (
362 &ExternalParams->Pointer[i], &Info->Parameters[i]);
363 if (ACPI_FAILURE (Status))
369 Info->Parameters[Info->ParamCount] = NULL;
375 /* Warn if arguments passed to an object that is not a method */
377 if (Info->ParamCount)
379 ACPI_WARNING ((AE_INFO,
380 "%u arguments were passed to a non-method ACPI object",
389 /* Now we can evaluate the object */
391 Status = AcpiNsEvaluate (Info);
394 * If we are expecting a return value, and all went well above,
395 * copy the return value to an external object.
399 if (!Info->ReturnObject)
401 ReturnBuffer->Length = 0;
405 if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) ==
406 ACPI_DESC_TYPE_NAMED)
409 * If we received a NS Node as a return object, this means that
410 * the object we are evaluating has nothing interesting to
411 * return (such as a mutex, etc.) We return an error because
412 * these types are essentially unsupported by this interface.
413 * We don't check up front because this makes it easier to add
414 * support for various types at a later date if necessary.
417 Info->ReturnObject = NULL; /* No need to delete a NS Node */
418 ReturnBuffer->Length = 0;
421 if (ACPI_SUCCESS (Status))
423 /* Dereference Index and RefOf references */
425 AcpiNsResolveReferences (Info);
427 /* Get the size of the returned object */
429 Status = AcpiUtGetObjectSize (Info->ReturnObject,
431 if (ACPI_SUCCESS (Status))
433 /* Validate/Allocate/Clear caller buffer */
435 Status = AcpiUtInitializeBuffer (ReturnBuffer,
437 if (ACPI_FAILURE (Status))
440 * Caller's buffer is too small or a new one can't
443 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
444 "Needed buffer size %X, %s\n",
445 (UINT32) BufferSpaceNeeded,
446 AcpiFormatException (Status)));
450 /* We have enough space for the object, build it */
452 Status = AcpiUtCopyIobjectToEobject (Info->ReturnObject,
460 if (Info->ReturnObject)
463 * Delete the internal return object. NOTE: Interpreter must be
464 * locked to avoid race condition.
466 AcpiExEnterInterpreter ();
468 /* Remove one reference on the return object (should delete it) */
470 AcpiUtRemoveReference (Info->ReturnObject);
471 AcpiExExitInterpreter ();
477 /* Free the input parameter list (if we created one) */
479 if (Info->Parameters)
481 /* Free the allocated parameter block */
483 AcpiUtDeleteInternalObjectList (Info->Parameters);
487 return_ACPI_STATUS (Status);
490 ACPI_EXPORT_SYMBOL (AcpiEvaluateObject)
493 /*******************************************************************************
495 * FUNCTION: AcpiNsResolveReferences
497 * PARAMETERS: Info - Evaluation info block
499 * RETURN: Info->ReturnObject is replaced with the dereferenced object
501 * DESCRIPTION: Dereference certain reference objects. Called before an
502 * internal return object is converted to an external ACPI_OBJECT.
504 * Performs an automatic dereference of Index and RefOf reference objects.
505 * These reference objects are not supported by the ACPI_OBJECT, so this is a
506 * last resort effort to return something useful. Also, provides compatibility
507 * with other ACPI implementations.
509 * NOTE: does not handle references within returned package objects or nested
510 * references, but this support could be added later if found to be necessary.
512 ******************************************************************************/
515 AcpiNsResolveReferences (
516 ACPI_EVALUATE_INFO *Info)
518 ACPI_OPERAND_OBJECT *ObjDesc = NULL;
519 ACPI_NAMESPACE_NODE *Node;
522 /* We are interested in reference objects only */
524 if ((Info->ReturnObject)->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
530 * Two types of references are supported - those created by Index and
531 * RefOf operators. A name reference (AML_NAMEPATH_OP) can be converted
532 * to an ACPI_OBJECT, so it is not dereferenced here. A DdbHandle
533 * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
536 switch (Info->ReturnObject->Reference.Class)
538 case ACPI_REFCLASS_INDEX:
540 ObjDesc = *(Info->ReturnObject->Reference.Where);
543 case ACPI_REFCLASS_REFOF:
545 Node = Info->ReturnObject->Reference.Object;
548 ObjDesc = Node->Object;
557 /* Replace the existing reference object */
561 AcpiUtAddReference (ObjDesc);
562 AcpiUtRemoveReference (Info->ReturnObject);
563 Info->ReturnObject = ObjDesc;
570 /*******************************************************************************
572 * FUNCTION: AcpiWalkNamespace
574 * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
575 * StartObject - Handle in namespace where search begins
576 * MaxDepth - Depth to which search is to reach
577 * DescendingCallback - Called during tree descent
578 * when an object of "Type" is found
579 * AscendingCallback - Called during tree ascent
580 * when an object of "Type" is found
581 * Context - Passed to user function(s) above
582 * ReturnValue - Location where return value of
583 * UserFunction is put if terminated early
585 * RETURNS Return value from the UserFunction if terminated early.
586 * Otherwise, returns NULL.
588 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
589 * starting (and ending) at the object specified by StartHandle.
590 * The callback function is called whenever an object that matches
591 * the type parameter is found. If the callback function returns
592 * a non-zero value, the search is terminated immediately and this
593 * value is returned to the caller.
595 * The point of this procedure is to provide a generic namespace
596 * walk routine that can be called from multiple places to
597 * provide multiple services; the callback function(s) can be
598 * tailored to each task, whether it is a print function,
599 * a compare function, etc.
601 ******************************************************************************/
605 ACPI_OBJECT_TYPE Type,
606 ACPI_HANDLE StartObject,
608 ACPI_WALK_CALLBACK DescendingCallback,
609 ACPI_WALK_CALLBACK AscendingCallback,
616 ACPI_FUNCTION_TRACE (AcpiWalkNamespace);
619 /* Parameter validation */
621 if ((Type > ACPI_TYPE_LOCAL_MAX) ||
623 (!DescendingCallback && !AscendingCallback))
625 return_ACPI_STATUS (AE_BAD_PARAMETER);
629 * Need to acquire the namespace reader lock to prevent interference
630 * with any concurrent table unloads (which causes the deletion of
631 * namespace objects). We cannot allow the deletion of a namespace node
632 * while the user function is using it. The exception to this are the
633 * nodes created and deleted during control method execution -- these
634 * nodes are marked as temporary nodes and are ignored by the namespace
635 * walk. Thus, control methods can be executed while holding the
636 * namespace deletion lock (and the user function can execute control
639 Status = AcpiUtAcquireReadLock (&AcpiGbl_NamespaceRwLock);
640 if (ACPI_FAILURE (Status))
642 return_ACPI_STATUS (Status);
646 * Lock the namespace around the walk. The namespace will be
647 * unlocked/locked around each call to the user function - since the user
648 * function must be allowed to make ACPICA calls itself (for example, it
649 * will typically execute control methods during device enumeration.)
651 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
652 if (ACPI_FAILURE (Status))
657 /* Now we can validate the starting node */
659 if (!AcpiNsValidateHandle (StartObject))
661 Status = AE_BAD_PARAMETER;
665 Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth,
666 ACPI_NS_WALK_UNLOCK, DescendingCallback,
667 AscendingCallback, Context, ReturnValue);
670 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
673 (void) AcpiUtReleaseReadLock (&AcpiGbl_NamespaceRwLock);
674 return_ACPI_STATUS (Status);
677 ACPI_EXPORT_SYMBOL (AcpiWalkNamespace)
680 /*******************************************************************************
682 * FUNCTION: AcpiNsGetDeviceCallback
684 * PARAMETERS: Callback from AcpiGetDevice
688 * DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non-
689 * present devices, or if they specified a HID, it filters based
692 ******************************************************************************/
695 AcpiNsGetDeviceCallback (
696 ACPI_HANDLE ObjHandle,
701 ACPI_GET_DEVICES_INFO *Info = Context;
703 ACPI_NAMESPACE_NODE *Node;
705 ACPI_PNP_DEVICE_ID *Hid;
706 ACPI_PNP_DEVICE_ID_LIST *Cid;
712 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
713 if (ACPI_FAILURE (Status))
718 Node = AcpiNsValidateHandle (ObjHandle);
719 Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
720 if (ACPI_FAILURE (Status))
727 return (AE_BAD_PARAMETER);
731 * First, filter based on the device HID and CID.
733 * 01/2010: For this case where a specific HID is requested, we don't
734 * want to run _STA until we have an actual HID match. Thus, we will
735 * not unnecessarily execute _STA on devices for which the caller
736 * doesn't care about. Previously, _STA was executed unconditionally
737 * on all devices found here.
739 * A side-effect of this change is that now we will continue to search
740 * for a matching HID even under device trees where the parent device
741 * would have returned a _STA that indicates it is not present or
742 * not functioning (thus aborting the search on that branch).
744 if (Info->Hid != NULL)
746 Status = AcpiUtExecute_HID (Node, &Hid);
747 if (Status == AE_NOT_FOUND)
751 else if (ACPI_FAILURE (Status))
753 return (AE_CTRL_DEPTH);
756 NoMatch = ACPI_STRCMP (Hid->String, Info->Hid);
762 * HID does not match, attempt match within the
763 * list of Compatible IDs (CIDs)
765 Status = AcpiUtExecute_CID (Node, &Cid);
766 if (Status == AE_NOT_FOUND)
770 else if (ACPI_FAILURE (Status))
772 return (AE_CTRL_DEPTH);
775 /* Walk the CID list */
778 for (i = 0; i < Cid->Count; i++)
780 if (ACPI_STRCMP (Cid->Ids[i].String, Info->Hid) == 0)
782 /* Found a matching CID */
797 /* Run _STA to determine if device is present */
799 Status = AcpiUtExecute_STA (Node, &Flags);
800 if (ACPI_FAILURE (Status))
802 return (AE_CTRL_DEPTH);
805 if (!(Flags & ACPI_STA_DEVICE_PRESENT) &&
806 !(Flags & ACPI_STA_DEVICE_FUNCTIONING))
809 * Don't examine the children of the device only when the
810 * device is neither present nor functional. See ACPI spec,
811 * description of _STA for more information.
813 return (AE_CTRL_DEPTH);
816 /* We have a valid device, invoke the user function */
818 Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context,
824 /*******************************************************************************
826 * FUNCTION: AcpiGetDevices
828 * PARAMETERS: HID - HID to search for. Can be NULL.
829 * UserFunction - Called when a matching object is found
830 * Context - Passed to user function
831 * ReturnValue - Location where return value of
832 * UserFunction is put if terminated early
834 * RETURNS Return value from the UserFunction if terminated early.
835 * Otherwise, returns NULL.
837 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
838 * starting (and ending) at the object specified by StartHandle.
839 * The UserFunction is called whenever an object of type
840 * Device is found. If the user function returns
841 * a non-zero value, the search is terminated immediately and this
842 * value is returned to the caller.
844 * This is a wrapper for WalkNamespace, but the callback performs
845 * additional filtering. Please see AcpiNsGetDeviceCallback.
847 ******************************************************************************/
852 ACPI_WALK_CALLBACK UserFunction,
857 ACPI_GET_DEVICES_INFO Info;
860 ACPI_FUNCTION_TRACE (AcpiGetDevices);
863 /* Parameter validation */
867 return_ACPI_STATUS (AE_BAD_PARAMETER);
871 * We're going to call their callback from OUR callback, so we need
872 * to know what it is, and their context parameter.
875 Info.Context = Context;
876 Info.UserFunction = UserFunction;
879 * Lock the namespace around the walk.
880 * The namespace will be unlocked/locked around each call
881 * to the user function - since this function
882 * must be allowed to make Acpi calls itself.
884 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
885 if (ACPI_FAILURE (Status))
887 return_ACPI_STATUS (Status);
890 Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
891 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
892 AcpiNsGetDeviceCallback, NULL, &Info, ReturnValue);
894 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
895 return_ACPI_STATUS (Status);
898 ACPI_EXPORT_SYMBOL (AcpiGetDevices)
901 /*******************************************************************************
903 * FUNCTION: AcpiAttachData
905 * PARAMETERS: ObjHandle - Namespace node
906 * Handler - Handler for this attachment
907 * Data - Pointer to data to be attached
911 * DESCRIPTION: Attach arbitrary data and handler to a namespace node.
913 ******************************************************************************/
917 ACPI_HANDLE ObjHandle,
918 ACPI_OBJECT_HANDLER Handler,
921 ACPI_NAMESPACE_NODE *Node;
925 /* Parameter validation */
931 return (AE_BAD_PARAMETER);
934 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
935 if (ACPI_FAILURE (Status))
940 /* Convert and validate the handle */
942 Node = AcpiNsValidateHandle (ObjHandle);
945 Status = AE_BAD_PARAMETER;
949 Status = AcpiNsAttachData (Node, Handler, Data);
952 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
956 ACPI_EXPORT_SYMBOL (AcpiAttachData)
959 /*******************************************************************************
961 * FUNCTION: AcpiDetachData
963 * PARAMETERS: ObjHandle - Namespace node handle
964 * Handler - Handler used in call to AcpiAttachData
968 * DESCRIPTION: Remove data that was previously attached to a node.
970 ******************************************************************************/
974 ACPI_HANDLE ObjHandle,
975 ACPI_OBJECT_HANDLER Handler)
977 ACPI_NAMESPACE_NODE *Node;
981 /* Parameter validation */
986 return (AE_BAD_PARAMETER);
989 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
990 if (ACPI_FAILURE (Status))
995 /* Convert and validate the handle */
997 Node = AcpiNsValidateHandle (ObjHandle);
1000 Status = AE_BAD_PARAMETER;
1004 Status = AcpiNsDetachData (Node, Handler);
1007 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
1011 ACPI_EXPORT_SYMBOL (AcpiDetachData)
1014 /*******************************************************************************
1016 * FUNCTION: AcpiGetData
1018 * PARAMETERS: ObjHandle - Namespace node
1019 * Handler - Handler used in call to AttachData
1020 * Data - Where the data is returned
1024 * DESCRIPTION: Retrieve data that was previously attached to a namespace node.
1026 ******************************************************************************/
1030 ACPI_HANDLE ObjHandle,
1031 ACPI_OBJECT_HANDLER Handler,
1034 ACPI_NAMESPACE_NODE *Node;
1038 /* Parameter validation */
1044 return (AE_BAD_PARAMETER);
1047 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
1048 if (ACPI_FAILURE (Status))
1053 /* Convert and validate the handle */
1055 Node = AcpiNsValidateHandle (ObjHandle);
1058 Status = AE_BAD_PARAMETER;
1062 Status = AcpiNsGetAttachedData (Node, Handler, Data);
1065 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
1069 ACPI_EXPORT_SYMBOL (AcpiGetData)