1 /******************************************************************************
3 * Module Name: dsfield - Dispatcher field routines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2019, 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.
57 #define _COMPONENT ACPI_DISPATCHER
58 ACPI_MODULE_NAME ("dsfield")
60 /* Local prototypes */
62 #ifdef ACPI_ASL_COMPILER
66 AcpiDsCreateExternalRegion (
67 ACPI_STATUS LookupStatus
,
68 ACPI_PARSE_OBJECT
*Op
,
70 ACPI_WALK_STATE
*WalkState
,
71 ACPI_NAMESPACE_NODE
**Node
);
76 ACPI_CREATE_FIELD_INFO
*Info
,
77 ACPI_WALK_STATE
*WalkState
,
78 ACPI_PARSE_OBJECT
*Arg
);
81 #ifdef ACPI_ASL_COMPILER
82 /*******************************************************************************
84 * FUNCTION: AcpiDsCreateExternalRegion (iASL Disassembler only)
86 * PARAMETERS: LookupStatus - Status from NsLookup operation
87 * Op - Op containing the Field definition and args
88 * Path - Pathname of the region
89 * ` WalkState - Current method state
90 * Node - Where the new region node is returned
94 * DESCRIPTION: Add region to the external list if NOT_FOUND. Create a new
97 ******************************************************************************/
100 AcpiDsCreateExternalRegion (
101 ACPI_STATUS LookupStatus
,
102 ACPI_PARSE_OBJECT
*Op
,
104 ACPI_WALK_STATE
*WalkState
,
105 ACPI_NAMESPACE_NODE
**Node
)
108 ACPI_OPERAND_OBJECT
*ObjDesc
;
111 if (LookupStatus
!= AE_NOT_FOUND
)
113 return (LookupStatus
);
118 * OperationRegion not found. Generate an External for it, and
119 * insert the name into the namespace.
121 AcpiDmAddOpToExternalList (Op
, Path
, ACPI_TYPE_REGION
, 0, 0);
123 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ACPI_TYPE_REGION
,
124 ACPI_IMODE_LOAD_PASS1
, ACPI_NS_SEARCH_PARENT
, WalkState
, Node
);
125 if (ACPI_FAILURE (Status
))
130 /* Must create and install a region object for the new node */
132 ObjDesc
= AcpiUtCreateInternalObject (ACPI_TYPE_REGION
);
135 return (AE_NO_MEMORY
);
138 ObjDesc
->Region
.Node
= *Node
;
139 Status
= AcpiNsAttachObject (*Node
, ObjDesc
, ACPI_TYPE_REGION
);
145 /*******************************************************************************
147 * FUNCTION: AcpiDsCreateBufferField
149 * PARAMETERS: Op - Current parse op (CreateXXField)
150 * WalkState - Current state
154 * DESCRIPTION: Execute the CreateField operators:
158 * CreateDwordFieldOp,
159 * CreateQwordFieldOp,
160 * CreateFieldOp (all of which define a field in a buffer)
162 ******************************************************************************/
165 AcpiDsCreateBufferField (
166 ACPI_PARSE_OBJECT
*Op
,
167 ACPI_WALK_STATE
*WalkState
)
169 ACPI_PARSE_OBJECT
*Arg
;
170 ACPI_NAMESPACE_NODE
*Node
;
172 ACPI_OPERAND_OBJECT
*ObjDesc
;
173 ACPI_OPERAND_OBJECT
*SecondDesc
= NULL
;
177 ACPI_FUNCTION_TRACE (DsCreateBufferField
);
181 * Get the NameString argument (name of the new BufferField)
183 if (Op
->Common
.AmlOpcode
== AML_CREATE_FIELD_OP
)
185 /* For CreateField, name is the 4th argument */
187 Arg
= AcpiPsGetArg (Op
, 3);
191 /* For all other CreateXXXField operators, name is the 3rd argument */
193 Arg
= AcpiPsGetArg (Op
, 2);
198 return_ACPI_STATUS (AE_AML_NO_OPERAND
);
201 if (WalkState
->DeferredNode
)
203 Node
= WalkState
->DeferredNode
;
207 /* Execute flag should always be set when this function is entered */
209 if (!(WalkState
->ParseFlags
& ACPI_PARSE_EXECUTE
))
211 ACPI_ERROR ((AE_INFO
,
212 "Parse execute mode is not set"));
213 return_ACPI_STATUS (AE_AML_INTERNAL
);
216 /* Creating new namespace node, should not already exist */
218 Flags
= ACPI_NS_NO_UPSEARCH
| ACPI_NS_DONT_OPEN_SCOPE
|
219 ACPI_NS_ERROR_IF_FOUND
;
222 * Mark node temporary if we are executing a normal control
223 * method. (Don't mark if this is a module-level code method)
225 if (WalkState
->MethodNode
&&
226 !(WalkState
->ParseFlags
& ACPI_PARSE_MODULE_LEVEL
))
228 Flags
|= ACPI_NS_TEMPORARY
;
231 /* Enter the NameString into the namespace */
233 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
234 Arg
->Common
.Value
.String
, ACPI_TYPE_ANY
,
235 ACPI_IMODE_LOAD_PASS1
, Flags
, WalkState
, &Node
);
236 if (ACPI_FAILURE (Status
))
238 ACPI_ERROR_NAMESPACE (WalkState
->ScopeInfo
,
239 Arg
->Common
.Value
.String
, Status
);
240 return_ACPI_STATUS (Status
);
245 * We could put the returned object (Node) on the object stack for later,
246 * but for now, we will put it in the "op" object that the parser uses,
247 * so we can get it again at the end of this scope.
249 Op
->Common
.Node
= Node
;
252 * If there is no object attached to the node, this node was just created
253 * and we need to create the field object. Otherwise, this was a lookup
254 * of an existing node and we don't want to create the field object again.
256 ObjDesc
= AcpiNsGetAttachedObject (Node
);
259 return_ACPI_STATUS (AE_OK
);
263 * The Field definition is not fully parsed at this time.
264 * (We must save the address of the AML for the buffer and index operands)
267 /* Create the buffer field object */
269 ObjDesc
= AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD
);
272 Status
= AE_NO_MEMORY
;
277 * Remember location in AML stream of the field unit opcode and operands
278 * -- since the buffer and index operands must be evaluated.
280 SecondDesc
= ObjDesc
->Common
.NextObject
;
281 SecondDesc
->Extra
.AmlStart
= Op
->Named
.Data
;
282 SecondDesc
->Extra
.AmlLength
= Op
->Named
.Length
;
283 ObjDesc
->BufferField
.Node
= Node
;
285 /* Attach constructed field descriptors to parent node */
287 Status
= AcpiNsAttachObject (Node
, ObjDesc
, ACPI_TYPE_BUFFER_FIELD
);
288 if (ACPI_FAILURE (Status
))
296 /* Remove local reference to the object */
298 AcpiUtRemoveReference (ObjDesc
);
299 return_ACPI_STATUS (Status
);
303 /*******************************************************************************
305 * FUNCTION: AcpiDsGetFieldNames
307 * PARAMETERS: Info - CreateField info structure
308 * ` WalkState - Current method state
309 * Arg - First parser arg for the field name list
313 * DESCRIPTION: Process all named fields in a field declaration. Names are
314 * entered into the namespace.
316 ******************************************************************************/
319 AcpiDsGetFieldNames (
320 ACPI_CREATE_FIELD_INFO
*Info
,
321 ACPI_WALK_STATE
*WalkState
,
322 ACPI_PARSE_OBJECT
*Arg
)
326 ACPI_PARSE_OBJECT
*Child
;
329 ACPI_OPERAND_OBJECT
*ResultDesc
;
330 ACPI_OPERAND_OBJECT
*ObjDesc
;
335 ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames
, Info
);
338 /* First field starts at bit zero */
340 Info
->FieldBitPosition
= 0;
342 /* Process all elements in the field list (of parse nodes) */
347 * Four types of field elements are handled:
348 * 1) Name - Enters a new named field into the namespace
349 * 2) Offset - specifies a bit offset
350 * 3) AccessAs - changes the access mode/attributes
351 * 4) Connection - Associate a resource template with the field
353 switch (Arg
->Common
.AmlOpcode
)
355 case AML_INT_RESERVEDFIELD_OP
:
357 Position
= (UINT64
) Info
->FieldBitPosition
+
358 (UINT64
) Arg
->Common
.Value
.Size
;
360 if (Position
> ACPI_UINT32_MAX
)
362 ACPI_ERROR ((AE_INFO
,
363 "Bit offset within field too large (> 0xFFFFFFFF)"));
364 return_ACPI_STATUS (AE_SUPPORT
);
367 Info
->FieldBitPosition
= (UINT32
) Position
;
370 case AML_INT_ACCESSFIELD_OP
:
371 case AML_INT_EXTACCESSFIELD_OP
:
373 * Get new AccessType, AccessAttribute, and AccessLength fields
374 * -- to be used for all field units that follow, until the
375 * end-of-field or another AccessAs keyword is encountered.
376 * NOTE. These three bytes are encoded in the integer value
377 * of the parseop for convenience.
379 * In FieldFlags, preserve the flag bits other than the
383 /* AccessType (ByteAcc, WordAcc, etc.) */
385 Info
->FieldFlags
= (UINT8
)
386 ((Info
->FieldFlags
& ~(AML_FIELD_ACCESS_TYPE_MASK
)) |
387 ((UINT8
) ((UINT32
) (Arg
->Common
.Value
.Integer
& 0x07))));
389 /* AccessAttribute (AttribQuick, AttribByte, etc.) */
391 Info
->Attribute
= (UINT8
)
392 ((Arg
->Common
.Value
.Integer
>> 8) & 0xFF);
394 /* AccessLength (for serial/buffer protocols) */
396 Info
->AccessLength
= (UINT8
)
397 ((Arg
->Common
.Value
.Integer
>> 16) & 0xFF);
400 case AML_INT_CONNECTION_OP
:
402 * Clear any previous connection. New connection is used for all
403 * fields that follow, similar to AccessAs
405 Info
->ResourceBuffer
= NULL
;
406 Info
->ConnectionNode
= NULL
;
407 Info
->PinNumberIndex
= 0;
410 * A Connection() is either an actual resource descriptor (buffer)
411 * or a named reference to a resource template
413 Child
= Arg
->Common
.Value
.Arg
;
414 if (Child
->Common
.AmlOpcode
== AML_INT_BYTELIST_OP
)
416 Info
->ResourceBuffer
= Child
->Named
.Data
;
417 Info
->ResourceLength
= (UINT16
) Child
->Named
.Value
.Integer
;
421 /* Lookup the Connection() namepath, it should already exist */
423 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
424 Child
->Common
.Value
.Name
, ACPI_TYPE_ANY
,
425 ACPI_IMODE_EXECUTE
, ACPI_NS_DONT_OPEN_SCOPE
,
426 WalkState
, &Info
->ConnectionNode
);
427 if (ACPI_FAILURE (Status
))
429 ACPI_ERROR_NAMESPACE (WalkState
->ScopeInfo
,
430 Child
->Common
.Value
.Name
, Status
);
431 return_ACPI_STATUS (Status
);
436 case AML_INT_NAMEDFIELD_OP
:
438 /* Lookup the name, it should already exist */
440 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
441 (char *) &Arg
->Named
.Name
, Info
->FieldType
,
442 ACPI_IMODE_EXECUTE
, ACPI_NS_DONT_OPEN_SCOPE
,
443 WalkState
, &Info
->FieldNode
);
444 if (ACPI_FAILURE (Status
))
446 ACPI_ERROR_NAMESPACE (WalkState
->ScopeInfo
,
447 (char *) &Arg
->Named
.Name
, Status
);
448 return_ACPI_STATUS (Status
);
452 Arg
->Common
.Node
= Info
->FieldNode
;
453 Info
->FieldBitLength
= Arg
->Common
.Value
.Size
;
456 * If there is no object attached to the node, this node was
457 * just created and we need to create the field object.
458 * Otherwise, this was a lookup of an existing node and we
459 * don't want to create the field object again.
461 if (!AcpiNsGetAttachedObject (Info
->FieldNode
))
463 Status
= AcpiExPrepFieldValue (Info
);
464 if (ACPI_FAILURE (Status
))
466 return_ACPI_STATUS (Status
);
469 NamePath
= AcpiNsGetExternalPathname (Info
->FieldNode
);
470 if (ACPI_SUCCESS (AeLookupInitFileEntry (NamePath
, &ObjDesc
)))
472 AcpiExWriteDataToField (ObjDesc
,
473 AcpiNsGetAttachedObject (Info
->FieldNode
),
475 AcpiUtRemoveReference (ObjDesc
);
477 ACPI_FREE (NamePath
);
482 /* Keep track of bit position for the next field */
484 Position
= (UINT64
) Info
->FieldBitPosition
+
485 (UINT64
) Arg
->Common
.Value
.Size
;
487 if (Position
> ACPI_UINT32_MAX
)
489 ACPI_ERROR ((AE_INFO
,
490 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
491 ACPI_CAST_PTR (char, &Info
->FieldNode
->Name
)));
492 return_ACPI_STATUS (AE_SUPPORT
);
495 Info
->FieldBitPosition
+= Info
->FieldBitLength
;
496 Info
->PinNumberIndex
++; /* Index relative to previous Connection() */
501 ACPI_ERROR ((AE_INFO
,
502 "Invalid opcode in field list: 0x%X",
503 Arg
->Common
.AmlOpcode
));
504 return_ACPI_STATUS (AE_AML_BAD_OPCODE
);
507 Arg
= Arg
->Common
.Next
;
510 return_ACPI_STATUS (AE_OK
);
514 /*******************************************************************************
516 * FUNCTION: AcpiDsCreateField
518 * PARAMETERS: Op - Op containing the Field definition and args
519 * RegionNode - Object for the containing Operation Region
520 * ` WalkState - Current method state
524 * DESCRIPTION: Create a new field in the specified operation region
526 ******************************************************************************/
530 ACPI_PARSE_OBJECT
*Op
,
531 ACPI_NAMESPACE_NODE
*RegionNode
,
532 ACPI_WALK_STATE
*WalkState
)
535 ACPI_PARSE_OBJECT
*Arg
;
536 ACPI_CREATE_FIELD_INFO Info
;
539 ACPI_FUNCTION_TRACE_PTR (DsCreateField
, Op
);
542 /* First arg is the name of the parent OpRegion (must already exist) */
544 Arg
= Op
->Common
.Value
.Arg
;
548 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.Name
,
549 ACPI_TYPE_REGION
, ACPI_IMODE_EXECUTE
,
550 ACPI_NS_SEARCH_PARENT
, WalkState
, &RegionNode
);
551 #ifdef ACPI_ASL_COMPILER
552 Status
= AcpiDsCreateExternalRegion (Status
, Arg
,
553 Arg
->Common
.Value
.Name
, WalkState
, &RegionNode
);
555 if (ACPI_FAILURE (Status
))
557 ACPI_ERROR_NAMESPACE (WalkState
->ScopeInfo
,
558 Arg
->Common
.Value
.Name
, Status
);
559 return_ACPI_STATUS (Status
);
563 memset (&Info
, 0, sizeof (ACPI_CREATE_FIELD_INFO
));
565 /* Second arg is the field flags */
567 Arg
= Arg
->Common
.Next
;
568 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
571 /* Each remaining arg is a Named Field */
573 Info
.FieldType
= ACPI_TYPE_LOCAL_REGION_FIELD
;
574 Info
.RegionNode
= RegionNode
;
576 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
577 if (Info
.RegionNode
->Object
->Region
.SpaceId
== ACPI_ADR_SPACE_PLATFORM_COMM
&&
578 !(RegionNode
->Object
->Field
.InternalPccBuffer
579 = ACPI_ALLOCATE_ZEROED(Info
.RegionNode
->Object
->Region
.Length
)))
581 return_ACPI_STATUS (AE_NO_MEMORY
);
583 return_ACPI_STATUS (Status
);
587 /*******************************************************************************
589 * FUNCTION: AcpiDsInitFieldObjects
591 * PARAMETERS: Op - Op containing the Field definition and args
592 * ` WalkState - Current method state
596 * DESCRIPTION: For each "Field Unit" name in the argument list that is
597 * part of the field declaration, enter the name into the
600 ******************************************************************************/
603 AcpiDsInitFieldObjects (
604 ACPI_PARSE_OBJECT
*Op
,
605 ACPI_WALK_STATE
*WalkState
)
608 ACPI_PARSE_OBJECT
*Arg
= NULL
;
609 ACPI_NAMESPACE_NODE
*Node
;
614 ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects
, Op
);
617 /* Execute flag should always be set when this function is entered */
619 if (!(WalkState
->ParseFlags
& ACPI_PARSE_EXECUTE
))
621 if (WalkState
->ParseFlags
& ACPI_PARSE_DEFERRED_OP
)
623 /* BankField Op is deferred, just return OK */
625 return_ACPI_STATUS (AE_OK
);
628 ACPI_ERROR ((AE_INFO
,
629 "Parse deferred mode is not set"));
630 return_ACPI_STATUS (AE_AML_INTERNAL
);
634 * Get the FieldList argument for this opcode. This is the start of the
635 * list of field elements.
637 switch (WalkState
->Opcode
)
641 Arg
= AcpiPsGetArg (Op
, 2);
642 Type
= ACPI_TYPE_LOCAL_REGION_FIELD
;
645 case AML_BANK_FIELD_OP
:
647 Arg
= AcpiPsGetArg (Op
, 4);
648 Type
= ACPI_TYPE_LOCAL_BANK_FIELD
;
651 case AML_INDEX_FIELD_OP
:
653 Arg
= AcpiPsGetArg (Op
, 3);
654 Type
= ACPI_TYPE_LOCAL_INDEX_FIELD
;
659 return_ACPI_STATUS (AE_BAD_PARAMETER
);
662 /* Creating new namespace node(s), should not already exist */
664 Flags
= ACPI_NS_NO_UPSEARCH
| ACPI_NS_DONT_OPEN_SCOPE
|
665 ACPI_NS_ERROR_IF_FOUND
;
668 * Mark node(s) temporary if we are executing a normal control
669 * method. (Don't mark if this is a module-level code method)
671 if (WalkState
->MethodNode
&&
672 !(WalkState
->ParseFlags
& ACPI_PARSE_MODULE_LEVEL
))
674 Flags
|= ACPI_NS_TEMPORARY
;
678 Flags
|= ACPI_NS_OVERRIDE_IF_FOUND
;
681 * Walk the list of entries in the FieldList
682 * Note: FieldList can be of zero length. In this case, Arg will be NULL.
687 * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
688 * in the field names in order to enter them into the namespace.
690 if (Arg
->Common
.AmlOpcode
== AML_INT_NAMEDFIELD_OP
)
692 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
693 (char *) &Arg
->Named
.Name
, Type
, ACPI_IMODE_LOAD_PASS1
,
694 Flags
, WalkState
, &Node
);
695 if (ACPI_FAILURE (Status
))
697 ACPI_ERROR_NAMESPACE (WalkState
->ScopeInfo
,
698 (char *) &Arg
->Named
.Name
, Status
);
699 if (Status
!= AE_ALREADY_EXISTS
)
701 return_ACPI_STATUS (Status
);
704 /* Name already exists, just ignore this error */
707 Arg
->Common
.Node
= Node
;
710 /* Get the next field element in the list */
712 Arg
= Arg
->Common
.Next
;
715 return_ACPI_STATUS (AE_OK
);
719 /*******************************************************************************
721 * FUNCTION: AcpiDsCreateBankField
723 * PARAMETERS: Op - Op containing the Field definition and args
724 * RegionNode - Object for the containing Operation Region
725 * WalkState - Current method state
729 * DESCRIPTION: Create a new bank field in the specified operation region
731 ******************************************************************************/
734 AcpiDsCreateBankField (
735 ACPI_PARSE_OBJECT
*Op
,
736 ACPI_NAMESPACE_NODE
*RegionNode
,
737 ACPI_WALK_STATE
*WalkState
)
740 ACPI_PARSE_OBJECT
*Arg
;
741 ACPI_CREATE_FIELD_INFO Info
;
744 ACPI_FUNCTION_TRACE_PTR (DsCreateBankField
, Op
);
747 /* First arg is the name of the parent OpRegion (must already exist) */
749 Arg
= Op
->Common
.Value
.Arg
;
752 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.Name
,
753 ACPI_TYPE_REGION
, ACPI_IMODE_EXECUTE
,
754 ACPI_NS_SEARCH_PARENT
, WalkState
, &RegionNode
);
755 #ifdef ACPI_ASL_COMPILER
756 Status
= AcpiDsCreateExternalRegion (Status
, Arg
,
757 Arg
->Common
.Value
.Name
, WalkState
, &RegionNode
);
759 if (ACPI_FAILURE (Status
))
761 ACPI_ERROR_NAMESPACE (WalkState
->ScopeInfo
,
762 Arg
->Common
.Value
.Name
, Status
);
763 return_ACPI_STATUS (Status
);
767 /* Second arg is the Bank Register (Field) (must already exist) */
769 Arg
= Arg
->Common
.Next
;
770 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
771 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
772 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.RegisterNode
);
773 if (ACPI_FAILURE (Status
))
775 ACPI_ERROR_NAMESPACE (WalkState
->ScopeInfo
,
776 Arg
->Common
.Value
.String
, Status
);
777 return_ACPI_STATUS (Status
);
781 * Third arg is the BankValue
782 * This arg is a TermArg, not a constant
783 * It will be evaluated later, by AcpiDsEvalBankFieldOperands
785 Arg
= Arg
->Common
.Next
;
787 /* Fourth arg is the field flags */
789 Arg
= Arg
->Common
.Next
;
790 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
792 /* Each remaining arg is a Named Field */
794 Info
.FieldType
= ACPI_TYPE_LOCAL_BANK_FIELD
;
795 Info
.RegionNode
= RegionNode
;
798 * Use Info.DataRegisterNode to store BankField Op
799 * It's safe because DataRegisterNode will never be used when create
800 * bank field \we store AmlStart and AmlLength in the BankField Op for
801 * late evaluation. Used in AcpiExPrepFieldValue(Info)
803 * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like
806 Info
.DataRegisterNode
= (ACPI_NAMESPACE_NODE
*) Op
;
808 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
809 return_ACPI_STATUS (Status
);
813 /*******************************************************************************
815 * FUNCTION: AcpiDsCreateIndexField
817 * PARAMETERS: Op - Op containing the Field definition and args
818 * RegionNode - Object for the containing Operation Region
819 * ` WalkState - Current method state
823 * DESCRIPTION: Create a new index field in the specified operation region
825 ******************************************************************************/
828 AcpiDsCreateIndexField (
829 ACPI_PARSE_OBJECT
*Op
,
830 ACPI_NAMESPACE_NODE
*RegionNode
,
831 ACPI_WALK_STATE
*WalkState
)
834 ACPI_PARSE_OBJECT
*Arg
;
835 ACPI_CREATE_FIELD_INFO Info
;
838 ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField
, Op
);
841 /* First arg is the name of the Index register (must already exist) */
843 Arg
= Op
->Common
.Value
.Arg
;
844 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
845 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
846 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.RegisterNode
);
847 if (ACPI_FAILURE (Status
))
849 ACPI_ERROR_NAMESPACE (WalkState
->ScopeInfo
,
850 Arg
->Common
.Value
.String
, Status
);
851 return_ACPI_STATUS (Status
);
854 /* Second arg is the data register (must already exist) */
856 Arg
= Arg
->Common
.Next
;
857 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
858 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
859 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.DataRegisterNode
);
860 if (ACPI_FAILURE (Status
))
862 ACPI_ERROR_NAMESPACE (WalkState
->ScopeInfo
,
863 Arg
->Common
.Value
.String
, Status
);
864 return_ACPI_STATUS (Status
);
867 /* Next arg is the field flags */
869 Arg
= Arg
->Common
.Next
;
870 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
872 /* Each remaining arg is a Named Field */
874 Info
.FieldType
= ACPI_TYPE_LOCAL_INDEX_FIELD
;
875 Info
.RegionNode
= RegionNode
;
877 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
878 return_ACPI_STATUS (Status
);