1 /******************************************************************************
3 * Module Name: dsopcode - Dispatcher support for regions and fields
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2020, 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 * Alternatively, you may choose to be licensed under the terms of the
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
153 #include "accommon.h"
154 #include "acparser.h"
156 #include "acdispat.h"
157 #include "acinterp.h"
158 #include "acnamesp.h"
159 #include "acevents.h"
160 #include "actables.h"
162 #define _COMPONENT ACPI_DISPATCHER
163 ACPI_MODULE_NAME ("dsopcode")
165 /* Local prototypes */
168 AcpiDsInitBufferField (
170 ACPI_OPERAND_OBJECT *ObjDesc,
171 ACPI_OPERAND_OBJECT *BufferDesc,
172 ACPI_OPERAND_OBJECT *OffsetDesc,
173 ACPI_OPERAND_OBJECT *LengthDesc,
174 ACPI_OPERAND_OBJECT *ResultDesc);
177 /*******************************************************************************
179 * FUNCTION: AcpiDsInitializeRegion
181 * PARAMETERS: ObjHandle - Region namespace node
185 * DESCRIPTION: Front end to EvInitializeRegion
187 ******************************************************************************/
190 AcpiDsInitializeRegion (
191 ACPI_HANDLE ObjHandle)
193 ACPI_OPERAND_OBJECT *ObjDesc;
197 ObjDesc = AcpiNsGetAttachedObject (ObjHandle);
199 /* Namespace is NOT locked */
201 Status = AcpiEvInitializeRegion (ObjDesc);
206 /*******************************************************************************
208 * FUNCTION: AcpiDsInitBufferField
210 * PARAMETERS: AmlOpcode - CreateXxxField
211 * ObjDesc - BufferField object
212 * BufferDesc - Host Buffer
213 * OffsetDesc - Offset into buffer
214 * LengthDesc - Length of field (CREATE_FIELD_OP only)
215 * ResultDesc - Where to store the result
219 * DESCRIPTION: Perform actual initialization of a buffer field
221 ******************************************************************************/
224 AcpiDsInitBufferField (
226 ACPI_OPERAND_OBJECT *ObjDesc,
227 ACPI_OPERAND_OBJECT *BufferDesc,
228 ACPI_OPERAND_OBJECT *OffsetDesc,
229 ACPI_OPERAND_OBJECT *LengthDesc,
230 ACPI_OPERAND_OBJECT *ResultDesc)
239 ACPI_FUNCTION_TRACE_PTR (DsInitBufferField, ObjDesc);
242 /* Host object must be a Buffer */
244 if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER)
246 ACPI_ERROR ((AE_INFO,
247 "Target of Create Field is not a Buffer object - %s",
248 AcpiUtGetObjectTypeName (BufferDesc)));
250 Status = AE_AML_OPERAND_TYPE;
255 * The last parameter to all of these opcodes (ResultDesc) started
256 * out as a NameString, and should therefore now be a NS node
257 * after resolution in AcpiExResolveOperands().
259 if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED)
261 ACPI_ERROR ((AE_INFO,
262 "(%s) destination not a NS Node [%s]",
263 AcpiPsGetOpcodeName (AmlOpcode),
264 AcpiUtGetDescriptorName (ResultDesc)));
266 Status = AE_AML_OPERAND_TYPE;
270 Offset = (UINT32) OffsetDesc->Integer.Value;
273 * Setup the Bit offsets and counts, according to the opcode
277 case AML_CREATE_FIELD_OP:
279 /* Offset is in bits, count is in bits */
281 FieldFlags = AML_FIELD_ACCESS_BYTE;
283 BitCount = (UINT32) LengthDesc->Integer.Value;
285 /* Must have a valid (>0) bit count */
289 ACPI_BIOS_ERROR ((AE_INFO,
290 "Attempt to CreateField of length zero"));
291 Status = AE_AML_OPERAND_VALUE;
296 case AML_CREATE_BIT_FIELD_OP:
298 /* Offset is in bits, Field is one bit */
302 FieldFlags = AML_FIELD_ACCESS_BYTE;
305 case AML_CREATE_BYTE_FIELD_OP:
307 /* Offset is in bytes, field is one byte */
309 BitOffset = 8 * Offset;
311 FieldFlags = AML_FIELD_ACCESS_BYTE;
314 case AML_CREATE_WORD_FIELD_OP:
316 /* Offset is in bytes, field is one word */
318 BitOffset = 8 * Offset;
320 FieldFlags = AML_FIELD_ACCESS_WORD;
323 case AML_CREATE_DWORD_FIELD_OP:
325 /* Offset is in bytes, field is one dword */
327 BitOffset = 8 * Offset;
329 FieldFlags = AML_FIELD_ACCESS_DWORD;
332 case AML_CREATE_QWORD_FIELD_OP:
334 /* Offset is in bytes, field is one qword */
336 BitOffset = 8 * Offset;
338 FieldFlags = AML_FIELD_ACCESS_QWORD;
343 ACPI_ERROR ((AE_INFO,
344 "Unknown field creation opcode 0x%02X",
346 Status = AE_AML_BAD_OPCODE;
350 /* Entire field must fit within the current length of the buffer */
352 if ((BitOffset + BitCount) >
353 (8 * (UINT32) BufferDesc->Buffer.Length))
355 Status = AE_AML_BUFFER_LIMIT;
356 ACPI_BIOS_EXCEPTION ((AE_INFO, Status,
357 "Field [%4.4s] at bit offset/length %u/%u "
358 "exceeds size of target Buffer (%u bits)",
359 AcpiUtGetNodeName (ResultDesc), BitOffset, BitCount,
360 8 * (UINT32) BufferDesc->Buffer.Length));
365 * Initialize areas of the field object that are common to all fields
366 * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK),
367 * UPDATE_RULE = 0 (UPDATE_PRESERVE)
369 Status = AcpiExPrepCommonFieldObject (
370 ObjDesc, FieldFlags, 0, BitOffset, BitCount);
371 if (ACPI_FAILURE (Status))
376 ObjDesc->BufferField.BufferObj = BufferDesc;
377 ObjDesc->BufferField.IsCreateField = AmlOpcode == AML_CREATE_FIELD_OP;
379 /* Reference count for BufferDesc inherits ObjDesc count */
381 BufferDesc->Common.ReferenceCount = (UINT16)
382 (BufferDesc->Common.ReferenceCount + ObjDesc->Common.ReferenceCount);
387 /* Always delete the operands */
389 AcpiUtRemoveReference (OffsetDesc);
390 AcpiUtRemoveReference (BufferDesc);
392 if (AmlOpcode == AML_CREATE_FIELD_OP)
394 AcpiUtRemoveReference (LengthDesc);
397 /* On failure, delete the result descriptor */
399 if (ACPI_FAILURE (Status))
401 AcpiUtRemoveReference (ResultDesc); /* Result descriptor */
405 /* Now the address and length are valid for this BufferField */
407 ObjDesc->BufferField.Flags |= AOPOBJ_DATA_VALID;
410 return_ACPI_STATUS (Status);
414 /*******************************************************************************
416 * FUNCTION: AcpiDsEvalBufferFieldOperands
418 * PARAMETERS: WalkState - Current walk
419 * Op - A valid BufferField Op object
423 * DESCRIPTION: Get BufferField Buffer and Index
424 * Called from AcpiDsExecEndOp during BufferField parse tree walk
426 ******************************************************************************/
429 AcpiDsEvalBufferFieldOperands (
430 ACPI_WALK_STATE *WalkState,
431 ACPI_PARSE_OBJECT *Op)
434 ACPI_OPERAND_OBJECT *ObjDesc;
435 ACPI_NAMESPACE_NODE *Node;
436 ACPI_PARSE_OBJECT *NextOp;
439 ACPI_FUNCTION_TRACE_PTR (DsEvalBufferFieldOperands, Op);
443 * This is where we evaluate the address and length fields of the
444 * CreateXxxField declaration
446 Node = Op->Common.Node;
448 /* NextOp points to the op that holds the Buffer */
450 NextOp = Op->Common.Value.Arg;
452 /* Evaluate/create the address and length operands */
454 Status = AcpiDsCreateOperands (WalkState, NextOp);
455 if (ACPI_FAILURE (Status))
457 return_ACPI_STATUS (Status);
460 ObjDesc = AcpiNsGetAttachedObject (Node);
463 return_ACPI_STATUS (AE_NOT_EXIST);
466 /* Resolve the operands */
468 Status = AcpiExResolveOperands (
469 Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
470 if (ACPI_FAILURE (Status))
472 ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X",
473 AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
475 return_ACPI_STATUS (Status);
478 /* Initialize the Buffer Field */
480 if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
482 /* NOTE: Slightly different operands for this opcode */
484 Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
485 WalkState->Operands[0], WalkState->Operands[1],
486 WalkState->Operands[2], WalkState->Operands[3]);
490 /* All other, CreateXxxField opcodes */
492 Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
493 WalkState->Operands[0], WalkState->Operands[1],
494 NULL, WalkState->Operands[2]);
497 return_ACPI_STATUS (Status);
501 /*******************************************************************************
503 * FUNCTION: AcpiDsEvalRegionOperands
505 * PARAMETERS: WalkState - Current walk
506 * Op - A valid region Op object
510 * DESCRIPTION: Get region address and length
511 * Called from AcpiDsExecEndOp during OpRegion parse tree walk
513 ******************************************************************************/
516 AcpiDsEvalRegionOperands (
517 ACPI_WALK_STATE *WalkState,
518 ACPI_PARSE_OBJECT *Op)
521 ACPI_OPERAND_OBJECT *ObjDesc;
522 ACPI_OPERAND_OBJECT *OperandDesc;
523 ACPI_NAMESPACE_NODE *Node;
524 ACPI_PARSE_OBJECT *NextOp;
525 ACPI_ADR_SPACE_TYPE SpaceId;
528 ACPI_FUNCTION_TRACE_PTR (DsEvalRegionOperands, Op);
532 * This is where we evaluate the address and length fields of the
533 * OpRegion declaration
535 Node = Op->Common.Node;
537 /* NextOp points to the op that holds the SpaceID */
539 NextOp = Op->Common.Value.Arg;
540 SpaceId = (ACPI_ADR_SPACE_TYPE) NextOp->Common.Value.Integer;
542 /* NextOp points to address op */
544 NextOp = NextOp->Common.Next;
546 /* Evaluate/create the address and length operands */
548 Status = AcpiDsCreateOperands (WalkState, NextOp);
549 if (ACPI_FAILURE (Status))
551 return_ACPI_STATUS (Status);
554 /* Resolve the length and address operands to numbers */
556 Status = AcpiExResolveOperands (
557 Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
558 if (ACPI_FAILURE (Status))
560 return_ACPI_STATUS (Status);
563 ObjDesc = AcpiNsGetAttachedObject (Node);
566 return_ACPI_STATUS (AE_NOT_EXIST);
570 * Get the length operand and save it
573 OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
575 ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value;
576 AcpiUtRemoveReference (OperandDesc);
578 /* A zero-length operation region is unusable. Just warn */
580 if (!ObjDesc->Region.Length && (SpaceId < ACPI_NUM_PREDEFINED_REGIONS))
582 ACPI_WARNING ((AE_INFO,
583 "Operation Region [%4.4s] has zero length (SpaceId %X)",
584 Node->Name.Ascii, SpaceId));
588 * Get the address and save it
589 * (at top of stack - 1)
591 OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
593 ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS)
594 OperandDesc->Integer.Value;
595 AcpiUtRemoveReference (OperandDesc);
597 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
598 ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
599 ObjDesc->Region.Length));
601 Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId,
602 ObjDesc->Region.Address, ObjDesc->Region.Length, Node);
604 /* Now the address and length are valid for this opregion */
606 ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
607 return_ACPI_STATUS (Status);
611 /*******************************************************************************
613 * FUNCTION: AcpiDsEvalTableRegionOperands
615 * PARAMETERS: WalkState - Current walk
616 * Op - A valid region Op object
620 * DESCRIPTION: Get region address and length.
621 * Called from AcpiDsExecEndOp during DataTableRegion parse
624 ******************************************************************************/
627 AcpiDsEvalTableRegionOperands (
628 ACPI_WALK_STATE *WalkState,
629 ACPI_PARSE_OBJECT *Op)
632 ACPI_OPERAND_OBJECT *ObjDesc;
633 ACPI_OPERAND_OBJECT **Operand;
634 ACPI_NAMESPACE_NODE *Node;
635 ACPI_PARSE_OBJECT *NextOp;
636 ACPI_TABLE_HEADER *Table;
640 ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
644 * This is where we evaluate the Signature string, OemId string,
645 * and OemTableId string of the Data Table Region declaration
647 Node = Op->Common.Node;
649 /* NextOp points to Signature string op */
651 NextOp = Op->Common.Value.Arg;
654 * Evaluate/create the Signature string, OemId string,
655 * and OemTableId string operands
657 Status = AcpiDsCreateOperands (WalkState, NextOp);
658 if (ACPI_FAILURE (Status))
660 return_ACPI_STATUS (Status);
663 Operand = &WalkState->Operands[0];
666 * Resolve the Signature string, OemId string,
667 * and OemTableId string operands
669 Status = AcpiExResolveOperands (
670 Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
671 if (ACPI_FAILURE (Status))
676 /* Find the ACPI table */
678 Status = AcpiTbFindTable (
679 Operand[0]->String.Pointer,
680 Operand[1]->String.Pointer,
681 Operand[2]->String.Pointer, &TableIndex);
682 if (ACPI_FAILURE (Status))
684 if (Status == AE_NOT_FOUND)
686 ACPI_ERROR ((AE_INFO,
687 "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT",
688 Operand[0]->String.Pointer,
689 Operand[1]->String.Pointer,
690 Operand[2]->String.Pointer));
695 Status = AcpiGetTableByIndex (TableIndex, &Table);
696 if (ACPI_FAILURE (Status))
701 ObjDesc = AcpiNsGetAttachedObject (Node);
704 Status = AE_NOT_EXIST;
708 ObjDesc->Region.Address = ACPI_PTR_TO_PHYSADDR (Table);
709 ObjDesc->Region.Length = Table->Length;
711 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
712 ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
713 ObjDesc->Region.Length));
715 /* Now the address and length are valid for this opregion */
717 ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
720 AcpiUtRemoveReference (Operand[0]);
721 AcpiUtRemoveReference (Operand[1]);
722 AcpiUtRemoveReference (Operand[2]);
724 return_ACPI_STATUS (Status);
728 /*******************************************************************************
730 * FUNCTION: AcpiDsEvalDataObjectOperands
732 * PARAMETERS: WalkState - Current walk
733 * Op - A valid DataObject Op object
734 * ObjDesc - DataObject
738 * DESCRIPTION: Get the operands and complete the following data object types:
741 ******************************************************************************/
744 AcpiDsEvalDataObjectOperands (
745 ACPI_WALK_STATE *WalkState,
746 ACPI_PARSE_OBJECT *Op,
747 ACPI_OPERAND_OBJECT *ObjDesc)
750 ACPI_OPERAND_OBJECT *ArgDesc;
754 ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands);
757 /* The first operand (for all of these data objects) is the length */
760 * Set proper index into operand stack for AcpiDsObjStackPush
761 * invoked inside AcpiDsCreateOperand.
763 WalkState->OperandIndex = WalkState->NumOperands;
765 /* Ignore if child is not valid */
767 if (!Op->Common.Value.Arg)
769 ACPI_ERROR ((AE_INFO,
770 "Missing child while evaluating opcode %4.4X, Op %p",
771 Op->Common.AmlOpcode, Op));
772 return_ACPI_STATUS (AE_OK);
775 Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
776 if (ACPI_FAILURE (Status))
778 return_ACPI_STATUS (Status);
781 Status = AcpiExResolveOperands (WalkState->Opcode,
782 &(WalkState->Operands [WalkState->NumOperands -1]),
784 if (ACPI_FAILURE (Status))
786 return_ACPI_STATUS (Status);
789 /* Extract length operand */
791 ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
792 Length = (UINT32) ArgDesc->Integer.Value;
794 /* Cleanup for length operand */
796 Status = AcpiDsObjStackPop (1, WalkState);
797 if (ACPI_FAILURE (Status))
799 return_ACPI_STATUS (Status);
802 AcpiUtRemoveReference (ArgDesc);
805 * Create the actual data object
807 switch (Op->Common.AmlOpcode)
811 Status = AcpiDsBuildInternalBufferObj (
812 WalkState, Op, Length, &ObjDesc);
816 case AML_VARIABLE_PACKAGE_OP:
818 Status = AcpiDsBuildInternalPackageObj (
819 WalkState, Op, Length, &ObjDesc);
824 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
827 if (ACPI_SUCCESS (Status))
830 * Return the object in the WalkState, unless the parent is a package -
831 * in this case, the return object will be stored in the parse tree
834 if ((!Op->Common.Parent) ||
835 ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
836 (Op->Common.Parent->Common.AmlOpcode != AML_VARIABLE_PACKAGE_OP) &&
837 (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
839 WalkState->ResultObj = ObjDesc;
843 return_ACPI_STATUS (Status);
847 /*******************************************************************************
849 * FUNCTION: AcpiDsEvalBankFieldOperands
851 * PARAMETERS: WalkState - Current walk
852 * Op - A valid BankField Op object
856 * DESCRIPTION: Get BankField BankValue
857 * Called from AcpiDsExecEndOp during BankField parse tree walk
859 ******************************************************************************/
862 AcpiDsEvalBankFieldOperands (
863 ACPI_WALK_STATE *WalkState,
864 ACPI_PARSE_OBJECT *Op)
867 ACPI_OPERAND_OBJECT *ObjDesc;
868 ACPI_OPERAND_OBJECT *OperandDesc;
869 ACPI_NAMESPACE_NODE *Node;
870 ACPI_PARSE_OBJECT *NextOp;
871 ACPI_PARSE_OBJECT *Arg;
874 ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op);
878 * This is where we evaluate the BankValue field of the
879 * BankField declaration
882 /* NextOp points to the op that holds the Region */
884 NextOp = Op->Common.Value.Arg;
886 /* NextOp points to the op that holds the Bank Register */
888 NextOp = NextOp->Common.Next;
890 /* NextOp points to the op that holds the Bank Value */
892 NextOp = NextOp->Common.Next;
895 * Set proper index into operand stack for AcpiDsObjStackPush
896 * invoked inside AcpiDsCreateOperand.
898 * We use WalkState->Operands[0] to store the evaluated BankValue
900 WalkState->OperandIndex = 0;
902 Status = AcpiDsCreateOperand (WalkState, NextOp, 0);
903 if (ACPI_FAILURE (Status))
905 return_ACPI_STATUS (Status);
908 Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState);
909 if (ACPI_FAILURE (Status))
911 return_ACPI_STATUS (Status);
914 ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS,
915 AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1);
917 * Get the BankValue operand and save it
920 OperandDesc = WalkState->Operands[0];
922 /* Arg points to the start Bank Field */
924 Arg = AcpiPsGetArg (Op, 4);
927 /* Ignore OFFSET and ACCESSAS terms here */
929 if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
931 Node = Arg->Common.Node;
933 ObjDesc = AcpiNsGetAttachedObject (Node);
936 return_ACPI_STATUS (AE_NOT_EXIST);
939 ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
942 /* Move to next field in the list */
944 Arg = Arg->Common.Next;
947 AcpiUtRemoveReference (OperandDesc);
948 return_ACPI_STATUS (Status);