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