167754Smsmith/*******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: nsobject - Utilities for objects attached to namespace
467754Smsmith *                         table entries
567754Smsmith *
667754Smsmith ******************************************************************************/
767754Smsmith
8217365Sjkim/*
9306536Sjkim * Copyright (C) 2000 - 2016, Intel Corp.
1070243Smsmith * All rights reserved.
1167754Smsmith *
12217365Sjkim * Redistribution and use in source and binary forms, with or without
13217365Sjkim * modification, are permitted provided that the following conditions
14217365Sjkim * are met:
15217365Sjkim * 1. Redistributions of source code must retain the above copyright
16217365Sjkim *    notice, this list of conditions, and the following disclaimer,
17217365Sjkim *    without modification.
18217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
20217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
21217365Sjkim *    including a substantially similar Disclaimer requirement for further
22217365Sjkim *    binary redistribution.
23217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
24217365Sjkim *    of any contributors may be used to endorse or promote products derived
25217365Sjkim *    from this software without specific prior written permission.
2667754Smsmith *
27217365Sjkim * Alternatively, this software may be distributed under the terms of the
28217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
29217365Sjkim * Software Foundation.
3067754Smsmith *
31217365Sjkim * NO WARRANTY
32217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42217365Sjkim * POSSIBILITY OF SUCH DAMAGES.
43217365Sjkim */
4467754Smsmith
45193341Sjkim#include <contrib/dev/acpica/include/acpi.h>
46193341Sjkim#include <contrib/dev/acpica/include/accommon.h>
47193341Sjkim#include <contrib/dev/acpica/include/acnamesp.h>
4867754Smsmith
4967754Smsmith
5077424Smsmith#define _COMPONENT          ACPI_NAMESPACE
5191116Smsmith        ACPI_MODULE_NAME    ("nsobject")
5267754Smsmith
5367754Smsmith
5467754Smsmith/*******************************************************************************
5567754Smsmith *
5667754Smsmith * FUNCTION:    AcpiNsAttachObject
5767754Smsmith *
5882367Smsmith * PARAMETERS:  Node                - Parent Node
5967754Smsmith *              Object              - Object to be attached
6067754Smsmith *              Type                - Type of object, or ACPI_TYPE_ANY if not
6182367Smsmith *                                    known
6267754Smsmith *
63151937Sjkim * RETURN:      Status
64151937Sjkim *
6567754Smsmith * DESCRIPTION: Record the given object as the value associated with the
66241973Sjkim *              name whose ACPI_HANDLE is passed. If Object is NULL
6767754Smsmith *              and Type is ACPI_TYPE_ANY, set the name as having no value.
6887031Smsmith *              Note: Future may require that the Node->Flags field be passed
6987031Smsmith *              as a parameter.
7067754Smsmith *
7167754Smsmith * MUTEX:       Assumes namespace is locked
7267754Smsmith *
7367754Smsmith ******************************************************************************/
7467754Smsmith
7567754SmsmithACPI_STATUS
7667754SmsmithAcpiNsAttachObject (
7767754Smsmith    ACPI_NAMESPACE_NODE     *Node,
7867754Smsmith    ACPI_OPERAND_OBJECT     *Object,
7991116Smsmith    ACPI_OBJECT_TYPE        Type)
8067754Smsmith{
8167754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
8287031Smsmith    ACPI_OPERAND_OBJECT     *LastObjDesc;
8391116Smsmith    ACPI_OBJECT_TYPE        ObjectType = ACPI_TYPE_ANY;
8467754Smsmith
8567754Smsmith
86167802Sjkim    ACPI_FUNCTION_TRACE (NsAttachObject);
8767754Smsmith
8867754Smsmith
8967754Smsmith    /*
9067754Smsmith     * Parameter validation
9167754Smsmith     */
9267754Smsmith    if (!Node)
9367754Smsmith    {
9467754Smsmith        /* Invalid handle */
9567754Smsmith
96167802Sjkim        ACPI_ERROR ((AE_INFO, "Null NamedObj handle"));
9767754Smsmith        return_ACPI_STATUS (AE_BAD_PARAMETER);
9867754Smsmith    }
9967754Smsmith
10067754Smsmith    if (!Object && (ACPI_TYPE_ANY != Type))
10167754Smsmith    {
10267754Smsmith        /* Null object */
10367754Smsmith
104167802Sjkim        ACPI_ERROR ((AE_INFO,
105167802Sjkim            "Null object, but type not ACPI_TYPE_ANY"));
10667754Smsmith        return_ACPI_STATUS (AE_BAD_PARAMETER);
10767754Smsmith    }
10867754Smsmith
10991116Smsmith    if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
11067754Smsmith    {
11167754Smsmith        /* Not a name handle */
11267754Smsmith
113167802Sjkim        ACPI_ERROR ((AE_INFO, "Invalid handle %p [%s]",
114167802Sjkim            Node, AcpiUtGetDescriptorName (Node)));
11567754Smsmith        return_ACPI_STATUS (AE_BAD_PARAMETER);
11667754Smsmith    }
11767754Smsmith
11867754Smsmith    /* Check if this object is already attached */
11967754Smsmith
12067754Smsmith    if (Node->Object == Object)
12167754Smsmith    {
122151937Sjkim        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
123151937Sjkim            "Obj %p already installed in NameObj %p\n",
12467754Smsmith            Object, Node));
12567754Smsmith
12667754Smsmith        return_ACPI_STATUS (AE_OK);
12767754Smsmith    }
12867754Smsmith
12967754Smsmith    /* If null object, we will just install it */
13067754Smsmith
13167754Smsmith    if (!Object)
13267754Smsmith    {
13387031Smsmith        ObjDesc    = NULL;
13487031Smsmith        ObjectType = ACPI_TYPE_ANY;
13567754Smsmith    }
13667754Smsmith
13767754Smsmith    /*
13884491Smsmith     * If the source object is a namespace Node with an attached object,
13967754Smsmith     * we will use that (attached) object
14067754Smsmith     */
14191116Smsmith    else if ((ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) &&
14267754Smsmith            ((ACPI_NAMESPACE_NODE *) Object)->Object)
14367754Smsmith    {
14467754Smsmith        /*
14567754Smsmith         * Value passed is a name handle and that name has a
146241973Sjkim         * non-null value. Use that name's value and type.
14767754Smsmith         */
148306536Sjkim        ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object;
14987031Smsmith        ObjectType = ((ACPI_NAMESPACE_NODE *) Object)->Type;
15067754Smsmith    }
15167754Smsmith
15267754Smsmith    /*
15367754Smsmith     * Otherwise, we will use the parameter object, but we must type
15467754Smsmith     * it first
15567754Smsmith     */
15667754Smsmith    else
15767754Smsmith    {
15867754Smsmith        ObjDesc = (ACPI_OPERAND_OBJECT  *) Object;
15967754Smsmith
160107325Siwasaki        /* Use the given type */
16167754Smsmith
162107325Siwasaki        ObjectType = Type;
16367754Smsmith    }
16467754Smsmith
16582367Smsmith    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
166123315Snjl        ObjDesc, Node, AcpiUtGetNodeName (Node)));
16767754Smsmith
16887031Smsmith    /* Detach an existing attached object if present */
16967754Smsmith
17087031Smsmith    if (Node->Object)
17187031Smsmith    {
17287031Smsmith        AcpiNsDetachObject (Node);
17387031Smsmith    }
17467754Smsmith
17599679Siwasaki    if (ObjDesc)
17667754Smsmith    {
17799679Siwasaki        /*
17899679Siwasaki         * Must increment the new value's reference count
17999679Siwasaki         * (if it is an internal object)
18099679Siwasaki         */
18199679Siwasaki        AcpiUtAddReference (ObjDesc);
18267754Smsmith
18399679Siwasaki        /*
18499679Siwasaki         * Handle objects with multiple descriptors - walk
18599679Siwasaki         * to the end of the descriptor list
18699679Siwasaki         */
18799679Siwasaki        LastObjDesc = ObjDesc;
18899679Siwasaki        while (LastObjDesc->Common.NextObject)
18999679Siwasaki        {
19099679Siwasaki            LastObjDesc = LastObjDesc->Common.NextObject;
19199679Siwasaki        }
19267754Smsmith
19399679Siwasaki        /* Install the object at the front of the object list */
19467754Smsmith
19599679Siwasaki        LastObjDesc->Common.NextObject = Node->Object;
19699679Siwasaki    }
19799679Siwasaki
198306536Sjkim    Node->Type = (UINT8) ObjectType;
199306536Sjkim    Node->Object = ObjDesc;
20067754Smsmith
20167754Smsmith    return_ACPI_STATUS (AE_OK);
20267754Smsmith}
20367754Smsmith
20467754Smsmith
20567754Smsmith/*******************************************************************************
20667754Smsmith *
20767754Smsmith * FUNCTION:    AcpiNsDetachObject
20867754Smsmith *
209151937Sjkim * PARAMETERS:  Node           - A Namespace node whose object will be detached
21067754Smsmith *
21167754Smsmith * RETURN:      None.
21267754Smsmith *
213114237Snjl * DESCRIPTION: Detach/delete an object associated with a namespace node.
214107325Siwasaki *              if the object is an allocated object, it is freed.
215107325Siwasaki *              Otherwise, the field is simply cleared.
21667754Smsmith *
21767754Smsmith ******************************************************************************/
21867754Smsmith
21967754Smsmithvoid
22067754SmsmithAcpiNsDetachObject (
22167754Smsmith    ACPI_NAMESPACE_NODE     *Node)
22267754Smsmith{
22367754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
22467754Smsmith
22567754Smsmith
226167802Sjkim    ACPI_FUNCTION_TRACE (NsDetachObject);
22767754Smsmith
22883174Smsmith
22967754Smsmith    ObjDesc = Node->Object;
23099679Siwasaki
23199679Siwasaki    if (!ObjDesc ||
232193267Sjkim        (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA))
23367754Smsmith    {
23467754Smsmith        return_VOID;
23567754Smsmith    }
23667754Smsmith
237193267Sjkim    if (Node->Flags & ANOBJ_ALLOCATED_BUFFER)
238193267Sjkim    {
239193267Sjkim        /* Free the dynamic aml buffer */
240193267Sjkim
241193267Sjkim        if (ObjDesc->Common.Type == ACPI_TYPE_METHOD)
242193267Sjkim        {
243193267Sjkim            ACPI_FREE (ObjDesc->Method.AmlStart);
244193267Sjkim        }
245193267Sjkim    }
246193267Sjkim
247281075Sdim    /* Clear the Node entry in all cases */
24867754Smsmith
24967754Smsmith    Node->Object = NULL;
25099679Siwasaki    if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
25187031Smsmith    {
252281075Sdim        /* Unlink object from front of possible object list */
253281075Sdim
25487031Smsmith        Node->Object = ObjDesc->Common.NextObject;
255281075Sdim
256281075Sdim        /* Handle possible 2-descriptor object */
257281075Sdim
25887031Smsmith        if (Node->Object &&
259281075Sdim           (Node->Object->Common.Type != ACPI_TYPE_LOCAL_DATA))
26087031Smsmith        {
26187031Smsmith            Node->Object = Node->Object->Common.NextObject;
26287031Smsmith        }
263281075Sdim
264281075Sdim        /*
265281075Sdim         * Detach the object from any data objects (which are still held by
266281075Sdim         * the namespace node)
267281075Sdim         */
268281075Sdim        if (ObjDesc->Common.NextObject &&
269281075Sdim           ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA))
270281075Sdim        {
271281075Sdim           ObjDesc->Common.NextObject = NULL;
272281075Sdim        }
27387031Smsmith    }
27467754Smsmith
27587031Smsmith    /* Reset the node type to untyped */
27687031Smsmith
27787031Smsmith    Node->Type = ACPI_TYPE_ANY;
27887031Smsmith
27999146Siwasaki    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
280123315Snjl        Node, AcpiUtGetNodeName (Node), ObjDesc));
28167754Smsmith
28285756Smsmith    /* Remove one reference on the object (and all subobjects) */
28367754Smsmith
28485756Smsmith    AcpiUtRemoveReference (ObjDesc);
28567754Smsmith    return_VOID;
28667754Smsmith}
28767754Smsmith
28867754Smsmith
28967754Smsmith/*******************************************************************************
29067754Smsmith *
29167754Smsmith * FUNCTION:    AcpiNsGetAttachedObject
29267754Smsmith *
293151937Sjkim * PARAMETERS:  Node             - Namespace node
29467754Smsmith *
29567754Smsmith * RETURN:      Current value of the object field from the Node whose
29667754Smsmith *              handle is passed
29767754Smsmith *
298107325Siwasaki * DESCRIPTION: Obtain the object attached to a namespace node.
299107325Siwasaki *
30067754Smsmith ******************************************************************************/
30167754Smsmith
30287031SmsmithACPI_OPERAND_OBJECT *
30367754SmsmithAcpiNsGetAttachedObject (
30477424Smsmith    ACPI_NAMESPACE_NODE     *Node)
30567754Smsmith{
306167802Sjkim    ACPI_FUNCTION_TRACE_PTR (NsGetAttachedObject, Node);
30767754Smsmith
30867754Smsmith
30977424Smsmith    if (!Node)
31067754Smsmith    {
311167802Sjkim        ACPI_WARNING ((AE_INFO, "Null Node ptr"));
31267754Smsmith        return_PTR (NULL);
31367754Smsmith    }
31467754Smsmith
31587031Smsmith    if (!Node->Object ||
31699679Siwasaki            ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_OPERAND) &&
31799679Siwasaki             (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED))  ||
318193267Sjkim        ((Node->Object)->Common.Type == ACPI_TYPE_LOCAL_DATA))
31987031Smsmith    {
32087031Smsmith        return_PTR (NULL);
32187031Smsmith    }
32287031Smsmith
32377424Smsmith    return_PTR (Node->Object);
32467754Smsmith}
32567754Smsmith
32667754Smsmith
32787031Smsmith/*******************************************************************************
32887031Smsmith *
32987031Smsmith * FUNCTION:    AcpiNsGetSecondaryObject
33087031Smsmith *
331151937Sjkim * PARAMETERS:  Node             - Namespace node
33287031Smsmith *
33387031Smsmith * RETURN:      Current value of the object field from the Node whose
334107325Siwasaki *              handle is passed.
33587031Smsmith *
336107325Siwasaki * DESCRIPTION: Obtain a secondary object associated with a namespace node.
337107325Siwasaki *
33887031Smsmith ******************************************************************************/
33987031Smsmith
34087031SmsmithACPI_OPERAND_OBJECT *
34187031SmsmithAcpiNsGetSecondaryObject (
34287031Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc)
34387031Smsmith{
344167802Sjkim    ACPI_FUNCTION_TRACE_PTR (NsGetSecondaryObject, ObjDesc);
34587031Smsmith
34687031Smsmith
347193267Sjkim    if ((!ObjDesc)                                     ||
348193267Sjkim        (ObjDesc->Common.Type== ACPI_TYPE_LOCAL_DATA)  ||
349193267Sjkim        (!ObjDesc->Common.NextObject)                  ||
350193267Sjkim        ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA))
35187031Smsmith    {
35287031Smsmith        return_PTR (NULL);
35387031Smsmith    }
35487031Smsmith
35587031Smsmith    return_PTR (ObjDesc->Common.NextObject);
35687031Smsmith}
35787031Smsmith
35887031Smsmith
35987031Smsmith/*******************************************************************************
36087031Smsmith *
36187031Smsmith * FUNCTION:    AcpiNsAttachData
36287031Smsmith *
363107325Siwasaki * PARAMETERS:  Node            - Namespace node
364107325Siwasaki *              Handler         - Handler to be associated with the data
365107325Siwasaki *              Data            - Data to be attached
36687031Smsmith *
36787031Smsmith * RETURN:      Status
36887031Smsmith *
369241973Sjkim * DESCRIPTION: Low-level attach data. Create and attach a Data object.
37087031Smsmith *
37187031Smsmith ******************************************************************************/
37287031Smsmith
37387031SmsmithACPI_STATUS
37487031SmsmithAcpiNsAttachData (
37587031Smsmith    ACPI_NAMESPACE_NODE     *Node,
37687031Smsmith    ACPI_OBJECT_HANDLER     Handler,
37787031Smsmith    void                    *Data)
37887031Smsmith{
37987031Smsmith    ACPI_OPERAND_OBJECT     *PrevObjDesc;
38087031Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
38187031Smsmith    ACPI_OPERAND_OBJECT     *DataDesc;
38287031Smsmith
38387031Smsmith
384107325Siwasaki    /* We only allow one attachment per handler */
385107325Siwasaki
38687031Smsmith    PrevObjDesc = NULL;
38787031Smsmith    ObjDesc = Node->Object;
38887031Smsmith    while (ObjDesc)
38987031Smsmith    {
390193267Sjkim        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
39187031Smsmith            (ObjDesc->Data.Handler == Handler))
39287031Smsmith        {
39387031Smsmith            return (AE_ALREADY_EXISTS);
39487031Smsmith        }
39587031Smsmith
39687031Smsmith        PrevObjDesc = ObjDesc;
39787031Smsmith        ObjDesc = ObjDesc->Common.NextObject;
39887031Smsmith    }
39987031Smsmith
40087031Smsmith    /* Create an internal object for the data */
40187031Smsmith
402107325Siwasaki    DataDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_DATA);
40387031Smsmith    if (!DataDesc)
40487031Smsmith    {
40587031Smsmith        return (AE_NO_MEMORY);
40687031Smsmith    }
40787031Smsmith
40887031Smsmith    DataDesc->Data.Handler = Handler;
40987031Smsmith    DataDesc->Data.Pointer = Data;
41087031Smsmith
41187031Smsmith    /* Install the data object */
41287031Smsmith
41387031Smsmith    if (PrevObjDesc)
41487031Smsmith    {
41587031Smsmith        PrevObjDesc->Common.NextObject = DataDesc;
41687031Smsmith    }
41787031Smsmith    else
41887031Smsmith    {
41987031Smsmith        Node->Object = DataDesc;
42087031Smsmith    }
42187031Smsmith
42287031Smsmith    return (AE_OK);
42387031Smsmith}
42487031Smsmith
42587031Smsmith
42687031Smsmith/*******************************************************************************
42787031Smsmith *
42887031Smsmith * FUNCTION:    AcpiNsDetachData
42987031Smsmith *
430107325Siwasaki * PARAMETERS:  Node            - Namespace node
431107325Siwasaki *              Handler         - Handler associated with the data
43287031Smsmith *
43387031Smsmith * RETURN:      Status
43487031Smsmith *
435241973Sjkim * DESCRIPTION: Low-level detach data. Delete the data node, but the caller
436107325Siwasaki *              is responsible for the actual data.
43787031Smsmith *
43887031Smsmith ******************************************************************************/
43987031Smsmith
44087031SmsmithACPI_STATUS
44187031SmsmithAcpiNsDetachData (
44287031Smsmith    ACPI_NAMESPACE_NODE     *Node,
44387031Smsmith    ACPI_OBJECT_HANDLER     Handler)
44487031Smsmith{
44587031Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
44687031Smsmith    ACPI_OPERAND_OBJECT     *PrevObjDesc;
44787031Smsmith
44887031Smsmith
44987031Smsmith    PrevObjDesc = NULL;
45087031Smsmith    ObjDesc = Node->Object;
45187031Smsmith    while (ObjDesc)
45287031Smsmith    {
453193267Sjkim        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
45487031Smsmith            (ObjDesc->Data.Handler == Handler))
45587031Smsmith        {
45687031Smsmith            if (PrevObjDesc)
45787031Smsmith            {
45887031Smsmith                PrevObjDesc->Common.NextObject = ObjDesc->Common.NextObject;
45987031Smsmith            }
46087031Smsmith            else
46187031Smsmith            {
46287031Smsmith                Node->Object = ObjDesc->Common.NextObject;
46387031Smsmith            }
46487031Smsmith
46587031Smsmith            AcpiUtRemoveReference (ObjDesc);
46687031Smsmith            return (AE_OK);
46787031Smsmith        }
46887031Smsmith
46987031Smsmith        PrevObjDesc = ObjDesc;
47087031Smsmith        ObjDesc = ObjDesc->Common.NextObject;
47187031Smsmith    }
47287031Smsmith
47387031Smsmith    return (AE_NOT_FOUND);
47487031Smsmith}
47587031Smsmith
47687031Smsmith
47787031Smsmith/*******************************************************************************
47887031Smsmith *
47987031Smsmith * FUNCTION:    AcpiNsGetAttachedData
48087031Smsmith *
481107325Siwasaki * PARAMETERS:  Node            - Namespace node
482107325Siwasaki *              Handler         - Handler associated with the data
483107325Siwasaki *              Data            - Where the data is returned
48487031Smsmith *
48587031Smsmith * RETURN:      Status
48687031Smsmith *
487107325Siwasaki * DESCRIPTION: Low level interface to obtain data previously associated with
488107325Siwasaki *              a namespace node.
48987031Smsmith *
49087031Smsmith ******************************************************************************/
49187031Smsmith
49287031SmsmithACPI_STATUS
49387031SmsmithAcpiNsGetAttachedData (
49487031Smsmith    ACPI_NAMESPACE_NODE     *Node,
49587031Smsmith    ACPI_OBJECT_HANDLER     Handler,
49687031Smsmith    void                    **Data)
49787031Smsmith{
49887031Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
49987031Smsmith
50087031Smsmith
50187031Smsmith    ObjDesc = Node->Object;
50287031Smsmith    while (ObjDesc)
50387031Smsmith    {
504193267Sjkim        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
50587031Smsmith            (ObjDesc->Data.Handler == Handler))
50687031Smsmith        {
50787031Smsmith            *Data = ObjDesc->Data.Pointer;
50887031Smsmith            return (AE_OK);
50987031Smsmith        }
51087031Smsmith
51187031Smsmith        ObjDesc = ObjDesc->Common.NextObject;
51287031Smsmith    }
51387031Smsmith
51487031Smsmith    return (AE_NOT_FOUND);
51587031Smsmith}
516