1 /******************************************************************************
3 * Module Name: dsfield - Dispatcher field routines
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp.
12 * All rights reserved.
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
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
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
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
72 * 3.4. Intel retains all right, title, and interest in and to the Original
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
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
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__
119 #include "accommon.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 #ifdef ACPI_ASL_COMPILER
133 #include "acdisasm.h"
136 AcpiDsCreateExternalRegion (
137 ACPI_STATUS LookupStatus
,
138 ACPI_PARSE_OBJECT
*Op
,
140 ACPI_WALK_STATE
*WalkState
,
141 ACPI_NAMESPACE_NODE
**Node
);
145 AcpiDsGetFieldNames (
146 ACPI_CREATE_FIELD_INFO
*Info
,
147 ACPI_WALK_STATE
*WalkState
,
148 ACPI_PARSE_OBJECT
*Arg
);
151 #ifdef ACPI_ASL_COMPILER
152 /*******************************************************************************
154 * FUNCTION: AcpiDsCreateExternalRegion (iASL Disassembler only)
156 * PARAMETERS: LookupStatus - Status from NsLookup operation
157 * Op - Op containing the Field definition and args
158 * Path - Pathname of the region
159 * ` WalkState - Current method state
160 * Node - Where the new region node is returned
164 * DESCRIPTION: Add region to the external list if NOT_FOUND. Create a new
165 * region node/object.
167 ******************************************************************************/
170 AcpiDsCreateExternalRegion (
171 ACPI_STATUS LookupStatus
,
172 ACPI_PARSE_OBJECT
*Op
,
174 ACPI_WALK_STATE
*WalkState
,
175 ACPI_NAMESPACE_NODE
**Node
)
178 ACPI_OPERAND_OBJECT
*ObjDesc
;
181 if (LookupStatus
!= AE_NOT_FOUND
)
183 return (LookupStatus
);
188 * OperationRegion not found. Generate an External for it, and
189 * insert the name into the namespace.
191 AcpiDmAddOpToExternalList (Op
, Path
, ACPI_TYPE_REGION
, 0, 0);
192 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ACPI_TYPE_REGION
,
193 ACPI_IMODE_LOAD_PASS1
, ACPI_NS_SEARCH_PARENT
, WalkState
, Node
);
194 if (ACPI_FAILURE (Status
))
199 /* Must create and install a region object for the new node */
201 ObjDesc
= AcpiUtCreateInternalObject (ACPI_TYPE_REGION
);
204 return (AE_NO_MEMORY
);
207 ObjDesc
->Region
.Node
= *Node
;
208 Status
= AcpiNsAttachObject (*Node
, ObjDesc
, ACPI_TYPE_REGION
);
214 /*******************************************************************************
216 * FUNCTION: AcpiDsCreateBufferField
218 * PARAMETERS: Op - Current parse op (CreateXXField)
219 * WalkState - Current state
223 * DESCRIPTION: Execute the CreateField operators:
227 * CreateDwordFieldOp,
228 * CreateQwordFieldOp,
229 * CreateFieldOp (all of which define a field in a buffer)
231 ******************************************************************************/
234 AcpiDsCreateBufferField (
235 ACPI_PARSE_OBJECT
*Op
,
236 ACPI_WALK_STATE
*WalkState
)
238 ACPI_PARSE_OBJECT
*Arg
;
239 ACPI_NAMESPACE_NODE
*Node
;
241 ACPI_OPERAND_OBJECT
*ObjDesc
;
242 ACPI_OPERAND_OBJECT
*SecondDesc
= NULL
;
246 ACPI_FUNCTION_TRACE (DsCreateBufferField
);
250 * Get the NameString argument (name of the new BufferField)
252 if (Op
->Common
.AmlOpcode
== AML_CREATE_FIELD_OP
)
254 /* For CreateField, name is the 4th argument */
256 Arg
= AcpiPsGetArg (Op
, 3);
260 /* For all other CreateXXXField operators, name is the 3rd argument */
262 Arg
= AcpiPsGetArg (Op
, 2);
267 return_ACPI_STATUS (AE_AML_NO_OPERAND
);
270 if (WalkState
->DeferredNode
)
272 Node
= WalkState
->DeferredNode
;
277 /* Execute flag should always be set when this function is entered */
279 if (!(WalkState
->ParseFlags
& ACPI_PARSE_EXECUTE
))
281 return_ACPI_STATUS (AE_AML_INTERNAL
);
284 /* Creating new namespace node, should not already exist */
286 Flags
= ACPI_NS_NO_UPSEARCH
| ACPI_NS_DONT_OPEN_SCOPE
|
287 ACPI_NS_ERROR_IF_FOUND
;
290 * Mark node temporary if we are executing a normal control
291 * method. (Don't mark if this is a module-level code method)
293 if (WalkState
->MethodNode
&&
294 !(WalkState
->ParseFlags
& ACPI_PARSE_MODULE_LEVEL
))
296 Flags
|= ACPI_NS_TEMPORARY
;
299 /* Enter the NameString into the namespace */
301 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
302 ACPI_TYPE_ANY
, ACPI_IMODE_LOAD_PASS1
,
303 Flags
, WalkState
, &Node
);
304 if (ACPI_FAILURE (Status
))
306 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
307 return_ACPI_STATUS (Status
);
312 * We could put the returned object (Node) on the object stack for later,
313 * but for now, we will put it in the "op" object that the parser uses,
314 * so we can get it again at the end of this scope.
316 Op
->Common
.Node
= Node
;
319 * If there is no object attached to the node, this node was just created
320 * and we need to create the field object. Otherwise, this was a lookup
321 * of an existing node and we don't want to create the field object again.
323 ObjDesc
= AcpiNsGetAttachedObject (Node
);
326 return_ACPI_STATUS (AE_OK
);
330 * The Field definition is not fully parsed at this time.
331 * (We must save the address of the AML for the buffer and index operands)
334 /* Create the buffer field object */
336 ObjDesc
= AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD
);
339 Status
= AE_NO_MEMORY
;
344 * Remember location in AML stream of the field unit opcode and operands --
345 * since the buffer and index operands must be evaluated.
347 SecondDesc
= ObjDesc
->Common
.NextObject
;
348 SecondDesc
->Extra
.AmlStart
= Op
->Named
.Data
;
349 SecondDesc
->Extra
.AmlLength
= Op
->Named
.Length
;
350 ObjDesc
->BufferField
.Node
= Node
;
352 /* Attach constructed field descriptors to parent node */
354 Status
= AcpiNsAttachObject (Node
, ObjDesc
, ACPI_TYPE_BUFFER_FIELD
);
355 if (ACPI_FAILURE (Status
))
363 /* Remove local reference to the object */
365 AcpiUtRemoveReference (ObjDesc
);
366 return_ACPI_STATUS (Status
);
370 /*******************************************************************************
372 * FUNCTION: AcpiDsGetFieldNames
374 * PARAMETERS: Info - CreateField info structure
375 * ` WalkState - Current method state
376 * Arg - First parser arg for the field name list
380 * DESCRIPTION: Process all named fields in a field declaration. Names are
381 * entered into the namespace.
383 ******************************************************************************/
386 AcpiDsGetFieldNames (
387 ACPI_CREATE_FIELD_INFO
*Info
,
388 ACPI_WALK_STATE
*WalkState
,
389 ACPI_PARSE_OBJECT
*Arg
)
393 ACPI_PARSE_OBJECT
*Child
;
396 ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames
, Info
);
399 /* First field starts at bit zero */
401 Info
->FieldBitPosition
= 0;
403 /* Process all elements in the field list (of parse nodes) */
408 * Four types of field elements are handled:
409 * 1) Name - Enters a new named field into the namespace
410 * 2) Offset - specifies a bit offset
411 * 3) AccessAs - changes the access mode/attributes
412 * 4) Connection - Associate a resource template with the field
414 switch (Arg
->Common
.AmlOpcode
)
416 case AML_INT_RESERVEDFIELD_OP
:
418 Position
= (UINT64
) Info
->FieldBitPosition
419 + (UINT64
) Arg
->Common
.Value
.Size
;
421 if (Position
> ACPI_UINT32_MAX
)
423 ACPI_ERROR ((AE_INFO
,
424 "Bit offset within field too large (> 0xFFFFFFFF)"));
425 return_ACPI_STATUS (AE_SUPPORT
);
428 Info
->FieldBitPosition
= (UINT32
) Position
;
431 case AML_INT_ACCESSFIELD_OP
:
432 case AML_INT_EXTACCESSFIELD_OP
:
434 * Get new AccessType, AccessAttribute, and AccessLength fields
435 * -- to be used for all field units that follow, until the
436 * end-of-field or another AccessAs keyword is encountered.
437 * NOTE. These three bytes are encoded in the integer value
438 * of the parseop for convenience.
440 * In FieldFlags, preserve the flag bits other than the
444 /* AccessType (ByteAcc, WordAcc, etc.) */
446 Info
->FieldFlags
= (UINT8
)
447 ((Info
->FieldFlags
& ~(AML_FIELD_ACCESS_TYPE_MASK
)) |
448 ((UINT8
) ((UINT32
) (Arg
->Common
.Value
.Integer
& 0x07))));
450 /* AccessAttribute (AttribQuick, AttribByte, etc.) */
452 Info
->Attribute
= (UINT8
) ((Arg
->Common
.Value
.Integer
>> 8) & 0xFF);
454 /* AccessLength (for serial/buffer protocols) */
456 Info
->AccessLength
= (UINT8
) ((Arg
->Common
.Value
.Integer
>> 16) & 0xFF);
459 case AML_INT_CONNECTION_OP
:
461 * Clear any previous connection. New connection is used for all
462 * fields that follow, similar to AccessAs
464 Info
->ResourceBuffer
= NULL
;
465 Info
->ConnectionNode
= NULL
;
468 * A Connection() is either an actual resource descriptor (buffer)
469 * or a named reference to a resource template
471 Child
= Arg
->Common
.Value
.Arg
;
472 if (Child
->Common
.AmlOpcode
== AML_INT_BYTELIST_OP
)
474 Info
->ResourceBuffer
= Child
->Named
.Data
;
475 Info
->ResourceLength
= (UINT16
) Child
->Named
.Value
.Integer
;
479 /* Lookup the Connection() namepath, it should already exist */
481 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
482 Child
->Common
.Value
.Name
, ACPI_TYPE_ANY
,
483 ACPI_IMODE_EXECUTE
, ACPI_NS_DONT_OPEN_SCOPE
,
484 WalkState
, &Info
->ConnectionNode
);
485 if (ACPI_FAILURE (Status
))
487 ACPI_ERROR_NAMESPACE (Child
->Common
.Value
.Name
, Status
);
488 return_ACPI_STATUS (Status
);
493 case AML_INT_NAMEDFIELD_OP
:
495 /* Lookup the name, it should already exist */
497 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
498 (char *) &Arg
->Named
.Name
, Info
->FieldType
,
499 ACPI_IMODE_EXECUTE
, ACPI_NS_DONT_OPEN_SCOPE
,
500 WalkState
, &Info
->FieldNode
);
501 if (ACPI_FAILURE (Status
))
503 ACPI_ERROR_NAMESPACE ((char *) &Arg
->Named
.Name
, Status
);
504 return_ACPI_STATUS (Status
);
508 Arg
->Common
.Node
= Info
->FieldNode
;
509 Info
->FieldBitLength
= Arg
->Common
.Value
.Size
;
512 * If there is no object attached to the node, this node was
513 * just created and we need to create the field object.
514 * Otherwise, this was a lookup of an existing node and we
515 * don't want to create the field object again.
517 if (!AcpiNsGetAttachedObject (Info
->FieldNode
))
519 Status
= AcpiExPrepFieldValue (Info
);
520 if (ACPI_FAILURE (Status
))
522 return_ACPI_STATUS (Status
);
527 /* Keep track of bit position for the next field */
529 Position
= (UINT64
) Info
->FieldBitPosition
530 + (UINT64
) Arg
->Common
.Value
.Size
;
532 if (Position
> ACPI_UINT32_MAX
)
534 ACPI_ERROR ((AE_INFO
,
535 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
536 ACPI_CAST_PTR (char, &Info
->FieldNode
->Name
)));
537 return_ACPI_STATUS (AE_SUPPORT
);
540 Info
->FieldBitPosition
+= Info
->FieldBitLength
;
545 ACPI_ERROR ((AE_INFO
,
546 "Invalid opcode in field list: 0x%X", Arg
->Common
.AmlOpcode
));
547 return_ACPI_STATUS (AE_AML_BAD_OPCODE
);
550 Arg
= Arg
->Common
.Next
;
553 return_ACPI_STATUS (AE_OK
);
557 /*******************************************************************************
559 * FUNCTION: AcpiDsCreateField
561 * PARAMETERS: Op - Op containing the Field definition and args
562 * RegionNode - Object for the containing Operation Region
563 * ` WalkState - Current method state
567 * DESCRIPTION: Create a new field in the specified operation region
569 ******************************************************************************/
573 ACPI_PARSE_OBJECT
*Op
,
574 ACPI_NAMESPACE_NODE
*RegionNode
,
575 ACPI_WALK_STATE
*WalkState
)
578 ACPI_PARSE_OBJECT
*Arg
;
579 ACPI_CREATE_FIELD_INFO Info
;
582 ACPI_FUNCTION_TRACE_PTR (DsCreateField
, Op
);
585 /* First arg is the name of the parent OpRegion (must already exist) */
587 Arg
= Op
->Common
.Value
.Arg
;
591 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.Name
,
592 ACPI_TYPE_REGION
, ACPI_IMODE_EXECUTE
,
593 ACPI_NS_SEARCH_PARENT
, WalkState
, &RegionNode
);
594 #ifdef ACPI_ASL_COMPILER
595 Status
= AcpiDsCreateExternalRegion (Status
, Arg
,
596 Arg
->Common
.Value
.Name
, WalkState
, &RegionNode
);
598 if (ACPI_FAILURE (Status
))
600 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.Name
, Status
);
601 return_ACPI_STATUS (Status
);
605 ACPI_MEMSET (&Info
, 0, sizeof (ACPI_CREATE_FIELD_INFO
));
607 /* Second arg is the field flags */
609 Arg
= Arg
->Common
.Next
;
610 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
613 /* Each remaining arg is a Named Field */
615 Info
.FieldType
= ACPI_TYPE_LOCAL_REGION_FIELD
;
616 Info
.RegionNode
= RegionNode
;
618 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
619 return_ACPI_STATUS (Status
);
623 /*******************************************************************************
625 * FUNCTION: AcpiDsInitFieldObjects
627 * PARAMETERS: Op - Op containing the Field definition and args
628 * ` WalkState - Current method state
632 * DESCRIPTION: For each "Field Unit" name in the argument list that is
633 * part of the field declaration, enter the name into the
636 ******************************************************************************/
639 AcpiDsInitFieldObjects (
640 ACPI_PARSE_OBJECT
*Op
,
641 ACPI_WALK_STATE
*WalkState
)
644 ACPI_PARSE_OBJECT
*Arg
= NULL
;
645 ACPI_NAMESPACE_NODE
*Node
;
650 ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects
, Op
);
653 /* Execute flag should always be set when this function is entered */
655 if (!(WalkState
->ParseFlags
& ACPI_PARSE_EXECUTE
))
657 if (WalkState
->ParseFlags
& ACPI_PARSE_DEFERRED_OP
)
659 /* BankField Op is deferred, just return OK */
661 return_ACPI_STATUS (AE_OK
);
664 return_ACPI_STATUS (AE_AML_INTERNAL
);
668 * Get the FieldList argument for this opcode. This is the start of the
669 * list of field elements.
671 switch (WalkState
->Opcode
)
675 Arg
= AcpiPsGetArg (Op
, 2);
676 Type
= ACPI_TYPE_LOCAL_REGION_FIELD
;
679 case AML_BANK_FIELD_OP
:
681 Arg
= AcpiPsGetArg (Op
, 4);
682 Type
= ACPI_TYPE_LOCAL_BANK_FIELD
;
685 case AML_INDEX_FIELD_OP
:
687 Arg
= AcpiPsGetArg (Op
, 3);
688 Type
= ACPI_TYPE_LOCAL_INDEX_FIELD
;
693 return_ACPI_STATUS (AE_BAD_PARAMETER
);
696 /* Creating new namespace node(s), should not already exist */
698 Flags
= ACPI_NS_NO_UPSEARCH
| ACPI_NS_DONT_OPEN_SCOPE
|
699 ACPI_NS_ERROR_IF_FOUND
;
702 * Mark node(s) temporary if we are executing a normal control
703 * method. (Don't mark if this is a module-level code method)
705 if (WalkState
->MethodNode
&&
706 !(WalkState
->ParseFlags
& ACPI_PARSE_MODULE_LEVEL
))
708 Flags
|= ACPI_NS_TEMPORARY
;
712 * Walk the list of entries in the FieldList
713 * Note: FieldList can be of zero length. In this case, Arg will be NULL.
718 * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
719 * in the field names in order to enter them into the namespace.
721 if (Arg
->Common
.AmlOpcode
== AML_INT_NAMEDFIELD_OP
)
723 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
724 (char *) &Arg
->Named
.Name
, Type
, ACPI_IMODE_LOAD_PASS1
,
725 Flags
, WalkState
, &Node
);
726 if (ACPI_FAILURE (Status
))
728 ACPI_ERROR_NAMESPACE ((char *) &Arg
->Named
.Name
, Status
);
729 if (Status
!= AE_ALREADY_EXISTS
)
731 return_ACPI_STATUS (Status
);
734 /* Name already exists, just ignore this error */
739 Arg
->Common
.Node
= Node
;
742 /* Get the next field element in the list */
744 Arg
= Arg
->Common
.Next
;
747 return_ACPI_STATUS (AE_OK
);
751 /*******************************************************************************
753 * FUNCTION: AcpiDsCreateBankField
755 * PARAMETERS: Op - Op containing the Field definition and args
756 * RegionNode - Object for the containing Operation Region
757 * WalkState - Current method state
761 * DESCRIPTION: Create a new bank field in the specified operation region
763 ******************************************************************************/
766 AcpiDsCreateBankField (
767 ACPI_PARSE_OBJECT
*Op
,
768 ACPI_NAMESPACE_NODE
*RegionNode
,
769 ACPI_WALK_STATE
*WalkState
)
772 ACPI_PARSE_OBJECT
*Arg
;
773 ACPI_CREATE_FIELD_INFO Info
;
776 ACPI_FUNCTION_TRACE_PTR (DsCreateBankField
, Op
);
779 /* First arg is the name of the parent OpRegion (must already exist) */
781 Arg
= Op
->Common
.Value
.Arg
;
784 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.Name
,
785 ACPI_TYPE_REGION
, ACPI_IMODE_EXECUTE
,
786 ACPI_NS_SEARCH_PARENT
, WalkState
, &RegionNode
);
787 #ifdef ACPI_ASL_COMPILER
788 Status
= AcpiDsCreateExternalRegion (Status
, Arg
,
789 Arg
->Common
.Value
.Name
, WalkState
, &RegionNode
);
791 if (ACPI_FAILURE (Status
))
793 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.Name
, Status
);
794 return_ACPI_STATUS (Status
);
798 /* Second arg is the Bank Register (Field) (must already exist) */
800 Arg
= Arg
->Common
.Next
;
801 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
802 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
803 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.RegisterNode
);
804 if (ACPI_FAILURE (Status
))
806 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
807 return_ACPI_STATUS (Status
);
811 * Third arg is the BankValue
812 * This arg is a TermArg, not a constant
813 * It will be evaluated later, by AcpiDsEvalBankFieldOperands
815 Arg
= Arg
->Common
.Next
;
817 /* Fourth arg is the field flags */
819 Arg
= Arg
->Common
.Next
;
820 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
822 /* Each remaining arg is a Named Field */
824 Info
.FieldType
= ACPI_TYPE_LOCAL_BANK_FIELD
;
825 Info
.RegionNode
= RegionNode
;
828 * Use Info.DataRegisterNode to store BankField Op
829 * It's safe because DataRegisterNode will never be used when create bank field
830 * We store AmlStart and AmlLength in the BankField Op for late evaluation
831 * Used in AcpiExPrepFieldValue(Info)
833 * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"?
835 Info
.DataRegisterNode
= (ACPI_NAMESPACE_NODE
*) Op
;
837 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
838 return_ACPI_STATUS (Status
);
842 /*******************************************************************************
844 * FUNCTION: AcpiDsCreateIndexField
846 * PARAMETERS: Op - Op containing the Field definition and args
847 * RegionNode - Object for the containing Operation Region
848 * ` WalkState - Current method state
852 * DESCRIPTION: Create a new index field in the specified operation region
854 ******************************************************************************/
857 AcpiDsCreateIndexField (
858 ACPI_PARSE_OBJECT
*Op
,
859 ACPI_NAMESPACE_NODE
*RegionNode
,
860 ACPI_WALK_STATE
*WalkState
)
863 ACPI_PARSE_OBJECT
*Arg
;
864 ACPI_CREATE_FIELD_INFO Info
;
867 ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField
, Op
);
870 /* First arg is the name of the Index register (must already exist) */
872 Arg
= Op
->Common
.Value
.Arg
;
873 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
874 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
875 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.RegisterNode
);
876 if (ACPI_FAILURE (Status
))
878 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
879 return_ACPI_STATUS (Status
);
882 /* Second arg is the data register (must already exist) */
884 Arg
= Arg
->Common
.Next
;
885 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
886 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
887 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.DataRegisterNode
);
888 if (ACPI_FAILURE (Status
))
890 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
891 return_ACPI_STATUS (Status
);
894 /* Next arg is the field flags */
896 Arg
= Arg
->Common
.Next
;
897 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
899 /* Each remaining arg is a Named Field */
901 Info
.FieldType
= ACPI_TYPE_LOCAL_INDEX_FIELD
;
902 Info
.RegionNode
= RegionNode
;
904 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
905 return_ACPI_STATUS (Status
);