1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46#include <acpi/acpi.h>
47#include <acpi/acparser.h>
48#include <acpi/amlcode.h>
49#include <acpi/acdispat.h>
50#include <acpi/acinterp.h>
51#include <acpi/acnamesp.h>
52#include <acpi/acevents.h>
53
54#define _COMPONENT ACPI_DISPATCHER
55 ACPI_MODULE_NAME ("dsopcode")
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72acpi_status
73acpi_ds_execute_arguments (
74 struct acpi_namespace_node *node,
75 struct acpi_namespace_node *scope_node,
76 u32 aml_length,
77 u8 *aml_start)
78{
79 acpi_status status;
80 union acpi_parse_object *op;
81 struct acpi_walk_state *walk_state;
82
83
84 ACPI_FUNCTION_TRACE ("ds_execute_arguments");
85
86
87
88
89
90 op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP);
91 if (!op) {
92 return_ACPI_STATUS (AE_NO_MEMORY);
93 }
94
95
96
97 op->common.node = scope_node;
98
99
100
101 walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
102 if (!walk_state) {
103 return_ACPI_STATUS (AE_NO_MEMORY);
104 }
105
106 status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
107 aml_length, NULL, NULL, 1);
108 if (ACPI_FAILURE (status)) {
109 acpi_ds_delete_walk_state (walk_state);
110 return_ACPI_STATUS (status);
111 }
112
113
114
115 walk_state->parse_flags = ACPI_PARSE_DEFERRED_OP;
116 walk_state->deferred_node = node;
117
118
119
120 status = acpi_ps_parse_aml (walk_state);
121 if (ACPI_FAILURE (status)) {
122 acpi_ps_delete_parse_tree (op);
123 return_ACPI_STATUS (status);
124 }
125
126
127
128 op->common.node = node;
129 acpi_ps_delete_parse_tree (op);
130
131
132
133 op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP);
134 if (!op) {
135 return_ACPI_STATUS (AE_NO_MEMORY);
136 }
137
138 op->common.node = scope_node;
139
140
141
142 walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
143 if (!walk_state) {
144 return_ACPI_STATUS (AE_NO_MEMORY);
145 }
146
147
148
149 status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
150 aml_length, NULL, NULL, 3);
151 if (ACPI_FAILURE (status)) {
152 acpi_ds_delete_walk_state (walk_state);
153 return_ACPI_STATUS (status);
154 }
155
156
157
158 walk_state->deferred_node = node;
159 status = acpi_ps_parse_aml (walk_state);
160 acpi_ps_delete_parse_tree (op);
161 return_ACPI_STATUS (status);
162}
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178acpi_status
179acpi_ds_get_buffer_field_arguments (
180 union acpi_operand_object *obj_desc)
181{
182 union acpi_operand_object *extra_desc;
183 struct acpi_namespace_node *node;
184 acpi_status status;
185
186
187 ACPI_FUNCTION_TRACE_PTR ("ds_get_buffer_field_arguments", obj_desc);
188
189
190 if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
191 return_ACPI_STATUS (AE_OK);
192 }
193
194
195
196 extra_desc = acpi_ns_get_secondary_object (obj_desc);
197 node = obj_desc->buffer_field.node;
198
199 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_BUFFER_FIELD, node, NULL));
200 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n",
201 acpi_ut_get_node_name (node)));
202
203
204
205 status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node),
206 extra_desc->extra.aml_length, extra_desc->extra.aml_start);
207 return_ACPI_STATUS (status);
208}
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224acpi_status
225acpi_ds_get_buffer_arguments (
226 union acpi_operand_object *obj_desc)
227{
228 struct acpi_namespace_node *node;
229 acpi_status status;
230
231
232 ACPI_FUNCTION_TRACE_PTR ("ds_get_buffer_arguments", obj_desc);
233
234
235 if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
236 return_ACPI_STATUS (AE_OK);
237 }
238
239
240
241 node = obj_desc->buffer.node;
242 if (!node) {
243 ACPI_REPORT_ERROR ((
244 "No pointer back to NS node in buffer obj %p\n", obj_desc));
245 return_ACPI_STATUS (AE_AML_INTERNAL);
246 }
247
248 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
249
250
251
252 status = acpi_ds_execute_arguments (node, node,
253 obj_desc->buffer.aml_length, obj_desc->buffer.aml_start);
254 return_ACPI_STATUS (status);
255}
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271acpi_status
272acpi_ds_get_package_arguments (
273 union acpi_operand_object *obj_desc)
274{
275 struct acpi_namespace_node *node;
276 acpi_status status;
277
278
279 ACPI_FUNCTION_TRACE_PTR ("ds_get_package_arguments", obj_desc);
280
281
282 if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
283 return_ACPI_STATUS (AE_OK);
284 }
285
286
287
288 node = obj_desc->package.node;
289 if (!node) {
290 ACPI_REPORT_ERROR ((
291 "No pointer back to NS node in package %p\n", obj_desc));
292 return_ACPI_STATUS (AE_AML_INTERNAL);
293 }
294
295 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n"));
296
297
298
299 status = acpi_ds_execute_arguments (node, node,
300 obj_desc->package.aml_length, obj_desc->package.aml_start);
301 return_ACPI_STATUS (status);
302}
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318acpi_status
319acpi_ds_get_region_arguments (
320 union acpi_operand_object *obj_desc)
321{
322 struct acpi_namespace_node *node;
323 acpi_status status;
324 union acpi_operand_object *extra_desc;
325
326
327 ACPI_FUNCTION_TRACE_PTR ("ds_get_region_arguments", obj_desc);
328
329
330 if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
331 return_ACPI_STATUS (AE_OK);
332 }
333
334 extra_desc = acpi_ns_get_secondary_object (obj_desc);
335 if (!extra_desc) {
336 return_ACPI_STATUS (AE_NOT_EXIST);
337 }
338
339
340
341 node = obj_desc->region.node;
342
343 ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_REGION, node, NULL));
344
345 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] op_region Arg Init at AML %p\n",
346 acpi_ut_get_node_name (node), extra_desc->extra.aml_start));
347
348
349
350 status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node),
351 extra_desc->extra.aml_length, extra_desc->extra.aml_start);
352 return_ACPI_STATUS (status);
353}
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368acpi_status
369acpi_ds_initialize_region (
370 acpi_handle obj_handle)
371{
372 union acpi_operand_object *obj_desc;
373 acpi_status status;
374
375
376 obj_desc = acpi_ns_get_attached_object (obj_handle);
377
378
379
380 status = acpi_ev_initialize_region (obj_desc, FALSE);
381 return (status);
382}
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402acpi_status
403acpi_ds_init_buffer_field (
404 u16 aml_opcode,
405 union acpi_operand_object *obj_desc,
406 union acpi_operand_object *buffer_desc,
407 union acpi_operand_object *offset_desc,
408 union acpi_operand_object *length_desc,
409 union acpi_operand_object *result_desc)
410{
411 u32 offset;
412 u32 bit_offset;
413 u32 bit_count;
414 u8 field_flags;
415 acpi_status status;
416
417
418 ACPI_FUNCTION_TRACE_PTR ("ds_init_buffer_field", obj_desc);
419
420
421
422
423 if (ACPI_GET_OBJECT_TYPE (buffer_desc) != ACPI_TYPE_BUFFER) {
424 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
425 "Target of Create Field is not a Buffer object - %s\n",
426 acpi_ut_get_object_type_name (buffer_desc)));
427
428 status = AE_AML_OPERAND_TYPE;
429 goto cleanup;
430 }
431
432
433
434
435
436
437 if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) {
438 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n",
439 acpi_ps_get_opcode_name (aml_opcode), acpi_ut_get_descriptor_name (result_desc)));
440
441 status = AE_AML_OPERAND_TYPE;
442 goto cleanup;
443 }
444
445 offset = (u32) offset_desc->integer.value;
446
447
448
449
450 switch (aml_opcode) {
451 case AML_CREATE_FIELD_OP:
452
453
454
455 bit_offset = offset;
456 bit_count = (u32) length_desc->integer.value;
457 field_flags = AML_FIELD_ACCESS_BYTE;
458 break;
459
460 case AML_CREATE_BIT_FIELD_OP:
461
462
463
464 bit_offset = offset;
465 bit_count = 1;
466 field_flags = AML_FIELD_ACCESS_BYTE;
467 break;
468
469 case AML_CREATE_BYTE_FIELD_OP:
470
471
472
473 bit_offset = 8 * offset;
474 bit_count = 8;
475 field_flags = AML_FIELD_ACCESS_BYTE;
476 break;
477
478 case AML_CREATE_WORD_FIELD_OP:
479
480
481
482 bit_offset = 8 * offset;
483 bit_count = 16;
484 field_flags = AML_FIELD_ACCESS_WORD;
485 break;
486
487 case AML_CREATE_DWORD_FIELD_OP:
488
489
490
491 bit_offset = 8 * offset;
492 bit_count = 32;
493 field_flags = AML_FIELD_ACCESS_DWORD;
494 break;
495
496 case AML_CREATE_QWORD_FIELD_OP:
497
498
499
500 bit_offset = 8 * offset;
501 bit_count = 64;
502 field_flags = AML_FIELD_ACCESS_QWORD;
503 break;
504
505 default:
506
507 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
508 "Unknown field creation opcode %02x\n",
509 aml_opcode));
510 status = AE_AML_BAD_OPCODE;
511 goto cleanup;
512 }
513
514
515
516 if ((bit_offset + bit_count) >
517 (8 * (u32) buffer_desc->buffer.length)) {
518 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
519 "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n",
520 acpi_ut_get_node_name (result_desc),
521 bit_offset + bit_count,
522 acpi_ut_get_node_name (buffer_desc->buffer.node),
523 8 * (u32) buffer_desc->buffer.length));
524 status = AE_AML_BUFFER_LIMIT;
525 goto cleanup;
526 }
527
528
529
530
531
532 status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0,
533 bit_offset, bit_count);
534 if (ACPI_FAILURE (status)) {
535 goto cleanup;
536 }
537
538 obj_desc->buffer_field.buffer_obj = buffer_desc;
539
540
541
542 buffer_desc->common.reference_count = (u16) (buffer_desc->common.reference_count +
543 obj_desc->common.reference_count);
544
545
546cleanup:
547
548
549
550 acpi_ut_remove_reference (offset_desc);
551 acpi_ut_remove_reference (buffer_desc);
552
553 if (aml_opcode == AML_CREATE_FIELD_OP) {
554 acpi_ut_remove_reference (length_desc);
555 }
556
557
558
559 if (ACPI_FAILURE (status)) {
560 acpi_ut_remove_reference (result_desc);
561 }
562 else {
563
564
565 obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
566 }
567
568 return_ACPI_STATUS (status);
569}
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586acpi_status
587acpi_ds_eval_buffer_field_operands (
588 struct acpi_walk_state *walk_state,
589 union acpi_parse_object *op)
590{
591 acpi_status status;
592 union acpi_operand_object *obj_desc;
593 struct acpi_namespace_node *node;
594 union acpi_parse_object *next_op;
595
596
597 ACPI_FUNCTION_TRACE_PTR ("ds_eval_buffer_field_operands", op);
598
599
600
601
602
603
604 node = op->common.node;
605
606
607
608 next_op = op->common.value.arg;
609
610
611
612 status = acpi_ds_create_operands (walk_state, next_op);
613 if (ACPI_FAILURE (status)) {
614 return_ACPI_STATUS (status);
615 }
616
617 obj_desc = acpi_ns_get_attached_object (node);
618 if (!obj_desc) {
619 return_ACPI_STATUS (AE_NOT_EXIST);
620 }
621
622
623
624 status = acpi_ex_resolve_operands (op->common.aml_opcode,
625 ACPI_WALK_OPERANDS, walk_state);
626
627 ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
628 acpi_ps_get_opcode_name (op->common.aml_opcode),
629 walk_state->num_operands, "after acpi_ex_resolve_operands");
630
631 if (ACPI_FAILURE (status)) {
632 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
633 acpi_ps_get_opcode_name (op->common.aml_opcode), status));
634
635 return_ACPI_STATUS (status);
636 }
637
638
639
640 if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
641
642
643 status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc,
644 walk_state->operands[0], walk_state->operands[1],
645 walk_state->operands[2], walk_state->operands[3]);
646 }
647 else {
648
649
650 status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc,
651 walk_state->operands[0], walk_state->operands[1],
652 NULL, walk_state->operands[2]);
653 }
654
655 return_ACPI_STATUS (status);
656}
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673acpi_status
674acpi_ds_eval_region_operands (
675 struct acpi_walk_state *walk_state,
676 union acpi_parse_object *op)
677{
678 acpi_status status;
679 union acpi_operand_object *obj_desc;
680 union acpi_operand_object *operand_desc;
681 struct acpi_namespace_node *node;
682 union acpi_parse_object *next_op;
683
684
685 ACPI_FUNCTION_TRACE_PTR ("ds_eval_region_operands", op);
686
687
688
689
690
691 node = op->common.node;
692
693
694
695 next_op = op->common.value.arg;
696
697
698
699 next_op = next_op->common.next;
700
701
702
703 status = acpi_ds_create_operands (walk_state, next_op);
704 if (ACPI_FAILURE (status)) {
705 return_ACPI_STATUS (status);
706 }
707
708
709
710 status = acpi_ex_resolve_operands (op->common.aml_opcode, ACPI_WALK_OPERANDS, walk_state);
711 if (ACPI_FAILURE (status)) {
712 return_ACPI_STATUS (status);
713 }
714
715 ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
716 acpi_ps_get_opcode_name (op->common.aml_opcode),
717 1, "after acpi_ex_resolve_operands");
718
719 obj_desc = acpi_ns_get_attached_object (node);
720 if (!obj_desc) {
721 return_ACPI_STATUS (AE_NOT_EXIST);
722 }
723
724
725
726
727
728 operand_desc = walk_state->operands[walk_state->num_operands - 1];
729
730 obj_desc->region.length = (u32) operand_desc->integer.value;
731 acpi_ut_remove_reference (operand_desc);
732
733
734
735
736
737 operand_desc = walk_state->operands[walk_state->num_operands - 2];
738
739 obj_desc->region.address = (acpi_physical_address) operand_desc->integer.value;
740 acpi_ut_remove_reference (operand_desc);
741
742 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n",
743 obj_desc,
744 ACPI_FORMAT_UINT64 (obj_desc->region.address),
745 obj_desc->region.length));
746
747
748
749 obj_desc->region.flags |= AOPOBJ_DATA_VALID;
750
751 return_ACPI_STATUS (status);
752}
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771acpi_status
772acpi_ds_eval_data_object_operands (
773 struct acpi_walk_state *walk_state,
774 union acpi_parse_object *op,
775 union acpi_operand_object *obj_desc)
776{
777 acpi_status status;
778 union acpi_operand_object *arg_desc;
779 u32 length;
780
781
782 ACPI_FUNCTION_TRACE ("ds_eval_data_object_operands");
783
784
785
786
787 status = acpi_ds_create_operand (walk_state, op->common.value.arg, 1);
788 if (ACPI_FAILURE (status)) {
789 return_ACPI_STATUS (status);
790 }
791
792 status = acpi_ex_resolve_operands (walk_state->opcode,
793 &(walk_state->operands [walk_state->num_operands -1]),
794 walk_state);
795 if (ACPI_FAILURE (status)) {
796 return_ACPI_STATUS (status);
797 }
798
799
800
801 arg_desc = walk_state->operands [walk_state->num_operands - 1];
802 length = (u32) arg_desc->integer.value;
803
804
805
806 status = acpi_ds_obj_stack_pop (1, walk_state);
807 if (ACPI_FAILURE (status)) {
808 return_ACPI_STATUS (status);
809 }
810
811 acpi_ut_remove_reference (arg_desc);
812
813
814
815
816 switch (op->common.aml_opcode) {
817 case AML_BUFFER_OP:
818
819 status = acpi_ds_build_internal_buffer_obj (walk_state, op, length, &obj_desc);
820 break;
821
822 case AML_PACKAGE_OP:
823 case AML_VAR_PACKAGE_OP:
824
825 status = acpi_ds_build_internal_package_obj (walk_state, op, length, &obj_desc);
826 break;
827
828 default:
829 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
830 }
831
832 if (ACPI_SUCCESS (status)) {
833
834
835
836
837
838 if ((!op->common.parent) ||
839 ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
840 (op->common.parent->common.aml_opcode != AML_VAR_PACKAGE_OP) &&
841 (op->common.parent->common.aml_opcode != AML_NAME_OP))) {
842 walk_state->result_obj = obj_desc;
843 }
844 }
845
846 return_ACPI_STATUS (status);
847}
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864acpi_status
865acpi_ds_exec_begin_control_op (
866 struct acpi_walk_state *walk_state,
867 union acpi_parse_object *op)
868{
869 acpi_status status = AE_OK;
870 union acpi_generic_state *control_state;
871
872
873 ACPI_FUNCTION_NAME ("ds_exec_begin_control_op");
874
875
876 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op,
877 op->common.aml_opcode, walk_state));
878
879 switch (op->common.aml_opcode) {
880 case AML_IF_OP:
881 case AML_WHILE_OP:
882
883
884
885
886
887
888 control_state = acpi_ut_create_control_state ();
889 if (!control_state) {
890 status = AE_NO_MEMORY;
891 break;
892 }
893
894
895
896
897 control_state->control.aml_predicate_start = walk_state->parser_state.aml - 1;
898 control_state->control.package_end = walk_state->parser_state.pkg_end;
899 control_state->control.opcode = op->common.aml_opcode;
900
901
902
903
904 acpi_ut_push_generic_state (&walk_state->control_state, control_state);
905 break;
906
907 case AML_ELSE_OP:
908
909
910
911
912 if (walk_state->last_predicate) {
913 status = AE_CTRL_TRUE;
914 }
915
916 break;
917
918 case AML_RETURN_OP:
919
920 break;
921
922 default:
923 break;
924 }
925
926 return (status);
927}
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944acpi_status
945acpi_ds_exec_end_control_op (
946 struct acpi_walk_state *walk_state,
947 union acpi_parse_object *op)
948{
949 acpi_status status = AE_OK;
950 union acpi_generic_state *control_state;
951
952
953 ACPI_FUNCTION_NAME ("ds_exec_end_control_op");
954
955
956 switch (op->common.aml_opcode) {
957 case AML_IF_OP:
958
959 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op));
960
961
962
963
964
965 walk_state->last_predicate =
966 (u8) walk_state->control_state->common.value;
967
968
969
970
971
972 control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
973 acpi_ut_delete_generic_state (control_state);
974 break;
975
976
977 case AML_ELSE_OP:
978
979 break;
980
981
982 case AML_WHILE_OP:
983
984 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op));
985
986 if (walk_state->control_state->common.value) {
987
988
989 status = AE_CTRL_PENDING;
990 }
991
992 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op));
993
994
995
996 control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
997
998 walk_state->aml_last_while = control_state->control.aml_predicate_start;
999 acpi_ut_delete_generic_state (control_state);
1000 break;
1001
1002
1003 case AML_RETURN_OP:
1004
1005 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
1006 "[RETURN_OP] Op=%p Arg=%p\n",op, op->common.value.arg));
1007
1008
1009
1010
1011
1012
1013 if (op->common.value.arg) {
1014
1015
1016 status = acpi_ds_create_operands (walk_state, op->common.value.arg);
1017 if (ACPI_FAILURE (status)) {
1018 return (status);
1019 }
1020
1021
1022
1023
1024
1025
1026 status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
1027 if (ACPI_FAILURE (status)) {
1028 return (status);
1029 }
1030
1031
1032
1033
1034
1035
1036 walk_state->return_desc = walk_state->operands[0];
1037 }
1038 else if ((walk_state->results) &&
1039 (walk_state->results->results.num_results > 0)) {
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049 if ((ACPI_GET_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc[0]) == ACPI_DESC_TYPE_OPERAND) &&
1050 (ACPI_GET_OBJECT_TYPE (walk_state->results->results.obj_desc [0]) == ACPI_TYPE_LOCAL_REFERENCE) &&
1051 ((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) {
1052 status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state);
1053 if (ACPI_FAILURE (status)) {
1054 return (status);
1055 }
1056 }
1057
1058 walk_state->return_desc = walk_state->results->results.obj_desc [0];
1059 }
1060 else {
1061
1062
1063 if (walk_state->num_operands) {
1064 acpi_ut_remove_reference (walk_state->operands [0]);
1065 }
1066
1067 walk_state->operands [0] = NULL;
1068 walk_state->num_operands = 0;
1069 walk_state->return_desc = NULL;
1070 }
1071
1072
1073 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
1074 "Completed RETURN_OP State=%p, ret_val=%p\n",
1075 walk_state, walk_state->return_desc));
1076
1077
1078
1079 status = AE_CTRL_TERMINATE;
1080 break;
1081
1082
1083 case AML_NOOP_OP:
1084
1085
1086 break;
1087
1088
1089 case AML_BREAK_POINT_OP:
1090
1091
1092
1093 status = acpi_os_signal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
1094
1095
1096
1097 break;
1098
1099
1100 case AML_BREAK_OP:
1101 case AML_CONTINUE_OP:
1102
1103
1104
1105
1106 while (walk_state->control_state &&
1107 (walk_state->control_state->control.opcode != AML_WHILE_OP)) {
1108 control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
1109 acpi_ut_delete_generic_state (control_state);
1110 }
1111
1112
1113
1114 if (!walk_state->control_state) {
1115 return (AE_AML_NO_WHILE);
1116 }
1117
1118
1119
1120 walk_state->aml_last_while = walk_state->control_state->control.package_end;
1121
1122
1123
1124 if (op->common.aml_opcode == AML_BREAK_OP) {
1125 status = AE_CTRL_BREAK;
1126 }
1127 else {
1128 status = AE_CTRL_CONTINUE;
1129 }
1130 break;
1131
1132
1133 default:
1134
1135 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
1136 op->common.aml_opcode, op));
1137
1138 status = AE_AML_BAD_OPCODE;
1139 break;
1140 }
1141
1142 return (status);
1143}
1144
1145