1433d6423SLionel Sambuc /******************************************************************************
2433d6423SLionel Sambuc *
3*29492bb7SDavid van Moolenbroek * Module Name: dsopcode - Dispatcher support for regions and fields
4433d6423SLionel Sambuc *
5433d6423SLionel Sambuc *****************************************************************************/
6433d6423SLionel Sambuc
7*29492bb7SDavid van Moolenbroek /*
8*29492bb7SDavid van Moolenbroek * Copyright (C) 2000 - 2014, Intel Corp.
9433d6423SLionel Sambuc * All rights reserved.
10433d6423SLionel Sambuc *
11*29492bb7SDavid van Moolenbroek * Redistribution and use in source and binary forms, with or without
12*29492bb7SDavid van Moolenbroek * modification, are permitted provided that the following conditions
13*29492bb7SDavid van Moolenbroek * are met:
14*29492bb7SDavid van Moolenbroek * 1. Redistributions of source code must retain the above copyright
15*29492bb7SDavid van Moolenbroek * notice, this list of conditions, and the following disclaimer,
16*29492bb7SDavid van Moolenbroek * without modification.
17*29492bb7SDavid van Moolenbroek * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18*29492bb7SDavid van Moolenbroek * substantially similar to the "NO WARRANTY" disclaimer below
19*29492bb7SDavid van Moolenbroek * ("Disclaimer") and any redistribution must be conditioned upon
20*29492bb7SDavid van Moolenbroek * including a substantially similar Disclaimer requirement for further
21*29492bb7SDavid van Moolenbroek * binary redistribution.
22*29492bb7SDavid van Moolenbroek * 3. Neither the names of the above-listed copyright holders nor the names
23*29492bb7SDavid van Moolenbroek * of any contributors may be used to endorse or promote products derived
24*29492bb7SDavid van Moolenbroek * from this software without specific prior written permission.
25433d6423SLionel Sambuc *
26*29492bb7SDavid van Moolenbroek * Alternatively, this software may be distributed under the terms of the
27*29492bb7SDavid van Moolenbroek * GNU General Public License ("GPL") version 2 as published by the Free
28*29492bb7SDavid van Moolenbroek * Software Foundation.
29433d6423SLionel Sambuc *
30*29492bb7SDavid van Moolenbroek * NO WARRANTY
31*29492bb7SDavid van Moolenbroek * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32*29492bb7SDavid van Moolenbroek * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33*29492bb7SDavid van Moolenbroek * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34*29492bb7SDavid van Moolenbroek * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35*29492bb7SDavid van Moolenbroek * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36*29492bb7SDavid van Moolenbroek * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37*29492bb7SDavid van Moolenbroek * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38*29492bb7SDavid van Moolenbroek * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39*29492bb7SDavid van Moolenbroek * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40*29492bb7SDavid van Moolenbroek * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41*29492bb7SDavid van Moolenbroek * POSSIBILITY OF SUCH DAMAGES.
42*29492bb7SDavid van Moolenbroek */
43433d6423SLionel Sambuc
44433d6423SLionel Sambuc #include "acpi.h"
45433d6423SLionel Sambuc #include "accommon.h"
46433d6423SLionel Sambuc #include "acparser.h"
47433d6423SLionel Sambuc #include "amlcode.h"
48433d6423SLionel Sambuc #include "acdispat.h"
49433d6423SLionel Sambuc #include "acinterp.h"
50433d6423SLionel Sambuc #include "acnamesp.h"
51433d6423SLionel Sambuc #include "acevents.h"
52433d6423SLionel Sambuc #include "actables.h"
53433d6423SLionel Sambuc
54433d6423SLionel Sambuc #define _COMPONENT ACPI_DISPATCHER
55433d6423SLionel Sambuc ACPI_MODULE_NAME ("dsopcode")
56433d6423SLionel Sambuc
57433d6423SLionel Sambuc /* Local prototypes */
58433d6423SLionel Sambuc
59433d6423SLionel Sambuc static ACPI_STATUS
60433d6423SLionel Sambuc AcpiDsInitBufferField (
61433d6423SLionel Sambuc UINT16 AmlOpcode,
62433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ObjDesc,
63433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *BufferDesc,
64433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *OffsetDesc,
65433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *LengthDesc,
66433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ResultDesc);
67433d6423SLionel Sambuc
68433d6423SLionel Sambuc
69433d6423SLionel Sambuc /*******************************************************************************
70433d6423SLionel Sambuc *
71433d6423SLionel Sambuc * FUNCTION: AcpiDsInitializeRegion
72433d6423SLionel Sambuc *
73433d6423SLionel Sambuc * PARAMETERS: ObjHandle - Region namespace node
74433d6423SLionel Sambuc *
75433d6423SLionel Sambuc * RETURN: Status
76433d6423SLionel Sambuc *
77433d6423SLionel Sambuc * DESCRIPTION: Front end to EvInitializeRegion
78433d6423SLionel Sambuc *
79433d6423SLionel Sambuc ******************************************************************************/
80433d6423SLionel Sambuc
81433d6423SLionel Sambuc ACPI_STATUS
AcpiDsInitializeRegion(ACPI_HANDLE ObjHandle)82433d6423SLionel Sambuc AcpiDsInitializeRegion (
83433d6423SLionel Sambuc ACPI_HANDLE ObjHandle)
84433d6423SLionel Sambuc {
85433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ObjDesc;
86433d6423SLionel Sambuc ACPI_STATUS Status;
87433d6423SLionel Sambuc
88433d6423SLionel Sambuc
89433d6423SLionel Sambuc ObjDesc = AcpiNsGetAttachedObject (ObjHandle);
90433d6423SLionel Sambuc
91433d6423SLionel Sambuc /* Namespace is NOT locked */
92433d6423SLionel Sambuc
93433d6423SLionel Sambuc Status = AcpiEvInitializeRegion (ObjDesc, FALSE);
94433d6423SLionel Sambuc return (Status);
95433d6423SLionel Sambuc }
96433d6423SLionel Sambuc
97433d6423SLionel Sambuc
98433d6423SLionel Sambuc /*******************************************************************************
99433d6423SLionel Sambuc *
100433d6423SLionel Sambuc * FUNCTION: AcpiDsInitBufferField
101433d6423SLionel Sambuc *
102433d6423SLionel Sambuc * PARAMETERS: AmlOpcode - CreateXxxField
103433d6423SLionel Sambuc * ObjDesc - BufferField object
104433d6423SLionel Sambuc * BufferDesc - Host Buffer
105433d6423SLionel Sambuc * OffsetDesc - Offset into buffer
106433d6423SLionel Sambuc * LengthDesc - Length of field (CREATE_FIELD_OP only)
107433d6423SLionel Sambuc * ResultDesc - Where to store the result
108433d6423SLionel Sambuc *
109433d6423SLionel Sambuc * RETURN: Status
110433d6423SLionel Sambuc *
111433d6423SLionel Sambuc * DESCRIPTION: Perform actual initialization of a buffer field
112433d6423SLionel Sambuc *
113433d6423SLionel Sambuc ******************************************************************************/
114433d6423SLionel Sambuc
115433d6423SLionel Sambuc static ACPI_STATUS
AcpiDsInitBufferField(UINT16 AmlOpcode,ACPI_OPERAND_OBJECT * ObjDesc,ACPI_OPERAND_OBJECT * BufferDesc,ACPI_OPERAND_OBJECT * OffsetDesc,ACPI_OPERAND_OBJECT * LengthDesc,ACPI_OPERAND_OBJECT * ResultDesc)116433d6423SLionel Sambuc AcpiDsInitBufferField (
117433d6423SLionel Sambuc UINT16 AmlOpcode,
118433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ObjDesc,
119433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *BufferDesc,
120433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *OffsetDesc,
121433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *LengthDesc,
122433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ResultDesc)
123433d6423SLionel Sambuc {
124433d6423SLionel Sambuc UINT32 Offset;
125433d6423SLionel Sambuc UINT32 BitOffset;
126433d6423SLionel Sambuc UINT32 BitCount;
127433d6423SLionel Sambuc UINT8 FieldFlags;
128433d6423SLionel Sambuc ACPI_STATUS Status;
129433d6423SLionel Sambuc
130433d6423SLionel Sambuc
131433d6423SLionel Sambuc ACPI_FUNCTION_TRACE_PTR (DsInitBufferField, ObjDesc);
132433d6423SLionel Sambuc
133433d6423SLionel Sambuc
134433d6423SLionel Sambuc /* Host object must be a Buffer */
135433d6423SLionel Sambuc
136433d6423SLionel Sambuc if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER)
137433d6423SLionel Sambuc {
138433d6423SLionel Sambuc ACPI_ERROR ((AE_INFO,
139433d6423SLionel Sambuc "Target of Create Field is not a Buffer object - %s",
140433d6423SLionel Sambuc AcpiUtGetObjectTypeName (BufferDesc)));
141433d6423SLionel Sambuc
142433d6423SLionel Sambuc Status = AE_AML_OPERAND_TYPE;
143433d6423SLionel Sambuc goto Cleanup;
144433d6423SLionel Sambuc }
145433d6423SLionel Sambuc
146433d6423SLionel Sambuc /*
147433d6423SLionel Sambuc * The last parameter to all of these opcodes (ResultDesc) started
148433d6423SLionel Sambuc * out as a NameString, and should therefore now be a NS node
149433d6423SLionel Sambuc * after resolution in AcpiExResolveOperands().
150433d6423SLionel Sambuc */
151433d6423SLionel Sambuc if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED)
152433d6423SLionel Sambuc {
153433d6423SLionel Sambuc ACPI_ERROR ((AE_INFO,
154433d6423SLionel Sambuc "(%s) destination not a NS Node [%s]",
155433d6423SLionel Sambuc AcpiPsGetOpcodeName (AmlOpcode),
156433d6423SLionel Sambuc AcpiUtGetDescriptorName (ResultDesc)));
157433d6423SLionel Sambuc
158433d6423SLionel Sambuc Status = AE_AML_OPERAND_TYPE;
159433d6423SLionel Sambuc goto Cleanup;
160433d6423SLionel Sambuc }
161433d6423SLionel Sambuc
162433d6423SLionel Sambuc Offset = (UINT32) OffsetDesc->Integer.Value;
163433d6423SLionel Sambuc
164433d6423SLionel Sambuc /*
165433d6423SLionel Sambuc * Setup the Bit offsets and counts, according to the opcode
166433d6423SLionel Sambuc */
167433d6423SLionel Sambuc switch (AmlOpcode)
168433d6423SLionel Sambuc {
169433d6423SLionel Sambuc case AML_CREATE_FIELD_OP:
170433d6423SLionel Sambuc
171433d6423SLionel Sambuc /* Offset is in bits, count is in bits */
172433d6423SLionel Sambuc
173433d6423SLionel Sambuc FieldFlags = AML_FIELD_ACCESS_BYTE;
174433d6423SLionel Sambuc BitOffset = Offset;
175433d6423SLionel Sambuc BitCount = (UINT32) LengthDesc->Integer.Value;
176433d6423SLionel Sambuc
177433d6423SLionel Sambuc /* Must have a valid (>0) bit count */
178433d6423SLionel Sambuc
179433d6423SLionel Sambuc if (BitCount == 0)
180433d6423SLionel Sambuc {
181433d6423SLionel Sambuc ACPI_ERROR ((AE_INFO,
182433d6423SLionel Sambuc "Attempt to CreateField of length zero"));
183433d6423SLionel Sambuc Status = AE_AML_OPERAND_VALUE;
184433d6423SLionel Sambuc goto Cleanup;
185433d6423SLionel Sambuc }
186433d6423SLionel Sambuc break;
187433d6423SLionel Sambuc
188433d6423SLionel Sambuc case AML_CREATE_BIT_FIELD_OP:
189433d6423SLionel Sambuc
190433d6423SLionel Sambuc /* Offset is in bits, Field is one bit */
191433d6423SLionel Sambuc
192433d6423SLionel Sambuc BitOffset = Offset;
193433d6423SLionel Sambuc BitCount = 1;
194433d6423SLionel Sambuc FieldFlags = AML_FIELD_ACCESS_BYTE;
195433d6423SLionel Sambuc break;
196433d6423SLionel Sambuc
197433d6423SLionel Sambuc case AML_CREATE_BYTE_FIELD_OP:
198433d6423SLionel Sambuc
199433d6423SLionel Sambuc /* Offset is in bytes, field is one byte */
200433d6423SLionel Sambuc
201433d6423SLionel Sambuc BitOffset = 8 * Offset;
202433d6423SLionel Sambuc BitCount = 8;
203433d6423SLionel Sambuc FieldFlags = AML_FIELD_ACCESS_BYTE;
204433d6423SLionel Sambuc break;
205433d6423SLionel Sambuc
206433d6423SLionel Sambuc case AML_CREATE_WORD_FIELD_OP:
207433d6423SLionel Sambuc
208433d6423SLionel Sambuc /* Offset is in bytes, field is one word */
209433d6423SLionel Sambuc
210433d6423SLionel Sambuc BitOffset = 8 * Offset;
211433d6423SLionel Sambuc BitCount = 16;
212433d6423SLionel Sambuc FieldFlags = AML_FIELD_ACCESS_WORD;
213433d6423SLionel Sambuc break;
214433d6423SLionel Sambuc
215433d6423SLionel Sambuc case AML_CREATE_DWORD_FIELD_OP:
216433d6423SLionel Sambuc
217433d6423SLionel Sambuc /* Offset is in bytes, field is one dword */
218433d6423SLionel Sambuc
219433d6423SLionel Sambuc BitOffset = 8 * Offset;
220433d6423SLionel Sambuc BitCount = 32;
221433d6423SLionel Sambuc FieldFlags = AML_FIELD_ACCESS_DWORD;
222433d6423SLionel Sambuc break;
223433d6423SLionel Sambuc
224433d6423SLionel Sambuc case AML_CREATE_QWORD_FIELD_OP:
225433d6423SLionel Sambuc
226433d6423SLionel Sambuc /* Offset is in bytes, field is one qword */
227433d6423SLionel Sambuc
228433d6423SLionel Sambuc BitOffset = 8 * Offset;
229433d6423SLionel Sambuc BitCount = 64;
230433d6423SLionel Sambuc FieldFlags = AML_FIELD_ACCESS_QWORD;
231433d6423SLionel Sambuc break;
232433d6423SLionel Sambuc
233433d6423SLionel Sambuc default:
234433d6423SLionel Sambuc
235433d6423SLionel Sambuc ACPI_ERROR ((AE_INFO,
236433d6423SLionel Sambuc "Unknown field creation opcode 0x%02X",
237433d6423SLionel Sambuc AmlOpcode));
238433d6423SLionel Sambuc Status = AE_AML_BAD_OPCODE;
239433d6423SLionel Sambuc goto Cleanup;
240433d6423SLionel Sambuc }
241433d6423SLionel Sambuc
242433d6423SLionel Sambuc /* Entire field must fit within the current length of the buffer */
243433d6423SLionel Sambuc
244433d6423SLionel Sambuc if ((BitOffset + BitCount) >
245433d6423SLionel Sambuc (8 * (UINT32) BufferDesc->Buffer.Length))
246433d6423SLionel Sambuc {
247433d6423SLionel Sambuc ACPI_ERROR ((AE_INFO,
248433d6423SLionel Sambuc "Field [%4.4s] at %u exceeds Buffer [%4.4s] size %u (bits)",
249433d6423SLionel Sambuc AcpiUtGetNodeName (ResultDesc),
250433d6423SLionel Sambuc BitOffset + BitCount,
251433d6423SLionel Sambuc AcpiUtGetNodeName (BufferDesc->Buffer.Node),
252433d6423SLionel Sambuc 8 * (UINT32) BufferDesc->Buffer.Length));
253433d6423SLionel Sambuc Status = AE_AML_BUFFER_LIMIT;
254433d6423SLionel Sambuc goto Cleanup;
255433d6423SLionel Sambuc }
256433d6423SLionel Sambuc
257433d6423SLionel Sambuc /*
258433d6423SLionel Sambuc * Initialize areas of the field object that are common to all fields
259433d6423SLionel Sambuc * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK),
260433d6423SLionel Sambuc * UPDATE_RULE = 0 (UPDATE_PRESERVE)
261433d6423SLionel Sambuc */
262433d6423SLionel Sambuc Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, 0,
263433d6423SLionel Sambuc BitOffset, BitCount);
264433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
265433d6423SLionel Sambuc {
266433d6423SLionel Sambuc goto Cleanup;
267433d6423SLionel Sambuc }
268433d6423SLionel Sambuc
269433d6423SLionel Sambuc ObjDesc->BufferField.BufferObj = BufferDesc;
270433d6423SLionel Sambuc
271433d6423SLionel Sambuc /* Reference count for BufferDesc inherits ObjDesc count */
272433d6423SLionel Sambuc
273433d6423SLionel Sambuc BufferDesc->Common.ReferenceCount = (UINT16)
274433d6423SLionel Sambuc (BufferDesc->Common.ReferenceCount + ObjDesc->Common.ReferenceCount);
275433d6423SLionel Sambuc
276433d6423SLionel Sambuc
277433d6423SLionel Sambuc Cleanup:
278433d6423SLionel Sambuc
279433d6423SLionel Sambuc /* Always delete the operands */
280433d6423SLionel Sambuc
281433d6423SLionel Sambuc AcpiUtRemoveReference (OffsetDesc);
282433d6423SLionel Sambuc AcpiUtRemoveReference (BufferDesc);
283433d6423SLionel Sambuc
284433d6423SLionel Sambuc if (AmlOpcode == AML_CREATE_FIELD_OP)
285433d6423SLionel Sambuc {
286433d6423SLionel Sambuc AcpiUtRemoveReference (LengthDesc);
287433d6423SLionel Sambuc }
288433d6423SLionel Sambuc
289433d6423SLionel Sambuc /* On failure, delete the result descriptor */
290433d6423SLionel Sambuc
291433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
292433d6423SLionel Sambuc {
293433d6423SLionel Sambuc AcpiUtRemoveReference (ResultDesc); /* Result descriptor */
294433d6423SLionel Sambuc }
295433d6423SLionel Sambuc else
296433d6423SLionel Sambuc {
297433d6423SLionel Sambuc /* Now the address and length are valid for this BufferField */
298433d6423SLionel Sambuc
299433d6423SLionel Sambuc ObjDesc->BufferField.Flags |= AOPOBJ_DATA_VALID;
300433d6423SLionel Sambuc }
301433d6423SLionel Sambuc
302433d6423SLionel Sambuc return_ACPI_STATUS (Status);
303433d6423SLionel Sambuc }
304433d6423SLionel Sambuc
305433d6423SLionel Sambuc
306433d6423SLionel Sambuc /*******************************************************************************
307433d6423SLionel Sambuc *
308433d6423SLionel Sambuc * FUNCTION: AcpiDsEvalBufferFieldOperands
309433d6423SLionel Sambuc *
310433d6423SLionel Sambuc * PARAMETERS: WalkState - Current walk
311433d6423SLionel Sambuc * Op - A valid BufferField Op object
312433d6423SLionel Sambuc *
313433d6423SLionel Sambuc * RETURN: Status
314433d6423SLionel Sambuc *
315433d6423SLionel Sambuc * DESCRIPTION: Get BufferField Buffer and Index
316433d6423SLionel Sambuc * Called from AcpiDsExecEndOp during BufferField parse tree walk
317433d6423SLionel Sambuc *
318433d6423SLionel Sambuc ******************************************************************************/
319433d6423SLionel Sambuc
320433d6423SLionel Sambuc ACPI_STATUS
AcpiDsEvalBufferFieldOperands(ACPI_WALK_STATE * WalkState,ACPI_PARSE_OBJECT * Op)321433d6423SLionel Sambuc AcpiDsEvalBufferFieldOperands (
322433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState,
323433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Op)
324433d6423SLionel Sambuc {
325433d6423SLionel Sambuc ACPI_STATUS Status;
326433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ObjDesc;
327433d6423SLionel Sambuc ACPI_NAMESPACE_NODE *Node;
328433d6423SLionel Sambuc ACPI_PARSE_OBJECT *NextOp;
329433d6423SLionel Sambuc
330433d6423SLionel Sambuc
331433d6423SLionel Sambuc ACPI_FUNCTION_TRACE_PTR (DsEvalBufferFieldOperands, Op);
332433d6423SLionel Sambuc
333433d6423SLionel Sambuc
334433d6423SLionel Sambuc /*
335433d6423SLionel Sambuc * This is where we evaluate the address and length fields of the
336433d6423SLionel Sambuc * CreateXxxField declaration
337433d6423SLionel Sambuc */
338433d6423SLionel Sambuc Node = Op->Common.Node;
339433d6423SLionel Sambuc
340433d6423SLionel Sambuc /* NextOp points to the op that holds the Buffer */
341433d6423SLionel Sambuc
342433d6423SLionel Sambuc NextOp = Op->Common.Value.Arg;
343433d6423SLionel Sambuc
344433d6423SLionel Sambuc /* Evaluate/create the address and length operands */
345433d6423SLionel Sambuc
346433d6423SLionel Sambuc Status = AcpiDsCreateOperands (WalkState, NextOp);
347433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
348433d6423SLionel Sambuc {
349433d6423SLionel Sambuc return_ACPI_STATUS (Status);
350433d6423SLionel Sambuc }
351433d6423SLionel Sambuc
352433d6423SLionel Sambuc ObjDesc = AcpiNsGetAttachedObject (Node);
353433d6423SLionel Sambuc if (!ObjDesc)
354433d6423SLionel Sambuc {
355433d6423SLionel Sambuc return_ACPI_STATUS (AE_NOT_EXIST);
356433d6423SLionel Sambuc }
357433d6423SLionel Sambuc
358433d6423SLionel Sambuc /* Resolve the operands */
359433d6423SLionel Sambuc
360433d6423SLionel Sambuc Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
361433d6423SLionel Sambuc ACPI_WALK_OPERANDS, WalkState);
362433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
363433d6423SLionel Sambuc {
364433d6423SLionel Sambuc ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X",
365433d6423SLionel Sambuc AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
366433d6423SLionel Sambuc
367433d6423SLionel Sambuc return_ACPI_STATUS (Status);
368433d6423SLionel Sambuc }
369433d6423SLionel Sambuc
370433d6423SLionel Sambuc /* Initialize the Buffer Field */
371433d6423SLionel Sambuc
372433d6423SLionel Sambuc if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
373433d6423SLionel Sambuc {
374433d6423SLionel Sambuc /* NOTE: Slightly different operands for this opcode */
375433d6423SLionel Sambuc
376433d6423SLionel Sambuc Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
377433d6423SLionel Sambuc WalkState->Operands[0], WalkState->Operands[1],
378433d6423SLionel Sambuc WalkState->Operands[2], WalkState->Operands[3]);
379433d6423SLionel Sambuc }
380433d6423SLionel Sambuc else
381433d6423SLionel Sambuc {
382433d6423SLionel Sambuc /* All other, CreateXxxField opcodes */
383433d6423SLionel Sambuc
384433d6423SLionel Sambuc Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
385433d6423SLionel Sambuc WalkState->Operands[0], WalkState->Operands[1],
386433d6423SLionel Sambuc NULL, WalkState->Operands[2]);
387433d6423SLionel Sambuc }
388433d6423SLionel Sambuc
389433d6423SLionel Sambuc return_ACPI_STATUS (Status);
390433d6423SLionel Sambuc }
391433d6423SLionel Sambuc
392433d6423SLionel Sambuc
393433d6423SLionel Sambuc /*******************************************************************************
394433d6423SLionel Sambuc *
395433d6423SLionel Sambuc * FUNCTION: AcpiDsEvalRegionOperands
396433d6423SLionel Sambuc *
397433d6423SLionel Sambuc * PARAMETERS: WalkState - Current walk
398433d6423SLionel Sambuc * Op - A valid region Op object
399433d6423SLionel Sambuc *
400433d6423SLionel Sambuc * RETURN: Status
401433d6423SLionel Sambuc *
402433d6423SLionel Sambuc * DESCRIPTION: Get region address and length
403433d6423SLionel Sambuc * Called from AcpiDsExecEndOp during OpRegion parse tree walk
404433d6423SLionel Sambuc *
405433d6423SLionel Sambuc ******************************************************************************/
406433d6423SLionel Sambuc
407433d6423SLionel Sambuc ACPI_STATUS
AcpiDsEvalRegionOperands(ACPI_WALK_STATE * WalkState,ACPI_PARSE_OBJECT * Op)408433d6423SLionel Sambuc AcpiDsEvalRegionOperands (
409433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState,
410433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Op)
411433d6423SLionel Sambuc {
412433d6423SLionel Sambuc ACPI_STATUS Status;
413433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ObjDesc;
414433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *OperandDesc;
415433d6423SLionel Sambuc ACPI_NAMESPACE_NODE *Node;
416433d6423SLionel Sambuc ACPI_PARSE_OBJECT *NextOp;
417433d6423SLionel Sambuc
418433d6423SLionel Sambuc
419433d6423SLionel Sambuc ACPI_FUNCTION_TRACE_PTR (DsEvalRegionOperands, Op);
420433d6423SLionel Sambuc
421433d6423SLionel Sambuc
422433d6423SLionel Sambuc /*
423433d6423SLionel Sambuc * This is where we evaluate the address and length fields of the
424433d6423SLionel Sambuc * OpRegion declaration
425433d6423SLionel Sambuc */
426433d6423SLionel Sambuc Node = Op->Common.Node;
427433d6423SLionel Sambuc
428433d6423SLionel Sambuc /* NextOp points to the op that holds the SpaceID */
429433d6423SLionel Sambuc
430433d6423SLionel Sambuc NextOp = Op->Common.Value.Arg;
431433d6423SLionel Sambuc
432433d6423SLionel Sambuc /* NextOp points to address op */
433433d6423SLionel Sambuc
434433d6423SLionel Sambuc NextOp = NextOp->Common.Next;
435433d6423SLionel Sambuc
436433d6423SLionel Sambuc /* Evaluate/create the address and length operands */
437433d6423SLionel Sambuc
438433d6423SLionel Sambuc Status = AcpiDsCreateOperands (WalkState, NextOp);
439433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
440433d6423SLionel Sambuc {
441433d6423SLionel Sambuc return_ACPI_STATUS (Status);
442433d6423SLionel Sambuc }
443433d6423SLionel Sambuc
444433d6423SLionel Sambuc /* Resolve the length and address operands to numbers */
445433d6423SLionel Sambuc
446433d6423SLionel Sambuc Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
447433d6423SLionel Sambuc ACPI_WALK_OPERANDS, WalkState);
448433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
449433d6423SLionel Sambuc {
450433d6423SLionel Sambuc return_ACPI_STATUS (Status);
451433d6423SLionel Sambuc }
452433d6423SLionel Sambuc
453433d6423SLionel Sambuc ObjDesc = AcpiNsGetAttachedObject (Node);
454433d6423SLionel Sambuc if (!ObjDesc)
455433d6423SLionel Sambuc {
456433d6423SLionel Sambuc return_ACPI_STATUS (AE_NOT_EXIST);
457433d6423SLionel Sambuc }
458433d6423SLionel Sambuc
459433d6423SLionel Sambuc /*
460433d6423SLionel Sambuc * Get the length operand and save it
461433d6423SLionel Sambuc * (at Top of stack)
462433d6423SLionel Sambuc */
463433d6423SLionel Sambuc OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
464433d6423SLionel Sambuc
465433d6423SLionel Sambuc ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value;
466433d6423SLionel Sambuc AcpiUtRemoveReference (OperandDesc);
467433d6423SLionel Sambuc
468433d6423SLionel Sambuc /*
469433d6423SLionel Sambuc * Get the address and save it
470433d6423SLionel Sambuc * (at top of stack - 1)
471433d6423SLionel Sambuc */
472433d6423SLionel Sambuc OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
473433d6423SLionel Sambuc
474433d6423SLionel Sambuc ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS)
475433d6423SLionel Sambuc OperandDesc->Integer.Value;
476433d6423SLionel Sambuc AcpiUtRemoveReference (OperandDesc);
477433d6423SLionel Sambuc
478433d6423SLionel Sambuc ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
479433d6423SLionel Sambuc ObjDesc,
480433d6423SLionel Sambuc ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
481433d6423SLionel Sambuc ObjDesc->Region.Length));
482433d6423SLionel Sambuc
483433d6423SLionel Sambuc /* Now the address and length are valid for this opregion */
484433d6423SLionel Sambuc
485433d6423SLionel Sambuc ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
486433d6423SLionel Sambuc
487433d6423SLionel Sambuc return_ACPI_STATUS (Status);
488433d6423SLionel Sambuc }
489433d6423SLionel Sambuc
490433d6423SLionel Sambuc
491433d6423SLionel Sambuc /*******************************************************************************
492433d6423SLionel Sambuc *
493433d6423SLionel Sambuc * FUNCTION: AcpiDsEvalTableRegionOperands
494433d6423SLionel Sambuc *
495433d6423SLionel Sambuc * PARAMETERS: WalkState - Current walk
496433d6423SLionel Sambuc * Op - A valid region Op object
497433d6423SLionel Sambuc *
498433d6423SLionel Sambuc * RETURN: Status
499433d6423SLionel Sambuc *
500*29492bb7SDavid van Moolenbroek * DESCRIPTION: Get region address and length.
501*29492bb7SDavid van Moolenbroek * Called from AcpiDsExecEndOp during DataTableRegion parse
502*29492bb7SDavid van Moolenbroek * tree walk.
503433d6423SLionel Sambuc *
504433d6423SLionel Sambuc ******************************************************************************/
505433d6423SLionel Sambuc
506433d6423SLionel Sambuc ACPI_STATUS
AcpiDsEvalTableRegionOperands(ACPI_WALK_STATE * WalkState,ACPI_PARSE_OBJECT * Op)507433d6423SLionel Sambuc AcpiDsEvalTableRegionOperands (
508433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState,
509433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Op)
510433d6423SLionel Sambuc {
511433d6423SLionel Sambuc ACPI_STATUS Status;
512433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ObjDesc;
513433d6423SLionel Sambuc ACPI_OPERAND_OBJECT **Operand;
514433d6423SLionel Sambuc ACPI_NAMESPACE_NODE *Node;
515433d6423SLionel Sambuc ACPI_PARSE_OBJECT *NextOp;
516433d6423SLionel Sambuc UINT32 TableIndex;
517433d6423SLionel Sambuc ACPI_TABLE_HEADER *Table;
518433d6423SLionel Sambuc
519433d6423SLionel Sambuc
520433d6423SLionel Sambuc ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
521433d6423SLionel Sambuc
522433d6423SLionel Sambuc
523433d6423SLionel Sambuc /*
524*29492bb7SDavid van Moolenbroek * This is where we evaluate the Signature string, OemId string,
525*29492bb7SDavid van Moolenbroek * and OemTableId string of the Data Table Region declaration
526433d6423SLionel Sambuc */
527433d6423SLionel Sambuc Node = Op->Common.Node;
528433d6423SLionel Sambuc
529*29492bb7SDavid van Moolenbroek /* NextOp points to Signature string op */
530433d6423SLionel Sambuc
531433d6423SLionel Sambuc NextOp = Op->Common.Value.Arg;
532433d6423SLionel Sambuc
533433d6423SLionel Sambuc /*
534*29492bb7SDavid van Moolenbroek * Evaluate/create the Signature string, OemId string,
535*29492bb7SDavid van Moolenbroek * and OemTableId string operands
536433d6423SLionel Sambuc */
537433d6423SLionel Sambuc Status = AcpiDsCreateOperands (WalkState, NextOp);
538433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
539433d6423SLionel Sambuc {
540433d6423SLionel Sambuc return_ACPI_STATUS (Status);
541433d6423SLionel Sambuc }
542433d6423SLionel Sambuc
543433d6423SLionel Sambuc /*
544*29492bb7SDavid van Moolenbroek * Resolve the Signature string, OemId string,
545*29492bb7SDavid van Moolenbroek * and OemTableId string operands
546433d6423SLionel Sambuc */
547433d6423SLionel Sambuc Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
548433d6423SLionel Sambuc ACPI_WALK_OPERANDS, WalkState);
549433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
550433d6423SLionel Sambuc {
551433d6423SLionel Sambuc return_ACPI_STATUS (Status);
552433d6423SLionel Sambuc }
553433d6423SLionel Sambuc
554433d6423SLionel Sambuc Operand = &WalkState->Operands[0];
555433d6423SLionel Sambuc
556433d6423SLionel Sambuc /* Find the ACPI table */
557433d6423SLionel Sambuc
558433d6423SLionel Sambuc Status = AcpiTbFindTable (Operand[0]->String.Pointer,
559433d6423SLionel Sambuc Operand[1]->String.Pointer, Operand[2]->String.Pointer,
560433d6423SLionel Sambuc &TableIndex);
561433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
562433d6423SLionel Sambuc {
563433d6423SLionel Sambuc return_ACPI_STATUS (Status);
564433d6423SLionel Sambuc }
565433d6423SLionel Sambuc
566433d6423SLionel Sambuc AcpiUtRemoveReference (Operand[0]);
567433d6423SLionel Sambuc AcpiUtRemoveReference (Operand[1]);
568433d6423SLionel Sambuc AcpiUtRemoveReference (Operand[2]);
569433d6423SLionel Sambuc
570433d6423SLionel Sambuc Status = AcpiGetTableByIndex (TableIndex, &Table);
571433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
572433d6423SLionel Sambuc {
573433d6423SLionel Sambuc return_ACPI_STATUS (Status);
574433d6423SLionel Sambuc }
575433d6423SLionel Sambuc
576433d6423SLionel Sambuc ObjDesc = AcpiNsGetAttachedObject (Node);
577433d6423SLionel Sambuc if (!ObjDesc)
578433d6423SLionel Sambuc {
579433d6423SLionel Sambuc return_ACPI_STATUS (AE_NOT_EXIST);
580433d6423SLionel Sambuc }
581433d6423SLionel Sambuc
582433d6423SLionel Sambuc ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table);
583433d6423SLionel Sambuc ObjDesc->Region.Length = Table->Length;
584433d6423SLionel Sambuc
585433d6423SLionel Sambuc ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
586433d6423SLionel Sambuc ObjDesc,
587433d6423SLionel Sambuc ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
588433d6423SLionel Sambuc ObjDesc->Region.Length));
589433d6423SLionel Sambuc
590433d6423SLionel Sambuc /* Now the address and length are valid for this opregion */
591433d6423SLionel Sambuc
592433d6423SLionel Sambuc ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
593433d6423SLionel Sambuc
594433d6423SLionel Sambuc return_ACPI_STATUS (Status);
595433d6423SLionel Sambuc }
596433d6423SLionel Sambuc
597433d6423SLionel Sambuc
598433d6423SLionel Sambuc /*******************************************************************************
599433d6423SLionel Sambuc *
600433d6423SLionel Sambuc * FUNCTION: AcpiDsEvalDataObjectOperands
601433d6423SLionel Sambuc *
602433d6423SLionel Sambuc * PARAMETERS: WalkState - Current walk
603433d6423SLionel Sambuc * Op - A valid DataObject Op object
604433d6423SLionel Sambuc * ObjDesc - DataObject
605433d6423SLionel Sambuc *
606433d6423SLionel Sambuc * RETURN: Status
607433d6423SLionel Sambuc *
608433d6423SLionel Sambuc * DESCRIPTION: Get the operands and complete the following data object types:
609433d6423SLionel Sambuc * Buffer, Package.
610433d6423SLionel Sambuc *
611433d6423SLionel Sambuc ******************************************************************************/
612433d6423SLionel Sambuc
613433d6423SLionel Sambuc ACPI_STATUS
AcpiDsEvalDataObjectOperands(ACPI_WALK_STATE * WalkState,ACPI_PARSE_OBJECT * Op,ACPI_OPERAND_OBJECT * ObjDesc)614433d6423SLionel Sambuc AcpiDsEvalDataObjectOperands (
615433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState,
616433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Op,
617433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ObjDesc)
618433d6423SLionel Sambuc {
619433d6423SLionel Sambuc ACPI_STATUS Status;
620433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ArgDesc;
621433d6423SLionel Sambuc UINT32 Length;
622433d6423SLionel Sambuc
623433d6423SLionel Sambuc
624433d6423SLionel Sambuc ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands);
625433d6423SLionel Sambuc
626433d6423SLionel Sambuc
627433d6423SLionel Sambuc /* The first operand (for all of these data objects) is the length */
628433d6423SLionel Sambuc
629433d6423SLionel Sambuc /*
630433d6423SLionel Sambuc * Set proper index into operand stack for AcpiDsObjStackPush
631433d6423SLionel Sambuc * invoked inside AcpiDsCreateOperand.
632433d6423SLionel Sambuc */
633433d6423SLionel Sambuc WalkState->OperandIndex = WalkState->NumOperands;
634433d6423SLionel Sambuc
635433d6423SLionel Sambuc Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
636433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
637433d6423SLionel Sambuc {
638433d6423SLionel Sambuc return_ACPI_STATUS (Status);
639433d6423SLionel Sambuc }
640433d6423SLionel Sambuc
641433d6423SLionel Sambuc Status = AcpiExResolveOperands (WalkState->Opcode,
642433d6423SLionel Sambuc &(WalkState->Operands [WalkState->NumOperands -1]),
643433d6423SLionel Sambuc WalkState);
644433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
645433d6423SLionel Sambuc {
646433d6423SLionel Sambuc return_ACPI_STATUS (Status);
647433d6423SLionel Sambuc }
648433d6423SLionel Sambuc
649433d6423SLionel Sambuc /* Extract length operand */
650433d6423SLionel Sambuc
651433d6423SLionel Sambuc ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
652433d6423SLionel Sambuc Length = (UINT32) ArgDesc->Integer.Value;
653433d6423SLionel Sambuc
654433d6423SLionel Sambuc /* Cleanup for length operand */
655433d6423SLionel Sambuc
656433d6423SLionel Sambuc Status = AcpiDsObjStackPop (1, WalkState);
657433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
658433d6423SLionel Sambuc {
659433d6423SLionel Sambuc return_ACPI_STATUS (Status);
660433d6423SLionel Sambuc }
661433d6423SLionel Sambuc
662433d6423SLionel Sambuc AcpiUtRemoveReference (ArgDesc);
663433d6423SLionel Sambuc
664433d6423SLionel Sambuc /*
665433d6423SLionel Sambuc * Create the actual data object
666433d6423SLionel Sambuc */
667433d6423SLionel Sambuc switch (Op->Common.AmlOpcode)
668433d6423SLionel Sambuc {
669433d6423SLionel Sambuc case AML_BUFFER_OP:
670433d6423SLionel Sambuc
671433d6423SLionel Sambuc Status = AcpiDsBuildInternalBufferObj (WalkState, Op, Length, &ObjDesc);
672433d6423SLionel Sambuc break;
673433d6423SLionel Sambuc
674433d6423SLionel Sambuc case AML_PACKAGE_OP:
675433d6423SLionel Sambuc case AML_VAR_PACKAGE_OP:
676433d6423SLionel Sambuc
677433d6423SLionel Sambuc Status = AcpiDsBuildInternalPackageObj (WalkState, Op, Length, &ObjDesc);
678433d6423SLionel Sambuc break;
679433d6423SLionel Sambuc
680433d6423SLionel Sambuc default:
681*29492bb7SDavid van Moolenbroek
682433d6423SLionel Sambuc return_ACPI_STATUS (AE_AML_BAD_OPCODE);
683433d6423SLionel Sambuc }
684433d6423SLionel Sambuc
685433d6423SLionel Sambuc if (ACPI_SUCCESS (Status))
686433d6423SLionel Sambuc {
687433d6423SLionel Sambuc /*
688433d6423SLionel Sambuc * Return the object in the WalkState, unless the parent is a package -
689433d6423SLionel Sambuc * in this case, the return object will be stored in the parse tree
690433d6423SLionel Sambuc * for the package.
691433d6423SLionel Sambuc */
692433d6423SLionel Sambuc if ((!Op->Common.Parent) ||
693433d6423SLionel Sambuc ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
694433d6423SLionel Sambuc (Op->Common.Parent->Common.AmlOpcode != AML_VAR_PACKAGE_OP) &&
695433d6423SLionel Sambuc (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
696433d6423SLionel Sambuc {
697433d6423SLionel Sambuc WalkState->ResultObj = ObjDesc;
698433d6423SLionel Sambuc }
699433d6423SLionel Sambuc }
700433d6423SLionel Sambuc
701433d6423SLionel Sambuc return_ACPI_STATUS (Status);
702433d6423SLionel Sambuc }
703433d6423SLionel Sambuc
704433d6423SLionel Sambuc
705433d6423SLionel Sambuc /*******************************************************************************
706433d6423SLionel Sambuc *
707433d6423SLionel Sambuc * FUNCTION: AcpiDsEvalBankFieldOperands
708433d6423SLionel Sambuc *
709433d6423SLionel Sambuc * PARAMETERS: WalkState - Current walk
710433d6423SLionel Sambuc * Op - A valid BankField Op object
711433d6423SLionel Sambuc *
712433d6423SLionel Sambuc * RETURN: Status
713433d6423SLionel Sambuc *
714433d6423SLionel Sambuc * DESCRIPTION: Get BankField BankValue
715433d6423SLionel Sambuc * Called from AcpiDsExecEndOp during BankField parse tree walk
716433d6423SLionel Sambuc *
717433d6423SLionel Sambuc ******************************************************************************/
718433d6423SLionel Sambuc
719433d6423SLionel Sambuc ACPI_STATUS
AcpiDsEvalBankFieldOperands(ACPI_WALK_STATE * WalkState,ACPI_PARSE_OBJECT * Op)720433d6423SLionel Sambuc AcpiDsEvalBankFieldOperands (
721433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState,
722433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Op)
723433d6423SLionel Sambuc {
724433d6423SLionel Sambuc ACPI_STATUS Status;
725433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ObjDesc;
726433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *OperandDesc;
727433d6423SLionel Sambuc ACPI_NAMESPACE_NODE *Node;
728433d6423SLionel Sambuc ACPI_PARSE_OBJECT *NextOp;
729433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Arg;
730433d6423SLionel Sambuc
731433d6423SLionel Sambuc
732433d6423SLionel Sambuc ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op);
733433d6423SLionel Sambuc
734433d6423SLionel Sambuc
735433d6423SLionel Sambuc /*
736433d6423SLionel Sambuc * This is where we evaluate the BankValue field of the
737433d6423SLionel Sambuc * BankField declaration
738433d6423SLionel Sambuc */
739433d6423SLionel Sambuc
740433d6423SLionel Sambuc /* NextOp points to the op that holds the Region */
741433d6423SLionel Sambuc
742433d6423SLionel Sambuc NextOp = Op->Common.Value.Arg;
743433d6423SLionel Sambuc
744433d6423SLionel Sambuc /* NextOp points to the op that holds the Bank Register */
745433d6423SLionel Sambuc
746433d6423SLionel Sambuc NextOp = NextOp->Common.Next;
747433d6423SLionel Sambuc
748433d6423SLionel Sambuc /* NextOp points to the op that holds the Bank Value */
749433d6423SLionel Sambuc
750433d6423SLionel Sambuc NextOp = NextOp->Common.Next;
751433d6423SLionel Sambuc
752433d6423SLionel Sambuc /*
753433d6423SLionel Sambuc * Set proper index into operand stack for AcpiDsObjStackPush
754433d6423SLionel Sambuc * invoked inside AcpiDsCreateOperand.
755433d6423SLionel Sambuc *
756433d6423SLionel Sambuc * We use WalkState->Operands[0] to store the evaluated BankValue
757433d6423SLionel Sambuc */
758433d6423SLionel Sambuc WalkState->OperandIndex = 0;
759433d6423SLionel Sambuc
760433d6423SLionel Sambuc Status = AcpiDsCreateOperand (WalkState, NextOp, 0);
761433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
762433d6423SLionel Sambuc {
763433d6423SLionel Sambuc return_ACPI_STATUS (Status);
764433d6423SLionel Sambuc }
765433d6423SLionel Sambuc
766433d6423SLionel Sambuc Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState);
767433d6423SLionel Sambuc if (ACPI_FAILURE (Status))
768433d6423SLionel Sambuc {
769433d6423SLionel Sambuc return_ACPI_STATUS (Status);
770433d6423SLionel Sambuc }
771433d6423SLionel Sambuc
772433d6423SLionel Sambuc ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS,
773433d6423SLionel Sambuc AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1);
774433d6423SLionel Sambuc /*
775433d6423SLionel Sambuc * Get the BankValue operand and save it
776433d6423SLionel Sambuc * (at Top of stack)
777433d6423SLionel Sambuc */
778433d6423SLionel Sambuc OperandDesc = WalkState->Operands[0];
779433d6423SLionel Sambuc
780433d6423SLionel Sambuc /* Arg points to the start Bank Field */
781433d6423SLionel Sambuc
782433d6423SLionel Sambuc Arg = AcpiPsGetArg (Op, 4);
783433d6423SLionel Sambuc while (Arg)
784433d6423SLionel Sambuc {
785433d6423SLionel Sambuc /* Ignore OFFSET and ACCESSAS terms here */
786433d6423SLionel Sambuc
787433d6423SLionel Sambuc if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
788433d6423SLionel Sambuc {
789433d6423SLionel Sambuc Node = Arg->Common.Node;
790433d6423SLionel Sambuc
791433d6423SLionel Sambuc ObjDesc = AcpiNsGetAttachedObject (Node);
792433d6423SLionel Sambuc if (!ObjDesc)
793433d6423SLionel Sambuc {
794433d6423SLionel Sambuc return_ACPI_STATUS (AE_NOT_EXIST);
795433d6423SLionel Sambuc }
796433d6423SLionel Sambuc
797433d6423SLionel Sambuc ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
798433d6423SLionel Sambuc }
799433d6423SLionel Sambuc
800433d6423SLionel Sambuc /* Move to next field in the list */
801433d6423SLionel Sambuc
802433d6423SLionel Sambuc Arg = Arg->Common.Next;
803433d6423SLionel Sambuc }
804433d6423SLionel Sambuc
805433d6423SLionel Sambuc AcpiUtRemoveReference (OperandDesc);
806433d6423SLionel Sambuc return_ACPI_STATUS (Status);
807433d6423SLionel Sambuc }
808