Home | History | Annotate | Line # | Download | only in dispatcher
dsfield.c revision 1.1
      1 /******************************************************************************
      2  *
      3  * Module Name: dsfield - Dispatcher field routines
      4  *
      5  *****************************************************************************/
      6 
      7 /******************************************************************************
      8  *
      9  * 1. Copyright Notice
     10  *
     11  * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
     12  * All rights reserved.
     13  *
     14  * 2. License
     15  *
     16  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  * rights.  You may have additional license terms from the party that provided
     18  * you this software, covering your right to use that party's intellectual
     19  * property rights.
     20  *
     21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  * copy of the source code appearing in this file ("Covered Code") an
     23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  * make derivatives, distribute, use and display any portion of the Covered
     26  * Code in any form, with the right to sublicense such rights; and
     27  *
     28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     29  * license (with the right to sublicense), under only those claims of Intel
     30  * patents that are infringed by the Original Intel Code, to make, use, sell,
     31  * offer to sell, and import the Covered Code and derivative works thereof
     32  * solely to the minimum extent necessary to exercise the above copyright
     33  * license, and in no event shall the patent license extend to any additions
     34  * to or modifications of the Original Intel Code.  No other license or right
     35  * is granted directly or by implication, estoppel or otherwise;
     36  *
     37  * The above copyright and patent license is granted only if the following
     38  * conditions are met:
     39  *
     40  * 3. Conditions
     41  *
     42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     43  * Redistribution of source code of any substantial portion of the Covered
     44  * Code or modification with rights to further distribute source must include
     45  * the above Copyright Notice, the above License, this list of Conditions,
     46  * and the following Disclaimer and Export Compliance provision.  In addition,
     47  * Licensee must cause all Covered Code to which Licensee contributes to
     48  * contain a file documenting the changes Licensee made to create that Covered
     49  * Code and the date of any change.  Licensee must include in that file the
     50  * documentation of any changes made by any predecessor Licensee.  Licensee
     51  * must include a prominent statement that the modification is derived,
     52  * directly or indirectly, from Original Intel Code.
     53  *
     54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     55  * Redistribution of source code of any substantial portion of the Covered
     56  * Code or modification without rights to further distribute source must
     57  * include the following Disclaimer and Export Compliance provision in the
     58  * documentation and/or other materials provided with distribution.  In
     59  * addition, Licensee may not authorize further sublicense of source of any
     60  * portion of the Covered Code, and must include terms to the effect that the
     61  * license from Licensee to its licensee is limited to the intellectual
     62  * property embodied in the software Licensee provides to its licensee, and
     63  * not to intellectual property embodied in modifications its licensee may
     64  * make.
     65  *
     66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     67  * substantial portion of the Covered Code or modification must reproduce the
     68  * above Copyright Notice, and the following Disclaimer and Export Compliance
     69  * provision in the documentation and/or other materials provided with the
     70  * distribution.
     71  *
     72  * 3.4. Intel retains all right, title, and interest in and to the Original
     73  * Intel Code.
     74  *
     75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     76  * Intel shall be used in advertising or otherwise to promote the sale, use or
     77  * other dealings in products derived from or relating to the Covered Code
     78  * without prior written authorization from Intel.
     79  *
     80  * 4. Disclaimer and Export Compliance
     81  *
     82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     83  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
     85  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
     86  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
     87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     88  * PARTICULAR PURPOSE.
     89  *
     90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
     96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     97  * LIMITED REMEDY.
     98  *
     99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    100  * software or system incorporating such software without first obtaining any
    101  * required license or other approval from the U. S. Department of Commerce or
    102  * any other agency or department of the United States Government.  In the
    103  * event Licensee exports any such software from the United States or
    104  * re-exports any such software from a foreign destination, Licensee shall
    105  * ensure that the distribution and export/re-export of the software is in
    106  * compliance with all laws, regulations, orders, or other restrictions of the
    107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    108  * any of its subsidiaries will export/re-export any technical data, process,
    109  * software, or service, directly or indirectly, to any country for which the
    110  * United States government or any agency thereof requires an export license,
    111  * other governmental approval, or letter of assurance, without first obtaining
    112  * such license, approval or letter.
    113  *
    114  *****************************************************************************/
    115 
    116 #define __DSFIELD_C__
    117 
    118 #include "acpi.h"
    119 #include "accommon.h"
    120 #include "amlcode.h"
    121 #include "acdispat.h"
    122 #include "acinterp.h"
    123 #include "acnamesp.h"
    124 #include "acparser.h"
    125 
    126 
    127 #define _COMPONENT          ACPI_DISPATCHER
    128         ACPI_MODULE_NAME    ("dsfield")
    129 
    130 /* Local prototypes */
    131 
    132 static ACPI_STATUS
    133 AcpiDsGetFieldNames (
    134     ACPI_CREATE_FIELD_INFO  *Info,
    135     ACPI_WALK_STATE         *WalkState,
    136     ACPI_PARSE_OBJECT       *Arg);
    137 
    138 
    139 /*******************************************************************************
    140  *
    141  * FUNCTION:    AcpiDsCreateBufferField
    142  *
    143  * PARAMETERS:  Op                  - Current parse op (CreateXXField)
    144  *              WalkState           - Current state
    145  *
    146  * RETURN:      Status
    147  *
    148  * DESCRIPTION: Execute the CreateField operators:
    149  *              CreateBitFieldOp,
    150  *              CreateByteFieldOp,
    151  *              CreateWordFieldOp,
    152  *              CreateDWordFieldOp,
    153  *              CreateQWordFieldOp,
    154  *              CreateFieldOp       (all of which define a field in a buffer)
    155  *
    156  ******************************************************************************/
    157 
    158 ACPI_STATUS
    159 AcpiDsCreateBufferField (
    160     ACPI_PARSE_OBJECT       *Op,
    161     ACPI_WALK_STATE         *WalkState)
    162 {
    163     ACPI_PARSE_OBJECT       *Arg;
    164     ACPI_NAMESPACE_NODE     *Node;
    165     ACPI_STATUS             Status;
    166     ACPI_OPERAND_OBJECT     *ObjDesc;
    167     ACPI_OPERAND_OBJECT     *SecondDesc = NULL;
    168     UINT32                  Flags;
    169 
    170 
    171     ACPI_FUNCTION_TRACE (DsCreateBufferField);
    172 
    173 
    174     /*
    175      * Get the NameString argument (name of the new BufferField)
    176      */
    177     if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
    178     {
    179         /* For CreateField, name is the 4th argument */
    180 
    181         Arg = AcpiPsGetArg (Op, 3);
    182     }
    183     else
    184     {
    185         /* For all other CreateXXXField operators, name is the 3rd argument */
    186 
    187         Arg = AcpiPsGetArg (Op, 2);
    188     }
    189 
    190     if (!Arg)
    191     {
    192         return_ACPI_STATUS (AE_AML_NO_OPERAND);
    193     }
    194 
    195     if (WalkState->DeferredNode)
    196     {
    197         Node = WalkState->DeferredNode;
    198         Status = AE_OK;
    199     }
    200     else
    201     {
    202         /* Execute flag should always be set when this function is entered */
    203 
    204         if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
    205         {
    206             return_ACPI_STATUS (AE_AML_INTERNAL);
    207         }
    208 
    209         /* Creating new namespace node, should not already exist */
    210 
    211         Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
    212                 ACPI_NS_ERROR_IF_FOUND;
    213 
    214         /*
    215          * Mark node temporary if we are executing a normal control
    216          * method. (Don't mark if this is a module-level code method)
    217          */
    218         if (WalkState->MethodNode &&
    219             !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
    220         {
    221             Flags |= ACPI_NS_TEMPORARY;
    222         }
    223 
    224         /* Enter the NameString into the namespace */
    225 
    226         Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
    227                     ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
    228                     Flags, WalkState, &Node);
    229         if (ACPI_FAILURE (Status))
    230         {
    231             ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
    232             return_ACPI_STATUS (Status);
    233         }
    234     }
    235 
    236     /*
    237      * We could put the returned object (Node) on the object stack for later,
    238      * but for now, we will put it in the "op" object that the parser uses,
    239      * so we can get it again at the end of this scope.
    240      */
    241     Op->Common.Node = Node;
    242 
    243     /*
    244      * If there is no object attached to the node, this node was just created
    245      * and we need to create the field object. Otherwise, this was a lookup
    246      * of an existing node and we don't want to create the field object again.
    247      */
    248     ObjDesc = AcpiNsGetAttachedObject (Node);
    249     if (ObjDesc)
    250     {
    251         return_ACPI_STATUS (AE_OK);
    252     }
    253 
    254     /*
    255      * The Field definition is not fully parsed at this time.
    256      * (We must save the address of the AML for the buffer and index operands)
    257      */
    258 
    259     /* Create the buffer field object */
    260 
    261     ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD);
    262     if (!ObjDesc)
    263     {
    264         Status = AE_NO_MEMORY;
    265         goto Cleanup;
    266     }
    267 
    268     /*
    269      * Remember location in AML stream of the field unit opcode and operands --
    270      * since the buffer and index operands must be evaluated.
    271      */
    272     SecondDesc                  = ObjDesc->Common.NextObject;
    273     SecondDesc->Extra.AmlStart  = Op->Named.Data;
    274     SecondDesc->Extra.AmlLength = Op->Named.Length;
    275     ObjDesc->BufferField.Node   = Node;
    276 
    277     /* Attach constructed field descriptors to parent node */
    278 
    279     Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_BUFFER_FIELD);
    280     if (ACPI_FAILURE (Status))
    281     {
    282         goto Cleanup;
    283     }
    284 
    285 
    286 Cleanup:
    287 
    288     /* Remove local reference to the object */
    289 
    290     AcpiUtRemoveReference (ObjDesc);
    291     return_ACPI_STATUS (Status);
    292 }
    293 
    294 
    295 /*******************************************************************************
    296  *
    297  * FUNCTION:    AcpiDsGetFieldNames
    298  *
    299  * PARAMETERS:  Info            - CreateField info structure
    300  *  `           WalkState       - Current method state
    301  *              Arg             - First parser arg for the field name list
    302  *
    303  * RETURN:      Status
    304  *
    305  * DESCRIPTION: Process all named fields in a field declaration.  Names are
    306  *              entered into the namespace.
    307  *
    308  ******************************************************************************/
    309 
    310 static ACPI_STATUS
    311 AcpiDsGetFieldNames (
    312     ACPI_CREATE_FIELD_INFO  *Info,
    313     ACPI_WALK_STATE         *WalkState,
    314     ACPI_PARSE_OBJECT       *Arg)
    315 {
    316     ACPI_STATUS             Status;
    317     UINT64                  Position;
    318 
    319 
    320     ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
    321 
    322 
    323     /* First field starts at bit zero */
    324 
    325     Info->FieldBitPosition = 0;
    326 
    327     /* Process all elements in the field list (of parse nodes) */
    328 
    329     while (Arg)
    330     {
    331         /*
    332          * Three types of field elements are handled:
    333          * 1) Offset - specifies a bit offset
    334          * 2) AccessAs - changes the access mode
    335          * 3) Name - Enters a new named field into the namespace
    336          */
    337         switch (Arg->Common.AmlOpcode)
    338         {
    339         case AML_INT_RESERVEDFIELD_OP:
    340 
    341             Position = (UINT64) Info->FieldBitPosition
    342                         + (UINT64) Arg->Common.Value.Size;
    343 
    344             if (Position > ACPI_UINT32_MAX)
    345             {
    346                 ACPI_ERROR ((AE_INFO,
    347                     "Bit offset within field too large (> 0xFFFFFFFF)"));
    348                 return_ACPI_STATUS (AE_SUPPORT);
    349             }
    350 
    351             Info->FieldBitPosition = (UINT32) Position;
    352             break;
    353 
    354 
    355         case AML_INT_ACCESSFIELD_OP:
    356 
    357             /*
    358              * Get a new AccessType and AccessAttribute -- to be used for all
    359              * field units that follow, until field end or another AccessAs
    360              * keyword.
    361              *
    362              * In FieldFlags, preserve the flag bits other than the
    363              * ACCESS_TYPE bits
    364              */
    365             Info->FieldFlags = (UINT8)
    366                 ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
    367                 ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8)));
    368 
    369             Info->Attribute = (UINT8) (Arg->Common.Value.Integer);
    370             break;
    371 
    372 
    373         case AML_INT_NAMEDFIELD_OP:
    374 
    375             /* Lookup the name, it should already exist */
    376 
    377             Status = AcpiNsLookup (WalkState->ScopeInfo,
    378                         (char *) &Arg->Named.Name, Info->FieldType,
    379                         ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
    380                         WalkState, &Info->FieldNode);
    381             if (ACPI_FAILURE (Status))
    382             {
    383                 ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
    384                 return_ACPI_STATUS (Status);
    385             }
    386             else
    387             {
    388                 Arg->Common.Node = Info->FieldNode;
    389                 Info->FieldBitLength = Arg->Common.Value.Size;
    390 
    391                 /*
    392                  * If there is no object attached to the node, this node was
    393                  * just created and we need to create the field object.
    394                  * Otherwise, this was a lookup of an existing node and we
    395                  * don't want to create the field object again.
    396                  */
    397                 if (!AcpiNsGetAttachedObject (Info->FieldNode))
    398                 {
    399                     Status = AcpiExPrepFieldValue (Info);
    400                     if (ACPI_FAILURE (Status))
    401                     {
    402                         return_ACPI_STATUS (Status);
    403                     }
    404                 }
    405             }
    406 
    407             /* Keep track of bit position for the next field */
    408 
    409             Position = (UINT64) Info->FieldBitPosition
    410                         + (UINT64) Arg->Common.Value.Size;
    411 
    412             if (Position > ACPI_UINT32_MAX)
    413             {
    414                 ACPI_ERROR ((AE_INFO,
    415                     "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
    416                     ACPI_CAST_PTR (char, &Info->FieldNode->Name)));
    417                 return_ACPI_STATUS (AE_SUPPORT);
    418             }
    419 
    420             Info->FieldBitPosition += Info->FieldBitLength;
    421             break;
    422 
    423 
    424         default:
    425 
    426             ACPI_ERROR ((AE_INFO,
    427                 "Invalid opcode in field list: 0x%X", Arg->Common.AmlOpcode));
    428             return_ACPI_STATUS (AE_AML_BAD_OPCODE);
    429         }
    430 
    431         Arg = Arg->Common.Next;
    432     }
    433 
    434     return_ACPI_STATUS (AE_OK);
    435 }
    436 
    437 
    438 /*******************************************************************************
    439  *
    440  * FUNCTION:    AcpiDsCreateField
    441  *
    442  * PARAMETERS:  Op              - Op containing the Field definition and args
    443  *              RegionNode      - Object for the containing Operation Region
    444  *  `           WalkState       - Current method state
    445  *
    446  * RETURN:      Status
    447  *
    448  * DESCRIPTION: Create a new field in the specified operation region
    449  *
    450  ******************************************************************************/
    451 
    452 ACPI_STATUS
    453 AcpiDsCreateField (
    454     ACPI_PARSE_OBJECT       *Op,
    455     ACPI_NAMESPACE_NODE     *RegionNode,
    456     ACPI_WALK_STATE         *WalkState)
    457 {
    458     ACPI_STATUS             Status;
    459     ACPI_PARSE_OBJECT       *Arg;
    460     ACPI_CREATE_FIELD_INFO  Info;
    461 
    462 
    463     ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op);
    464 
    465 
    466     /* First arg is the name of the parent OpRegion (must already exist) */
    467 
    468     Arg = Op->Common.Value.Arg;
    469     if (!RegionNode)
    470     {
    471         Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
    472                         ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
    473                         ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
    474         if (ACPI_FAILURE (Status))
    475         {
    476             ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status);
    477             return_ACPI_STATUS (Status);
    478         }
    479     }
    480 
    481     /* Second arg is the field flags */
    482 
    483     Arg = Arg->Common.Next;
    484     Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
    485     Info.Attribute = 0;
    486 
    487     /* Each remaining arg is a Named Field */
    488 
    489     Info.FieldType = ACPI_TYPE_LOCAL_REGION_FIELD;
    490     Info.RegionNode = RegionNode;
    491 
    492     Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
    493 
    494     return_ACPI_STATUS (Status);
    495 }
    496 
    497 
    498 /*******************************************************************************
    499  *
    500  * FUNCTION:    AcpiDsInitFieldObjects
    501  *
    502  * PARAMETERS:  Op              - Op containing the Field definition and args
    503  *  `           WalkState       - Current method state
    504  *
    505  * RETURN:      Status
    506  *
    507  * DESCRIPTION: For each "Field Unit" name in the argument list that is
    508  *              part of the field declaration, enter the name into the
    509  *              namespace.
    510  *
    511  ******************************************************************************/
    512 
    513 ACPI_STATUS
    514 AcpiDsInitFieldObjects (
    515     ACPI_PARSE_OBJECT       *Op,
    516     ACPI_WALK_STATE         *WalkState)
    517 {
    518     ACPI_STATUS             Status;
    519     ACPI_PARSE_OBJECT       *Arg = NULL;
    520     ACPI_NAMESPACE_NODE     *Node;
    521     UINT8                   Type = 0;
    522     UINT32                  Flags;
    523 
    524 
    525     ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op);
    526 
    527 
    528     /* Execute flag should always be set when this function is entered */
    529 
    530     if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
    531     {
    532         if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)
    533         {
    534             /* BankField Op is deferred, just return OK */
    535 
    536             return_ACPI_STATUS (AE_OK);
    537         }
    538 
    539         return_ACPI_STATUS (AE_AML_INTERNAL);
    540     }
    541 
    542     /*
    543      * Get the FieldList argument for this opcode. This is the start of the
    544      * list of field elements.
    545      */
    546     switch (WalkState->Opcode)
    547     {
    548     case AML_FIELD_OP:
    549         Arg = AcpiPsGetArg (Op, 2);
    550         Type = ACPI_TYPE_LOCAL_REGION_FIELD;
    551         break;
    552 
    553     case AML_BANK_FIELD_OP:
    554         Arg = AcpiPsGetArg (Op, 4);
    555         Type = ACPI_TYPE_LOCAL_BANK_FIELD;
    556         break;
    557 
    558     case AML_INDEX_FIELD_OP:
    559         Arg = AcpiPsGetArg (Op, 3);
    560         Type = ACPI_TYPE_LOCAL_INDEX_FIELD;
    561         break;
    562 
    563     default:
    564         return_ACPI_STATUS (AE_BAD_PARAMETER);
    565     }
    566 
    567     /* Creating new namespace node(s), should not already exist */
    568 
    569     Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
    570             ACPI_NS_ERROR_IF_FOUND;
    571 
    572     /*
    573      * Mark node(s) temporary if we are executing a normal control
    574      * method. (Don't mark if this is a module-level code method)
    575      */
    576     if (WalkState->MethodNode &&
    577         !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
    578     {
    579         Flags |= ACPI_NS_TEMPORARY;
    580     }
    581 
    582     /*
    583      * Walk the list of entries in the FieldList
    584      * Note: FieldList can be of zero length. In this case, Arg will be NULL.
    585      */
    586     while (Arg)
    587     {
    588         /*
    589          * Ignore OFFSET and ACCESSAS terms here; we are only interested in the
    590          * field names in order to enter them into the namespace.
    591          */
    592         if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
    593         {
    594             Status = AcpiNsLookup (WalkState->ScopeInfo,
    595                         (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
    596                         Flags, WalkState, &Node);
    597             if (ACPI_FAILURE (Status))
    598             {
    599                 ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
    600                 if (Status != AE_ALREADY_EXISTS)
    601                 {
    602                     return_ACPI_STATUS (Status);
    603                 }
    604 
    605                 /* Name already exists, just ignore this error */
    606 
    607                 Status = AE_OK;
    608             }
    609 
    610             Arg->Common.Node = Node;
    611         }
    612 
    613         /* Get the next field element in the list */
    614 
    615         Arg = Arg->Common.Next;
    616     }
    617 
    618     return_ACPI_STATUS (AE_OK);
    619 }
    620 
    621 
    622 /*******************************************************************************
    623  *
    624  * FUNCTION:    AcpiDsCreateBankField
    625  *
    626  * PARAMETERS:  Op              - Op containing the Field definition and args
    627  *              RegionNode      - Object for the containing Operation Region
    628  *              WalkState       - Current method state
    629  *
    630  * RETURN:      Status
    631  *
    632  * DESCRIPTION: Create a new bank field in the specified operation region
    633  *
    634  ******************************************************************************/
    635 
    636 ACPI_STATUS
    637 AcpiDsCreateBankField (
    638     ACPI_PARSE_OBJECT       *Op,
    639     ACPI_NAMESPACE_NODE     *RegionNode,
    640     ACPI_WALK_STATE         *WalkState)
    641 {
    642     ACPI_STATUS             Status;
    643     ACPI_PARSE_OBJECT       *Arg;
    644     ACPI_CREATE_FIELD_INFO  Info;
    645 
    646 
    647     ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op);
    648 
    649 
    650     /* First arg is the name of the parent OpRegion (must already exist) */
    651 
    652     Arg = Op->Common.Value.Arg;
    653     if (!RegionNode)
    654     {
    655         Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
    656                         ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
    657                         ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
    658         if (ACPI_FAILURE (Status))
    659         {
    660             ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status);
    661             return_ACPI_STATUS (Status);
    662         }
    663     }
    664 
    665     /* Second arg is the Bank Register (Field) (must already exist) */
    666 
    667     Arg = Arg->Common.Next;
    668     Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
    669                     ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
    670                     ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
    671     if (ACPI_FAILURE (Status))
    672     {
    673         ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
    674         return_ACPI_STATUS (Status);
    675     }
    676 
    677     /*
    678      * Third arg is the BankValue
    679      * This arg is a TermArg, not a constant
    680      * It will be evaluated later, by AcpiDsEvalBankFieldOperands
    681      */
    682     Arg = Arg->Common.Next;
    683 
    684     /* Fourth arg is the field flags */
    685 
    686     Arg = Arg->Common.Next;
    687     Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
    688 
    689     /* Each remaining arg is a Named Field */
    690 
    691     Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD;
    692     Info.RegionNode = RegionNode;
    693 
    694     /*
    695      * Use Info.DataRegisterNode to store BankField Op
    696      * It's safe because DataRegisterNode will never be used when create bank field
    697      * We store AmlStart and AmlLength in the BankField Op for late evaluation
    698      * Used in AcpiExPrepFieldValue(Info)
    699      *
    700      * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"?
    701      */
    702     Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op;
    703 
    704     Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
    705     return_ACPI_STATUS (Status);
    706 }
    707 
    708 
    709 /*******************************************************************************
    710  *
    711  * FUNCTION:    AcpiDsCreateIndexField
    712  *
    713  * PARAMETERS:  Op              - Op containing the Field definition and args
    714  *              RegionNode      - Object for the containing Operation Region
    715  *  `           WalkState       - Current method state
    716  *
    717  * RETURN:      Status
    718  *
    719  * DESCRIPTION: Create a new index field in the specified operation region
    720  *
    721  ******************************************************************************/
    722 
    723 ACPI_STATUS
    724 AcpiDsCreateIndexField (
    725     ACPI_PARSE_OBJECT       *Op,
    726     ACPI_NAMESPACE_NODE     *RegionNode,
    727     ACPI_WALK_STATE         *WalkState)
    728 {
    729     ACPI_STATUS             Status;
    730     ACPI_PARSE_OBJECT       *Arg;
    731     ACPI_CREATE_FIELD_INFO  Info;
    732 
    733 
    734     ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op);
    735 
    736 
    737     /* First arg is the name of the Index register (must already exist) */
    738 
    739     Arg = Op->Common.Value.Arg;
    740     Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
    741                     ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
    742                     ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
    743     if (ACPI_FAILURE (Status))
    744     {
    745         ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
    746         return_ACPI_STATUS (Status);
    747     }
    748 
    749     /* Second arg is the data register (must already exist) */
    750 
    751     Arg = Arg->Common.Next;
    752     Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
    753                     ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
    754                     ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
    755     if (ACPI_FAILURE (Status))
    756     {
    757         ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
    758         return_ACPI_STATUS (Status);
    759     }
    760 
    761     /* Next arg is the field flags */
    762 
    763     Arg = Arg->Common.Next;
    764     Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
    765 
    766     /* Each remaining arg is a Named Field */
    767 
    768     Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD;
    769     Info.RegionNode = RegionNode;
    770 
    771     Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
    772 
    773     return_ACPI_STATUS (Status);
    774 }
    775 
    776 
    777