1 /******************************************************************************
3 * Module Name: dsfield - Dispatcher field routines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2017, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
53 #define _COMPONENT ACPI_DISPATCHER
54 ACPI_MODULE_NAME ("dsfield")
56 /* Local prototypes */
58 #ifdef ACPI_ASL_COMPILER
62 AcpiDsCreateExternalRegion (
63 ACPI_STATUS LookupStatus
,
64 ACPI_PARSE_OBJECT
*Op
,
66 ACPI_WALK_STATE
*WalkState
,
67 ACPI_NAMESPACE_NODE
**Node
);
72 ACPI_CREATE_FIELD_INFO
*Info
,
73 ACPI_WALK_STATE
*WalkState
,
74 ACPI_PARSE_OBJECT
*Arg
);
77 #ifdef ACPI_ASL_COMPILER
78 /*******************************************************************************
80 * FUNCTION: AcpiDsCreateExternalRegion (iASL Disassembler only)
82 * PARAMETERS: LookupStatus - Status from NsLookup operation
83 * Op - Op containing the Field definition and args
84 * Path - Pathname of the region
85 * ` WalkState - Current method state
86 * Node - Where the new region node is returned
90 * DESCRIPTION: Add region to the external list if NOT_FOUND. Create a new
93 ******************************************************************************/
96 AcpiDsCreateExternalRegion (
97 ACPI_STATUS LookupStatus
,
98 ACPI_PARSE_OBJECT
*Op
,
100 ACPI_WALK_STATE
*WalkState
,
101 ACPI_NAMESPACE_NODE
**Node
)
104 ACPI_OPERAND_OBJECT
*ObjDesc
;
107 if (LookupStatus
!= AE_NOT_FOUND
)
109 return (LookupStatus
);
114 * OperationRegion not found. Generate an External for it, and
115 * insert the name into the namespace.
117 AcpiDmAddOpToExternalList (Op
, Path
, ACPI_TYPE_REGION
, 0, 0);
119 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ACPI_TYPE_REGION
,
120 ACPI_IMODE_LOAD_PASS1
, ACPI_NS_SEARCH_PARENT
, WalkState
, Node
);
121 if (ACPI_FAILURE (Status
))
126 /* Must create and install a region object for the new node */
128 ObjDesc
= AcpiUtCreateInternalObject (ACPI_TYPE_REGION
);
131 return (AE_NO_MEMORY
);
134 ObjDesc
->Region
.Node
= *Node
;
135 Status
= AcpiNsAttachObject (*Node
, ObjDesc
, ACPI_TYPE_REGION
);
141 /*******************************************************************************
143 * FUNCTION: AcpiDsCreateBufferField
145 * PARAMETERS: Op - Current parse op (CreateXXField)
146 * WalkState - Current state
150 * DESCRIPTION: Execute the CreateField operators:
154 * CreateDwordFieldOp,
155 * CreateQwordFieldOp,
156 * CreateFieldOp (all of which define a field in a buffer)
158 ******************************************************************************/
161 AcpiDsCreateBufferField (
162 ACPI_PARSE_OBJECT
*Op
,
163 ACPI_WALK_STATE
*WalkState
)
165 ACPI_PARSE_OBJECT
*Arg
;
166 ACPI_NAMESPACE_NODE
*Node
;
168 ACPI_OPERAND_OBJECT
*ObjDesc
;
169 ACPI_OPERAND_OBJECT
*SecondDesc
= NULL
;
173 ACPI_FUNCTION_TRACE (DsCreateBufferField
);
177 * Get the NameString argument (name of the new BufferField)
179 if (Op
->Common
.AmlOpcode
== AML_CREATE_FIELD_OP
)
181 /* For CreateField, name is the 4th argument */
183 Arg
= AcpiPsGetArg (Op
, 3);
187 /* For all other CreateXXXField operators, name is the 3rd argument */
189 Arg
= AcpiPsGetArg (Op
, 2);
194 return_ACPI_STATUS (AE_AML_NO_OPERAND
);
197 if (WalkState
->DeferredNode
)
199 Node
= WalkState
->DeferredNode
;
204 /* Execute flag should always be set when this function is entered */
206 if (!(WalkState
->ParseFlags
& ACPI_PARSE_EXECUTE
))
208 ACPI_ERROR ((AE_INFO
,
209 "Parse execute mode is not set"));
210 return_ACPI_STATUS (AE_AML_INTERNAL
);
213 /* Creating new namespace node, should not already exist */
215 Flags
= ACPI_NS_NO_UPSEARCH
| ACPI_NS_DONT_OPEN_SCOPE
|
216 ACPI_NS_ERROR_IF_FOUND
;
219 * Mark node temporary if we are executing a normal control
220 * method. (Don't mark if this is a module-level code method)
222 if (WalkState
->MethodNode
&&
223 !(WalkState
->ParseFlags
& ACPI_PARSE_MODULE_LEVEL
))
225 Flags
|= ACPI_NS_TEMPORARY
;
228 /* Enter the NameString into the namespace */
230 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
231 Arg
->Common
.Value
.String
, ACPI_TYPE_ANY
,
232 ACPI_IMODE_LOAD_PASS1
, Flags
, WalkState
, &Node
);
233 if (ACPI_FAILURE (Status
))
235 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
236 return_ACPI_STATUS (Status
);
241 * We could put the returned object (Node) on the object stack for later,
242 * but for now, we will put it in the "op" object that the parser uses,
243 * so we can get it again at the end of this scope.
245 Op
->Common
.Node
= Node
;
248 * If there is no object attached to the node, this node was just created
249 * and we need to create the field object. Otherwise, this was a lookup
250 * of an existing node and we don't want to create the field object again.
252 ObjDesc
= AcpiNsGetAttachedObject (Node
);
255 return_ACPI_STATUS (AE_OK
);
259 * The Field definition is not fully parsed at this time.
260 * (We must save the address of the AML for the buffer and index operands)
263 /* Create the buffer field object */
265 ObjDesc
= AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD
);
268 Status
= AE_NO_MEMORY
;
273 * Remember location in AML stream of the field unit opcode and operands
274 * -- since the buffer and index operands must be evaluated.
276 SecondDesc
= ObjDesc
->Common
.NextObject
;
277 SecondDesc
->Extra
.AmlStart
= Op
->Named
.Data
;
278 SecondDesc
->Extra
.AmlLength
= Op
->Named
.Length
;
279 ObjDesc
->BufferField
.Node
= Node
;
281 /* Attach constructed field descriptors to parent node */
283 Status
= AcpiNsAttachObject (Node
, ObjDesc
, ACPI_TYPE_BUFFER_FIELD
);
284 if (ACPI_FAILURE (Status
))
292 /* Remove local reference to the object */
294 AcpiUtRemoveReference (ObjDesc
);
295 return_ACPI_STATUS (Status
);
299 /*******************************************************************************
301 * FUNCTION: AcpiDsGetFieldNames
303 * PARAMETERS: Info - CreateField info structure
304 * ` WalkState - Current method state
305 * Arg - First parser arg for the field name list
309 * DESCRIPTION: Process all named fields in a field declaration. Names are
310 * entered into the namespace.
312 ******************************************************************************/
315 AcpiDsGetFieldNames (
316 ACPI_CREATE_FIELD_INFO
*Info
,
317 ACPI_WALK_STATE
*WalkState
,
318 ACPI_PARSE_OBJECT
*Arg
)
322 ACPI_PARSE_OBJECT
*Child
;
325 ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames
, Info
);
328 /* First field starts at bit zero */
330 Info
->FieldBitPosition
= 0;
332 /* Process all elements in the field list (of parse nodes) */
337 * Four types of field elements are handled:
338 * 1) Name - Enters a new named field into the namespace
339 * 2) Offset - specifies a bit offset
340 * 3) AccessAs - changes the access mode/attributes
341 * 4) Connection - Associate a resource template with the field
343 switch (Arg
->Common
.AmlOpcode
)
345 case AML_INT_RESERVEDFIELD_OP
:
347 Position
= (UINT64
) Info
->FieldBitPosition
+
348 (UINT64
) Arg
->Common
.Value
.Size
;
350 if (Position
> ACPI_UINT32_MAX
)
352 ACPI_ERROR ((AE_INFO
,
353 "Bit offset within field too large (> 0xFFFFFFFF)"));
354 return_ACPI_STATUS (AE_SUPPORT
);
357 Info
->FieldBitPosition
= (UINT32
) Position
;
360 case AML_INT_ACCESSFIELD_OP
:
361 case AML_INT_EXTACCESSFIELD_OP
:
363 * Get new AccessType, AccessAttribute, and AccessLength fields
364 * -- to be used for all field units that follow, until the
365 * end-of-field or another AccessAs keyword is encountered.
366 * NOTE. These three bytes are encoded in the integer value
367 * of the parseop for convenience.
369 * In FieldFlags, preserve the flag bits other than the
373 /* AccessType (ByteAcc, WordAcc, etc.) */
375 Info
->FieldFlags
= (UINT8
)
376 ((Info
->FieldFlags
& ~(AML_FIELD_ACCESS_TYPE_MASK
)) |
377 ((UINT8
) ((UINT32
) (Arg
->Common
.Value
.Integer
& 0x07))));
379 /* AccessAttribute (AttribQuick, AttribByte, etc.) */
381 Info
->Attribute
= (UINT8
)
382 ((Arg
->Common
.Value
.Integer
>> 8) & 0xFF);
384 /* AccessLength (for serial/buffer protocols) */
386 Info
->AccessLength
= (UINT8
)
387 ((Arg
->Common
.Value
.Integer
>> 16) & 0xFF);
390 case AML_INT_CONNECTION_OP
:
392 * Clear any previous connection. New connection is used for all
393 * fields that follow, similar to AccessAs
395 Info
->ResourceBuffer
= NULL
;
396 Info
->ConnectionNode
= NULL
;
397 Info
->PinNumberIndex
= 0;
400 * A Connection() is either an actual resource descriptor (buffer)
401 * or a named reference to a resource template
403 Child
= Arg
->Common
.Value
.Arg
;
404 if (Child
->Common
.AmlOpcode
== AML_INT_BYTELIST_OP
)
406 Info
->ResourceBuffer
= Child
->Named
.Data
;
407 Info
->ResourceLength
= (UINT16
) Child
->Named
.Value
.Integer
;
411 /* Lookup the Connection() namepath, it should already exist */
413 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
414 Child
->Common
.Value
.Name
, ACPI_TYPE_ANY
,
415 ACPI_IMODE_EXECUTE
, ACPI_NS_DONT_OPEN_SCOPE
,
416 WalkState
, &Info
->ConnectionNode
);
417 if (ACPI_FAILURE (Status
))
419 ACPI_ERROR_NAMESPACE (Child
->Common
.Value
.Name
, Status
);
420 return_ACPI_STATUS (Status
);
425 case AML_INT_NAMEDFIELD_OP
:
427 /* Lookup the name, it should already exist */
429 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
430 (char *) &Arg
->Named
.Name
, Info
->FieldType
,
431 ACPI_IMODE_EXECUTE
, ACPI_NS_DONT_OPEN_SCOPE
,
432 WalkState
, &Info
->FieldNode
);
433 if (ACPI_FAILURE (Status
))
435 ACPI_ERROR_NAMESPACE ((char *) &Arg
->Named
.Name
, Status
);
436 return_ACPI_STATUS (Status
);
440 Arg
->Common
.Node
= Info
->FieldNode
;
441 Info
->FieldBitLength
= Arg
->Common
.Value
.Size
;
444 * If there is no object attached to the node, this node was
445 * just created and we need to create the field object.
446 * Otherwise, this was a lookup of an existing node and we
447 * don't want to create the field object again.
449 if (!AcpiNsGetAttachedObject (Info
->FieldNode
))
451 Status
= AcpiExPrepFieldValue (Info
);
452 if (ACPI_FAILURE (Status
))
454 return_ACPI_STATUS (Status
);
459 /* Keep track of bit position for the next field */
461 Position
= (UINT64
) Info
->FieldBitPosition
+
462 (UINT64
) Arg
->Common
.Value
.Size
;
464 if (Position
> ACPI_UINT32_MAX
)
466 ACPI_ERROR ((AE_INFO
,
467 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
468 ACPI_CAST_PTR (char, &Info
->FieldNode
->Name
)));
469 return_ACPI_STATUS (AE_SUPPORT
);
472 Info
->FieldBitPosition
+= Info
->FieldBitLength
;
473 Info
->PinNumberIndex
++; /* Index relative to previous Connection() */
478 ACPI_ERROR ((AE_INFO
,
479 "Invalid opcode in field list: 0x%X",
480 Arg
->Common
.AmlOpcode
));
481 return_ACPI_STATUS (AE_AML_BAD_OPCODE
);
484 Arg
= Arg
->Common
.Next
;
487 return_ACPI_STATUS (AE_OK
);
491 /*******************************************************************************
493 * FUNCTION: AcpiDsCreateField
495 * PARAMETERS: Op - Op containing the Field definition and args
496 * RegionNode - Object for the containing Operation Region
497 * ` WalkState - Current method state
501 * DESCRIPTION: Create a new field in the specified operation region
503 ******************************************************************************/
507 ACPI_PARSE_OBJECT
*Op
,
508 ACPI_NAMESPACE_NODE
*RegionNode
,
509 ACPI_WALK_STATE
*WalkState
)
512 ACPI_PARSE_OBJECT
*Arg
;
513 ACPI_CREATE_FIELD_INFO Info
;
516 ACPI_FUNCTION_TRACE_PTR (DsCreateField
, Op
);
519 /* First arg is the name of the parent OpRegion (must already exist) */
521 Arg
= Op
->Common
.Value
.Arg
;
525 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.Name
,
526 ACPI_TYPE_REGION
, ACPI_IMODE_EXECUTE
,
527 ACPI_NS_SEARCH_PARENT
, WalkState
, &RegionNode
);
528 #ifdef ACPI_ASL_COMPILER
529 Status
= AcpiDsCreateExternalRegion (Status
, Arg
,
530 Arg
->Common
.Value
.Name
, WalkState
, &RegionNode
);
532 if (ACPI_FAILURE (Status
))
534 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.Name
, Status
);
535 return_ACPI_STATUS (Status
);
539 memset (&Info
, 0, sizeof (ACPI_CREATE_FIELD_INFO
));
541 /* Second arg is the field flags */
543 Arg
= Arg
->Common
.Next
;
544 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
547 /* Each remaining arg is a Named Field */
549 Info
.FieldType
= ACPI_TYPE_LOCAL_REGION_FIELD
;
550 Info
.RegionNode
= RegionNode
;
552 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
553 return_ACPI_STATUS (Status
);
557 /*******************************************************************************
559 * FUNCTION: AcpiDsInitFieldObjects
561 * PARAMETERS: Op - Op containing the Field definition and args
562 * ` WalkState - Current method state
566 * DESCRIPTION: For each "Field Unit" name in the argument list that is
567 * part of the field declaration, enter the name into the
570 ******************************************************************************/
573 AcpiDsInitFieldObjects (
574 ACPI_PARSE_OBJECT
*Op
,
575 ACPI_WALK_STATE
*WalkState
)
578 ACPI_PARSE_OBJECT
*Arg
= NULL
;
579 ACPI_NAMESPACE_NODE
*Node
;
584 ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects
, Op
);
587 /* Execute flag should always be set when this function is entered */
589 if (!(WalkState
->ParseFlags
& ACPI_PARSE_EXECUTE
))
591 if (WalkState
->ParseFlags
& ACPI_PARSE_DEFERRED_OP
)
593 /* BankField Op is deferred, just return OK */
595 return_ACPI_STATUS (AE_OK
);
598 ACPI_ERROR ((AE_INFO
,
599 "Parse deferred mode is not set"));
600 return_ACPI_STATUS (AE_AML_INTERNAL
);
604 * Get the FieldList argument for this opcode. This is the start of the
605 * list of field elements.
607 switch (WalkState
->Opcode
)
611 Arg
= AcpiPsGetArg (Op
, 2);
612 Type
= ACPI_TYPE_LOCAL_REGION_FIELD
;
615 case AML_BANK_FIELD_OP
:
617 Arg
= AcpiPsGetArg (Op
, 4);
618 Type
= ACPI_TYPE_LOCAL_BANK_FIELD
;
621 case AML_INDEX_FIELD_OP
:
623 Arg
= AcpiPsGetArg (Op
, 3);
624 Type
= ACPI_TYPE_LOCAL_INDEX_FIELD
;
629 return_ACPI_STATUS (AE_BAD_PARAMETER
);
632 /* Creating new namespace node(s), should not already exist */
634 Flags
= ACPI_NS_NO_UPSEARCH
| ACPI_NS_DONT_OPEN_SCOPE
|
635 ACPI_NS_ERROR_IF_FOUND
;
638 * Mark node(s) temporary if we are executing a normal control
639 * method. (Don't mark if this is a module-level code method)
641 if (WalkState
->MethodNode
&&
642 !(WalkState
->ParseFlags
& ACPI_PARSE_MODULE_LEVEL
))
644 Flags
|= ACPI_NS_TEMPORARY
;
648 * Walk the list of entries in the FieldList
649 * Note: FieldList can be of zero length. In this case, Arg will be NULL.
654 * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
655 * in the field names in order to enter them into the namespace.
657 if (Arg
->Common
.AmlOpcode
== AML_INT_NAMEDFIELD_OP
)
659 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
660 (char *) &Arg
->Named
.Name
, Type
, ACPI_IMODE_LOAD_PASS1
,
661 Flags
, WalkState
, &Node
);
662 if (ACPI_FAILURE (Status
))
664 ACPI_ERROR_NAMESPACE ((char *) &Arg
->Named
.Name
, Status
);
665 if (Status
!= AE_ALREADY_EXISTS
)
667 return_ACPI_STATUS (Status
);
670 /* Name already exists, just ignore this error */
675 Arg
->Common
.Node
= Node
;
678 /* Get the next field element in the list */
680 Arg
= Arg
->Common
.Next
;
683 return_ACPI_STATUS (AE_OK
);
687 /*******************************************************************************
689 * FUNCTION: AcpiDsCreateBankField
691 * PARAMETERS: Op - Op containing the Field definition and args
692 * RegionNode - Object for the containing Operation Region
693 * WalkState - Current method state
697 * DESCRIPTION: Create a new bank field in the specified operation region
699 ******************************************************************************/
702 AcpiDsCreateBankField (
703 ACPI_PARSE_OBJECT
*Op
,
704 ACPI_NAMESPACE_NODE
*RegionNode
,
705 ACPI_WALK_STATE
*WalkState
)
708 ACPI_PARSE_OBJECT
*Arg
;
709 ACPI_CREATE_FIELD_INFO Info
;
712 ACPI_FUNCTION_TRACE_PTR (DsCreateBankField
, Op
);
715 /* First arg is the name of the parent OpRegion (must already exist) */
717 Arg
= Op
->Common
.Value
.Arg
;
720 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.Name
,
721 ACPI_TYPE_REGION
, ACPI_IMODE_EXECUTE
,
722 ACPI_NS_SEARCH_PARENT
, WalkState
, &RegionNode
);
723 #ifdef ACPI_ASL_COMPILER
724 Status
= AcpiDsCreateExternalRegion (Status
, Arg
,
725 Arg
->Common
.Value
.Name
, WalkState
, &RegionNode
);
727 if (ACPI_FAILURE (Status
))
729 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.Name
, Status
);
730 return_ACPI_STATUS (Status
);
734 /* Second arg is the Bank Register (Field) (must already exist) */
736 Arg
= Arg
->Common
.Next
;
737 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
738 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
739 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.RegisterNode
);
740 if (ACPI_FAILURE (Status
))
742 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
743 return_ACPI_STATUS (Status
);
747 * Third arg is the BankValue
748 * This arg is a TermArg, not a constant
749 * It will be evaluated later, by AcpiDsEvalBankFieldOperands
751 Arg
= Arg
->Common
.Next
;
753 /* Fourth arg is the field flags */
755 Arg
= Arg
->Common
.Next
;
756 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
758 /* Each remaining arg is a Named Field */
760 Info
.FieldType
= ACPI_TYPE_LOCAL_BANK_FIELD
;
761 Info
.RegionNode
= RegionNode
;
764 * Use Info.DataRegisterNode to store BankField Op
765 * It's safe because DataRegisterNode will never be used when create
766 * bank field \we store AmlStart and AmlLength in the BankField Op for
767 * late evaluation. Used in AcpiExPrepFieldValue(Info)
769 * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like
772 Info
.DataRegisterNode
= (ACPI_NAMESPACE_NODE
*) Op
;
774 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
775 return_ACPI_STATUS (Status
);
779 /*******************************************************************************
781 * FUNCTION: AcpiDsCreateIndexField
783 * PARAMETERS: Op - Op containing the Field definition and args
784 * RegionNode - Object for the containing Operation Region
785 * ` WalkState - Current method state
789 * DESCRIPTION: Create a new index field in the specified operation region
791 ******************************************************************************/
794 AcpiDsCreateIndexField (
795 ACPI_PARSE_OBJECT
*Op
,
796 ACPI_NAMESPACE_NODE
*RegionNode
,
797 ACPI_WALK_STATE
*WalkState
)
800 ACPI_PARSE_OBJECT
*Arg
;
801 ACPI_CREATE_FIELD_INFO Info
;
804 ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField
, Op
);
807 /* First arg is the name of the Index register (must already exist) */
809 Arg
= Op
->Common
.Value
.Arg
;
810 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
811 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
812 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.RegisterNode
);
813 if (ACPI_FAILURE (Status
))
815 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
816 return_ACPI_STATUS (Status
);
819 /* Second arg is the data register (must already exist) */
821 Arg
= Arg
->Common
.Next
;
822 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
823 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
824 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.DataRegisterNode
);
825 if (ACPI_FAILURE (Status
))
827 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
828 return_ACPI_STATUS (Status
);
831 /* Next arg is the field flags */
833 Arg
= Arg
->Common
.Next
;
834 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
836 /* Each remaining arg is a Named Field */
838 Info
.FieldType
= ACPI_TYPE_LOCAL_INDEX_FIELD
;
839 Info
.RegionNode
= RegionNode
;
841 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
842 return_ACPI_STATUS (Status
);