dsopcode.c revision 1.20 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.4 christos * Module Name: dsopcode - Dispatcher support for regions and fields
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.20 christos /******************************************************************************
8 1.20 christos *
9 1.20 christos * 1. Copyright Notice
10 1.20 christos *
11 1.20 christos * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
12 1.1 jruoho * All rights reserved.
13 1.1 jruoho *
14 1.20 christos * 2. License
15 1.20 christos *
16 1.20 christos * 2.1. This is your license from Intel Corp. under its intellectual property
17 1.20 christos * rights. You may have additional license terms from the party that provided
18 1.20 christos * you this software, covering your right to use that party's intellectual
19 1.20 christos * property rights.
20 1.20 christos *
21 1.20 christos * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 1.20 christos * copy of the source code appearing in this file ("Covered Code") an
23 1.20 christos * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 1.20 christos * base code distributed originally by Intel ("Original Intel Code") to copy,
25 1.20 christos * make derivatives, distribute, use and display any portion of the Covered
26 1.20 christos * Code in any form, with the right to sublicense such rights; and
27 1.20 christos *
28 1.20 christos * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 1.20 christos * license (with the right to sublicense), under only those claims of Intel
30 1.20 christos * patents that are infringed by the Original Intel Code, to make, use, sell,
31 1.20 christos * offer to sell, and import the Covered Code and derivative works thereof
32 1.20 christos * solely to the minimum extent necessary to exercise the above copyright
33 1.20 christos * license, and in no event shall the patent license extend to any additions
34 1.20 christos * to or modifications of the Original Intel Code. No other license or right
35 1.20 christos * is granted directly or by implication, estoppel or otherwise;
36 1.20 christos *
37 1.20 christos * The above copyright and patent license is granted only if the following
38 1.20 christos * conditions are met:
39 1.20 christos *
40 1.20 christos * 3. Conditions
41 1.20 christos *
42 1.20 christos * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 1.20 christos * Redistribution of source code of any substantial portion of the Covered
44 1.20 christos * Code or modification with rights to further distribute source must include
45 1.20 christos * the above Copyright Notice, the above License, this list of Conditions,
46 1.20 christos * and the following Disclaimer and Export Compliance provision. In addition,
47 1.20 christos * Licensee must cause all Covered Code to which Licensee contributes to
48 1.20 christos * contain a file documenting the changes Licensee made to create that Covered
49 1.20 christos * Code and the date of any change. Licensee must include in that file the
50 1.20 christos * documentation of any changes made by any predecessor Licensee. Licensee
51 1.20 christos * must include a prominent statement that the modification is derived,
52 1.20 christos * directly or indirectly, from Original Intel Code.
53 1.20 christos *
54 1.20 christos * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 1.20 christos * Redistribution of source code of any substantial portion of the Covered
56 1.20 christos * Code or modification without rights to further distribute source must
57 1.20 christos * include the following Disclaimer and Export Compliance provision in the
58 1.20 christos * documentation and/or other materials provided with distribution. In
59 1.20 christos * addition, Licensee may not authorize further sublicense of source of any
60 1.20 christos * portion of the Covered Code, and must include terms to the effect that the
61 1.20 christos * license from Licensee to its licensee is limited to the intellectual
62 1.20 christos * property embodied in the software Licensee provides to its licensee, and
63 1.20 christos * not to intellectual property embodied in modifications its licensee may
64 1.20 christos * make.
65 1.20 christos *
66 1.20 christos * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 1.20 christos * substantial portion of the Covered Code or modification must reproduce the
68 1.20 christos * above Copyright Notice, and the following Disclaimer and Export Compliance
69 1.20 christos * provision in the documentation and/or other materials provided with the
70 1.20 christos * distribution.
71 1.20 christos *
72 1.20 christos * 3.4. Intel retains all right, title, and interest in and to the Original
73 1.20 christos * Intel Code.
74 1.20 christos *
75 1.20 christos * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 1.20 christos * Intel shall be used in advertising or otherwise to promote the sale, use or
77 1.20 christos * other dealings in products derived from or relating to the Covered Code
78 1.20 christos * without prior written authorization from Intel.
79 1.20 christos *
80 1.20 christos * 4. Disclaimer and Export Compliance
81 1.20 christos *
82 1.20 christos * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 1.20 christos * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 1.20 christos * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 1.20 christos * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 1.20 christos * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 1.20 christos * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 1.20 christos * PARTICULAR PURPOSE.
89 1.20 christos *
90 1.20 christos * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 1.20 christos * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 1.20 christos * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 1.20 christos * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 1.20 christos * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 1.20 christos * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 1.20 christos * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 1.20 christos * LIMITED REMEDY.
98 1.20 christos *
99 1.20 christos * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 1.20 christos * software or system incorporating such software without first obtaining any
101 1.20 christos * required license or other approval from the U. S. Department of Commerce or
102 1.20 christos * any other agency or department of the United States Government. In the
103 1.20 christos * event Licensee exports any such software from the United States or
104 1.20 christos * re-exports any such software from a foreign destination, Licensee shall
105 1.20 christos * ensure that the distribution and export/re-export of the software is in
106 1.20 christos * compliance with all laws, regulations, orders, or other restrictions of the
107 1.20 christos * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 1.20 christos * any of its subsidiaries will export/re-export any technical data, process,
109 1.20 christos * software, or service, directly or indirectly, to any country for which the
110 1.20 christos * United States government or any agency thereof requires an export license,
111 1.20 christos * other governmental approval, or letter of assurance, without first obtaining
112 1.20 christos * such license, approval or letter.
113 1.20 christos *
114 1.20 christos *****************************************************************************
115 1.20 christos *
116 1.20 christos * Alternatively, you may choose to be licensed under the terms of the
117 1.20 christos * following license:
118 1.20 christos *
119 1.3 jruoho * Redistribution and use in source and binary forms, with or without
120 1.3 jruoho * modification, are permitted provided that the following conditions
121 1.3 jruoho * are met:
122 1.3 jruoho * 1. Redistributions of source code must retain the above copyright
123 1.3 jruoho * notice, this list of conditions, and the following disclaimer,
124 1.3 jruoho * without modification.
125 1.3 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 1.3 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
127 1.3 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
128 1.3 jruoho * including a substantially similar Disclaimer requirement for further
129 1.3 jruoho * binary redistribution.
130 1.3 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
131 1.3 jruoho * of any contributors may be used to endorse or promote products derived
132 1.3 jruoho * from this software without specific prior written permission.
133 1.3 jruoho *
134 1.3 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 1.3 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 1.16 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 1.3 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 1.20 christos * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 1.20 christos * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 1.20 christos * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 1.20 christos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 1.20 christos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 1.20 christos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 1.20 christos * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145 1.20 christos *
146 1.20 christos * Alternatively, you may choose to be licensed under the terms of the
147 1.20 christos * GNU General Public License ("GPL") version 2 as published by the Free
148 1.20 christos * Software Foundation.
149 1.20 christos *
150 1.20 christos *****************************************************************************/
151 1.1 jruoho
152 1.1 jruoho #include "acpi.h"
153 1.1 jruoho #include "accommon.h"
154 1.1 jruoho #include "acparser.h"
155 1.1 jruoho #include "amlcode.h"
156 1.1 jruoho #include "acdispat.h"
157 1.1 jruoho #include "acinterp.h"
158 1.1 jruoho #include "acnamesp.h"
159 1.1 jruoho #include "acevents.h"
160 1.1 jruoho #include "actables.h"
161 1.1 jruoho
162 1.1 jruoho #define _COMPONENT ACPI_DISPATCHER
163 1.1 jruoho ACPI_MODULE_NAME ("dsopcode")
164 1.1 jruoho
165 1.1 jruoho /* Local prototypes */
166 1.1 jruoho
167 1.1 jruoho static ACPI_STATUS
168 1.1 jruoho AcpiDsInitBufferField (
169 1.1 jruoho UINT16 AmlOpcode,
170 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc,
171 1.1 jruoho ACPI_OPERAND_OBJECT *BufferDesc,
172 1.1 jruoho ACPI_OPERAND_OBJECT *OffsetDesc,
173 1.1 jruoho ACPI_OPERAND_OBJECT *LengthDesc,
174 1.1 jruoho ACPI_OPERAND_OBJECT *ResultDesc);
175 1.1 jruoho
176 1.1 jruoho
177 1.1 jruoho /*******************************************************************************
178 1.1 jruoho *
179 1.1 jruoho * FUNCTION: AcpiDsInitializeRegion
180 1.1 jruoho *
181 1.1 jruoho * PARAMETERS: ObjHandle - Region namespace node
182 1.1 jruoho *
183 1.1 jruoho * RETURN: Status
184 1.1 jruoho *
185 1.1 jruoho * DESCRIPTION: Front end to EvInitializeRegion
186 1.1 jruoho *
187 1.1 jruoho ******************************************************************************/
188 1.1 jruoho
189 1.1 jruoho ACPI_STATUS
190 1.1 jruoho AcpiDsInitializeRegion (
191 1.1 jruoho ACPI_HANDLE ObjHandle)
192 1.1 jruoho {
193 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc;
194 1.1 jruoho ACPI_STATUS Status;
195 1.1 jruoho
196 1.1 jruoho
197 1.1 jruoho ObjDesc = AcpiNsGetAttachedObject (ObjHandle);
198 1.1 jruoho
199 1.1 jruoho /* Namespace is NOT locked */
200 1.1 jruoho
201 1.8 christos Status = AcpiEvInitializeRegion (ObjDesc);
202 1.1 jruoho return (Status);
203 1.1 jruoho }
204 1.1 jruoho
205 1.1 jruoho
206 1.1 jruoho /*******************************************************************************
207 1.1 jruoho *
208 1.1 jruoho * FUNCTION: AcpiDsInitBufferField
209 1.1 jruoho *
210 1.1 jruoho * PARAMETERS: AmlOpcode - CreateXxxField
211 1.1 jruoho * ObjDesc - BufferField object
212 1.1 jruoho * BufferDesc - Host Buffer
213 1.1 jruoho * OffsetDesc - Offset into buffer
214 1.1 jruoho * LengthDesc - Length of field (CREATE_FIELD_OP only)
215 1.1 jruoho * ResultDesc - Where to store the result
216 1.1 jruoho *
217 1.1 jruoho * RETURN: Status
218 1.1 jruoho *
219 1.1 jruoho * DESCRIPTION: Perform actual initialization of a buffer field
220 1.1 jruoho *
221 1.1 jruoho ******************************************************************************/
222 1.1 jruoho
223 1.1 jruoho static ACPI_STATUS
224 1.1 jruoho AcpiDsInitBufferField (
225 1.1 jruoho UINT16 AmlOpcode,
226 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc,
227 1.1 jruoho ACPI_OPERAND_OBJECT *BufferDesc,
228 1.1 jruoho ACPI_OPERAND_OBJECT *OffsetDesc,
229 1.1 jruoho ACPI_OPERAND_OBJECT *LengthDesc,
230 1.1 jruoho ACPI_OPERAND_OBJECT *ResultDesc)
231 1.1 jruoho {
232 1.1 jruoho UINT32 Offset;
233 1.1 jruoho UINT32 BitOffset;
234 1.1 jruoho UINT32 BitCount;
235 1.1 jruoho UINT8 FieldFlags;
236 1.1 jruoho ACPI_STATUS Status;
237 1.1 jruoho
238 1.1 jruoho
239 1.1 jruoho ACPI_FUNCTION_TRACE_PTR (DsInitBufferField, ObjDesc);
240 1.1 jruoho
241 1.1 jruoho
242 1.1 jruoho /* Host object must be a Buffer */
243 1.1 jruoho
244 1.1 jruoho if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER)
245 1.1 jruoho {
246 1.1 jruoho ACPI_ERROR ((AE_INFO,
247 1.1 jruoho "Target of Create Field is not a Buffer object - %s",
248 1.1 jruoho AcpiUtGetObjectTypeName (BufferDesc)));
249 1.1 jruoho
250 1.1 jruoho Status = AE_AML_OPERAND_TYPE;
251 1.1 jruoho goto Cleanup;
252 1.1 jruoho }
253 1.1 jruoho
254 1.1 jruoho /*
255 1.1 jruoho * The last parameter to all of these opcodes (ResultDesc) started
256 1.1 jruoho * out as a NameString, and should therefore now be a NS node
257 1.1 jruoho * after resolution in AcpiExResolveOperands().
258 1.1 jruoho */
259 1.1 jruoho if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED)
260 1.1 jruoho {
261 1.1 jruoho ACPI_ERROR ((AE_INFO,
262 1.1 jruoho "(%s) destination not a NS Node [%s]",
263 1.1 jruoho AcpiPsGetOpcodeName (AmlOpcode),
264 1.1 jruoho AcpiUtGetDescriptorName (ResultDesc)));
265 1.1 jruoho
266 1.1 jruoho Status = AE_AML_OPERAND_TYPE;
267 1.1 jruoho goto Cleanup;
268 1.1 jruoho }
269 1.1 jruoho
270 1.1 jruoho Offset = (UINT32) OffsetDesc->Integer.Value;
271 1.1 jruoho
272 1.1 jruoho /*
273 1.1 jruoho * Setup the Bit offsets and counts, according to the opcode
274 1.1 jruoho */
275 1.1 jruoho switch (AmlOpcode)
276 1.1 jruoho {
277 1.1 jruoho case AML_CREATE_FIELD_OP:
278 1.1 jruoho
279 1.1 jruoho /* Offset is in bits, count is in bits */
280 1.1 jruoho
281 1.1 jruoho FieldFlags = AML_FIELD_ACCESS_BYTE;
282 1.1 jruoho BitOffset = Offset;
283 1.1 jruoho BitCount = (UINT32) LengthDesc->Integer.Value;
284 1.1 jruoho
285 1.1 jruoho /* Must have a valid (>0) bit count */
286 1.1 jruoho
287 1.1 jruoho if (BitCount == 0)
288 1.1 jruoho {
289 1.13 christos ACPI_BIOS_ERROR ((AE_INFO,
290 1.1 jruoho "Attempt to CreateField of length zero"));
291 1.1 jruoho Status = AE_AML_OPERAND_VALUE;
292 1.1 jruoho goto Cleanup;
293 1.1 jruoho }
294 1.1 jruoho break;
295 1.1 jruoho
296 1.1 jruoho case AML_CREATE_BIT_FIELD_OP:
297 1.1 jruoho
298 1.1 jruoho /* Offset is in bits, Field is one bit */
299 1.1 jruoho
300 1.1 jruoho BitOffset = Offset;
301 1.1 jruoho BitCount = 1;
302 1.1 jruoho FieldFlags = AML_FIELD_ACCESS_BYTE;
303 1.1 jruoho break;
304 1.1 jruoho
305 1.1 jruoho case AML_CREATE_BYTE_FIELD_OP:
306 1.1 jruoho
307 1.1 jruoho /* Offset is in bytes, field is one byte */
308 1.1 jruoho
309 1.1 jruoho BitOffset = 8 * Offset;
310 1.1 jruoho BitCount = 8;
311 1.1 jruoho FieldFlags = AML_FIELD_ACCESS_BYTE;
312 1.1 jruoho break;
313 1.1 jruoho
314 1.1 jruoho case AML_CREATE_WORD_FIELD_OP:
315 1.1 jruoho
316 1.1 jruoho /* Offset is in bytes, field is one word */
317 1.1 jruoho
318 1.1 jruoho BitOffset = 8 * Offset;
319 1.1 jruoho BitCount = 16;
320 1.1 jruoho FieldFlags = AML_FIELD_ACCESS_WORD;
321 1.1 jruoho break;
322 1.1 jruoho
323 1.1 jruoho case AML_CREATE_DWORD_FIELD_OP:
324 1.1 jruoho
325 1.1 jruoho /* Offset is in bytes, field is one dword */
326 1.1 jruoho
327 1.1 jruoho BitOffset = 8 * Offset;
328 1.1 jruoho BitCount = 32;
329 1.1 jruoho FieldFlags = AML_FIELD_ACCESS_DWORD;
330 1.1 jruoho break;
331 1.1 jruoho
332 1.1 jruoho case AML_CREATE_QWORD_FIELD_OP:
333 1.1 jruoho
334 1.1 jruoho /* Offset is in bytes, field is one qword */
335 1.1 jruoho
336 1.1 jruoho BitOffset = 8 * Offset;
337 1.1 jruoho BitCount = 64;
338 1.1 jruoho FieldFlags = AML_FIELD_ACCESS_QWORD;
339 1.1 jruoho break;
340 1.1 jruoho
341 1.1 jruoho default:
342 1.1 jruoho
343 1.1 jruoho ACPI_ERROR ((AE_INFO,
344 1.1 jruoho "Unknown field creation opcode 0x%02X",
345 1.1 jruoho AmlOpcode));
346 1.1 jruoho Status = AE_AML_BAD_OPCODE;
347 1.1 jruoho goto Cleanup;
348 1.1 jruoho }
349 1.1 jruoho
350 1.1 jruoho /* Entire field must fit within the current length of the buffer */
351 1.1 jruoho
352 1.1 jruoho if ((BitOffset + BitCount) >
353 1.1 jruoho (8 * (UINT32) BufferDesc->Buffer.Length))
354 1.1 jruoho {
355 1.13 christos Status = AE_AML_BUFFER_LIMIT;
356 1.13 christos ACPI_BIOS_EXCEPTION ((AE_INFO, Status,
357 1.10 christos "Field [%4.4s] at bit offset/length %u/%u "
358 1.10 christos "exceeds size of target Buffer (%u bits)",
359 1.10 christos AcpiUtGetNodeName (ResultDesc), BitOffset, BitCount,
360 1.1 jruoho 8 * (UINT32) BufferDesc->Buffer.Length));
361 1.1 jruoho goto Cleanup;
362 1.1 jruoho }
363 1.1 jruoho
364 1.1 jruoho /*
365 1.1 jruoho * Initialize areas of the field object that are common to all fields
366 1.1 jruoho * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK),
367 1.1 jruoho * UPDATE_RULE = 0 (UPDATE_PRESERVE)
368 1.1 jruoho */
369 1.7 christos Status = AcpiExPrepCommonFieldObject (
370 1.7 christos ObjDesc, FieldFlags, 0, BitOffset, BitCount);
371 1.1 jruoho if (ACPI_FAILURE (Status))
372 1.1 jruoho {
373 1.1 jruoho goto Cleanup;
374 1.1 jruoho }
375 1.1 jruoho
376 1.1 jruoho ObjDesc->BufferField.BufferObj = BufferDesc;
377 1.14 christos ObjDesc->BufferField.IsCreateField = AmlOpcode == AML_CREATE_FIELD_OP;
378 1.1 jruoho
379 1.1 jruoho /* Reference count for BufferDesc inherits ObjDesc count */
380 1.1 jruoho
381 1.1 jruoho BufferDesc->Common.ReferenceCount = (UINT16)
382 1.1 jruoho (BufferDesc->Common.ReferenceCount + ObjDesc->Common.ReferenceCount);
383 1.1 jruoho
384 1.1 jruoho
385 1.1 jruoho Cleanup:
386 1.1 jruoho
387 1.1 jruoho /* Always delete the operands */
388 1.1 jruoho
389 1.1 jruoho AcpiUtRemoveReference (OffsetDesc);
390 1.1 jruoho AcpiUtRemoveReference (BufferDesc);
391 1.1 jruoho
392 1.1 jruoho if (AmlOpcode == AML_CREATE_FIELD_OP)
393 1.1 jruoho {
394 1.1 jruoho AcpiUtRemoveReference (LengthDesc);
395 1.1 jruoho }
396 1.1 jruoho
397 1.1 jruoho /* On failure, delete the result descriptor */
398 1.1 jruoho
399 1.1 jruoho if (ACPI_FAILURE (Status))
400 1.1 jruoho {
401 1.1 jruoho AcpiUtRemoveReference (ResultDesc); /* Result descriptor */
402 1.1 jruoho }
403 1.1 jruoho else
404 1.1 jruoho {
405 1.1 jruoho /* Now the address and length are valid for this BufferField */
406 1.1 jruoho
407 1.1 jruoho ObjDesc->BufferField.Flags |= AOPOBJ_DATA_VALID;
408 1.1 jruoho }
409 1.1 jruoho
410 1.1 jruoho return_ACPI_STATUS (Status);
411 1.1 jruoho }
412 1.1 jruoho
413 1.1 jruoho
414 1.1 jruoho /*******************************************************************************
415 1.1 jruoho *
416 1.1 jruoho * FUNCTION: AcpiDsEvalBufferFieldOperands
417 1.1 jruoho *
418 1.1 jruoho * PARAMETERS: WalkState - Current walk
419 1.1 jruoho * Op - A valid BufferField Op object
420 1.1 jruoho *
421 1.1 jruoho * RETURN: Status
422 1.1 jruoho *
423 1.1 jruoho * DESCRIPTION: Get BufferField Buffer and Index
424 1.1 jruoho * Called from AcpiDsExecEndOp during BufferField parse tree walk
425 1.1 jruoho *
426 1.1 jruoho ******************************************************************************/
427 1.1 jruoho
428 1.1 jruoho ACPI_STATUS
429 1.1 jruoho AcpiDsEvalBufferFieldOperands (
430 1.1 jruoho ACPI_WALK_STATE *WalkState,
431 1.1 jruoho ACPI_PARSE_OBJECT *Op)
432 1.1 jruoho {
433 1.1 jruoho ACPI_STATUS Status;
434 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc;
435 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
436 1.1 jruoho ACPI_PARSE_OBJECT *NextOp;
437 1.1 jruoho
438 1.1 jruoho
439 1.1 jruoho ACPI_FUNCTION_TRACE_PTR (DsEvalBufferFieldOperands, Op);
440 1.1 jruoho
441 1.1 jruoho
442 1.1 jruoho /*
443 1.1 jruoho * This is where we evaluate the address and length fields of the
444 1.1 jruoho * CreateXxxField declaration
445 1.1 jruoho */
446 1.1 jruoho Node = Op->Common.Node;
447 1.1 jruoho
448 1.1 jruoho /* NextOp points to the op that holds the Buffer */
449 1.1 jruoho
450 1.1 jruoho NextOp = Op->Common.Value.Arg;
451 1.1 jruoho
452 1.1 jruoho /* Evaluate/create the address and length operands */
453 1.1 jruoho
454 1.1 jruoho Status = AcpiDsCreateOperands (WalkState, NextOp);
455 1.1 jruoho if (ACPI_FAILURE (Status))
456 1.1 jruoho {
457 1.1 jruoho return_ACPI_STATUS (Status);
458 1.1 jruoho }
459 1.1 jruoho
460 1.1 jruoho ObjDesc = AcpiNsGetAttachedObject (Node);
461 1.1 jruoho if (!ObjDesc)
462 1.1 jruoho {
463 1.1 jruoho return_ACPI_STATUS (AE_NOT_EXIST);
464 1.1 jruoho }
465 1.1 jruoho
466 1.1 jruoho /* Resolve the operands */
467 1.1 jruoho
468 1.7 christos Status = AcpiExResolveOperands (
469 1.7 christos Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
470 1.1 jruoho if (ACPI_FAILURE (Status))
471 1.1 jruoho {
472 1.1 jruoho ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X",
473 1.1 jruoho AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
474 1.1 jruoho
475 1.1 jruoho return_ACPI_STATUS (Status);
476 1.1 jruoho }
477 1.1 jruoho
478 1.1 jruoho /* Initialize the Buffer Field */
479 1.1 jruoho
480 1.1 jruoho if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
481 1.1 jruoho {
482 1.1 jruoho /* NOTE: Slightly different operands for this opcode */
483 1.1 jruoho
484 1.1 jruoho Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
485 1.7 christos WalkState->Operands[0], WalkState->Operands[1],
486 1.7 christos WalkState->Operands[2], WalkState->Operands[3]);
487 1.1 jruoho }
488 1.1 jruoho else
489 1.1 jruoho {
490 1.1 jruoho /* All other, CreateXxxField opcodes */
491 1.1 jruoho
492 1.1 jruoho Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
493 1.7 christos WalkState->Operands[0], WalkState->Operands[1],
494 1.7 christos NULL, WalkState->Operands[2]);
495 1.1 jruoho }
496 1.1 jruoho
497 1.1 jruoho return_ACPI_STATUS (Status);
498 1.1 jruoho }
499 1.1 jruoho
500 1.1 jruoho
501 1.1 jruoho /*******************************************************************************
502 1.1 jruoho *
503 1.1 jruoho * FUNCTION: AcpiDsEvalRegionOperands
504 1.1 jruoho *
505 1.1 jruoho * PARAMETERS: WalkState - Current walk
506 1.1 jruoho * Op - A valid region Op object
507 1.1 jruoho *
508 1.1 jruoho * RETURN: Status
509 1.1 jruoho *
510 1.1 jruoho * DESCRIPTION: Get region address and length
511 1.1 jruoho * Called from AcpiDsExecEndOp during OpRegion parse tree walk
512 1.1 jruoho *
513 1.1 jruoho ******************************************************************************/
514 1.1 jruoho
515 1.1 jruoho ACPI_STATUS
516 1.1 jruoho AcpiDsEvalRegionOperands (
517 1.1 jruoho ACPI_WALK_STATE *WalkState,
518 1.1 jruoho ACPI_PARSE_OBJECT *Op)
519 1.1 jruoho {
520 1.1 jruoho ACPI_STATUS Status;
521 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc;
522 1.1 jruoho ACPI_OPERAND_OBJECT *OperandDesc;
523 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
524 1.1 jruoho ACPI_PARSE_OBJECT *NextOp;
525 1.13 christos ACPI_ADR_SPACE_TYPE SpaceId;
526 1.1 jruoho
527 1.1 jruoho
528 1.1 jruoho ACPI_FUNCTION_TRACE_PTR (DsEvalRegionOperands, Op);
529 1.1 jruoho
530 1.1 jruoho
531 1.1 jruoho /*
532 1.1 jruoho * This is where we evaluate the address and length fields of the
533 1.1 jruoho * OpRegion declaration
534 1.1 jruoho */
535 1.13 christos Node = Op->Common.Node;
536 1.1 jruoho
537 1.1 jruoho /* NextOp points to the op that holds the SpaceID */
538 1.1 jruoho
539 1.1 jruoho NextOp = Op->Common.Value.Arg;
540 1.13 christos SpaceId = (ACPI_ADR_SPACE_TYPE) NextOp->Common.Value.Integer;
541 1.1 jruoho
542 1.1 jruoho /* NextOp points to address op */
543 1.1 jruoho
544 1.1 jruoho NextOp = NextOp->Common.Next;
545 1.1 jruoho
546 1.1 jruoho /* Evaluate/create the address and length operands */
547 1.1 jruoho
548 1.1 jruoho Status = AcpiDsCreateOperands (WalkState, NextOp);
549 1.1 jruoho if (ACPI_FAILURE (Status))
550 1.1 jruoho {
551 1.1 jruoho return_ACPI_STATUS (Status);
552 1.1 jruoho }
553 1.1 jruoho
554 1.1 jruoho /* Resolve the length and address operands to numbers */
555 1.1 jruoho
556 1.7 christos Status = AcpiExResolveOperands (
557 1.7 christos Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
558 1.1 jruoho if (ACPI_FAILURE (Status))
559 1.1 jruoho {
560 1.1 jruoho return_ACPI_STATUS (Status);
561 1.1 jruoho }
562 1.1 jruoho
563 1.1 jruoho ObjDesc = AcpiNsGetAttachedObject (Node);
564 1.1 jruoho if (!ObjDesc)
565 1.1 jruoho {
566 1.1 jruoho return_ACPI_STATUS (AE_NOT_EXIST);
567 1.1 jruoho }
568 1.1 jruoho
569 1.1 jruoho /*
570 1.1 jruoho * Get the length operand and save it
571 1.1 jruoho * (at Top of stack)
572 1.1 jruoho */
573 1.1 jruoho OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
574 1.1 jruoho
575 1.1 jruoho ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value;
576 1.1 jruoho AcpiUtRemoveReference (OperandDesc);
577 1.1 jruoho
578 1.13 christos /* A zero-length operation region is unusable. Just warn */
579 1.13 christos
580 1.13 christos if (!ObjDesc->Region.Length && (SpaceId < ACPI_NUM_PREDEFINED_REGIONS))
581 1.13 christos {
582 1.13 christos ACPI_WARNING ((AE_INFO,
583 1.13 christos "Operation Region [%4.4s] has zero length (SpaceId %X)",
584 1.13 christos Node->Name.Ascii, SpaceId));
585 1.13 christos }
586 1.13 christos
587 1.1 jruoho /*
588 1.1 jruoho * Get the address and save it
589 1.1 jruoho * (at top of stack - 1)
590 1.1 jruoho */
591 1.1 jruoho OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
592 1.1 jruoho
593 1.1 jruoho ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS)
594 1.7 christos OperandDesc->Integer.Value;
595 1.1 jruoho AcpiUtRemoveReference (OperandDesc);
596 1.1 jruoho
597 1.1 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
598 1.7 christos ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
599 1.1 jruoho ObjDesc->Region.Length));
600 1.1 jruoho
601 1.12 christos Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId,
602 1.12 christos ObjDesc->Region.Address, ObjDesc->Region.Length, Node);
603 1.12 christos
604 1.1 jruoho /* Now the address and length are valid for this opregion */
605 1.1 jruoho
606 1.1 jruoho ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
607 1.1 jruoho return_ACPI_STATUS (Status);
608 1.1 jruoho }
609 1.1 jruoho
610 1.1 jruoho
611 1.1 jruoho /*******************************************************************************
612 1.1 jruoho *
613 1.1 jruoho * FUNCTION: AcpiDsEvalTableRegionOperands
614 1.1 jruoho *
615 1.1 jruoho * PARAMETERS: WalkState - Current walk
616 1.1 jruoho * Op - A valid region Op object
617 1.1 jruoho *
618 1.1 jruoho * RETURN: Status
619 1.1 jruoho *
620 1.3 jruoho * DESCRIPTION: Get region address and length.
621 1.3 jruoho * Called from AcpiDsExecEndOp during DataTableRegion parse
622 1.3 jruoho * tree walk.
623 1.1 jruoho *
624 1.1 jruoho ******************************************************************************/
625 1.1 jruoho
626 1.1 jruoho ACPI_STATUS
627 1.1 jruoho AcpiDsEvalTableRegionOperands (
628 1.1 jruoho ACPI_WALK_STATE *WalkState,
629 1.1 jruoho ACPI_PARSE_OBJECT *Op)
630 1.1 jruoho {
631 1.1 jruoho ACPI_STATUS Status;
632 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc;
633 1.1 jruoho ACPI_OPERAND_OBJECT **Operand;
634 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
635 1.1 jruoho ACPI_PARSE_OBJECT *NextOp;
636 1.7 christos ACPI_TABLE_HEADER *Table;
637 1.1 jruoho UINT32 TableIndex;
638 1.1 jruoho
639 1.1 jruoho
640 1.1 jruoho ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
641 1.1 jruoho
642 1.1 jruoho
643 1.1 jruoho /*
644 1.4 christos * This is where we evaluate the Signature string, OemId string,
645 1.4 christos * and OemTableId string of the Data Table Region declaration
646 1.1 jruoho */
647 1.1 jruoho Node = Op->Common.Node;
648 1.1 jruoho
649 1.4 christos /* NextOp points to Signature string op */
650 1.1 jruoho
651 1.1 jruoho NextOp = Op->Common.Value.Arg;
652 1.1 jruoho
653 1.1 jruoho /*
654 1.4 christos * Evaluate/create the Signature string, OemId string,
655 1.4 christos * and OemTableId string operands
656 1.1 jruoho */
657 1.1 jruoho Status = AcpiDsCreateOperands (WalkState, NextOp);
658 1.1 jruoho if (ACPI_FAILURE (Status))
659 1.1 jruoho {
660 1.1 jruoho return_ACPI_STATUS (Status);
661 1.1 jruoho }
662 1.1 jruoho
663 1.7 christos Operand = &WalkState->Operands[0];
664 1.7 christos
665 1.1 jruoho /*
666 1.4 christos * Resolve the Signature string, OemId string,
667 1.4 christos * and OemTableId string operands
668 1.1 jruoho */
669 1.7 christos Status = AcpiExResolveOperands (
670 1.7 christos Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
671 1.1 jruoho if (ACPI_FAILURE (Status))
672 1.1 jruoho {
673 1.7 christos goto Cleanup;
674 1.1 jruoho }
675 1.1 jruoho
676 1.1 jruoho /* Find the ACPI table */
677 1.1 jruoho
678 1.7 christos Status = AcpiTbFindTable (
679 1.7 christos Operand[0]->String.Pointer,
680 1.7 christos Operand[1]->String.Pointer,
681 1.7 christos Operand[2]->String.Pointer, &TableIndex);
682 1.1 jruoho if (ACPI_FAILURE (Status))
683 1.1 jruoho {
684 1.7 christos if (Status == AE_NOT_FOUND)
685 1.7 christos {
686 1.7 christos ACPI_ERROR ((AE_INFO,
687 1.7 christos "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT",
688 1.7 christos Operand[0]->String.Pointer,
689 1.7 christos Operand[1]->String.Pointer,
690 1.7 christos Operand[2]->String.Pointer));
691 1.7 christos }
692 1.7 christos goto Cleanup;
693 1.1 jruoho }
694 1.1 jruoho
695 1.1 jruoho Status = AcpiGetTableByIndex (TableIndex, &Table);
696 1.1 jruoho if (ACPI_FAILURE (Status))
697 1.1 jruoho {
698 1.7 christos goto Cleanup;
699 1.1 jruoho }
700 1.1 jruoho
701 1.1 jruoho ObjDesc = AcpiNsGetAttachedObject (Node);
702 1.1 jruoho if (!ObjDesc)
703 1.1 jruoho {
704 1.7 christos Status = AE_NOT_EXIST;
705 1.7 christos goto Cleanup;
706 1.1 jruoho }
707 1.1 jruoho
708 1.6 christos ObjDesc->Region.Address = ACPI_PTR_TO_PHYSADDR (Table);
709 1.1 jruoho ObjDesc->Region.Length = Table->Length;
710 1.17 christos ObjDesc->Region.Pointer = Table;
711 1.1 jruoho
712 1.1 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
713 1.7 christos ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
714 1.1 jruoho ObjDesc->Region.Length));
715 1.1 jruoho
716 1.1 jruoho /* Now the address and length are valid for this opregion */
717 1.1 jruoho
718 1.1 jruoho ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
719 1.1 jruoho
720 1.7 christos Cleanup:
721 1.7 christos AcpiUtRemoveReference (Operand[0]);
722 1.7 christos AcpiUtRemoveReference (Operand[1]);
723 1.7 christos AcpiUtRemoveReference (Operand[2]);
724 1.7 christos
725 1.1 jruoho return_ACPI_STATUS (Status);
726 1.1 jruoho }
727 1.1 jruoho
728 1.1 jruoho
729 1.1 jruoho /*******************************************************************************
730 1.1 jruoho *
731 1.1 jruoho * FUNCTION: AcpiDsEvalDataObjectOperands
732 1.1 jruoho *
733 1.1 jruoho * PARAMETERS: WalkState - Current walk
734 1.1 jruoho * Op - A valid DataObject Op object
735 1.1 jruoho * ObjDesc - DataObject
736 1.1 jruoho *
737 1.1 jruoho * RETURN: Status
738 1.1 jruoho *
739 1.1 jruoho * DESCRIPTION: Get the operands and complete the following data object types:
740 1.1 jruoho * Buffer, Package.
741 1.1 jruoho *
742 1.1 jruoho ******************************************************************************/
743 1.1 jruoho
744 1.1 jruoho ACPI_STATUS
745 1.1 jruoho AcpiDsEvalDataObjectOperands (
746 1.1 jruoho ACPI_WALK_STATE *WalkState,
747 1.1 jruoho ACPI_PARSE_OBJECT *Op,
748 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc)
749 1.1 jruoho {
750 1.1 jruoho ACPI_STATUS Status;
751 1.1 jruoho ACPI_OPERAND_OBJECT *ArgDesc;
752 1.1 jruoho UINT32 Length;
753 1.1 jruoho
754 1.1 jruoho
755 1.1 jruoho ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands);
756 1.1 jruoho
757 1.1 jruoho
758 1.1 jruoho /* The first operand (for all of these data objects) is the length */
759 1.1 jruoho
760 1.1 jruoho /*
761 1.1 jruoho * Set proper index into operand stack for AcpiDsObjStackPush
762 1.1 jruoho * invoked inside AcpiDsCreateOperand.
763 1.1 jruoho */
764 1.1 jruoho WalkState->OperandIndex = WalkState->NumOperands;
765 1.1 jruoho
766 1.10 christos /* Ignore if child is not valid */
767 1.10 christos
768 1.10 christos if (!Op->Common.Value.Arg)
769 1.10 christos {
770 1.10 christos ACPI_ERROR ((AE_INFO,
771 1.11 christos "Missing child while evaluating opcode %4.4X, Op %p",
772 1.11 christos Op->Common.AmlOpcode, Op));
773 1.10 christos return_ACPI_STATUS (AE_OK);
774 1.10 christos }
775 1.10 christos
776 1.1 jruoho Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
777 1.1 jruoho if (ACPI_FAILURE (Status))
778 1.1 jruoho {
779 1.1 jruoho return_ACPI_STATUS (Status);
780 1.1 jruoho }
781 1.1 jruoho
782 1.1 jruoho Status = AcpiExResolveOperands (WalkState->Opcode,
783 1.7 christos &(WalkState->Operands [WalkState->NumOperands -1]),
784 1.7 christos WalkState);
785 1.1 jruoho if (ACPI_FAILURE (Status))
786 1.1 jruoho {
787 1.1 jruoho return_ACPI_STATUS (Status);
788 1.1 jruoho }
789 1.1 jruoho
790 1.1 jruoho /* Extract length operand */
791 1.1 jruoho
792 1.1 jruoho ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
793 1.1 jruoho Length = (UINT32) ArgDesc->Integer.Value;
794 1.1 jruoho
795 1.1 jruoho /* Cleanup for length operand */
796 1.1 jruoho
797 1.1 jruoho Status = AcpiDsObjStackPop (1, WalkState);
798 1.1 jruoho if (ACPI_FAILURE (Status))
799 1.1 jruoho {
800 1.1 jruoho return_ACPI_STATUS (Status);
801 1.1 jruoho }
802 1.1 jruoho
803 1.1 jruoho AcpiUtRemoveReference (ArgDesc);
804 1.1 jruoho
805 1.1 jruoho /*
806 1.1 jruoho * Create the actual data object
807 1.1 jruoho */
808 1.1 jruoho switch (Op->Common.AmlOpcode)
809 1.1 jruoho {
810 1.1 jruoho case AML_BUFFER_OP:
811 1.1 jruoho
812 1.7 christos Status = AcpiDsBuildInternalBufferObj (
813 1.7 christos WalkState, Op, Length, &ObjDesc);
814 1.1 jruoho break;
815 1.1 jruoho
816 1.1 jruoho case AML_PACKAGE_OP:
817 1.9 christos case AML_VARIABLE_PACKAGE_OP:
818 1.1 jruoho
819 1.7 christos Status = AcpiDsBuildInternalPackageObj (
820 1.7 christos WalkState, Op, Length, &ObjDesc);
821 1.1 jruoho break;
822 1.1 jruoho
823 1.1 jruoho default:
824 1.4 christos
825 1.1 jruoho return_ACPI_STATUS (AE_AML_BAD_OPCODE);
826 1.1 jruoho }
827 1.1 jruoho
828 1.1 jruoho if (ACPI_SUCCESS (Status))
829 1.1 jruoho {
830 1.1 jruoho /*
831 1.1 jruoho * Return the object in the WalkState, unless the parent is a package -
832 1.1 jruoho * in this case, the return object will be stored in the parse tree
833 1.1 jruoho * for the package.
834 1.1 jruoho */
835 1.1 jruoho if ((!Op->Common.Parent) ||
836 1.1 jruoho ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
837 1.9 christos (Op->Common.Parent->Common.AmlOpcode != AML_VARIABLE_PACKAGE_OP) &&
838 1.1 jruoho (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
839 1.1 jruoho {
840 1.1 jruoho WalkState->ResultObj = ObjDesc;
841 1.1 jruoho }
842 1.1 jruoho }
843 1.1 jruoho
844 1.1 jruoho return_ACPI_STATUS (Status);
845 1.1 jruoho }
846 1.1 jruoho
847 1.1 jruoho
848 1.1 jruoho /*******************************************************************************
849 1.1 jruoho *
850 1.1 jruoho * FUNCTION: AcpiDsEvalBankFieldOperands
851 1.1 jruoho *
852 1.1 jruoho * PARAMETERS: WalkState - Current walk
853 1.1 jruoho * Op - A valid BankField Op object
854 1.1 jruoho *
855 1.1 jruoho * RETURN: Status
856 1.1 jruoho *
857 1.1 jruoho * DESCRIPTION: Get BankField BankValue
858 1.1 jruoho * Called from AcpiDsExecEndOp during BankField parse tree walk
859 1.1 jruoho *
860 1.1 jruoho ******************************************************************************/
861 1.1 jruoho
862 1.1 jruoho ACPI_STATUS
863 1.1 jruoho AcpiDsEvalBankFieldOperands (
864 1.1 jruoho ACPI_WALK_STATE *WalkState,
865 1.1 jruoho ACPI_PARSE_OBJECT *Op)
866 1.1 jruoho {
867 1.1 jruoho ACPI_STATUS Status;
868 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc;
869 1.1 jruoho ACPI_OPERAND_OBJECT *OperandDesc;
870 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
871 1.1 jruoho ACPI_PARSE_OBJECT *NextOp;
872 1.1 jruoho ACPI_PARSE_OBJECT *Arg;
873 1.1 jruoho
874 1.1 jruoho
875 1.1 jruoho ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op);
876 1.1 jruoho
877 1.1 jruoho
878 1.1 jruoho /*
879 1.1 jruoho * This is where we evaluate the BankValue field of the
880 1.1 jruoho * BankField declaration
881 1.1 jruoho */
882 1.1 jruoho
883 1.1 jruoho /* NextOp points to the op that holds the Region */
884 1.1 jruoho
885 1.1 jruoho NextOp = Op->Common.Value.Arg;
886 1.1 jruoho
887 1.1 jruoho /* NextOp points to the op that holds the Bank Register */
888 1.1 jruoho
889 1.1 jruoho NextOp = NextOp->Common.Next;
890 1.1 jruoho
891 1.1 jruoho /* NextOp points to the op that holds the Bank Value */
892 1.1 jruoho
893 1.1 jruoho NextOp = NextOp->Common.Next;
894 1.1 jruoho
895 1.1 jruoho /*
896 1.1 jruoho * Set proper index into operand stack for AcpiDsObjStackPush
897 1.1 jruoho * invoked inside AcpiDsCreateOperand.
898 1.1 jruoho *
899 1.1 jruoho * We use WalkState->Operands[0] to store the evaluated BankValue
900 1.1 jruoho */
901 1.1 jruoho WalkState->OperandIndex = 0;
902 1.1 jruoho
903 1.1 jruoho Status = AcpiDsCreateOperand (WalkState, NextOp, 0);
904 1.1 jruoho if (ACPI_FAILURE (Status))
905 1.1 jruoho {
906 1.1 jruoho return_ACPI_STATUS (Status);
907 1.1 jruoho }
908 1.1 jruoho
909 1.1 jruoho Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState);
910 1.1 jruoho if (ACPI_FAILURE (Status))
911 1.1 jruoho {
912 1.1 jruoho return_ACPI_STATUS (Status);
913 1.1 jruoho }
914 1.1 jruoho
915 1.1 jruoho ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS,
916 1.1 jruoho AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1);
917 1.1 jruoho /*
918 1.1 jruoho * Get the BankValue operand and save it
919 1.1 jruoho * (at Top of stack)
920 1.1 jruoho */
921 1.1 jruoho OperandDesc = WalkState->Operands[0];
922 1.1 jruoho
923 1.1 jruoho /* Arg points to the start Bank Field */
924 1.1 jruoho
925 1.1 jruoho Arg = AcpiPsGetArg (Op, 4);
926 1.1 jruoho while (Arg)
927 1.1 jruoho {
928 1.1 jruoho /* Ignore OFFSET and ACCESSAS terms here */
929 1.1 jruoho
930 1.1 jruoho if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
931 1.1 jruoho {
932 1.1 jruoho Node = Arg->Common.Node;
933 1.1 jruoho
934 1.1 jruoho ObjDesc = AcpiNsGetAttachedObject (Node);
935 1.1 jruoho if (!ObjDesc)
936 1.1 jruoho {
937 1.1 jruoho return_ACPI_STATUS (AE_NOT_EXIST);
938 1.1 jruoho }
939 1.1 jruoho
940 1.1 jruoho ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
941 1.1 jruoho }
942 1.1 jruoho
943 1.1 jruoho /* Move to next field in the list */
944 1.1 jruoho
945 1.1 jruoho Arg = Arg->Common.Next;
946 1.1 jruoho }
947 1.1 jruoho
948 1.1 jruoho AcpiUtRemoveReference (OperandDesc);
949 1.1 jruoho return_ACPI_STATUS (Status);
950 1.1 jruoho }
951