126f3cdf0SGordon Ross /******************************************************************************
226f3cdf0SGordon Ross  *
326f3cdf0SGordon Ross  * Module Name: dsargs - Support for execution of dynamic arguments for static
426f3cdf0SGordon Ross  *                       objects (regions, fields, buffer fields, etc.)
526f3cdf0SGordon Ross  *
626f3cdf0SGordon Ross  *****************************************************************************/
726f3cdf0SGordon Ross 
8*35786f68SRobert Mustacchi /******************************************************************************
9*35786f68SRobert Mustacchi  *
10*35786f68SRobert Mustacchi  * 1. Copyright Notice
11*35786f68SRobert Mustacchi  *
12*35786f68SRobert Mustacchi  * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
1326f3cdf0SGordon Ross  * All rights reserved.
1426f3cdf0SGordon Ross  *
15*35786f68SRobert Mustacchi  * 2. License
16*35786f68SRobert Mustacchi  *
17*35786f68SRobert Mustacchi  * 2.1. This is your license from Intel Corp. under its intellectual property
18*35786f68SRobert Mustacchi  * rights. You may have additional license terms from the party that provided
19*35786f68SRobert Mustacchi  * you this software, covering your right to use that party's intellectual
20*35786f68SRobert Mustacchi  * property rights.
21*35786f68SRobert Mustacchi  *
22*35786f68SRobert Mustacchi  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23*35786f68SRobert Mustacchi  * copy of the source code appearing in this file ("Covered Code") an
24*35786f68SRobert Mustacchi  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25*35786f68SRobert Mustacchi  * base code distributed originally by Intel ("Original Intel Code") to copy,
26*35786f68SRobert Mustacchi  * make derivatives, distribute, use and display any portion of the Covered
27*35786f68SRobert Mustacchi  * Code in any form, with the right to sublicense such rights; and
28*35786f68SRobert Mustacchi  *
29*35786f68SRobert Mustacchi  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30*35786f68SRobert Mustacchi  * license (with the right to sublicense), under only those claims of Intel
31*35786f68SRobert Mustacchi  * patents that are infringed by the Original Intel Code, to make, use, sell,
32*35786f68SRobert Mustacchi  * offer to sell, and import the Covered Code and derivative works thereof
33*35786f68SRobert Mustacchi  * solely to the minimum extent necessary to exercise the above copyright
34*35786f68SRobert Mustacchi  * license, and in no event shall the patent license extend to any additions
35*35786f68SRobert Mustacchi  * to or modifications of the Original Intel Code. No other license or right
36*35786f68SRobert Mustacchi  * is granted directly or by implication, estoppel or otherwise;
37*35786f68SRobert Mustacchi  *
38*35786f68SRobert Mustacchi  * The above copyright and patent license is granted only if the following
39*35786f68SRobert Mustacchi  * conditions are met:
40*35786f68SRobert Mustacchi  *
41*35786f68SRobert Mustacchi  * 3. Conditions
42*35786f68SRobert Mustacchi  *
43*35786f68SRobert Mustacchi  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44*35786f68SRobert Mustacchi  * Redistribution of source code of any substantial portion of the Covered
45*35786f68SRobert Mustacchi  * Code or modification with rights to further distribute source must include
46*35786f68SRobert Mustacchi  * the above Copyright Notice, the above License, this list of Conditions,
47*35786f68SRobert Mustacchi  * and the following Disclaimer and Export Compliance provision. In addition,
48*35786f68SRobert Mustacchi  * Licensee must cause all Covered Code to which Licensee contributes to
49*35786f68SRobert Mustacchi  * contain a file documenting the changes Licensee made to create that Covered
50*35786f68SRobert Mustacchi  * Code and the date of any change. Licensee must include in that file the
51*35786f68SRobert Mustacchi  * documentation of any changes made by any predecessor Licensee. Licensee
52*35786f68SRobert Mustacchi  * must include a prominent statement that the modification is derived,
53*35786f68SRobert Mustacchi  * directly or indirectly, from Original Intel Code.
54*35786f68SRobert Mustacchi  *
55*35786f68SRobert Mustacchi  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56*35786f68SRobert Mustacchi  * Redistribution of source code of any substantial portion of the Covered
57*35786f68SRobert Mustacchi  * Code or modification without rights to further distribute source must
58*35786f68SRobert Mustacchi  * include the following Disclaimer and Export Compliance provision in the
59*35786f68SRobert Mustacchi  * documentation and/or other materials provided with distribution. In
60*35786f68SRobert Mustacchi  * addition, Licensee may not authorize further sublicense of source of any
61*35786f68SRobert Mustacchi  * portion of the Covered Code, and must include terms to the effect that the
62*35786f68SRobert Mustacchi  * license from Licensee to its licensee is limited to the intellectual
63*35786f68SRobert Mustacchi  * property embodied in the software Licensee provides to its licensee, and
64*35786f68SRobert Mustacchi  * not to intellectual property embodied in modifications its licensee may
65*35786f68SRobert Mustacchi  * make.
66*35786f68SRobert Mustacchi  *
67*35786f68SRobert Mustacchi  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68*35786f68SRobert Mustacchi  * substantial portion of the Covered Code or modification must reproduce the
69*35786f68SRobert Mustacchi  * above Copyright Notice, and the following Disclaimer and Export Compliance
70*35786f68SRobert Mustacchi  * provision in the documentation and/or other materials provided with the
71*35786f68SRobert Mustacchi  * distribution.
72*35786f68SRobert Mustacchi  *
73*35786f68SRobert Mustacchi  * 3.4. Intel retains all right, title, and interest in and to the Original
74*35786f68SRobert Mustacchi  * Intel Code.
75*35786f68SRobert Mustacchi  *
76*35786f68SRobert Mustacchi  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77*35786f68SRobert Mustacchi  * Intel shall be used in advertising or otherwise to promote the sale, use or
78*35786f68SRobert Mustacchi  * other dealings in products derived from or relating to the Covered Code
79*35786f68SRobert Mustacchi  * without prior written authorization from Intel.
80*35786f68SRobert Mustacchi  *
81*35786f68SRobert Mustacchi  * 4. Disclaimer and Export Compliance
82*35786f68SRobert Mustacchi  *
83*35786f68SRobert Mustacchi  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84*35786f68SRobert Mustacchi  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85*35786f68SRobert Mustacchi  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86*35786f68SRobert Mustacchi  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87*35786f68SRobert Mustacchi  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88*35786f68SRobert Mustacchi  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89*35786f68SRobert Mustacchi  * PARTICULAR PURPOSE.
90*35786f68SRobert Mustacchi  *
91*35786f68SRobert Mustacchi  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92*35786f68SRobert Mustacchi  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93*35786f68SRobert Mustacchi  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94*35786f68SRobert Mustacchi  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95*35786f68SRobert Mustacchi  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96*35786f68SRobert Mustacchi  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97*35786f68SRobert Mustacchi  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98*35786f68SRobert Mustacchi  * LIMITED REMEDY.
99*35786f68SRobert Mustacchi  *
100*35786f68SRobert Mustacchi  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101*35786f68SRobert Mustacchi  * software or system incorporating such software without first obtaining any
102*35786f68SRobert Mustacchi  * required license or other approval from the U. S. Department of Commerce or
103*35786f68SRobert Mustacchi  * any other agency or department of the United States Government. In the
104*35786f68SRobert Mustacchi  * event Licensee exports any such software from the United States or
105*35786f68SRobert Mustacchi  * re-exports any such software from a foreign destination, Licensee shall
106*35786f68SRobert Mustacchi  * ensure that the distribution and export/re-export of the software is in
107*35786f68SRobert Mustacchi  * compliance with all laws, regulations, orders, or other restrictions of the
108*35786f68SRobert Mustacchi  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109*35786f68SRobert Mustacchi  * any of its subsidiaries will export/re-export any technical data, process,
110*35786f68SRobert Mustacchi  * software, or service, directly or indirectly, to any country for which the
111*35786f68SRobert Mustacchi  * United States government or any agency thereof requires an export license,
112*35786f68SRobert Mustacchi  * other governmental approval, or letter of assurance, without first obtaining
113*35786f68SRobert Mustacchi  * such license, approval or letter.
114*35786f68SRobert Mustacchi  *
115*35786f68SRobert Mustacchi  *****************************************************************************
116*35786f68SRobert Mustacchi  *
117*35786f68SRobert Mustacchi  * Alternatively, you may choose to be licensed under the terms of the
118*35786f68SRobert Mustacchi  * following license:
119*35786f68SRobert Mustacchi  *
12026f3cdf0SGordon Ross  * Redistribution and use in source and binary forms, with or without
12126f3cdf0SGordon Ross  * modification, are permitted provided that the following conditions
12226f3cdf0SGordon Ross  * are met:
12326f3cdf0SGordon Ross  * 1. Redistributions of source code must retain the above copyright
12426f3cdf0SGordon Ross  *    notice, this list of conditions, and the following disclaimer,
12526f3cdf0SGordon Ross  *    without modification.
12626f3cdf0SGordon Ross  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12726f3cdf0SGordon Ross  *    substantially similar to the "NO WARRANTY" disclaimer below
12826f3cdf0SGordon Ross  *    ("Disclaimer") and any redistribution must be conditioned upon
12926f3cdf0SGordon Ross  *    including a substantially similar Disclaimer requirement for further
13026f3cdf0SGordon Ross  *    binary redistribution.
13126f3cdf0SGordon Ross  * 3. Neither the names of the above-listed copyright holders nor the names
13226f3cdf0SGordon Ross  *    of any contributors may be used to endorse or promote products derived
13326f3cdf0SGordon Ross  *    from this software without specific prior written permission.
13426f3cdf0SGordon Ross  *
13526f3cdf0SGordon Ross  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13626f3cdf0SGordon Ross  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
137*35786f68SRobert Mustacchi  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
13826f3cdf0SGordon Ross  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
139*35786f68SRobert Mustacchi  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
140*35786f68SRobert Mustacchi  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
141*35786f68SRobert Mustacchi  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
142*35786f68SRobert Mustacchi  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
143*35786f68SRobert Mustacchi  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
144*35786f68SRobert Mustacchi  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
145*35786f68SRobert Mustacchi  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146*35786f68SRobert Mustacchi  *
147*35786f68SRobert Mustacchi  * Alternatively, you may choose to be licensed under the terms of the
148*35786f68SRobert Mustacchi  * GNU General Public License ("GPL") version 2 as published by the Free
149*35786f68SRobert Mustacchi  * Software Foundation.
150*35786f68SRobert Mustacchi  *
151*35786f68SRobert Mustacchi  *****************************************************************************/
15226f3cdf0SGordon Ross 
15326f3cdf0SGordon Ross #include "acpi.h"
15426f3cdf0SGordon Ross #include "accommon.h"
15526f3cdf0SGordon Ross #include "acparser.h"
15626f3cdf0SGordon Ross #include "amlcode.h"
15726f3cdf0SGordon Ross #include "acdispat.h"
15826f3cdf0SGordon Ross #include "acnamesp.h"
15926f3cdf0SGordon Ross 
16026f3cdf0SGordon Ross #define _COMPONENT          ACPI_DISPATCHER
16126f3cdf0SGordon Ross         ACPI_MODULE_NAME    ("dsargs")
16226f3cdf0SGordon Ross 
16326f3cdf0SGordon Ross /* Local prototypes */
16426f3cdf0SGordon Ross 
16526f3cdf0SGordon Ross static ACPI_STATUS
16626f3cdf0SGordon Ross AcpiDsExecuteArguments (
16726f3cdf0SGordon Ross     ACPI_NAMESPACE_NODE     *Node,
16826f3cdf0SGordon Ross     ACPI_NAMESPACE_NODE     *ScopeNode,
16926f3cdf0SGordon Ross     UINT32                  AmlLength,
17026f3cdf0SGordon Ross     UINT8                   *AmlStart);
17126f3cdf0SGordon Ross 
17226f3cdf0SGordon Ross 
17326f3cdf0SGordon Ross /*******************************************************************************
17426f3cdf0SGordon Ross  *
17526f3cdf0SGordon Ross  * FUNCTION:    AcpiDsExecuteArguments
17626f3cdf0SGordon Ross  *
17726f3cdf0SGordon Ross  * PARAMETERS:  Node                - Object NS node
17826f3cdf0SGordon Ross  *              ScopeNode           - Parent NS node
17926f3cdf0SGordon Ross  *              AmlLength           - Length of executable AML
18026f3cdf0SGordon Ross  *              AmlStart            - Pointer to the AML
18126f3cdf0SGordon Ross  *
18226f3cdf0SGordon Ross  * RETURN:      Status.
18326f3cdf0SGordon Ross  *
18426f3cdf0SGordon Ross  * DESCRIPTION: Late (deferred) execution of region or field arguments
18526f3cdf0SGordon Ross  *
18626f3cdf0SGordon Ross  ******************************************************************************/
18726f3cdf0SGordon Ross 
18826f3cdf0SGordon Ross static ACPI_STATUS
AcpiDsExecuteArguments(ACPI_NAMESPACE_NODE * Node,ACPI_NAMESPACE_NODE * ScopeNode,UINT32 AmlLength,UINT8 * AmlStart)18926f3cdf0SGordon Ross AcpiDsExecuteArguments (
19026f3cdf0SGordon Ross     ACPI_NAMESPACE_NODE     *Node,
19126f3cdf0SGordon Ross     ACPI_NAMESPACE_NODE     *ScopeNode,
19226f3cdf0SGordon Ross     UINT32                  AmlLength,
19326f3cdf0SGordon Ross     UINT8                   *AmlStart)
19426f3cdf0SGordon Ross {
19526f3cdf0SGordon Ross     ACPI_STATUS             Status;
19626f3cdf0SGordon Ross     ACPI_PARSE_OBJECT       *Op;
19726f3cdf0SGordon Ross     ACPI_WALK_STATE         *WalkState;
19826f3cdf0SGordon Ross 
19926f3cdf0SGordon Ross 
200*35786f68SRobert Mustacchi     ACPI_FUNCTION_TRACE_PTR (DsExecuteArguments, AmlStart);
20126f3cdf0SGordon Ross 
20226f3cdf0SGordon Ross 
20326f3cdf0SGordon Ross     /* Allocate a new parser op to be the root of the parsed tree */
20426f3cdf0SGordon Ross 
2057b1019a6SJerry Jelinek     Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart);
20626f3cdf0SGordon Ross     if (!Op)
20726f3cdf0SGordon Ross     {
20826f3cdf0SGordon Ross         return_ACPI_STATUS (AE_NO_MEMORY);
20926f3cdf0SGordon Ross     }
21026f3cdf0SGordon Ross 
21126f3cdf0SGordon Ross     /* Save the Node for use in AcpiPsParseAml */
21226f3cdf0SGordon Ross 
21326f3cdf0SGordon Ross     Op->Common.Node = ScopeNode;
21426f3cdf0SGordon Ross 
21526f3cdf0SGordon Ross     /* Create and initialize a new parser state */
21626f3cdf0SGordon Ross 
21726f3cdf0SGordon Ross     WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
21826f3cdf0SGordon Ross     if (!WalkState)
21926f3cdf0SGordon Ross     {
22026f3cdf0SGordon Ross         Status = AE_NO_MEMORY;
22126f3cdf0SGordon Ross         goto Cleanup;
22226f3cdf0SGordon Ross     }
22326f3cdf0SGordon Ross 
22426f3cdf0SGordon Ross     Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
2257b1019a6SJerry Jelinek         AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
22626f3cdf0SGordon Ross     if (ACPI_FAILURE (Status))
22726f3cdf0SGordon Ross     {
22826f3cdf0SGordon Ross         AcpiDsDeleteWalkState (WalkState);
22926f3cdf0SGordon Ross         goto Cleanup;
23026f3cdf0SGordon Ross     }
23126f3cdf0SGordon Ross 
23226f3cdf0SGordon Ross     /* Mark this parse as a deferred opcode */
23326f3cdf0SGordon Ross 
23426f3cdf0SGordon Ross     WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP;
23526f3cdf0SGordon Ross     WalkState->DeferredNode = Node;
23626f3cdf0SGordon Ross 
23726f3cdf0SGordon Ross     /* Pass1: Parse the entire declaration */
23826f3cdf0SGordon Ross 
23926f3cdf0SGordon Ross     Status = AcpiPsParseAml (WalkState);
24026f3cdf0SGordon Ross     if (ACPI_FAILURE (Status))
24126f3cdf0SGordon Ross     {
24226f3cdf0SGordon Ross         goto Cleanup;
24326f3cdf0SGordon Ross     }
24426f3cdf0SGordon Ross 
24526f3cdf0SGordon Ross     /* Get and init the Op created above */
24626f3cdf0SGordon Ross 
24726f3cdf0SGordon Ross     Op->Common.Node = Node;
24826f3cdf0SGordon Ross     AcpiPsDeleteParseTree (Op);
24926f3cdf0SGordon Ross 
25026f3cdf0SGordon Ross     /* Evaluate the deferred arguments */
25126f3cdf0SGordon Ross 
2527b1019a6SJerry Jelinek     Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart);
25326f3cdf0SGordon Ross     if (!Op)
25426f3cdf0SGordon Ross     {
25526f3cdf0SGordon Ross         return_ACPI_STATUS (AE_NO_MEMORY);
25626f3cdf0SGordon Ross     }
25726f3cdf0SGordon Ross 
25826f3cdf0SGordon Ross     Op->Common.Node = ScopeNode;
25926f3cdf0SGordon Ross 
26026f3cdf0SGordon Ross     /* Create and initialize a new parser state */
26126f3cdf0SGordon Ross 
26226f3cdf0SGordon Ross     WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
26326f3cdf0SGordon Ross     if (!WalkState)
26426f3cdf0SGordon Ross     {
26526f3cdf0SGordon Ross         Status = AE_NO_MEMORY;
26626f3cdf0SGordon Ross         goto Cleanup;
26726f3cdf0SGordon Ross     }
26826f3cdf0SGordon Ross 
26926f3cdf0SGordon Ross     /* Execute the opcode and arguments */
27026f3cdf0SGordon Ross 
27126f3cdf0SGordon Ross     Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
2727b1019a6SJerry Jelinek         AmlLength, NULL, ACPI_IMODE_EXECUTE);
27326f3cdf0SGordon Ross     if (ACPI_FAILURE (Status))
27426f3cdf0SGordon Ross     {
27526f3cdf0SGordon Ross         AcpiDsDeleteWalkState (WalkState);
27626f3cdf0SGordon Ross         goto Cleanup;
27726f3cdf0SGordon Ross     }
27826f3cdf0SGordon Ross 
27926f3cdf0SGordon Ross     /* Mark this execution as a deferred opcode */
28026f3cdf0SGordon Ross 
28126f3cdf0SGordon Ross     WalkState->DeferredNode = Node;
28226f3cdf0SGordon Ross     Status = AcpiPsParseAml (WalkState);
28326f3cdf0SGordon Ross 
28426f3cdf0SGordon Ross Cleanup:
28526f3cdf0SGordon Ross     AcpiPsDeleteParseTree (Op);
28626f3cdf0SGordon Ross     return_ACPI_STATUS (Status);
28726f3cdf0SGordon Ross }
28826f3cdf0SGordon Ross 
28926f3cdf0SGordon Ross 
29026f3cdf0SGordon Ross /*******************************************************************************
29126f3cdf0SGordon Ross  *
29226f3cdf0SGordon Ross  * FUNCTION:    AcpiDsGetBufferFieldArguments
29326f3cdf0SGordon Ross  *
29426f3cdf0SGordon Ross  * PARAMETERS:  ObjDesc         - A valid BufferField object
29526f3cdf0SGordon Ross  *
29626f3cdf0SGordon Ross  * RETURN:      Status.
29726f3cdf0SGordon Ross  *
29826f3cdf0SGordon Ross  * DESCRIPTION: Get BufferField Buffer and Index. This implements the late
29926f3cdf0SGordon Ross  *              evaluation of these field attributes.
30026f3cdf0SGordon Ross  *
30126f3cdf0SGordon Ross  ******************************************************************************/
30226f3cdf0SGordon Ross 
30326f3cdf0SGordon Ross ACPI_STATUS
AcpiDsGetBufferFieldArguments(ACPI_OPERAND_OBJECT * ObjDesc)30426f3cdf0SGordon Ross AcpiDsGetBufferFieldArguments (
30526f3cdf0SGordon Ross     ACPI_OPERAND_OBJECT     *ObjDesc)
30626f3cdf0SGordon Ross {
30726f3cdf0SGordon Ross     ACPI_OPERAND_OBJECT     *ExtraDesc;
30826f3cdf0SGordon Ross     ACPI_NAMESPACE_NODE     *Node;
30926f3cdf0SGordon Ross     ACPI_STATUS             Status;
31026f3cdf0SGordon Ross 
31126f3cdf0SGordon Ross 
31226f3cdf0SGordon Ross     ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc);
31326f3cdf0SGordon Ross 
31426f3cdf0SGordon Ross 
31526f3cdf0SGordon Ross     if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
31626f3cdf0SGordon Ross     {
31726f3cdf0SGordon Ross         return_ACPI_STATUS (AE_OK);
31826f3cdf0SGordon Ross     }
31926f3cdf0SGordon Ross 
32026f3cdf0SGordon Ross     /* Get the AML pointer (method object) and BufferField node */
32126f3cdf0SGordon Ross 
32226f3cdf0SGordon Ross     ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
32326f3cdf0SGordon Ross     Node = ObjDesc->BufferField.Node;
32426f3cdf0SGordon Ross 
3257b1019a6SJerry Jelinek     ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
3267b1019a6SJerry Jelinek         ACPI_TYPE_BUFFER_FIELD, Node, NULL));
32726f3cdf0SGordon Ross 
32826f3cdf0SGordon Ross     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
32926f3cdf0SGordon Ross         AcpiUtGetNodeName (Node)));
33026f3cdf0SGordon Ross 
33126f3cdf0SGordon Ross     /* Execute the AML code for the TermArg arguments */
33226f3cdf0SGordon Ross 
33326f3cdf0SGordon Ross     Status = AcpiDsExecuteArguments (Node, Node->Parent,
3347b1019a6SJerry Jelinek         ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
33526f3cdf0SGordon Ross     return_ACPI_STATUS (Status);
33626f3cdf0SGordon Ross }
33726f3cdf0SGordon Ross 
33826f3cdf0SGordon Ross 
33926f3cdf0SGordon Ross /*******************************************************************************
34026f3cdf0SGordon Ross  *
34126f3cdf0SGordon Ross  * FUNCTION:    AcpiDsGetBankFieldArguments
34226f3cdf0SGordon Ross  *
34326f3cdf0SGordon Ross  * PARAMETERS:  ObjDesc         - A valid BankField object
34426f3cdf0SGordon Ross  *
34526f3cdf0SGordon Ross  * RETURN:      Status.
34626f3cdf0SGordon Ross  *
34726f3cdf0SGordon Ross  * DESCRIPTION: Get BankField BankValue. This implements the late
34826f3cdf0SGordon Ross  *              evaluation of these field attributes.
34926f3cdf0SGordon Ross  *
35026f3cdf0SGordon Ross  ******************************************************************************/
35126f3cdf0SGordon Ross 
35226f3cdf0SGordon Ross ACPI_STATUS
AcpiDsGetBankFieldArguments(ACPI_OPERAND_OBJECT * ObjDesc)35326f3cdf0SGordon Ross AcpiDsGetBankFieldArguments (
35426f3cdf0SGordon Ross     ACPI_OPERAND_OBJECT     *ObjDesc)
35526f3cdf0SGordon Ross {
35626f3cdf0SGordon Ross     ACPI_OPERAND_OBJECT     *ExtraDesc;
35726f3cdf0SGordon Ross     ACPI_NAMESPACE_NODE     *Node;
35826f3cdf0SGordon Ross     ACPI_STATUS             Status;
35926f3cdf0SGordon Ross 
36026f3cdf0SGordon Ross 
36126f3cdf0SGordon Ross     ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc);
36226f3cdf0SGordon Ross 
36326f3cdf0SGordon Ross 
36426f3cdf0SGordon Ross     if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
36526f3cdf0SGordon Ross     {
36626f3cdf0SGordon Ross         return_ACPI_STATUS (AE_OK);
36726f3cdf0SGordon Ross     }
36826f3cdf0SGordon Ross 
36926f3cdf0SGordon Ross     /* Get the AML pointer (method object) and BankField node */
37026f3cdf0SGordon Ross 
37126f3cdf0SGordon Ross     ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
37226f3cdf0SGordon Ross     Node = ObjDesc->BankField.Node;
37326f3cdf0SGordon Ross 
3747b1019a6SJerry Jelinek     ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
3757b1019a6SJerry Jelinek         ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL));
37626f3cdf0SGordon Ross 
37726f3cdf0SGordon Ross     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n",
37826f3cdf0SGordon Ross         AcpiUtGetNodeName (Node)));
37926f3cdf0SGordon Ross 
38026f3cdf0SGordon Ross     /* Execute the AML code for the TermArg arguments */
38126f3cdf0SGordon Ross 
38226f3cdf0SGordon Ross     Status = AcpiDsExecuteArguments (Node, Node->Parent,
3837b1019a6SJerry Jelinek         ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
38426f3cdf0SGordon Ross     return_ACPI_STATUS (Status);
38526f3cdf0SGordon Ross }
38626f3cdf0SGordon Ross 
38726f3cdf0SGordon Ross 
38826f3cdf0SGordon Ross /*******************************************************************************
38926f3cdf0SGordon Ross  *
39026f3cdf0SGordon Ross  * FUNCTION:    AcpiDsGetBufferArguments
39126f3cdf0SGordon Ross  *
39226f3cdf0SGordon Ross  * PARAMETERS:  ObjDesc         - A valid Buffer object
39326f3cdf0SGordon Ross  *
39426f3cdf0SGordon Ross  * RETURN:      Status.
39526f3cdf0SGordon Ross  *
39626f3cdf0SGordon Ross  * DESCRIPTION: Get Buffer length and initializer byte list. This implements
39726f3cdf0SGordon Ross  *              the late evaluation of these attributes.
39826f3cdf0SGordon Ross  *
39926f3cdf0SGordon Ross  ******************************************************************************/
40026f3cdf0SGordon Ross 
40126f3cdf0SGordon Ross ACPI_STATUS
AcpiDsGetBufferArguments(ACPI_OPERAND_OBJECT * ObjDesc)40226f3cdf0SGordon Ross AcpiDsGetBufferArguments (
40326f3cdf0SGordon Ross     ACPI_OPERAND_OBJECT     *ObjDesc)
40426f3cdf0SGordon Ross {
40526f3cdf0SGordon Ross     ACPI_NAMESPACE_NODE     *Node;
40626f3cdf0SGordon Ross     ACPI_STATUS             Status;
40726f3cdf0SGordon Ross 
40826f3cdf0SGordon Ross 
40926f3cdf0SGordon Ross     ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc);
41026f3cdf0SGordon Ross 
41126f3cdf0SGordon Ross 
41226f3cdf0SGordon Ross     if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
41326f3cdf0SGordon Ross     {
41426f3cdf0SGordon Ross         return_ACPI_STATUS (AE_OK);
41526f3cdf0SGordon Ross     }
41626f3cdf0SGordon Ross 
41726f3cdf0SGordon Ross     /* Get the Buffer node */
41826f3cdf0SGordon Ross 
41926f3cdf0SGordon Ross     Node = ObjDesc->Buffer.Node;
42026f3cdf0SGordon Ross     if (!Node)
42126f3cdf0SGordon Ross     {
42226f3cdf0SGordon Ross         ACPI_ERROR ((AE_INFO,
4237b1019a6SJerry Jelinek             "No pointer back to namespace node in buffer object %p",
4247b1019a6SJerry Jelinek             ObjDesc));
42526f3cdf0SGordon Ross         return_ACPI_STATUS (AE_AML_INTERNAL);
42626f3cdf0SGordon Ross     }
42726f3cdf0SGordon Ross 
42826f3cdf0SGordon Ross     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
42926f3cdf0SGordon Ross 
43026f3cdf0SGordon Ross     /* Execute the AML code for the TermArg arguments */
43126f3cdf0SGordon Ross 
43226f3cdf0SGordon Ross     Status = AcpiDsExecuteArguments (Node, Node,
4337b1019a6SJerry Jelinek         ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart);
43426f3cdf0SGordon Ross     return_ACPI_STATUS (Status);
43526f3cdf0SGordon Ross }
43626f3cdf0SGordon Ross 
43726f3cdf0SGordon Ross 
43826f3cdf0SGordon Ross /*******************************************************************************
43926f3cdf0SGordon Ross  *
44026f3cdf0SGordon Ross  * FUNCTION:    AcpiDsGetPackageArguments
44126f3cdf0SGordon Ross  *
44226f3cdf0SGordon Ross  * PARAMETERS:  ObjDesc         - A valid Package object
44326f3cdf0SGordon Ross  *
44426f3cdf0SGordon Ross  * RETURN:      Status.
44526f3cdf0SGordon Ross  *
44626f3cdf0SGordon Ross  * DESCRIPTION: Get Package length and initializer byte list. This implements
44726f3cdf0SGordon Ross  *              the late evaluation of these attributes.
44826f3cdf0SGordon Ross  *
44926f3cdf0SGordon Ross  ******************************************************************************/
45026f3cdf0SGordon Ross 
45126f3cdf0SGordon Ross ACPI_STATUS
AcpiDsGetPackageArguments(ACPI_OPERAND_OBJECT * ObjDesc)45226f3cdf0SGordon Ross AcpiDsGetPackageArguments (
45326f3cdf0SGordon Ross     ACPI_OPERAND_OBJECT     *ObjDesc)
45426f3cdf0SGordon Ross {
45526f3cdf0SGordon Ross     ACPI_NAMESPACE_NODE     *Node;
45626f3cdf0SGordon Ross     ACPI_STATUS             Status;
45726f3cdf0SGordon Ross 
45826f3cdf0SGordon Ross 
45926f3cdf0SGordon Ross     ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc);
46026f3cdf0SGordon Ross 
46126f3cdf0SGordon Ross 
46226f3cdf0SGordon Ross     if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
46326f3cdf0SGordon Ross     {
46426f3cdf0SGordon Ross         return_ACPI_STATUS (AE_OK);
46526f3cdf0SGordon Ross     }
46626f3cdf0SGordon Ross 
46726f3cdf0SGordon Ross     /* Get the Package node */
46826f3cdf0SGordon Ross 
46926f3cdf0SGordon Ross     Node = ObjDesc->Package.Node;
47026f3cdf0SGordon Ross     if (!Node)
47126f3cdf0SGordon Ross     {
47226f3cdf0SGordon Ross         ACPI_ERROR ((AE_INFO,
47326f3cdf0SGordon Ross             "No pointer back to namespace node in package %p", ObjDesc));
47426f3cdf0SGordon Ross         return_ACPI_STATUS (AE_AML_INTERNAL);
47526f3cdf0SGordon Ross     }
47626f3cdf0SGordon Ross 
477*35786f68SRobert Mustacchi     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Argument Init, AML Ptr: %p\n",
478*35786f68SRobert Mustacchi         ObjDesc->Package.AmlStart));
47926f3cdf0SGordon Ross 
48026f3cdf0SGordon Ross     /* Execute the AML code for the TermArg arguments */
48126f3cdf0SGordon Ross 
48226f3cdf0SGordon Ross     Status = AcpiDsExecuteArguments (Node, Node,
4837b1019a6SJerry Jelinek         ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart);
484*35786f68SRobert Mustacchi 
48526f3cdf0SGordon Ross     return_ACPI_STATUS (Status);
48626f3cdf0SGordon Ross }
48726f3cdf0SGordon Ross 
48826f3cdf0SGordon Ross 
48926f3cdf0SGordon Ross /*******************************************************************************
49026f3cdf0SGordon Ross  *
49126f3cdf0SGordon Ross  * FUNCTION:    AcpiDsGetRegionArguments
49226f3cdf0SGordon Ross  *
49326f3cdf0SGordon Ross  * PARAMETERS:  ObjDesc         - A valid region object
49426f3cdf0SGordon Ross  *
49526f3cdf0SGordon Ross  * RETURN:      Status.
49626f3cdf0SGordon Ross  *
49726f3cdf0SGordon Ross  * DESCRIPTION: Get region address and length. This implements the late
49826f3cdf0SGordon Ross  *              evaluation of these region attributes.
49926f3cdf0SGordon Ross  *
50026f3cdf0SGordon Ross  ******************************************************************************/
50126f3cdf0SGordon Ross 
50226f3cdf0SGordon Ross ACPI_STATUS
AcpiDsGetRegionArguments(ACPI_OPERAND_OBJECT * ObjDesc)50326f3cdf0SGordon Ross AcpiDsGetRegionArguments (
50426f3cdf0SGordon Ross     ACPI_OPERAND_OBJECT     *ObjDesc)
50526f3cdf0SGordon Ross {
50626f3cdf0SGordon Ross     ACPI_NAMESPACE_NODE     *Node;
50726f3cdf0SGordon Ross     ACPI_STATUS             Status;
50826f3cdf0SGordon Ross     ACPI_OPERAND_OBJECT     *ExtraDesc;
50926f3cdf0SGordon Ross 
51026f3cdf0SGordon Ross 
51126f3cdf0SGordon Ross     ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
51226f3cdf0SGordon Ross 
51326f3cdf0SGordon Ross 
51426f3cdf0SGordon Ross     if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
51526f3cdf0SGordon Ross     {
51626f3cdf0SGordon Ross         return_ACPI_STATUS (AE_OK);
51726f3cdf0SGordon Ross     }
51826f3cdf0SGordon Ross 
51926f3cdf0SGordon Ross     ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
52026f3cdf0SGordon Ross     if (!ExtraDesc)
52126f3cdf0SGordon Ross     {
52226f3cdf0SGordon Ross         return_ACPI_STATUS (AE_NOT_EXIST);
52326f3cdf0SGordon Ross     }
52426f3cdf0SGordon Ross 
52526f3cdf0SGordon Ross     /* Get the Region node */
52626f3cdf0SGordon Ross 
52726f3cdf0SGordon Ross     Node = ObjDesc->Region.Node;
52826f3cdf0SGordon Ross 
5297b1019a6SJerry Jelinek     ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
5307b1019a6SJerry Jelinek         ACPI_TYPE_REGION, Node, NULL));
53126f3cdf0SGordon Ross 
5327b1019a6SJerry Jelinek     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
5337b1019a6SJerry Jelinek         "[%4.4s] OpRegion Arg Init at AML %p\n",
53426f3cdf0SGordon Ross         AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart));
53526f3cdf0SGordon Ross 
53626f3cdf0SGordon Ross     /* Execute the argument AML */
53726f3cdf0SGordon Ross 
5387b1019a6SJerry Jelinek     Status = AcpiDsExecuteArguments (Node, ExtraDesc->Extra.ScopeNode,
5397b1019a6SJerry Jelinek         ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
5407b1019a6SJerry Jelinek     if (ACPI_FAILURE (Status))
5417b1019a6SJerry Jelinek     {
5427b1019a6SJerry Jelinek         return_ACPI_STATUS (Status);
5437b1019a6SJerry Jelinek     }
5447b1019a6SJerry Jelinek 
5457b1019a6SJerry Jelinek     Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId,
5467b1019a6SJerry Jelinek         ObjDesc->Region.Address, ObjDesc->Region.Length, Node);
54726f3cdf0SGordon Ross     return_ACPI_STATUS (Status);
54826f3cdf0SGordon Ross }
549