xref: /linux/drivers/acpi/acpica/dsopcode.c (revision 840c02ca2215af648c781ae680d93d8aecd083b7)
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /******************************************************************************
3  *
4  * Module Name: dsopcode - Dispatcher support for regions and fields
5  *
6  * Copyright (C) 2000 - 2019, Intel Corp.
7  *
8  *****************************************************************************/
9 
10 #include <acpi/acpi.h>
11 #include "accommon.h"
12 #include "acparser.h"
13 #include "amlcode.h"
14 #include "acdispat.h"
15 #include "acinterp.h"
16 #include "acnamesp.h"
17 #include "acevents.h"
18 #include "actables.h"
19 
20 #define _COMPONENT          ACPI_DISPATCHER
21 ACPI_MODULE_NAME("dsopcode")
22 
23 /* Local prototypes */
24 static acpi_status
25 acpi_ds_init_buffer_field(u16 aml_opcode,
26 			  union acpi_operand_object *obj_desc,
27 			  union acpi_operand_object *buffer_desc,
28 			  union acpi_operand_object *offset_desc,
29 			  union acpi_operand_object *length_desc,
30 			  union acpi_operand_object *result_desc);
31 
32 /*******************************************************************************
33  *
34  * FUNCTION:    acpi_ds_initialize_region
35  *
36  * PARAMETERS:  obj_handle      - Region namespace node
37  *
38  * RETURN:      Status
39  *
40  * DESCRIPTION: Front end to ev_initialize_region
41  *
42  ******************************************************************************/
43 
44 acpi_status acpi_ds_initialize_region(acpi_handle obj_handle)
45 {
46 	union acpi_operand_object *obj_desc;
47 	acpi_status status;
48 
49 	obj_desc = acpi_ns_get_attached_object(obj_handle);
50 
51 	/* Namespace is NOT locked */
52 
53 	status = acpi_ev_initialize_region(obj_desc);
54 	return (status);
55 }
56 
57 /*******************************************************************************
58  *
59  * FUNCTION:    acpi_ds_init_buffer_field
60  *
61  * PARAMETERS:  aml_opcode      - create_xxx_field
62  *              obj_desc        - buffer_field object
63  *              buffer_desc     - Host Buffer
64  *              offset_desc     - Offset into buffer
65  *              length_desc     - Length of field (CREATE_FIELD_OP only)
66  *              result_desc     - Where to store the result
67  *
68  * RETURN:      Status
69  *
70  * DESCRIPTION: Perform actual initialization of a buffer field
71  *
72  ******************************************************************************/
73 
74 static acpi_status
75 acpi_ds_init_buffer_field(u16 aml_opcode,
76 			  union acpi_operand_object *obj_desc,
77 			  union acpi_operand_object *buffer_desc,
78 			  union acpi_operand_object *offset_desc,
79 			  union acpi_operand_object *length_desc,
80 			  union acpi_operand_object *result_desc)
81 {
82 	u32 offset;
83 	u32 bit_offset;
84 	u32 bit_count;
85 	u8 field_flags;
86 	acpi_status status;
87 
88 	ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc);
89 
90 	/* Host object must be a Buffer */
91 
92 	if (buffer_desc->common.type != ACPI_TYPE_BUFFER) {
93 		ACPI_ERROR((AE_INFO,
94 			    "Target of Create Field is not a Buffer object - %s",
95 			    acpi_ut_get_object_type_name(buffer_desc)));
96 
97 		status = AE_AML_OPERAND_TYPE;
98 		goto cleanup;
99 	}
100 
101 	/*
102 	 * The last parameter to all of these opcodes (result_desc) started
103 	 * out as a name_string, and should therefore now be a NS node
104 	 * after resolution in acpi_ex_resolve_operands().
105 	 */
106 	if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) {
107 		ACPI_ERROR((AE_INFO,
108 			    "(%s) destination not a NS Node [%s]",
109 			    acpi_ps_get_opcode_name(aml_opcode),
110 			    acpi_ut_get_descriptor_name(result_desc)));
111 
112 		status = AE_AML_OPERAND_TYPE;
113 		goto cleanup;
114 	}
115 
116 	offset = (u32) offset_desc->integer.value;
117 
118 	/*
119 	 * Setup the Bit offsets and counts, according to the opcode
120 	 */
121 	switch (aml_opcode) {
122 	case AML_CREATE_FIELD_OP:
123 
124 		/* Offset is in bits, count is in bits */
125 
126 		field_flags = AML_FIELD_ACCESS_BYTE;
127 		bit_offset = offset;
128 		bit_count = (u32) length_desc->integer.value;
129 
130 		/* Must have a valid (>0) bit count */
131 
132 		if (bit_count == 0) {
133 			ACPI_BIOS_ERROR((AE_INFO,
134 					 "Attempt to CreateField of length zero"));
135 			status = AE_AML_OPERAND_VALUE;
136 			goto cleanup;
137 		}
138 		break;
139 
140 	case AML_CREATE_BIT_FIELD_OP:
141 
142 		/* Offset is in bits, Field is one bit */
143 
144 		bit_offset = offset;
145 		bit_count = 1;
146 		field_flags = AML_FIELD_ACCESS_BYTE;
147 		break;
148 
149 	case AML_CREATE_BYTE_FIELD_OP:
150 
151 		/* Offset is in bytes, field is one byte */
152 
153 		bit_offset = 8 * offset;
154 		bit_count = 8;
155 		field_flags = AML_FIELD_ACCESS_BYTE;
156 		break;
157 
158 	case AML_CREATE_WORD_FIELD_OP:
159 
160 		/* Offset is in bytes, field is one word */
161 
162 		bit_offset = 8 * offset;
163 		bit_count = 16;
164 		field_flags = AML_FIELD_ACCESS_WORD;
165 		break;
166 
167 	case AML_CREATE_DWORD_FIELD_OP:
168 
169 		/* Offset is in bytes, field is one dword */
170 
171 		bit_offset = 8 * offset;
172 		bit_count = 32;
173 		field_flags = AML_FIELD_ACCESS_DWORD;
174 		break;
175 
176 	case AML_CREATE_QWORD_FIELD_OP:
177 
178 		/* Offset is in bytes, field is one qword */
179 
180 		bit_offset = 8 * offset;
181 		bit_count = 64;
182 		field_flags = AML_FIELD_ACCESS_QWORD;
183 		break;
184 
185 	default:
186 
187 		ACPI_ERROR((AE_INFO,
188 			    "Unknown field creation opcode 0x%02X",
189 			    aml_opcode));
190 		status = AE_AML_BAD_OPCODE;
191 		goto cleanup;
192 	}
193 
194 	/* Entire field must fit within the current length of the buffer */
195 
196 	if ((bit_offset + bit_count) > (8 * (u32)buffer_desc->buffer.length)) {
197 		status = AE_AML_BUFFER_LIMIT;
198 		ACPI_BIOS_EXCEPTION((AE_INFO, status,
199 				     "Field [%4.4s] at bit offset/length %u/%u "
200 				     "exceeds size of target Buffer (%u bits)",
201 				     acpi_ut_get_node_name(result_desc),
202 				     bit_offset, bit_count,
203 				     8 * (u32)buffer_desc->buffer.length));
204 		goto cleanup;
205 	}
206 
207 	/*
208 	 * Initialize areas of the field object that are common to all fields
209 	 * For field_flags, use LOCK_RULE = 0 (NO_LOCK),
210 	 * UPDATE_RULE = 0 (UPDATE_PRESERVE)
211 	 */
212 	status =
213 	    acpi_ex_prep_common_field_object(obj_desc, field_flags, 0,
214 					     bit_offset, bit_count);
215 	if (ACPI_FAILURE(status)) {
216 		goto cleanup;
217 	}
218 
219 	obj_desc->buffer_field.buffer_obj = buffer_desc;
220 
221 	/* Reference count for buffer_desc inherits obj_desc count */
222 
223 	buffer_desc->common.reference_count = (u16)
224 	    (buffer_desc->common.reference_count +
225 	     obj_desc->common.reference_count);
226 
227 cleanup:
228 
229 	/* Always delete the operands */
230 
231 	acpi_ut_remove_reference(offset_desc);
232 	acpi_ut_remove_reference(buffer_desc);
233 
234 	if (aml_opcode == AML_CREATE_FIELD_OP) {
235 		acpi_ut_remove_reference(length_desc);
236 	}
237 
238 	/* On failure, delete the result descriptor */
239 
240 	if (ACPI_FAILURE(status)) {
241 		acpi_ut_remove_reference(result_desc);	/* Result descriptor */
242 	} else {
243 		/* Now the address and length are valid for this buffer_field */
244 
245 		obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
246 	}
247 
248 	return_ACPI_STATUS(status);
249 }
250 
251 /*******************************************************************************
252  *
253  * FUNCTION:    acpi_ds_eval_buffer_field_operands
254  *
255  * PARAMETERS:  walk_state      - Current walk
256  *              op              - A valid buffer_field Op object
257  *
258  * RETURN:      Status
259  *
260  * DESCRIPTION: Get buffer_field Buffer and Index
261  *              Called from acpi_ds_exec_end_op during buffer_field parse tree walk
262  *
263  ******************************************************************************/
264 
265 acpi_status
266 acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
267 				   union acpi_parse_object *op)
268 {
269 	acpi_status status;
270 	union acpi_operand_object *obj_desc;
271 	struct acpi_namespace_node *node;
272 	union acpi_parse_object *next_op;
273 
274 	ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op);
275 
276 	/*
277 	 * This is where we evaluate the address and length fields of the
278 	 * create_xxx_field declaration
279 	 */
280 	node = op->common.node;
281 
282 	/* next_op points to the op that holds the Buffer */
283 
284 	next_op = op->common.value.arg;
285 
286 	/* Evaluate/create the address and length operands */
287 
288 	status = acpi_ds_create_operands(walk_state, next_op);
289 	if (ACPI_FAILURE(status)) {
290 		return_ACPI_STATUS(status);
291 	}
292 
293 	obj_desc = acpi_ns_get_attached_object(node);
294 	if (!obj_desc) {
295 		return_ACPI_STATUS(AE_NOT_EXIST);
296 	}
297 
298 	/* Resolve the operands */
299 
300 	status =
301 	    acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS,
302 				     walk_state);
303 	if (ACPI_FAILURE(status)) {
304 		ACPI_ERROR((AE_INFO, "(%s) bad operand(s), status 0x%X",
305 			    acpi_ps_get_opcode_name(op->common.aml_opcode),
306 			    status));
307 
308 		return_ACPI_STATUS(status);
309 	}
310 
311 	/* Initialize the Buffer Field */
312 
313 	if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
314 
315 		/* NOTE: Slightly different operands for this opcode */
316 
317 		status =
318 		    acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc,
319 					      walk_state->operands[0],
320 					      walk_state->operands[1],
321 					      walk_state->operands[2],
322 					      walk_state->operands[3]);
323 	} else {
324 		/* All other, create_xxx_field opcodes */
325 
326 		status =
327 		    acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc,
328 					      walk_state->operands[0],
329 					      walk_state->operands[1], NULL,
330 					      walk_state->operands[2]);
331 	}
332 
333 	return_ACPI_STATUS(status);
334 }
335 
336 /*******************************************************************************
337  *
338  * FUNCTION:    acpi_ds_eval_region_operands
339  *
340  * PARAMETERS:  walk_state      - Current walk
341  *              op              - A valid region Op object
342  *
343  * RETURN:      Status
344  *
345  * DESCRIPTION: Get region address and length
346  *              Called from acpi_ds_exec_end_op during op_region parse tree walk
347  *
348  ******************************************************************************/
349 
350 acpi_status
351 acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
352 			     union acpi_parse_object *op)
353 {
354 	acpi_status status;
355 	union acpi_operand_object *obj_desc;
356 	union acpi_operand_object *operand_desc;
357 	struct acpi_namespace_node *node;
358 	union acpi_parse_object *next_op;
359 
360 	ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op);
361 
362 	/*
363 	 * This is where we evaluate the address and length fields of the
364 	 * op_region declaration
365 	 */
366 	node = op->common.node;
367 
368 	/* next_op points to the op that holds the space_ID */
369 
370 	next_op = op->common.value.arg;
371 
372 	/* next_op points to address op */
373 
374 	next_op = next_op->common.next;
375 
376 	/* Evaluate/create the address and length operands */
377 
378 	status = acpi_ds_create_operands(walk_state, next_op);
379 	if (ACPI_FAILURE(status)) {
380 		return_ACPI_STATUS(status);
381 	}
382 
383 	/* Resolve the length and address operands to numbers */
384 
385 	status =
386 	    acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS,
387 				     walk_state);
388 	if (ACPI_FAILURE(status)) {
389 		return_ACPI_STATUS(status);
390 	}
391 
392 	obj_desc = acpi_ns_get_attached_object(node);
393 	if (!obj_desc) {
394 		return_ACPI_STATUS(AE_NOT_EXIST);
395 	}
396 
397 	/*
398 	 * Get the length operand and save it
399 	 * (at Top of stack)
400 	 */
401 	operand_desc = walk_state->operands[walk_state->num_operands - 1];
402 
403 	obj_desc->region.length = (u32) operand_desc->integer.value;
404 	acpi_ut_remove_reference(operand_desc);
405 
406 	/*
407 	 * Get the address and save it
408 	 * (at top of stack - 1)
409 	 */
410 	operand_desc = walk_state->operands[walk_state->num_operands - 2];
411 
412 	obj_desc->region.address = (acpi_physical_address)
413 	    operand_desc->integer.value;
414 	acpi_ut_remove_reference(operand_desc);
415 
416 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
417 			  obj_desc,
418 			  ACPI_FORMAT_UINT64(obj_desc->region.address),
419 			  obj_desc->region.length));
420 
421 	status = acpi_ut_add_address_range(obj_desc->region.space_id,
422 					   obj_desc->region.address,
423 					   obj_desc->region.length, node);
424 
425 	/* Now the address and length are valid for this opregion */
426 
427 	obj_desc->region.flags |= AOPOBJ_DATA_VALID;
428 	return_ACPI_STATUS(status);
429 }
430 
431 /*******************************************************************************
432  *
433  * FUNCTION:    acpi_ds_eval_table_region_operands
434  *
435  * PARAMETERS:  walk_state      - Current walk
436  *              op              - A valid region Op object
437  *
438  * RETURN:      Status
439  *
440  * DESCRIPTION: Get region address and length.
441  *              Called from acpi_ds_exec_end_op during data_table_region parse
442  *              tree walk.
443  *
444  ******************************************************************************/
445 
446 acpi_status
447 acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
448 				   union acpi_parse_object *op)
449 {
450 	acpi_status status;
451 	union acpi_operand_object *obj_desc;
452 	union acpi_operand_object **operand;
453 	struct acpi_namespace_node *node;
454 	union acpi_parse_object *next_op;
455 	struct acpi_table_header *table;
456 	u32 table_index;
457 
458 	ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op);
459 
460 	/*
461 	 * This is where we evaluate the Signature string, oem_id string,
462 	 * and oem_table_id string of the Data Table Region declaration
463 	 */
464 	node = op->common.node;
465 
466 	/* next_op points to Signature string op */
467 
468 	next_op = op->common.value.arg;
469 
470 	/*
471 	 * Evaluate/create the Signature string, oem_id string,
472 	 * and oem_table_id string operands
473 	 */
474 	status = acpi_ds_create_operands(walk_state, next_op);
475 	if (ACPI_FAILURE(status)) {
476 		return_ACPI_STATUS(status);
477 	}
478 
479 	operand = &walk_state->operands[0];
480 
481 	/*
482 	 * Resolve the Signature string, oem_id string,
483 	 * and oem_table_id string operands
484 	 */
485 	status =
486 	    acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS,
487 				     walk_state);
488 	if (ACPI_FAILURE(status)) {
489 		goto cleanup;
490 	}
491 
492 	/* Find the ACPI table */
493 
494 	status = acpi_tb_find_table(operand[0]->string.pointer,
495 				    operand[1]->string.pointer,
496 				    operand[2]->string.pointer, &table_index);
497 	if (ACPI_FAILURE(status)) {
498 		if (status == AE_NOT_FOUND) {
499 			ACPI_ERROR((AE_INFO,
500 				    "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT",
501 				    operand[0]->string.pointer,
502 				    operand[1]->string.pointer,
503 				    operand[2]->string.pointer));
504 		}
505 		goto cleanup;
506 	}
507 
508 	status = acpi_get_table_by_index(table_index, &table);
509 	if (ACPI_FAILURE(status)) {
510 		goto cleanup;
511 	}
512 
513 	obj_desc = acpi_ns_get_attached_object(node);
514 	if (!obj_desc) {
515 		status = AE_NOT_EXIST;
516 		goto cleanup;
517 	}
518 
519 	obj_desc->region.address = ACPI_PTR_TO_PHYSADDR(table);
520 	obj_desc->region.length = table->length;
521 
522 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
523 			  obj_desc,
524 			  ACPI_FORMAT_UINT64(obj_desc->region.address),
525 			  obj_desc->region.length));
526 
527 	/* Now the address and length are valid for this opregion */
528 
529 	obj_desc->region.flags |= AOPOBJ_DATA_VALID;
530 
531 cleanup:
532 	acpi_ut_remove_reference(operand[0]);
533 	acpi_ut_remove_reference(operand[1]);
534 	acpi_ut_remove_reference(operand[2]);
535 
536 	return_ACPI_STATUS(status);
537 }
538 
539 /*******************************************************************************
540  *
541  * FUNCTION:    acpi_ds_eval_data_object_operands
542  *
543  * PARAMETERS:  walk_state      - Current walk
544  *              op              - A valid data_object Op object
545  *              obj_desc        - data_object
546  *
547  * RETURN:      Status
548  *
549  * DESCRIPTION: Get the operands and complete the following data object types:
550  *              Buffer, Package.
551  *
552  ******************************************************************************/
553 
554 acpi_status
555 acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
556 				  union acpi_parse_object *op,
557 				  union acpi_operand_object *obj_desc)
558 {
559 	acpi_status status;
560 	union acpi_operand_object *arg_desc;
561 	u32 length;
562 
563 	ACPI_FUNCTION_TRACE(ds_eval_data_object_operands);
564 
565 	/* The first operand (for all of these data objects) is the length */
566 
567 	/*
568 	 * Set proper index into operand stack for acpi_ds_obj_stack_push
569 	 * invoked inside acpi_ds_create_operand.
570 	 */
571 	walk_state->operand_index = walk_state->num_operands;
572 
573 	/* Ignore if child is not valid */
574 
575 	if (!op->common.value.arg) {
576 		ACPI_ERROR((AE_INFO,
577 			    "Missing child while evaluating opcode %4.4X, Op %p",
578 			    op->common.aml_opcode, op));
579 		return_ACPI_STATUS(AE_OK);
580 	}
581 
582 	status = acpi_ds_create_operand(walk_state, op->common.value.arg, 1);
583 	if (ACPI_FAILURE(status)) {
584 		return_ACPI_STATUS(status);
585 	}
586 
587 	status = acpi_ex_resolve_operands(walk_state->opcode,
588 					  &(walk_state->
589 					    operands[walk_state->num_operands -
590 						     1]), walk_state);
591 	if (ACPI_FAILURE(status)) {
592 		return_ACPI_STATUS(status);
593 	}
594 
595 	/* Extract length operand */
596 
597 	arg_desc = walk_state->operands[walk_state->num_operands - 1];
598 	length = (u32) arg_desc->integer.value;
599 
600 	/* Cleanup for length operand */
601 
602 	status = acpi_ds_obj_stack_pop(1, walk_state);
603 	if (ACPI_FAILURE(status)) {
604 		return_ACPI_STATUS(status);
605 	}
606 
607 	acpi_ut_remove_reference(arg_desc);
608 
609 	/*
610 	 * Create the actual data object
611 	 */
612 	switch (op->common.aml_opcode) {
613 	case AML_BUFFER_OP:
614 
615 		status =
616 		    acpi_ds_build_internal_buffer_obj(walk_state, op, length,
617 						      &obj_desc);
618 		break;
619 
620 	case AML_PACKAGE_OP:
621 	case AML_VARIABLE_PACKAGE_OP:
622 
623 		status =
624 		    acpi_ds_build_internal_package_obj(walk_state, op, length,
625 						       &obj_desc);
626 		break;
627 
628 	default:
629 
630 		return_ACPI_STATUS(AE_AML_BAD_OPCODE);
631 	}
632 
633 	if (ACPI_SUCCESS(status)) {
634 		/*
635 		 * Return the object in the walk_state, unless the parent is a package -
636 		 * in this case, the return object will be stored in the parse tree
637 		 * for the package.
638 		 */
639 		if ((!op->common.parent) ||
640 		    ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
641 		     (op->common.parent->common.aml_opcode !=
642 		      AML_VARIABLE_PACKAGE_OP)
643 		     && (op->common.parent->common.aml_opcode !=
644 			 AML_NAME_OP))) {
645 			walk_state->result_obj = obj_desc;
646 		}
647 	}
648 
649 	return_ACPI_STATUS(status);
650 }
651 
652 /*******************************************************************************
653  *
654  * FUNCTION:    acpi_ds_eval_bank_field_operands
655  *
656  * PARAMETERS:  walk_state      - Current walk
657  *              op              - A valid bank_field Op object
658  *
659  * RETURN:      Status
660  *
661  * DESCRIPTION: Get bank_field bank_value
662  *              Called from acpi_ds_exec_end_op during bank_field parse tree walk
663  *
664  ******************************************************************************/
665 
666 acpi_status
667 acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state,
668 				 union acpi_parse_object *op)
669 {
670 	acpi_status status;
671 	union acpi_operand_object *obj_desc;
672 	union acpi_operand_object *operand_desc;
673 	struct acpi_namespace_node *node;
674 	union acpi_parse_object *next_op;
675 	union acpi_parse_object *arg;
676 
677 	ACPI_FUNCTION_TRACE_PTR(ds_eval_bank_field_operands, op);
678 
679 	/*
680 	 * This is where we evaluate the bank_value field of the
681 	 * bank_field declaration
682 	 */
683 
684 	/* next_op points to the op that holds the Region */
685 
686 	next_op = op->common.value.arg;
687 
688 	/* next_op points to the op that holds the Bank Register */
689 
690 	next_op = next_op->common.next;
691 
692 	/* next_op points to the op that holds the Bank Value */
693 
694 	next_op = next_op->common.next;
695 
696 	/*
697 	 * Set proper index into operand stack for acpi_ds_obj_stack_push
698 	 * invoked inside acpi_ds_create_operand.
699 	 *
700 	 * We use walk_state->Operands[0] to store the evaluated bank_value
701 	 */
702 	walk_state->operand_index = 0;
703 
704 	status = acpi_ds_create_operand(walk_state, next_op, 0);
705 	if (ACPI_FAILURE(status)) {
706 		return_ACPI_STATUS(status);
707 	}
708 
709 	status = acpi_ex_resolve_to_value(&walk_state->operands[0], walk_state);
710 	if (ACPI_FAILURE(status)) {
711 		return_ACPI_STATUS(status);
712 	}
713 
714 	ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS,
715 			   acpi_ps_get_opcode_name(op->common.aml_opcode), 1);
716 	/*
717 	 * Get the bank_value operand and save it
718 	 * (at Top of stack)
719 	 */
720 	operand_desc = walk_state->operands[0];
721 
722 	/* Arg points to the start Bank Field */
723 
724 	arg = acpi_ps_get_arg(op, 4);
725 	while (arg) {
726 
727 		/* Ignore OFFSET and ACCESSAS terms here */
728 
729 		if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
730 			node = arg->common.node;
731 
732 			obj_desc = acpi_ns_get_attached_object(node);
733 			if (!obj_desc) {
734 				return_ACPI_STATUS(AE_NOT_EXIST);
735 			}
736 
737 			obj_desc->bank_field.value =
738 			    (u32) operand_desc->integer.value;
739 		}
740 
741 		/* Move to next field in the list */
742 
743 		arg = arg->common.next;
744 	}
745 
746 	acpi_ut_remove_reference(operand_desc);
747 	return_ACPI_STATUS(status);
748 }
749