t40c term[] count fix
[minix.git] / drivers / acpi / dispatcher / dsfield.c
blob23e33782d54dafaa49a80e28f79d9b8b642da609
1 /******************************************************************************
3 * Module Name: dsfield - Dispatcher field routines
5 *****************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12 * All rights reserved.
14 * 2. License
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.
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
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;
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
40 * 3. Conditions
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.
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.
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.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
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.
80 * 4. Disclaimer and Export Compliance
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.
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.
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.
114 *****************************************************************************/
116 #define __DSFIELD_C__
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"
127 #define _COMPONENT ACPI_DISPATCHER
128 ACPI_MODULE_NAME ("dsfield")
130 /* Local prototypes */
132 static ACPI_STATUS
133 AcpiDsGetFieldNames (
134 ACPI_CREATE_FIELD_INFO *Info,
135 ACPI_WALK_STATE *WalkState,
136 ACPI_PARSE_OBJECT *Arg);
139 /*******************************************************************************
141 * FUNCTION: AcpiDsCreateBufferField
143 * PARAMETERS: Op - Current parse op (CreateXXField)
144 * WalkState - Current state
146 * RETURN: Status
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)
156 ******************************************************************************/
158 ACPI_STATUS
159 AcpiDsCreateBufferField (
160 ACPI_PARSE_OBJECT *Op,
161 ACPI_WALK_STATE *WalkState)
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;
171 ACPI_FUNCTION_TRACE (DsCreateBufferField);
175 * Get the NameString argument (name of the new BufferField)
177 if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
179 /* For CreateField, name is the 4th argument */
181 Arg = AcpiPsGetArg (Op, 3);
183 else
185 /* For all other CreateXXXField operators, name is the 3rd argument */
187 Arg = AcpiPsGetArg (Op, 2);
190 if (!Arg)
192 return_ACPI_STATUS (AE_AML_NO_OPERAND);
195 if (WalkState->DeferredNode)
197 Node = WalkState->DeferredNode;
198 Status = AE_OK;
200 else
202 /* Execute flag should always be set when this function is entered */
204 if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
206 return_ACPI_STATUS (AE_AML_INTERNAL);
209 /* Creating new namespace node, should not already exist */
211 Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
212 ACPI_NS_ERROR_IF_FOUND;
215 * Mark node temporary if we are executing a normal control
216 * method. (Don't mark if this is a module-level code method)
218 if (WalkState->MethodNode &&
219 !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
221 Flags |= ACPI_NS_TEMPORARY;
224 /* Enter the NameString into the namespace */
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))
231 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
232 return_ACPI_STATUS (Status);
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.
241 Op->Common.Node = Node;
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.
248 ObjDesc = AcpiNsGetAttachedObject (Node);
249 if (ObjDesc)
251 return_ACPI_STATUS (AE_OK);
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)
259 /* Create the buffer field object */
261 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD);
262 if (!ObjDesc)
264 Status = AE_NO_MEMORY;
265 goto Cleanup;
269 * Remember location in AML stream of the field unit opcode and operands --
270 * since the buffer and index operands must be evaluated.
272 SecondDesc = ObjDesc->Common.NextObject;
273 SecondDesc->Extra.AmlStart = Op->Named.Data;
274 SecondDesc->Extra.AmlLength = Op->Named.Length;
275 ObjDesc->BufferField.Node = Node;
277 /* Attach constructed field descriptors to parent node */
279 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_BUFFER_FIELD);
280 if (ACPI_FAILURE (Status))
282 goto Cleanup;
286 Cleanup:
288 /* Remove local reference to the object */
290 AcpiUtRemoveReference (ObjDesc);
291 return_ACPI_STATUS (Status);
295 /*******************************************************************************
297 * FUNCTION: AcpiDsGetFieldNames
299 * PARAMETERS: Info - CreateField info structure
300 * ` WalkState - Current method state
301 * Arg - First parser arg for the field name list
303 * RETURN: Status
305 * DESCRIPTION: Process all named fields in a field declaration. Names are
306 * entered into the namespace.
308 ******************************************************************************/
310 static ACPI_STATUS
311 AcpiDsGetFieldNames (
312 ACPI_CREATE_FIELD_INFO *Info,
313 ACPI_WALK_STATE *WalkState,
314 ACPI_PARSE_OBJECT *Arg)
316 ACPI_STATUS Status;
317 UINT64 Position;
320 ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
323 /* First field starts at bit zero */
325 Info->FieldBitPosition = 0;
327 /* Process all elements in the field list (of parse nodes) */
329 while (Arg)
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
337 switch (Arg->Common.AmlOpcode)
339 case AML_INT_RESERVEDFIELD_OP:
341 Position = (UINT64) Info->FieldBitPosition
342 + (UINT64) Arg->Common.Value.Size;
344 if (Position > ACPI_UINT32_MAX)
346 ACPI_ERROR ((AE_INFO,
347 "Bit offset within field too large (> 0xFFFFFFFF)"));
348 return_ACPI_STATUS (AE_SUPPORT);
351 Info->FieldBitPosition = (UINT32) Position;
352 break;
355 case AML_INT_ACCESSFIELD_OP:
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.
362 * In FieldFlags, preserve the flag bits other than the
363 * ACCESS_TYPE bits
365 Info->FieldFlags = (UINT8)
366 ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
367 ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8)));
369 Info->Attribute = (UINT8) (Arg->Common.Value.Integer);
370 break;
373 case AML_INT_NAMEDFIELD_OP:
375 /* Lookup the name, it should already exist */
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))
383 ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
384 return_ACPI_STATUS (Status);
386 else
388 Arg->Common.Node = Info->FieldNode;
389 Info->FieldBitLength = Arg->Common.Value.Size;
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.
397 if (!AcpiNsGetAttachedObject (Info->FieldNode))
399 Status = AcpiExPrepFieldValue (Info);
400 if (ACPI_FAILURE (Status))
402 return_ACPI_STATUS (Status);
407 /* Keep track of bit position for the next field */
409 Position = (UINT64) Info->FieldBitPosition
410 + (UINT64) Arg->Common.Value.Size;
412 if (Position > ACPI_UINT32_MAX)
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);
420 Info->FieldBitPosition += Info->FieldBitLength;
421 break;
424 default:
426 ACPI_ERROR ((AE_INFO,
427 "Invalid opcode in field list: 0x%X", Arg->Common.AmlOpcode));
428 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
431 Arg = Arg->Common.Next;
434 return_ACPI_STATUS (AE_OK);
438 /*******************************************************************************
440 * FUNCTION: AcpiDsCreateField
442 * PARAMETERS: Op - Op containing the Field definition and args
443 * RegionNode - Object for the containing Operation Region
444 * ` WalkState - Current method state
446 * RETURN: Status
448 * DESCRIPTION: Create a new field in the specified operation region
450 ******************************************************************************/
452 ACPI_STATUS
453 AcpiDsCreateField (
454 ACPI_PARSE_OBJECT *Op,
455 ACPI_NAMESPACE_NODE *RegionNode,
456 ACPI_WALK_STATE *WalkState)
458 ACPI_STATUS Status;
459 ACPI_PARSE_OBJECT *Arg;
460 ACPI_CREATE_FIELD_INFO Info;
463 ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op);
466 /* First arg is the name of the parent OpRegion (must already exist) */
468 Arg = Op->Common.Value.Arg;
469 if (!RegionNode)
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))
476 ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status);
477 return_ACPI_STATUS (Status);
481 /* Second arg is the field flags */
483 Arg = Arg->Common.Next;
484 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
485 Info.Attribute = 0;
487 /* Each remaining arg is a Named Field */
489 Info.FieldType = ACPI_TYPE_LOCAL_REGION_FIELD;
490 Info.RegionNode = RegionNode;
492 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
494 return_ACPI_STATUS (Status);
498 /*******************************************************************************
500 * FUNCTION: AcpiDsInitFieldObjects
502 * PARAMETERS: Op - Op containing the Field definition and args
503 * ` WalkState - Current method state
505 * RETURN: Status
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.
511 ******************************************************************************/
513 ACPI_STATUS
514 AcpiDsInitFieldObjects (
515 ACPI_PARSE_OBJECT *Op,
516 ACPI_WALK_STATE *WalkState)
518 ACPI_STATUS Status;
519 ACPI_PARSE_OBJECT *Arg = NULL;
520 ACPI_NAMESPACE_NODE *Node;
521 UINT8 Type = 0;
522 UINT32 Flags;
525 ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op);
528 /* Execute flag should always be set when this function is entered */
530 if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
532 if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)
534 /* BankField Op is deferred, just return OK */
536 return_ACPI_STATUS (AE_OK);
539 return_ACPI_STATUS (AE_AML_INTERNAL);
543 * Get the FieldList argument for this opcode. This is the start of the
544 * list of field elements.
546 switch (WalkState->Opcode)
548 case AML_FIELD_OP:
549 Arg = AcpiPsGetArg (Op, 2);
550 Type = ACPI_TYPE_LOCAL_REGION_FIELD;
551 break;
553 case AML_BANK_FIELD_OP:
554 Arg = AcpiPsGetArg (Op, 4);
555 Type = ACPI_TYPE_LOCAL_BANK_FIELD;
556 break;
558 case AML_INDEX_FIELD_OP:
559 Arg = AcpiPsGetArg (Op, 3);
560 Type = ACPI_TYPE_LOCAL_INDEX_FIELD;
561 break;
563 default:
564 return_ACPI_STATUS (AE_BAD_PARAMETER);
567 /* Creating new namespace node(s), should not already exist */
569 Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
570 ACPI_NS_ERROR_IF_FOUND;
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)
576 if (WalkState->MethodNode &&
577 !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
579 Flags |= ACPI_NS_TEMPORARY;
583 * Walk the list of entries in the FieldList
584 * Note: FieldList can be of zero length. In this case, Arg will be NULL.
586 while (Arg)
589 * Ignore OFFSET and ACCESSAS terms here; we are only interested in the
590 * field names in order to enter them into the namespace.
592 if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
594 Status = AcpiNsLookup (WalkState->ScopeInfo,
595 (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
596 Flags, WalkState, &Node);
597 if (ACPI_FAILURE (Status))
599 ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
600 if (Status != AE_ALREADY_EXISTS)
602 return_ACPI_STATUS (Status);
605 /* Name already exists, just ignore this error */
607 Status = AE_OK;
610 Arg->Common.Node = Node;
613 /* Get the next field element in the list */
615 Arg = Arg->Common.Next;
618 return_ACPI_STATUS (AE_OK);
622 /*******************************************************************************
624 * FUNCTION: AcpiDsCreateBankField
626 * PARAMETERS: Op - Op containing the Field definition and args
627 * RegionNode - Object for the containing Operation Region
628 * WalkState - Current method state
630 * RETURN: Status
632 * DESCRIPTION: Create a new bank field in the specified operation region
634 ******************************************************************************/
636 ACPI_STATUS
637 AcpiDsCreateBankField (
638 ACPI_PARSE_OBJECT *Op,
639 ACPI_NAMESPACE_NODE *RegionNode,
640 ACPI_WALK_STATE *WalkState)
642 ACPI_STATUS Status;
643 ACPI_PARSE_OBJECT *Arg;
644 ACPI_CREATE_FIELD_INFO Info;
647 ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op);
650 /* First arg is the name of the parent OpRegion (must already exist) */
652 Arg = Op->Common.Value.Arg;
653 if (!RegionNode)
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))
660 ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status);
661 return_ACPI_STATUS (Status);
665 /* Second arg is the Bank Register (Field) (must already exist) */
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))
673 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
674 return_ACPI_STATUS (Status);
678 * Third arg is the BankValue
679 * This arg is a TermArg, not a constant
680 * It will be evaluated later, by AcpiDsEvalBankFieldOperands
682 Arg = Arg->Common.Next;
684 /* Fourth arg is the field flags */
686 Arg = Arg->Common.Next;
687 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
689 /* Each remaining arg is a Named Field */
691 Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD;
692 Info.RegionNode = RegionNode;
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)
700 * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"?
702 Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op;
704 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
705 return_ACPI_STATUS (Status);
709 /*******************************************************************************
711 * FUNCTION: AcpiDsCreateIndexField
713 * PARAMETERS: Op - Op containing the Field definition and args
714 * RegionNode - Object for the containing Operation Region
715 * ` WalkState - Current method state
717 * RETURN: Status
719 * DESCRIPTION: Create a new index field in the specified operation region
721 ******************************************************************************/
723 ACPI_STATUS
724 AcpiDsCreateIndexField (
725 ACPI_PARSE_OBJECT *Op,
726 ACPI_NAMESPACE_NODE *RegionNode,
727 ACPI_WALK_STATE *WalkState)
729 ACPI_STATUS Status;
730 ACPI_PARSE_OBJECT *Arg;
731 ACPI_CREATE_FIELD_INFO Info;
734 ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op);
737 /* First arg is the name of the Index register (must already exist) */
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))
745 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
746 return_ACPI_STATUS (Status);
749 /* Second arg is the data register (must already exist) */
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))
757 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
758 return_ACPI_STATUS (Status);
761 /* Next arg is the field flags */
763 Arg = Arg->Common.Next;
764 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
766 /* Each remaining arg is a Named Field */
768 Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD;
769 Info.RegionNode = RegionNode;
771 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
773 return_ACPI_STATUS (Status);