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
826f3cdf0SGordon Ross /*
9*cb565728SJerry Jelinek * Copyright (C) 2000 - 2016, Intel Corp.
1026f3cdf0SGordon Ross * All rights reserved.
1126f3cdf0SGordon Ross *
1226f3cdf0SGordon Ross * Redistribution and use in source and binary forms, with or without
1326f3cdf0SGordon Ross * modification, are permitted provided that the following conditions
1426f3cdf0SGordon Ross * are met:
1526f3cdf0SGordon Ross * 1. Redistributions of source code must retain the above copyright
1626f3cdf0SGordon Ross * notice, this list of conditions, and the following disclaimer,
1726f3cdf0SGordon Ross * without modification.
1826f3cdf0SGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1926f3cdf0SGordon Ross * substantially similar to the "NO WARRANTY" disclaimer below
2026f3cdf0SGordon Ross * ("Disclaimer") and any redistribution must be conditioned upon
2126f3cdf0SGordon Ross * including a substantially similar Disclaimer requirement for further
2226f3cdf0SGordon Ross * binary redistribution.
2326f3cdf0SGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names
2426f3cdf0SGordon Ross * of any contributors may be used to endorse or promote products derived
2526f3cdf0SGordon Ross * from this software without specific prior written permission.
2626f3cdf0SGordon Ross *
2726f3cdf0SGordon Ross * Alternatively, this software may be distributed under the terms of the
2826f3cdf0SGordon Ross * GNU General Public License ("GPL") version 2 as published by the Free
2926f3cdf0SGordon Ross * Software Foundation.
3026f3cdf0SGordon Ross *
3126f3cdf0SGordon Ross * NO WARRANTY
3226f3cdf0SGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3326f3cdf0SGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3426f3cdf0SGordon Ross * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3526f3cdf0SGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3626f3cdf0SGordon Ross * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3726f3cdf0SGordon Ross * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3826f3cdf0SGordon Ross * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3926f3cdf0SGordon Ross * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
4026f3cdf0SGordon Ross * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
4126f3cdf0SGordon Ross * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4226f3cdf0SGordon Ross * POSSIBILITY OF SUCH DAMAGES.
4326f3cdf0SGordon Ross */
4426f3cdf0SGordon Ross
4526f3cdf0SGordon Ross #include "acpi.h"
4626f3cdf0SGordon Ross #include "accommon.h"
4726f3cdf0SGordon Ross #include "acparser.h"
4826f3cdf0SGordon Ross #include "amlcode.h"
4926f3cdf0SGordon Ross #include "acdispat.h"
5026f3cdf0SGordon Ross #include "acnamesp.h"
5126f3cdf0SGordon Ross
5226f3cdf0SGordon Ross #define _COMPONENT ACPI_DISPATCHER
5326f3cdf0SGordon Ross ACPI_MODULE_NAME ("dsargs")
5426f3cdf0SGordon Ross
5526f3cdf0SGordon Ross /* Local prototypes */
5626f3cdf0SGordon Ross
5726f3cdf0SGordon Ross static ACPI_STATUS
5826f3cdf0SGordon Ross AcpiDsExecuteArguments (
5926f3cdf0SGordon Ross ACPI_NAMESPACE_NODE *Node,
6026f3cdf0SGordon Ross ACPI_NAMESPACE_NODE *ScopeNode,
6126f3cdf0SGordon Ross UINT32 AmlLength,
6226f3cdf0SGordon Ross UINT8 *AmlStart);
6326f3cdf0SGordon Ross
6426f3cdf0SGordon Ross
6526f3cdf0SGordon Ross /*******************************************************************************
6626f3cdf0SGordon Ross *
6726f3cdf0SGordon Ross * FUNCTION: AcpiDsExecuteArguments
6826f3cdf0SGordon Ross *
6926f3cdf0SGordon Ross * PARAMETERS: Node - Object NS node
7026f3cdf0SGordon Ross * ScopeNode - Parent NS node
7126f3cdf0SGordon Ross * AmlLength - Length of executable AML
7226f3cdf0SGordon Ross * AmlStart - Pointer to the AML
7326f3cdf0SGordon Ross *
7426f3cdf0SGordon Ross * RETURN: Status.
7526f3cdf0SGordon Ross *
7626f3cdf0SGordon Ross * DESCRIPTION: Late (deferred) execution of region or field arguments
7726f3cdf0SGordon Ross *
7826f3cdf0SGordon Ross ******************************************************************************/
7926f3cdf0SGordon Ross
8026f3cdf0SGordon Ross static ACPI_STATUS
AcpiDsExecuteArguments(ACPI_NAMESPACE_NODE * Node,ACPI_NAMESPACE_NODE * ScopeNode,UINT32 AmlLength,UINT8 * AmlStart)8126f3cdf0SGordon Ross AcpiDsExecuteArguments (
8226f3cdf0SGordon Ross ACPI_NAMESPACE_NODE *Node,
8326f3cdf0SGordon Ross ACPI_NAMESPACE_NODE *ScopeNode,
8426f3cdf0SGordon Ross UINT32 AmlLength,
8526f3cdf0SGordon Ross UINT8 *AmlStart)
8626f3cdf0SGordon Ross {
8726f3cdf0SGordon Ross ACPI_STATUS Status;
8826f3cdf0SGordon Ross ACPI_PARSE_OBJECT *Op;
8926f3cdf0SGordon Ross ACPI_WALK_STATE *WalkState;
9026f3cdf0SGordon Ross
9126f3cdf0SGordon Ross
9226f3cdf0SGordon Ross ACPI_FUNCTION_TRACE (DsExecuteArguments);
9326f3cdf0SGordon Ross
9426f3cdf0SGordon Ross
9526f3cdf0SGordon Ross /* Allocate a new parser op to be the root of the parsed tree */
9626f3cdf0SGordon Ross
97*cb565728SJerry Jelinek Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart);
9826f3cdf0SGordon Ross if (!Op)
9926f3cdf0SGordon Ross {
10026f3cdf0SGordon Ross return_ACPI_STATUS (AE_NO_MEMORY);
10126f3cdf0SGordon Ross }
10226f3cdf0SGordon Ross
10326f3cdf0SGordon Ross /* Save the Node for use in AcpiPsParseAml */
10426f3cdf0SGordon Ross
10526f3cdf0SGordon Ross Op->Common.Node = ScopeNode;
10626f3cdf0SGordon Ross
10726f3cdf0SGordon Ross /* Create and initialize a new parser state */
10826f3cdf0SGordon Ross
10926f3cdf0SGordon Ross WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
11026f3cdf0SGordon Ross if (!WalkState)
11126f3cdf0SGordon Ross {
11226f3cdf0SGordon Ross Status = AE_NO_MEMORY;
11326f3cdf0SGordon Ross goto Cleanup;
11426f3cdf0SGordon Ross }
11526f3cdf0SGordon Ross
11626f3cdf0SGordon Ross Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
11726f3cdf0SGordon Ross AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
11826f3cdf0SGordon Ross if (ACPI_FAILURE (Status))
11926f3cdf0SGordon Ross {
12026f3cdf0SGordon Ross AcpiDsDeleteWalkState (WalkState);
12126f3cdf0SGordon Ross goto Cleanup;
12226f3cdf0SGordon Ross }
12326f3cdf0SGordon Ross
12426f3cdf0SGordon Ross /* Mark this parse as a deferred opcode */
12526f3cdf0SGordon Ross
12626f3cdf0SGordon Ross WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP;
12726f3cdf0SGordon Ross WalkState->DeferredNode = Node;
12826f3cdf0SGordon Ross
12926f3cdf0SGordon Ross /* Pass1: Parse the entire declaration */
13026f3cdf0SGordon Ross
13126f3cdf0SGordon Ross Status = AcpiPsParseAml (WalkState);
13226f3cdf0SGordon Ross if (ACPI_FAILURE (Status))
13326f3cdf0SGordon Ross {
13426f3cdf0SGordon Ross goto Cleanup;
13526f3cdf0SGordon Ross }
13626f3cdf0SGordon Ross
13726f3cdf0SGordon Ross /* Get and init the Op created above */
13826f3cdf0SGordon Ross
13926f3cdf0SGordon Ross Op->Common.Node = Node;
14026f3cdf0SGordon Ross AcpiPsDeleteParseTree (Op);
14126f3cdf0SGordon Ross
14226f3cdf0SGordon Ross /* Evaluate the deferred arguments */
14326f3cdf0SGordon Ross
144*cb565728SJerry Jelinek Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart);
14526f3cdf0SGordon Ross if (!Op)
14626f3cdf0SGordon Ross {
14726f3cdf0SGordon Ross return_ACPI_STATUS (AE_NO_MEMORY);
14826f3cdf0SGordon Ross }
14926f3cdf0SGordon Ross
15026f3cdf0SGordon Ross Op->Common.Node = ScopeNode;
15126f3cdf0SGordon Ross
15226f3cdf0SGordon Ross /* Create and initialize a new parser state */
15326f3cdf0SGordon Ross
15426f3cdf0SGordon Ross WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
15526f3cdf0SGordon Ross if (!WalkState)
15626f3cdf0SGordon Ross {
15726f3cdf0SGordon Ross Status = AE_NO_MEMORY;
15826f3cdf0SGordon Ross goto Cleanup;
15926f3cdf0SGordon Ross }
16026f3cdf0SGordon Ross
16126f3cdf0SGordon Ross /* Execute the opcode and arguments */
16226f3cdf0SGordon Ross
16326f3cdf0SGordon Ross Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
16426f3cdf0SGordon Ross AmlLength, NULL, ACPI_IMODE_EXECUTE);
16526f3cdf0SGordon Ross if (ACPI_FAILURE (Status))
16626f3cdf0SGordon Ross {
16726f3cdf0SGordon Ross AcpiDsDeleteWalkState (WalkState);
16826f3cdf0SGordon Ross goto Cleanup;
16926f3cdf0SGordon Ross }
17026f3cdf0SGordon Ross
17126f3cdf0SGordon Ross /* Mark this execution as a deferred opcode */
17226f3cdf0SGordon Ross
17326f3cdf0SGordon Ross WalkState->DeferredNode = Node;
17426f3cdf0SGordon Ross Status = AcpiPsParseAml (WalkState);
17526f3cdf0SGordon Ross
17626f3cdf0SGordon Ross Cleanup:
17726f3cdf0SGordon Ross AcpiPsDeleteParseTree (Op);
17826f3cdf0SGordon Ross return_ACPI_STATUS (Status);
17926f3cdf0SGordon Ross }
18026f3cdf0SGordon Ross
18126f3cdf0SGordon Ross
18226f3cdf0SGordon Ross /*******************************************************************************
18326f3cdf0SGordon Ross *
18426f3cdf0SGordon Ross * FUNCTION: AcpiDsGetBufferFieldArguments
18526f3cdf0SGordon Ross *
18626f3cdf0SGordon Ross * PARAMETERS: ObjDesc - A valid BufferField object
18726f3cdf0SGordon Ross *
18826f3cdf0SGordon Ross * RETURN: Status.
18926f3cdf0SGordon Ross *
19026f3cdf0SGordon Ross * DESCRIPTION: Get BufferField Buffer and Index. This implements the late
19126f3cdf0SGordon Ross * evaluation of these field attributes.
19226f3cdf0SGordon Ross *
19326f3cdf0SGordon Ross ******************************************************************************/
19426f3cdf0SGordon Ross
19526f3cdf0SGordon Ross ACPI_STATUS
AcpiDsGetBufferFieldArguments(ACPI_OPERAND_OBJECT * ObjDesc)19626f3cdf0SGordon Ross AcpiDsGetBufferFieldArguments (
19726f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *ObjDesc)
19826f3cdf0SGordon Ross {
19926f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *ExtraDesc;
20026f3cdf0SGordon Ross ACPI_NAMESPACE_NODE *Node;
20126f3cdf0SGordon Ross ACPI_STATUS Status;
20226f3cdf0SGordon Ross
20326f3cdf0SGordon Ross
20426f3cdf0SGordon Ross ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc);
20526f3cdf0SGordon Ross
20626f3cdf0SGordon Ross
20726f3cdf0SGordon Ross if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
20826f3cdf0SGordon Ross {
20926f3cdf0SGordon Ross return_ACPI_STATUS (AE_OK);
21026f3cdf0SGordon Ross }
21126f3cdf0SGordon Ross
21226f3cdf0SGordon Ross /* Get the AML pointer (method object) and BufferField node */
21326f3cdf0SGordon Ross
21426f3cdf0SGordon Ross ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
21526f3cdf0SGordon Ross Node = ObjDesc->BufferField.Node;
21626f3cdf0SGordon Ross
217*cb565728SJerry Jelinek ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
218*cb565728SJerry Jelinek ACPI_TYPE_BUFFER_FIELD, Node, NULL));
21926f3cdf0SGordon Ross
22026f3cdf0SGordon Ross ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
22126f3cdf0SGordon Ross AcpiUtGetNodeName (Node)));
22226f3cdf0SGordon Ross
22326f3cdf0SGordon Ross /* Execute the AML code for the TermArg arguments */
22426f3cdf0SGordon Ross
22526f3cdf0SGordon Ross Status = AcpiDsExecuteArguments (Node, Node->Parent,
22626f3cdf0SGordon Ross ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
22726f3cdf0SGordon Ross return_ACPI_STATUS (Status);
22826f3cdf0SGordon Ross }
22926f3cdf0SGordon Ross
23026f3cdf0SGordon Ross
23126f3cdf0SGordon Ross /*******************************************************************************
23226f3cdf0SGordon Ross *
23326f3cdf0SGordon Ross * FUNCTION: AcpiDsGetBankFieldArguments
23426f3cdf0SGordon Ross *
23526f3cdf0SGordon Ross * PARAMETERS: ObjDesc - A valid BankField object
23626f3cdf0SGordon Ross *
23726f3cdf0SGordon Ross * RETURN: Status.
23826f3cdf0SGordon Ross *
23926f3cdf0SGordon Ross * DESCRIPTION: Get BankField BankValue. This implements the late
24026f3cdf0SGordon Ross * evaluation of these field attributes.
24126f3cdf0SGordon Ross *
24226f3cdf0SGordon Ross ******************************************************************************/
24326f3cdf0SGordon Ross
24426f3cdf0SGordon Ross ACPI_STATUS
AcpiDsGetBankFieldArguments(ACPI_OPERAND_OBJECT * ObjDesc)24526f3cdf0SGordon Ross AcpiDsGetBankFieldArguments (
24626f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *ObjDesc)
24726f3cdf0SGordon Ross {
24826f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *ExtraDesc;
24926f3cdf0SGordon Ross ACPI_NAMESPACE_NODE *Node;
25026f3cdf0SGordon Ross ACPI_STATUS Status;
25126f3cdf0SGordon Ross
25226f3cdf0SGordon Ross
25326f3cdf0SGordon Ross ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc);
25426f3cdf0SGordon Ross
25526f3cdf0SGordon Ross
25626f3cdf0SGordon Ross if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
25726f3cdf0SGordon Ross {
25826f3cdf0SGordon Ross return_ACPI_STATUS (AE_OK);
25926f3cdf0SGordon Ross }
26026f3cdf0SGordon Ross
26126f3cdf0SGordon Ross /* Get the AML pointer (method object) and BankField node */
26226f3cdf0SGordon Ross
26326f3cdf0SGordon Ross ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
26426f3cdf0SGordon Ross Node = ObjDesc->BankField.Node;
26526f3cdf0SGordon Ross
266*cb565728SJerry Jelinek ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
267*cb565728SJerry Jelinek ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL));
26826f3cdf0SGordon Ross
26926f3cdf0SGordon Ross ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n",
27026f3cdf0SGordon Ross AcpiUtGetNodeName (Node)));
27126f3cdf0SGordon Ross
27226f3cdf0SGordon Ross /* Execute the AML code for the TermArg arguments */
27326f3cdf0SGordon Ross
27426f3cdf0SGordon Ross Status = AcpiDsExecuteArguments (Node, Node->Parent,
27526f3cdf0SGordon Ross ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
27626f3cdf0SGordon Ross return_ACPI_STATUS (Status);
27726f3cdf0SGordon Ross }
27826f3cdf0SGordon Ross
27926f3cdf0SGordon Ross
28026f3cdf0SGordon Ross /*******************************************************************************
28126f3cdf0SGordon Ross *
28226f3cdf0SGordon Ross * FUNCTION: AcpiDsGetBufferArguments
28326f3cdf0SGordon Ross *
28426f3cdf0SGordon Ross * PARAMETERS: ObjDesc - A valid Buffer object
28526f3cdf0SGordon Ross *
28626f3cdf0SGordon Ross * RETURN: Status.
28726f3cdf0SGordon Ross *
28826f3cdf0SGordon Ross * DESCRIPTION: Get Buffer length and initializer byte list. This implements
28926f3cdf0SGordon Ross * the late evaluation of these attributes.
29026f3cdf0SGordon Ross *
29126f3cdf0SGordon Ross ******************************************************************************/
29226f3cdf0SGordon Ross
29326f3cdf0SGordon Ross ACPI_STATUS
AcpiDsGetBufferArguments(ACPI_OPERAND_OBJECT * ObjDesc)29426f3cdf0SGordon Ross AcpiDsGetBufferArguments (
29526f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *ObjDesc)
29626f3cdf0SGordon Ross {
29726f3cdf0SGordon Ross ACPI_NAMESPACE_NODE *Node;
29826f3cdf0SGordon Ross ACPI_STATUS Status;
29926f3cdf0SGordon Ross
30026f3cdf0SGordon Ross
30126f3cdf0SGordon Ross ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc);
30226f3cdf0SGordon Ross
30326f3cdf0SGordon Ross
30426f3cdf0SGordon Ross if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
30526f3cdf0SGordon Ross {
30626f3cdf0SGordon Ross return_ACPI_STATUS (AE_OK);
30726f3cdf0SGordon Ross }
30826f3cdf0SGordon Ross
30926f3cdf0SGordon Ross /* Get the Buffer node */
31026f3cdf0SGordon Ross
31126f3cdf0SGordon Ross Node = ObjDesc->Buffer.Node;
31226f3cdf0SGordon Ross if (!Node)
31326f3cdf0SGordon Ross {
31426f3cdf0SGordon Ross ACPI_ERROR ((AE_INFO,
315*cb565728SJerry Jelinek "No pointer back to namespace node in buffer object %p",
316*cb565728SJerry Jelinek ObjDesc));
31726f3cdf0SGordon Ross return_ACPI_STATUS (AE_AML_INTERNAL);
31826f3cdf0SGordon Ross }
31926f3cdf0SGordon Ross
32026f3cdf0SGordon Ross ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
32126f3cdf0SGordon Ross
32226f3cdf0SGordon Ross /* Execute the AML code for the TermArg arguments */
32326f3cdf0SGordon Ross
32426f3cdf0SGordon Ross Status = AcpiDsExecuteArguments (Node, Node,
32526f3cdf0SGordon Ross ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart);
32626f3cdf0SGordon Ross return_ACPI_STATUS (Status);
32726f3cdf0SGordon Ross }
32826f3cdf0SGordon Ross
32926f3cdf0SGordon Ross
33026f3cdf0SGordon Ross /*******************************************************************************
33126f3cdf0SGordon Ross *
33226f3cdf0SGordon Ross * FUNCTION: AcpiDsGetPackageArguments
33326f3cdf0SGordon Ross *
33426f3cdf0SGordon Ross * PARAMETERS: ObjDesc - A valid Package object
33526f3cdf0SGordon Ross *
33626f3cdf0SGordon Ross * RETURN: Status.
33726f3cdf0SGordon Ross *
33826f3cdf0SGordon Ross * DESCRIPTION: Get Package length and initializer byte list. This implements
33926f3cdf0SGordon Ross * the late evaluation of these attributes.
34026f3cdf0SGordon Ross *
34126f3cdf0SGordon Ross ******************************************************************************/
34226f3cdf0SGordon Ross
34326f3cdf0SGordon Ross ACPI_STATUS
AcpiDsGetPackageArguments(ACPI_OPERAND_OBJECT * ObjDesc)34426f3cdf0SGordon Ross AcpiDsGetPackageArguments (
34526f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *ObjDesc)
34626f3cdf0SGordon Ross {
34726f3cdf0SGordon Ross ACPI_NAMESPACE_NODE *Node;
34826f3cdf0SGordon Ross ACPI_STATUS Status;
34926f3cdf0SGordon Ross
35026f3cdf0SGordon Ross
35126f3cdf0SGordon Ross ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc);
35226f3cdf0SGordon Ross
35326f3cdf0SGordon Ross
35426f3cdf0SGordon Ross if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
35526f3cdf0SGordon Ross {
35626f3cdf0SGordon Ross return_ACPI_STATUS (AE_OK);
35726f3cdf0SGordon Ross }
35826f3cdf0SGordon Ross
35926f3cdf0SGordon Ross /* Get the Package node */
36026f3cdf0SGordon Ross
36126f3cdf0SGordon Ross Node = ObjDesc->Package.Node;
36226f3cdf0SGordon Ross if (!Node)
36326f3cdf0SGordon Ross {
36426f3cdf0SGordon Ross ACPI_ERROR ((AE_INFO,
36526f3cdf0SGordon Ross "No pointer back to namespace node in package %p", ObjDesc));
36626f3cdf0SGordon Ross return_ACPI_STATUS (AE_AML_INTERNAL);
36726f3cdf0SGordon Ross }
36826f3cdf0SGordon Ross
36926f3cdf0SGordon Ross ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n"));
37026f3cdf0SGordon Ross
37126f3cdf0SGordon Ross /* Execute the AML code for the TermArg arguments */
37226f3cdf0SGordon Ross
37326f3cdf0SGordon Ross Status = AcpiDsExecuteArguments (Node, Node,
37426f3cdf0SGordon Ross ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart);
37526f3cdf0SGordon Ross return_ACPI_STATUS (Status);
37626f3cdf0SGordon Ross }
37726f3cdf0SGordon Ross
37826f3cdf0SGordon Ross
37926f3cdf0SGordon Ross /*******************************************************************************
38026f3cdf0SGordon Ross *
38126f3cdf0SGordon Ross * FUNCTION: AcpiDsGetRegionArguments
38226f3cdf0SGordon Ross *
38326f3cdf0SGordon Ross * PARAMETERS: ObjDesc - A valid region object
38426f3cdf0SGordon Ross *
38526f3cdf0SGordon Ross * RETURN: Status.
38626f3cdf0SGordon Ross *
38726f3cdf0SGordon Ross * DESCRIPTION: Get region address and length. This implements the late
38826f3cdf0SGordon Ross * evaluation of these region attributes.
38926f3cdf0SGordon Ross *
39026f3cdf0SGordon Ross ******************************************************************************/
39126f3cdf0SGordon Ross
39226f3cdf0SGordon Ross ACPI_STATUS
AcpiDsGetRegionArguments(ACPI_OPERAND_OBJECT * ObjDesc)39326f3cdf0SGordon Ross AcpiDsGetRegionArguments (
39426f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *ObjDesc)
39526f3cdf0SGordon Ross {
39626f3cdf0SGordon Ross ACPI_NAMESPACE_NODE *Node;
39726f3cdf0SGordon Ross ACPI_STATUS Status;
39826f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *ExtraDesc;
39926f3cdf0SGordon Ross
40026f3cdf0SGordon Ross
40126f3cdf0SGordon Ross ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
40226f3cdf0SGordon Ross
40326f3cdf0SGordon Ross
40426f3cdf0SGordon Ross if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
40526f3cdf0SGordon Ross {
40626f3cdf0SGordon Ross return_ACPI_STATUS (AE_OK);
40726f3cdf0SGordon Ross }
40826f3cdf0SGordon Ross
40926f3cdf0SGordon Ross ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
41026f3cdf0SGordon Ross if (!ExtraDesc)
41126f3cdf0SGordon Ross {
41226f3cdf0SGordon Ross return_ACPI_STATUS (AE_NOT_EXIST);
41326f3cdf0SGordon Ross }
41426f3cdf0SGordon Ross
41526f3cdf0SGordon Ross /* Get the Region node */
41626f3cdf0SGordon Ross
41726f3cdf0SGordon Ross Node = ObjDesc->Region.Node;
41826f3cdf0SGordon Ross
419*cb565728SJerry Jelinek ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
420*cb565728SJerry Jelinek ACPI_TYPE_REGION, Node, NULL));
42126f3cdf0SGordon Ross
422*cb565728SJerry Jelinek ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
423*cb565728SJerry Jelinek "[%4.4s] OpRegion Arg Init at AML %p\n",
42426f3cdf0SGordon Ross AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart));
42526f3cdf0SGordon Ross
42626f3cdf0SGordon Ross /* Execute the argument AML */
42726f3cdf0SGordon Ross
428*cb565728SJerry Jelinek Status = AcpiDsExecuteArguments (Node, ExtraDesc->Extra.ScopeNode,
42926f3cdf0SGordon Ross ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
430*cb565728SJerry Jelinek if (ACPI_FAILURE (Status))
431*cb565728SJerry Jelinek {
432*cb565728SJerry Jelinek return_ACPI_STATUS (Status);
433*cb565728SJerry Jelinek }
434*cb565728SJerry Jelinek
435*cb565728SJerry Jelinek Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId,
436*cb565728SJerry Jelinek ObjDesc->Region.Address, ObjDesc->Region.Length, Node);
43726f3cdf0SGordon Ross return_ACPI_STATUS (Status);
43826f3cdf0SGordon Ross }
439