1 /******************************************************************************
3 * Module Name: dsfield - Dispatcher field routines
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2015, 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 *****************************************************************************/
117 #include "accommon.h"
119 #include "acdispat.h"
120 #include "acinterp.h"
121 #include "acnamesp.h"
122 #include "acparser.h"
125 #define _COMPONENT ACPI_DISPATCHER
126 ACPI_MODULE_NAME ("dsfield")
128 /* Local prototypes */
130 #ifdef ACPI_ASL_COMPILER
131 #include "acdisasm.h"
134 AcpiDsCreateExternalRegion (
135 ACPI_STATUS LookupStatus
,
136 ACPI_PARSE_OBJECT
*Op
,
138 ACPI_WALK_STATE
*WalkState
,
139 ACPI_NAMESPACE_NODE
**Node
);
143 AcpiDsGetFieldNames (
144 ACPI_CREATE_FIELD_INFO
*Info
,
145 ACPI_WALK_STATE
*WalkState
,
146 ACPI_PARSE_OBJECT
*Arg
);
149 #ifdef ACPI_ASL_COMPILER
150 /*******************************************************************************
152 * FUNCTION: AcpiDsCreateExternalRegion (iASL Disassembler only)
154 * PARAMETERS: LookupStatus - Status from NsLookup operation
155 * Op - Op containing the Field definition and args
156 * Path - Pathname of the region
157 * ` WalkState - Current method state
158 * Node - Where the new region node is returned
162 * DESCRIPTION: Add region to the external list if NOT_FOUND. Create a new
163 * region node/object.
165 ******************************************************************************/
168 AcpiDsCreateExternalRegion (
169 ACPI_STATUS LookupStatus
,
170 ACPI_PARSE_OBJECT
*Op
,
172 ACPI_WALK_STATE
*WalkState
,
173 ACPI_NAMESPACE_NODE
**Node
)
176 ACPI_OPERAND_OBJECT
*ObjDesc
;
179 if (LookupStatus
!= AE_NOT_FOUND
)
181 return (LookupStatus
);
186 * OperationRegion not found. Generate an External for it, and
187 * insert the name into the namespace.
189 AcpiDmAddOpToExternalList (Op
, Path
, ACPI_TYPE_REGION
, 0, 0);
191 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Path
, ACPI_TYPE_REGION
,
192 ACPI_IMODE_LOAD_PASS1
, ACPI_NS_SEARCH_PARENT
, WalkState
, Node
);
193 if (ACPI_FAILURE (Status
))
198 /* Must create and install a region object for the new node */
200 ObjDesc
= AcpiUtCreateInternalObject (ACPI_TYPE_REGION
);
203 return (AE_NO_MEMORY
);
206 ObjDesc
->Region
.Node
= *Node
;
207 Status
= AcpiNsAttachObject (*Node
, ObjDesc
, ACPI_TYPE_REGION
);
213 /*******************************************************************************
215 * FUNCTION: AcpiDsCreateBufferField
217 * PARAMETERS: Op - Current parse op (CreateXXField)
218 * WalkState - Current state
222 * DESCRIPTION: Execute the CreateField operators:
226 * CreateDwordFieldOp,
227 * CreateQwordFieldOp,
228 * CreateFieldOp (all of which define a field in a buffer)
230 ******************************************************************************/
233 AcpiDsCreateBufferField (
234 ACPI_PARSE_OBJECT
*Op
,
235 ACPI_WALK_STATE
*WalkState
)
237 ACPI_PARSE_OBJECT
*Arg
;
238 ACPI_NAMESPACE_NODE
*Node
;
240 ACPI_OPERAND_OBJECT
*ObjDesc
;
241 ACPI_OPERAND_OBJECT
*SecondDesc
= NULL
;
245 ACPI_FUNCTION_TRACE (DsCreateBufferField
);
249 * Get the NameString argument (name of the new BufferField)
251 if (Op
->Common
.AmlOpcode
== AML_CREATE_FIELD_OP
)
253 /* For CreateField, name is the 4th argument */
255 Arg
= AcpiPsGetArg (Op
, 3);
259 /* For all other CreateXXXField operators, name is the 3rd argument */
261 Arg
= AcpiPsGetArg (Op
, 2);
266 return_ACPI_STATUS (AE_AML_NO_OPERAND
);
269 if (WalkState
->DeferredNode
)
271 Node
= WalkState
->DeferredNode
;
276 /* Execute flag should always be set when this function is entered */
278 if (!(WalkState
->ParseFlags
& ACPI_PARSE_EXECUTE
))
280 return_ACPI_STATUS (AE_AML_INTERNAL
);
283 /* Creating new namespace node, should not already exist */
285 Flags
= ACPI_NS_NO_UPSEARCH
| ACPI_NS_DONT_OPEN_SCOPE
|
286 ACPI_NS_ERROR_IF_FOUND
;
289 * Mark node temporary if we are executing a normal control
290 * method. (Don't mark if this is a module-level code method)
292 if (WalkState
->MethodNode
&&
293 !(WalkState
->ParseFlags
& ACPI_PARSE_MODULE_LEVEL
))
295 Flags
|= ACPI_NS_TEMPORARY
;
298 /* Enter the NameString into the namespace */
300 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
301 Arg
->Common
.Value
.String
, ACPI_TYPE_ANY
,
302 ACPI_IMODE_LOAD_PASS1
, Flags
, WalkState
, &Node
);
303 if (ACPI_FAILURE (Status
))
305 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
306 return_ACPI_STATUS (Status
);
311 * We could put the returned object (Node) on the object stack for later,
312 * but for now, we will put it in the "op" object that the parser uses,
313 * so we can get it again at the end of this scope.
315 Op
->Common
.Node
= Node
;
318 * If there is no object attached to the node, this node was just created
319 * and we need to create the field object. Otherwise, this was a lookup
320 * of an existing node and we don't want to create the field object again.
322 ObjDesc
= AcpiNsGetAttachedObject (Node
);
325 return_ACPI_STATUS (AE_OK
);
329 * The Field definition is not fully parsed at this time.
330 * (We must save the address of the AML for the buffer and index operands)
333 /* Create the buffer field object */
335 ObjDesc
= AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD
);
338 Status
= AE_NO_MEMORY
;
343 * Remember location in AML stream of the field unit opcode and operands
344 * -- since the buffer and index operands must be evaluated.
346 SecondDesc
= ObjDesc
->Common
.NextObject
;
347 SecondDesc
->Extra
.AmlStart
= Op
->Named
.Data
;
348 SecondDesc
->Extra
.AmlLength
= Op
->Named
.Length
;
349 ObjDesc
->BufferField
.Node
= Node
;
351 /* Attach constructed field descriptors to parent node */
353 Status
= AcpiNsAttachObject (Node
, ObjDesc
, ACPI_TYPE_BUFFER_FIELD
);
354 if (ACPI_FAILURE (Status
))
362 /* Remove local reference to the object */
364 AcpiUtRemoveReference (ObjDesc
);
365 return_ACPI_STATUS (Status
);
369 /*******************************************************************************
371 * FUNCTION: AcpiDsGetFieldNames
373 * PARAMETERS: Info - CreateField info structure
374 * ` WalkState - Current method state
375 * Arg - First parser arg for the field name list
379 * DESCRIPTION: Process all named fields in a field declaration. Names are
380 * entered into the namespace.
382 ******************************************************************************/
385 AcpiDsGetFieldNames (
386 ACPI_CREATE_FIELD_INFO
*Info
,
387 ACPI_WALK_STATE
*WalkState
,
388 ACPI_PARSE_OBJECT
*Arg
)
392 ACPI_PARSE_OBJECT
*Child
;
395 ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames
, Info
);
398 /* First field starts at bit zero */
400 Info
->FieldBitPosition
= 0;
402 /* Process all elements in the field list (of parse nodes) */
407 * Four types of field elements are handled:
408 * 1) Name - Enters a new named field into the namespace
409 * 2) Offset - specifies a bit offset
410 * 3) AccessAs - changes the access mode/attributes
411 * 4) Connection - Associate a resource template with the field
413 switch (Arg
->Common
.AmlOpcode
)
415 case AML_INT_RESERVEDFIELD_OP
:
417 Position
= (UINT64
) Info
->FieldBitPosition
+
418 (UINT64
) Arg
->Common
.Value
.Size
;
420 if (Position
> ACPI_UINT32_MAX
)
422 ACPI_ERROR ((AE_INFO
,
423 "Bit offset within field too large (> 0xFFFFFFFF)"));
424 return_ACPI_STATUS (AE_SUPPORT
);
427 Info
->FieldBitPosition
= (UINT32
) Position
;
430 case AML_INT_ACCESSFIELD_OP
:
431 case AML_INT_EXTACCESSFIELD_OP
:
433 * Get new AccessType, AccessAttribute, and AccessLength fields
434 * -- to be used for all field units that follow, until the
435 * end-of-field or another AccessAs keyword is encountered.
436 * NOTE. These three bytes are encoded in the integer value
437 * of the parseop for convenience.
439 * In FieldFlags, preserve the flag bits other than the
443 /* AccessType (ByteAcc, WordAcc, etc.) */
445 Info
->FieldFlags
= (UINT8
)
446 ((Info
->FieldFlags
& ~(AML_FIELD_ACCESS_TYPE_MASK
)) |
447 ((UINT8
) ((UINT32
) (Arg
->Common
.Value
.Integer
& 0x07))));
449 /* AccessAttribute (AttribQuick, AttribByte, etc.) */
451 Info
->Attribute
= (UINT8
)
452 ((Arg
->Common
.Value
.Integer
>> 8) & 0xFF);
454 /* AccessLength (for serial/buffer protocols) */
456 Info
->AccessLength
= (UINT8
)
457 ((Arg
->Common
.Value
.Integer
>> 16) & 0xFF);
460 case AML_INT_CONNECTION_OP
:
462 * Clear any previous connection. New connection is used for all
463 * fields that follow, similar to AccessAs
465 Info
->ResourceBuffer
= NULL
;
466 Info
->ConnectionNode
= NULL
;
467 Info
->PinNumberIndex
= 0;
470 * A Connection() is either an actual resource descriptor (buffer)
471 * or a named reference to a resource template
473 Child
= Arg
->Common
.Value
.Arg
;
474 if (Child
->Common
.AmlOpcode
== AML_INT_BYTELIST_OP
)
476 Info
->ResourceBuffer
= Child
->Named
.Data
;
477 Info
->ResourceLength
= (UINT16
) Child
->Named
.Value
.Integer
;
481 /* Lookup the Connection() namepath, it should already exist */
483 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
484 Child
->Common
.Value
.Name
, ACPI_TYPE_ANY
,
485 ACPI_IMODE_EXECUTE
, ACPI_NS_DONT_OPEN_SCOPE
,
486 WalkState
, &Info
->ConnectionNode
);
487 if (ACPI_FAILURE (Status
))
489 ACPI_ERROR_NAMESPACE (Child
->Common
.Value
.Name
, Status
);
490 return_ACPI_STATUS (Status
);
495 case AML_INT_NAMEDFIELD_OP
:
497 /* Lookup the name, it should already exist */
499 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
500 (char *) &Arg
->Named
.Name
, Info
->FieldType
,
501 ACPI_IMODE_EXECUTE
, ACPI_NS_DONT_OPEN_SCOPE
,
502 WalkState
, &Info
->FieldNode
);
503 if (ACPI_FAILURE (Status
))
505 ACPI_ERROR_NAMESPACE ((char *) &Arg
->Named
.Name
, Status
);
506 return_ACPI_STATUS (Status
);
510 Arg
->Common
.Node
= Info
->FieldNode
;
511 Info
->FieldBitLength
= Arg
->Common
.Value
.Size
;
514 * If there is no object attached to the node, this node was
515 * just created and we need to create the field object.
516 * Otherwise, this was a lookup of an existing node and we
517 * don't want to create the field object again.
519 if (!AcpiNsGetAttachedObject (Info
->FieldNode
))
521 Status
= AcpiExPrepFieldValue (Info
);
522 if (ACPI_FAILURE (Status
))
524 return_ACPI_STATUS (Status
);
529 /* Keep track of bit position for the next field */
531 Position
= (UINT64
) Info
->FieldBitPosition
+
532 (UINT64
) Arg
->Common
.Value
.Size
;
534 if (Position
> ACPI_UINT32_MAX
)
536 ACPI_ERROR ((AE_INFO
,
537 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
538 ACPI_CAST_PTR (char, &Info
->FieldNode
->Name
)));
539 return_ACPI_STATUS (AE_SUPPORT
);
542 Info
->FieldBitPosition
+= Info
->FieldBitLength
;
543 Info
->PinNumberIndex
++; /* Index relative to previous Connection() */
548 ACPI_ERROR ((AE_INFO
,
549 "Invalid opcode in field list: 0x%X",
550 Arg
->Common
.AmlOpcode
));
551 return_ACPI_STATUS (AE_AML_BAD_OPCODE
);
554 Arg
= Arg
->Common
.Next
;
557 return_ACPI_STATUS (AE_OK
);
561 /*******************************************************************************
563 * FUNCTION: AcpiDsCreateField
565 * PARAMETERS: Op - Op containing the Field definition and args
566 * RegionNode - Object for the containing Operation Region
567 * ` WalkState - Current method state
571 * DESCRIPTION: Create a new field in the specified operation region
573 ******************************************************************************/
577 ACPI_PARSE_OBJECT
*Op
,
578 ACPI_NAMESPACE_NODE
*RegionNode
,
579 ACPI_WALK_STATE
*WalkState
)
582 ACPI_PARSE_OBJECT
*Arg
;
583 ACPI_CREATE_FIELD_INFO Info
;
586 ACPI_FUNCTION_TRACE_PTR (DsCreateField
, Op
);
589 /* First arg is the name of the parent OpRegion (must already exist) */
591 Arg
= Op
->Common
.Value
.Arg
;
595 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.Name
,
596 ACPI_TYPE_REGION
, ACPI_IMODE_EXECUTE
,
597 ACPI_NS_SEARCH_PARENT
, WalkState
, &RegionNode
);
598 #ifdef ACPI_ASL_COMPILER
599 Status
= AcpiDsCreateExternalRegion (Status
, Arg
,
600 Arg
->Common
.Value
.Name
, WalkState
, &RegionNode
);
602 if (ACPI_FAILURE (Status
))
604 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.Name
, Status
);
605 return_ACPI_STATUS (Status
);
609 memset (&Info
, 0, sizeof (ACPI_CREATE_FIELD_INFO
));
611 /* Second arg is the field flags */
613 Arg
= Arg
->Common
.Next
;
614 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
617 /* Each remaining arg is a Named Field */
619 Info
.FieldType
= ACPI_TYPE_LOCAL_REGION_FIELD
;
620 Info
.RegionNode
= RegionNode
;
622 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
623 return_ACPI_STATUS (Status
);
627 /*******************************************************************************
629 * FUNCTION: AcpiDsInitFieldObjects
631 * PARAMETERS: Op - Op containing the Field definition and args
632 * ` WalkState - Current method state
636 * DESCRIPTION: For each "Field Unit" name in the argument list that is
637 * part of the field declaration, enter the name into the
640 ******************************************************************************/
643 AcpiDsInitFieldObjects (
644 ACPI_PARSE_OBJECT
*Op
,
645 ACPI_WALK_STATE
*WalkState
)
648 ACPI_PARSE_OBJECT
*Arg
= NULL
;
649 ACPI_NAMESPACE_NODE
*Node
;
654 ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects
, Op
);
657 /* Execute flag should always be set when this function is entered */
659 if (!(WalkState
->ParseFlags
& ACPI_PARSE_EXECUTE
))
661 if (WalkState
->ParseFlags
& ACPI_PARSE_DEFERRED_OP
)
663 /* BankField Op is deferred, just return OK */
665 return_ACPI_STATUS (AE_OK
);
668 return_ACPI_STATUS (AE_AML_INTERNAL
);
672 * Get the FieldList argument for this opcode. This is the start of the
673 * list of field elements.
675 switch (WalkState
->Opcode
)
679 Arg
= AcpiPsGetArg (Op
, 2);
680 Type
= ACPI_TYPE_LOCAL_REGION_FIELD
;
683 case AML_BANK_FIELD_OP
:
685 Arg
= AcpiPsGetArg (Op
, 4);
686 Type
= ACPI_TYPE_LOCAL_BANK_FIELD
;
689 case AML_INDEX_FIELD_OP
:
691 Arg
= AcpiPsGetArg (Op
, 3);
692 Type
= ACPI_TYPE_LOCAL_INDEX_FIELD
;
697 return_ACPI_STATUS (AE_BAD_PARAMETER
);
700 /* Creating new namespace node(s), should not already exist */
702 Flags
= ACPI_NS_NO_UPSEARCH
| ACPI_NS_DONT_OPEN_SCOPE
|
703 ACPI_NS_ERROR_IF_FOUND
;
706 * Mark node(s) temporary if we are executing a normal control
707 * method. (Don't mark if this is a module-level code method)
709 if (WalkState
->MethodNode
&&
710 !(WalkState
->ParseFlags
& ACPI_PARSE_MODULE_LEVEL
))
712 Flags
|= ACPI_NS_TEMPORARY
;
716 * Walk the list of entries in the FieldList
717 * Note: FieldList can be of zero length. In this case, Arg will be NULL.
722 * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
723 * in the field names in order to enter them into the namespace.
725 if (Arg
->Common
.AmlOpcode
== AML_INT_NAMEDFIELD_OP
)
727 Status
= AcpiNsLookup (WalkState
->ScopeInfo
,
728 (char *) &Arg
->Named
.Name
, Type
, ACPI_IMODE_LOAD_PASS1
,
729 Flags
, WalkState
, &Node
);
730 if (ACPI_FAILURE (Status
))
732 ACPI_ERROR_NAMESPACE ((char *) &Arg
->Named
.Name
, Status
);
733 if (Status
!= AE_ALREADY_EXISTS
)
735 return_ACPI_STATUS (Status
);
738 /* Name already exists, just ignore this error */
743 Arg
->Common
.Node
= Node
;
746 /* Get the next field element in the list */
748 Arg
= Arg
->Common
.Next
;
751 return_ACPI_STATUS (AE_OK
);
755 /*******************************************************************************
757 * FUNCTION: AcpiDsCreateBankField
759 * PARAMETERS: Op - Op containing the Field definition and args
760 * RegionNode - Object for the containing Operation Region
761 * WalkState - Current method state
765 * DESCRIPTION: Create a new bank field in the specified operation region
767 ******************************************************************************/
770 AcpiDsCreateBankField (
771 ACPI_PARSE_OBJECT
*Op
,
772 ACPI_NAMESPACE_NODE
*RegionNode
,
773 ACPI_WALK_STATE
*WalkState
)
776 ACPI_PARSE_OBJECT
*Arg
;
777 ACPI_CREATE_FIELD_INFO Info
;
780 ACPI_FUNCTION_TRACE_PTR (DsCreateBankField
, Op
);
783 /* First arg is the name of the parent OpRegion (must already exist) */
785 Arg
= Op
->Common
.Value
.Arg
;
788 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.Name
,
789 ACPI_TYPE_REGION
, ACPI_IMODE_EXECUTE
,
790 ACPI_NS_SEARCH_PARENT
, WalkState
, &RegionNode
);
791 #ifdef ACPI_ASL_COMPILER
792 Status
= AcpiDsCreateExternalRegion (Status
, Arg
,
793 Arg
->Common
.Value
.Name
, WalkState
, &RegionNode
);
795 if (ACPI_FAILURE (Status
))
797 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.Name
, Status
);
798 return_ACPI_STATUS (Status
);
802 /* Second arg is the Bank Register (Field) (must already exist) */
804 Arg
= Arg
->Common
.Next
;
805 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
806 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
807 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.RegisterNode
);
808 if (ACPI_FAILURE (Status
))
810 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
811 return_ACPI_STATUS (Status
);
815 * Third arg is the BankValue
816 * This arg is a TermArg, not a constant
817 * It will be evaluated later, by AcpiDsEvalBankFieldOperands
819 Arg
= Arg
->Common
.Next
;
821 /* Fourth arg is the field flags */
823 Arg
= Arg
->Common
.Next
;
824 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
826 /* Each remaining arg is a Named Field */
828 Info
.FieldType
= ACPI_TYPE_LOCAL_BANK_FIELD
;
829 Info
.RegionNode
= RegionNode
;
832 * Use Info.DataRegisterNode to store BankField Op
833 * It's safe because DataRegisterNode will never be used when create
834 * bank field \we store AmlStart and AmlLength in the BankField Op for
835 * late evaluation. Used in AcpiExPrepFieldValue(Info)
837 * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like
840 Info
.DataRegisterNode
= (ACPI_NAMESPACE_NODE
*) Op
;
842 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
843 return_ACPI_STATUS (Status
);
847 /*******************************************************************************
849 * FUNCTION: AcpiDsCreateIndexField
851 * PARAMETERS: Op - Op containing the Field definition and args
852 * RegionNode - Object for the containing Operation Region
853 * ` WalkState - Current method state
857 * DESCRIPTION: Create a new index field in the specified operation region
859 ******************************************************************************/
862 AcpiDsCreateIndexField (
863 ACPI_PARSE_OBJECT
*Op
,
864 ACPI_NAMESPACE_NODE
*RegionNode
,
865 ACPI_WALK_STATE
*WalkState
)
868 ACPI_PARSE_OBJECT
*Arg
;
869 ACPI_CREATE_FIELD_INFO Info
;
872 ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField
, Op
);
875 /* First arg is the name of the Index register (must already exist) */
877 Arg
= Op
->Common
.Value
.Arg
;
878 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
879 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
880 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.RegisterNode
);
881 if (ACPI_FAILURE (Status
))
883 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
884 return_ACPI_STATUS (Status
);
887 /* Second arg is the data register (must already exist) */
889 Arg
= Arg
->Common
.Next
;
890 Status
= AcpiNsLookup (WalkState
->ScopeInfo
, Arg
->Common
.Value
.String
,
891 ACPI_TYPE_ANY
, ACPI_IMODE_EXECUTE
,
892 ACPI_NS_SEARCH_PARENT
, WalkState
, &Info
.DataRegisterNode
);
893 if (ACPI_FAILURE (Status
))
895 ACPI_ERROR_NAMESPACE (Arg
->Common
.Value
.String
, Status
);
896 return_ACPI_STATUS (Status
);
899 /* Next arg is the field flags */
901 Arg
= Arg
->Common
.Next
;
902 Info
.FieldFlags
= (UINT8
) Arg
->Common
.Value
.Integer
;
904 /* Each remaining arg is a Named Field */
906 Info
.FieldType
= ACPI_TYPE_LOCAL_INDEX_FIELD
;
907 Info
.RegionNode
= RegionNode
;
909 Status
= AcpiDsGetFieldNames (&Info
, WalkState
, Arg
->Common
.Next
);
910 return_ACPI_STATUS (Status
);