dsfield.c revision 70243
167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: dsfield - Dispatcher field routines
470243Smsmith *              $Revision: 30 $
567754Smsmith *
667754Smsmith *****************************************************************************/
767754Smsmith
867754Smsmith/******************************************************************************
967754Smsmith *
1067754Smsmith * 1. Copyright Notice
1167754Smsmith *
1270243Smsmith * Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
1370243Smsmith * All rights reserved.
1467754Smsmith *
1567754Smsmith * 2. License
1667754Smsmith *
1767754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property
1867754Smsmith * rights.  You may have additional license terms from the party that provided
1967754Smsmith * you this software, covering your right to use that party's intellectual
2067754Smsmith * property rights.
2167754Smsmith *
2267754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2367754Smsmith * copy of the source code appearing in this file ("Covered Code") an
2467754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy,
2667754Smsmith * make derivatives, distribute, use and display any portion of the Covered
2767754Smsmith * Code in any form, with the right to sublicense such rights; and
2867754Smsmith *
2967754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3067754Smsmith * license (with the right to sublicense), under only those claims of Intel
3167754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell,
3267754Smsmith * offer to sell, and import the Covered Code and derivative works thereof
3367754Smsmith * solely to the minimum extent necessary to exercise the above copyright
3467754Smsmith * license, and in no event shall the patent license extend to any additions
3567754Smsmith * to or modifications of the Original Intel Code.  No other license or right
3667754Smsmith * is granted directly or by implication, estoppel or otherwise;
3767754Smsmith *
3867754Smsmith * The above copyright and patent license is granted only if the following
3967754Smsmith * conditions are met:
4067754Smsmith *
4167754Smsmith * 3. Conditions
4267754Smsmith *
4367754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4467754Smsmith * Redistribution of source code of any substantial portion of the Covered
4567754Smsmith * Code or modification with rights to further distribute source must include
4667754Smsmith * the above Copyright Notice, the above License, this list of Conditions,
4767754Smsmith * and the following Disclaimer and Export Compliance provision.  In addition,
4867754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to
4967754Smsmith * contain a file documenting the changes Licensee made to create that Covered
5067754Smsmith * Code and the date of any change.  Licensee must include in that file the
5167754Smsmith * documentation of any changes made by any predecessor Licensee.  Licensee
5267754Smsmith * must include a prominent statement that the modification is derived,
5367754Smsmith * directly or indirectly, from Original Intel Code.
5467754Smsmith *
5567754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5667754Smsmith * Redistribution of source code of any substantial portion of the Covered
5767754Smsmith * Code or modification without rights to further distribute source must
5867754Smsmith * include the following Disclaimer and Export Compliance provision in the
5967754Smsmith * documentation and/or other materials provided with distribution.  In
6067754Smsmith * addition, Licensee may not authorize further sublicense of source of any
6167754Smsmith * portion of the Covered Code, and must include terms to the effect that the
6267754Smsmith * license from Licensee to its licensee is limited to the intellectual
6367754Smsmith * property embodied in the software Licensee provides to its licensee, and
6467754Smsmith * not to intellectual property embodied in modifications its licensee may
6567754Smsmith * make.
6667754Smsmith *
6767754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any
6867754Smsmith * substantial portion of the Covered Code or modification must reproduce the
6967754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance
7067754Smsmith * provision in the documentation and/or other materials provided with the
7167754Smsmith * distribution.
7267754Smsmith *
7367754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original
7467754Smsmith * Intel Code.
7567754Smsmith *
7667754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7767754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or
7867754Smsmith * other dealings in products derived from or relating to the Covered Code
7967754Smsmith * without prior written authorization from Intel.
8067754Smsmith *
8167754Smsmith * 4. Disclaimer and Export Compliance
8267754Smsmith *
8367754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8467754Smsmith * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8567754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8667754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8767754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8867754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8967754Smsmith * PARTICULAR PURPOSE.
9067754Smsmith *
9167754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9267754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9367754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9467754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9567754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9667754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9767754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9867754Smsmith * LIMITED REMEDY.
9967754Smsmith *
10067754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this
10167754Smsmith * software or system incorporating such software without first obtaining any
10267754Smsmith * required license or other approval from the U. S. Department of Commerce or
10367754Smsmith * any other agency or department of the United States Government.  In the
10467754Smsmith * event Licensee exports any such software from the United States or
10567754Smsmith * re-exports any such software from a foreign destination, Licensee shall
10667754Smsmith * ensure that the distribution and export/re-export of the software is in
10767754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the
10867754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10967754Smsmith * any of its subsidiaries will export/re-export any technical data, process,
11067754Smsmith * software, or service, directly or indirectly, to any country for which the
11167754Smsmith * United States government or any agency thereof requires an export license,
11267754Smsmith * other governmental approval, or letter of assurance, without first obtaining
11367754Smsmith * such license, approval or letter.
11467754Smsmith *
11567754Smsmith *****************************************************************************/
11667754Smsmith
11767754Smsmith#define __DSFIELD_C__
11867754Smsmith
11967754Smsmith#include "acpi.h"
12067754Smsmith#include "amlcode.h"
12167754Smsmith#include "acdispat.h"
12267754Smsmith#include "acinterp.h"
12367754Smsmith#include "acnamesp.h"
12467754Smsmith
12567754Smsmith
12667754Smsmith#define _COMPONENT          DISPATCHER
12767754Smsmith        MODULE_NAME         ("dsfield")
12867754Smsmith
12967754Smsmith
13067754Smsmith/*
13167754Smsmith * Field flags: Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.)
13267754Smsmith *                   04      : LockRule (1 == Lock)
13367754Smsmith *                   05 - 06 : UpdateRule
13467754Smsmith */
13567754Smsmith
13667754Smsmith#define FIELD_ACCESS_TYPE_MASK      0x0F
13767754Smsmith#define FIELD_LOCK_RULE_MASK        0x10
13867754Smsmith#define FIELD_UPDATE_RULE_MASK      0x60
13967754Smsmith
14067754Smsmith
14167754Smsmith/*******************************************************************************
14267754Smsmith *
14367754Smsmith * FUNCTION:    AcpiDsCreateField
14467754Smsmith *
14567754Smsmith * PARAMETERS:  Op              - Op containing the Field definition and args
14667754Smsmith *              RegionNode  - Object for the containing Operation Region
14767754Smsmith *
14867754Smsmith * RETURN:      Status
14967754Smsmith *
15067754Smsmith * DESCRIPTION: Create a new field in the specified operation region
15167754Smsmith *
15267754Smsmith ******************************************************************************/
15367754Smsmith
15467754SmsmithACPI_STATUS
15567754SmsmithAcpiDsCreateField (
15667754Smsmith    ACPI_PARSE_OBJECT       *Op,
15767754Smsmith    ACPI_NAMESPACE_NODE     *RegionNode,
15867754Smsmith    ACPI_WALK_STATE         *WalkState)
15967754Smsmith{
16067754Smsmith    ACPI_STATUS             Status = AE_AML_ERROR;
16167754Smsmith    ACPI_PARSE_OBJECT       *Arg;
16267754Smsmith    ACPI_NAMESPACE_NODE     *Node;
16367754Smsmith    UINT8                   FieldFlags;
16467754Smsmith    UINT8                   AccessAttribute = 0;
16567754Smsmith    UINT32                  FieldBitPosition = 0;
16667754Smsmith
16767754Smsmith
16867754Smsmith    FUNCTION_TRACE_PTR ("DsCreateField", Op);
16967754Smsmith
17067754Smsmith
17167754Smsmith    /* First arg is the name of the parent OpRegion */
17267754Smsmith
17367754Smsmith    Arg = Op->Value.Arg;
17467754Smsmith    if (!RegionNode)
17567754Smsmith    {
17667754Smsmith        Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name,
17767754Smsmith                                ACPI_TYPE_REGION, IMODE_EXECUTE,
17867754Smsmith                                NS_SEARCH_PARENT, WalkState,
17967754Smsmith                                &RegionNode);
18067754Smsmith
18167754Smsmith        if (ACPI_FAILURE (Status))
18267754Smsmith        {
18367754Smsmith            return_ACPI_STATUS (Status);
18467754Smsmith        }
18567754Smsmith    }
18667754Smsmith
18767754Smsmith    /* Second arg is the field flags */
18867754Smsmith
18967754Smsmith    Arg = Arg->Next;
19067754Smsmith    FieldFlags = (UINT8) Arg->Value.Integer;
19167754Smsmith
19267754Smsmith    /* Each remaining arg is a Named Field */
19367754Smsmith
19467754Smsmith    Arg = Arg->Next;
19567754Smsmith    while (Arg)
19667754Smsmith    {
19767754Smsmith        switch (Arg->Opcode)
19867754Smsmith        {
19967754Smsmith        case AML_RESERVEDFIELD_OP:
20067754Smsmith
20167754Smsmith            FieldBitPosition += Arg->Value.Size;
20267754Smsmith            break;
20367754Smsmith
20467754Smsmith
20567754Smsmith        case AML_ACCESSFIELD_OP:
20667754Smsmith
20767754Smsmith            /*
20867754Smsmith             * Get a new AccessType and AccessAttribute for all
20967754Smsmith             * entries (until end or another AccessAs keyword)
21067754Smsmith             */
21167754Smsmith
21267754Smsmith            AccessAttribute = (UINT8) Arg->Value.Integer;
21367754Smsmith            FieldFlags      = (UINT8)
21467754Smsmith                            ((FieldFlags & FIELD_ACCESS_TYPE_MASK) ||
21567754Smsmith                            ((UINT8) (Arg->Value.Integer >> 8)));
21667754Smsmith            break;
21767754Smsmith
21867754Smsmith
21967754Smsmith        case AML_NAMEDFIELD_OP:
22067754Smsmith
22167754Smsmith            Status = AcpiNsLookup (WalkState->ScopeInfo,
22267754Smsmith                            (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
22367754Smsmith                            INTERNAL_TYPE_DEF_FIELD,
22467754Smsmith                            IMODE_LOAD_PASS1,
22567754Smsmith                            NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
22667754Smsmith                            NULL, &Node);
22767754Smsmith
22867754Smsmith            if (ACPI_FAILURE (Status))
22967754Smsmith            {
23067754Smsmith                return_ACPI_STATUS (Status);
23167754Smsmith            }
23267754Smsmith
23367754Smsmith            /*
23467754Smsmith             * Initialize an object for the new Node that is on
23567754Smsmith             * the object stack
23667754Smsmith             */
23767754Smsmith
23867754Smsmith            Status = AcpiAmlPrepDefFieldValue (Node, RegionNode, FieldFlags,
23967754Smsmith                            AccessAttribute, FieldBitPosition, Arg->Value.Size);
24067754Smsmith
24167754Smsmith            if (ACPI_FAILURE (Status))
24267754Smsmith            {
24367754Smsmith                return_ACPI_STATUS (Status);
24467754Smsmith            }
24567754Smsmith
24667754Smsmith            /* Keep track of bit position for *next* field */
24767754Smsmith
24867754Smsmith            FieldBitPosition += Arg->Value.Size;
24967754Smsmith            break;
25067754Smsmith        }
25167754Smsmith
25267754Smsmith        Arg = Arg->Next;
25367754Smsmith    }
25467754Smsmith
25567754Smsmith    return_ACPI_STATUS (Status);
25667754Smsmith}
25767754Smsmith
25867754Smsmith
25967754Smsmith/*******************************************************************************
26067754Smsmith *
26167754Smsmith * FUNCTION:    AcpiDsCreateBankField
26267754Smsmith *
26367754Smsmith * PARAMETERS:  Op              - Op containing the Field definition and args
26467754Smsmith *              RegionNode  - Object for the containing Operation Region
26567754Smsmith *
26667754Smsmith * RETURN:      Status
26767754Smsmith *
26867754Smsmith * DESCRIPTION: Create a new bank field in the specified operation region
26967754Smsmith *
27067754Smsmith ******************************************************************************/
27167754Smsmith
27267754SmsmithACPI_STATUS
27367754SmsmithAcpiDsCreateBankField (
27467754Smsmith    ACPI_PARSE_OBJECT       *Op,
27567754Smsmith    ACPI_NAMESPACE_NODE     *RegionNode,
27667754Smsmith    ACPI_WALK_STATE         *WalkState)
27767754Smsmith{
27867754Smsmith    ACPI_STATUS             Status = AE_AML_ERROR;
27967754Smsmith    ACPI_PARSE_OBJECT       *Arg;
28067754Smsmith    ACPI_NAMESPACE_NODE     *RegisterNode;
28167754Smsmith    ACPI_NAMESPACE_NODE     *Node;
28267754Smsmith    UINT32                  BankValue;
28367754Smsmith    UINT8                   FieldFlags;
28467754Smsmith    UINT8                   AccessAttribute = 0;
28567754Smsmith    UINT32                  FieldBitPosition = 0;
28667754Smsmith
28767754Smsmith
28867754Smsmith    FUNCTION_TRACE_PTR ("DsCreateBankField", Op);
28967754Smsmith
29067754Smsmith
29167754Smsmith    /* First arg is the name of the parent OpRegion */
29267754Smsmith
29367754Smsmith    Arg = Op->Value.Arg;
29467754Smsmith    if (!RegionNode)
29567754Smsmith    {
29667754Smsmith        Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name,
29767754Smsmith                                ACPI_TYPE_REGION, IMODE_EXECUTE,
29867754Smsmith                                NS_SEARCH_PARENT, WalkState,
29967754Smsmith                                &RegionNode);
30067754Smsmith
30167754Smsmith        if (ACPI_FAILURE (Status))
30267754Smsmith        {
30367754Smsmith            return_ACPI_STATUS (Status);
30467754Smsmith        }
30567754Smsmith    }
30667754Smsmith
30767754Smsmith    /* Second arg is the Bank Register */
30867754Smsmith
30967754Smsmith    Arg = Arg->Next;
31067754Smsmith
31167754Smsmith    Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
31267754Smsmith                            INTERNAL_TYPE_BANK_FIELD_DEFN,
31367754Smsmith                            IMODE_LOAD_PASS1,
31467754Smsmith                            NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
31567754Smsmith                            NULL, &RegisterNode);
31667754Smsmith
31767754Smsmith    if (ACPI_FAILURE (Status))
31867754Smsmith    {
31967754Smsmith        return_ACPI_STATUS (Status);
32067754Smsmith    }
32167754Smsmith
32267754Smsmith    /* Third arg is the BankValue */
32367754Smsmith
32467754Smsmith    Arg = Arg->Next;
32567754Smsmith    BankValue = Arg->Value.Integer;
32667754Smsmith
32767754Smsmith
32867754Smsmith    /* Next arg is the field flags */
32967754Smsmith
33067754Smsmith    Arg = Arg->Next;
33167754Smsmith    FieldFlags = (UINT8) Arg->Value.Integer;
33267754Smsmith
33367754Smsmith    /* Each remaining arg is a Named Field */
33467754Smsmith
33567754Smsmith    Arg = Arg->Next;
33667754Smsmith    while (Arg)
33767754Smsmith    {
33867754Smsmith        switch (Arg->Opcode)
33967754Smsmith        {
34067754Smsmith        case AML_RESERVEDFIELD_OP:
34167754Smsmith
34267754Smsmith            FieldBitPosition += Arg->Value.Size;
34367754Smsmith            break;
34467754Smsmith
34567754Smsmith
34667754Smsmith        case AML_ACCESSFIELD_OP:
34767754Smsmith
34867754Smsmith            /*
34967754Smsmith             * Get a new AccessType and AccessAttribute for
35067754Smsmith             * all entries (until end or another AccessAs keyword)
35167754Smsmith             */
35267754Smsmith
35367754Smsmith            AccessAttribute = (UINT8) Arg->Value.Integer;
35467754Smsmith            FieldFlags      = (UINT8)
35567754Smsmith                            ((FieldFlags & FIELD_ACCESS_TYPE_MASK) ||
35667754Smsmith                            ((UINT8) (Arg->Value.Integer >> 8)));
35767754Smsmith            break;
35867754Smsmith
35967754Smsmith
36067754Smsmith        case AML_NAMEDFIELD_OP:
36167754Smsmith
36267754Smsmith            Status = AcpiNsLookup (WalkState->ScopeInfo,
36367754Smsmith                            (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
36467754Smsmith                            INTERNAL_TYPE_DEF_FIELD,
36567754Smsmith                            IMODE_LOAD_PASS1,
36667754Smsmith                            NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
36767754Smsmith                            NULL, &Node);
36867754Smsmith
36967754Smsmith            if (ACPI_FAILURE (Status))
37067754Smsmith            {
37167754Smsmith                return_ACPI_STATUS (Status);
37267754Smsmith            }
37367754Smsmith
37467754Smsmith            /*
37567754Smsmith             * Initialize an object for the new Node that is on
37667754Smsmith             * the object stack
37767754Smsmith             */
37867754Smsmith
37967754Smsmith            Status = AcpiAmlPrepBankFieldValue (Node, RegionNode, RegisterNode,
38067754Smsmith                            BankValue, FieldFlags, AccessAttribute,
38167754Smsmith                            FieldBitPosition, Arg->Value.Size);
38267754Smsmith
38367754Smsmith            if (ACPI_FAILURE (Status))
38467754Smsmith            {
38567754Smsmith                return_ACPI_STATUS (Status);
38667754Smsmith            }
38767754Smsmith
38867754Smsmith            /* Keep track of bit position for the *next* field */
38967754Smsmith
39067754Smsmith            FieldBitPosition += Arg->Value.Size;
39167754Smsmith            break;
39267754Smsmith
39367754Smsmith        }
39467754Smsmith
39567754Smsmith        Arg = Arg->Next;
39667754Smsmith    }
39767754Smsmith
39867754Smsmith    return_ACPI_STATUS (Status);
39967754Smsmith}
40067754Smsmith
40167754Smsmith
40267754Smsmith/*******************************************************************************
40367754Smsmith *
40467754Smsmith * FUNCTION:    AcpiDsCreateIndexField
40567754Smsmith *
40667754Smsmith * PARAMETERS:  Op              - Op containing the Field definition and args
40767754Smsmith *              RegionNode  - Object for the containing Operation Region
40867754Smsmith *
40967754Smsmith * RETURN:      Status
41067754Smsmith *
41167754Smsmith * DESCRIPTION: Create a new index field in the specified operation region
41267754Smsmith *
41367754Smsmith ******************************************************************************/
41467754Smsmith
41567754SmsmithACPI_STATUS
41667754SmsmithAcpiDsCreateIndexField (
41767754Smsmith    ACPI_PARSE_OBJECT       *Op,
41867754Smsmith    ACPI_HANDLE             RegionNode,
41967754Smsmith    ACPI_WALK_STATE         *WalkState)
42067754Smsmith{
42167754Smsmith    ACPI_STATUS             Status;
42267754Smsmith    ACPI_PARSE_OBJECT       *Arg;
42367754Smsmith    ACPI_NAMESPACE_NODE     *Node;
42467754Smsmith    ACPI_NAMESPACE_NODE     *IndexRegisterNode;
42567754Smsmith    ACPI_NAMESPACE_NODE     *DataRegisterNode;
42667754Smsmith    UINT8                   FieldFlags;
42767754Smsmith    UINT8                   AccessAttribute = 0;
42867754Smsmith    UINT32                  FieldBitPosition = 0;
42967754Smsmith
43067754Smsmith
43167754Smsmith    FUNCTION_TRACE_PTR ("DsCreateIndexField", Op);
43267754Smsmith
43367754Smsmith
43467754Smsmith    Arg = Op->Value.Arg;
43567754Smsmith
43667754Smsmith    /* First arg is the name of the Index register */
43767754Smsmith
43867754Smsmith    Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
43967754Smsmith                            ACPI_TYPE_ANY, IMODE_LOAD_PASS1,
44067754Smsmith                            NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
44167754Smsmith                            NULL, &IndexRegisterNode);
44267754Smsmith
44367754Smsmith    if (ACPI_FAILURE (Status))
44467754Smsmith    {
44567754Smsmith        return_ACPI_STATUS (Status);
44667754Smsmith    }
44767754Smsmith
44867754Smsmith    /* Second arg is the data register */
44967754Smsmith
45067754Smsmith    Arg = Arg->Next;
45167754Smsmith
45267754Smsmith    Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
45367754Smsmith                            INTERNAL_TYPE_INDEX_FIELD_DEFN,
45467754Smsmith                            IMODE_LOAD_PASS1,
45567754Smsmith                            NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
45667754Smsmith                            NULL, &DataRegisterNode);
45767754Smsmith
45867754Smsmith    if (ACPI_FAILURE (Status))
45967754Smsmith    {
46067754Smsmith        return_ACPI_STATUS (Status);
46167754Smsmith    }
46267754Smsmith
46367754Smsmith
46467754Smsmith    /* Next arg is the field flags */
46567754Smsmith
46667754Smsmith    Arg = Arg->Next;
46767754Smsmith    FieldFlags = (UINT8) Arg->Value.Integer;
46867754Smsmith
46967754Smsmith
47067754Smsmith    /* Each remaining arg is a Named Field */
47167754Smsmith
47267754Smsmith    Arg = Arg->Next;
47367754Smsmith    while (Arg)
47467754Smsmith    {
47567754Smsmith        switch (Arg->Opcode)
47667754Smsmith        {
47767754Smsmith        case AML_RESERVEDFIELD_OP:
47867754Smsmith
47967754Smsmith            FieldBitPosition += Arg->Value.Size;
48067754Smsmith            break;
48167754Smsmith
48267754Smsmith
48367754Smsmith        case AML_ACCESSFIELD_OP:
48467754Smsmith
48567754Smsmith            /*
48667754Smsmith             * Get a new AccessType and AccessAttribute for all
48767754Smsmith             * entries (until end or another AccessAs keyword)
48867754Smsmith             */
48967754Smsmith
49067754Smsmith            AccessAttribute = (UINT8) Arg->Value.Integer;
49167754Smsmith            FieldFlags      = (UINT8)
49267754Smsmith                                ((FieldFlags & FIELD_ACCESS_TYPE_MASK) ||
49367754Smsmith                                ((UINT8) (Arg->Value.Integer >> 8)));
49467754Smsmith            break;
49567754Smsmith
49667754Smsmith
49767754Smsmith        case AML_NAMEDFIELD_OP:
49867754Smsmith
49967754Smsmith            Status = AcpiNsLookup (WalkState->ScopeInfo,
50067754Smsmith                                    (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
50167754Smsmith                                    INTERNAL_TYPE_INDEX_FIELD,
50267754Smsmith                                    IMODE_LOAD_PASS1,
50367754Smsmith                                    NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
50467754Smsmith                                    NULL, &Node);
50567754Smsmith
50667754Smsmith            if (ACPI_FAILURE (Status))
50767754Smsmith            {
50867754Smsmith                return_ACPI_STATUS (Status);
50967754Smsmith            }
51067754Smsmith
51167754Smsmith            /*
51267754Smsmith             * Initialize an object for the new Node that is on
51367754Smsmith             * the object stack
51467754Smsmith             */
51567754Smsmith
51667754Smsmith            Status = AcpiAmlPrepIndexFieldValue (Node, IndexRegisterNode, DataRegisterNode,
51767754Smsmith                            FieldFlags, AccessAttribute,
51867754Smsmith                            FieldBitPosition, Arg->Value.Size);
51967754Smsmith
52067754Smsmith            if (ACPI_FAILURE (Status))
52167754Smsmith            {
52267754Smsmith                return_ACPI_STATUS (Status);
52367754Smsmith            }
52467754Smsmith
52567754Smsmith            /* Keep track of bit position for the *next* field */
52667754Smsmith
52767754Smsmith            FieldBitPosition += Arg->Value.Size;
52867754Smsmith            break;
52967754Smsmith
53067754Smsmith
53167754Smsmith        default:
53267754Smsmith
53367754Smsmith            DEBUG_PRINT (ACPI_ERROR,
53467754Smsmith                ("DsEnterIndexField: Invalid opcode in field list: %X\n",
53567754Smsmith                Arg->Opcode));
53667754Smsmith            Status = AE_AML_ERROR;
53767754Smsmith            break;
53867754Smsmith        }
53967754Smsmith
54067754Smsmith        Arg = Arg->Next;
54167754Smsmith    }
54267754Smsmith
54367754Smsmith    return_ACPI_STATUS (Status);
54467754Smsmith}
54567754Smsmith
54667754Smsmith
547