diff options
author | Bob Moore <robert.moore@intel.com> | 2013-01-11 07:08:51 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-11 07:08:51 -0500 |
commit | 42f8fb75c43cc67f06424f991009b3af674f93eb (patch) | |
tree | 01821d5eca5f97d474bee62e7f92fe481adb31b8 /drivers/acpi/acpica/psloop.c | |
parent | 4f8429166818dd615891990040ce13373893ee9a (diff) |
ACPICA: Source restructuring: split large files into 8 new files.
Created logical splits for eight new files. Improves modularity
and configurability.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/psloop.c')
-rw-r--r-- | drivers/acpi/acpica/psloop.c | 622 |
1 files changed, 0 insertions, 622 deletions
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c index a6f8592c9ae5..4261c5fe4718 100644 --- a/drivers/acpi/acpica/psloop.c +++ b/drivers/acpi/acpica/psloop.c | |||
@@ -58,353 +58,17 @@ | |||
58 | #define _COMPONENT ACPI_PARSER | 58 | #define _COMPONENT ACPI_PARSER |
59 | ACPI_MODULE_NAME("psloop") | 59 | ACPI_MODULE_NAME("psloop") |
60 | 60 | ||
61 | static u32 acpi_gbl_depth = 0; | ||
62 | |||
63 | /* Local prototypes */ | 61 | /* Local prototypes */ |
64 | |||
65 | static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state); | ||
66 | |||
67 | static acpi_status | ||
68 | acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | ||
69 | u8 * aml_op_start, | ||
70 | union acpi_parse_object *unnamed_op, | ||
71 | union acpi_parse_object **op); | ||
72 | |||
73 | static acpi_status | ||
74 | acpi_ps_create_op(struct acpi_walk_state *walk_state, | ||
75 | u8 * aml_op_start, union acpi_parse_object **new_op); | ||
76 | |||
77 | static acpi_status | 62 | static acpi_status |
78 | acpi_ps_get_arguments(struct acpi_walk_state *walk_state, | 63 | acpi_ps_get_arguments(struct acpi_walk_state *walk_state, |
79 | u8 * aml_op_start, union acpi_parse_object *op); | 64 | u8 * aml_op_start, union acpi_parse_object *op); |
80 | 65 | ||
81 | static acpi_status | ||
82 | acpi_ps_complete_op(struct acpi_walk_state *walk_state, | ||
83 | union acpi_parse_object **op, acpi_status status); | ||
84 | |||
85 | static acpi_status | ||
86 | acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, | ||
87 | union acpi_parse_object *op, acpi_status status); | ||
88 | |||
89 | static void | 66 | static void |
90 | acpi_ps_link_module_code(union acpi_parse_object *parent_op, | 67 | acpi_ps_link_module_code(union acpi_parse_object *parent_op, |
91 | u8 *aml_start, u32 aml_length, acpi_owner_id owner_id); | 68 | u8 *aml_start, u32 aml_length, acpi_owner_id owner_id); |
92 | 69 | ||
93 | /******************************************************************************* | 70 | /******************************************************************************* |
94 | * | 71 | * |
95 | * FUNCTION: acpi_ps_get_aml_opcode | ||
96 | * | ||
97 | * PARAMETERS: walk_state - Current state | ||
98 | * | ||
99 | * RETURN: Status | ||
100 | * | ||
101 | * DESCRIPTION: Extract the next AML opcode from the input stream. | ||
102 | * | ||
103 | ******************************************************************************/ | ||
104 | |||
105 | static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state) | ||
106 | { | ||
107 | |||
108 | ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state); | ||
109 | |||
110 | walk_state->aml_offset = | ||
111 | (u32) ACPI_PTR_DIFF(walk_state->parser_state.aml, | ||
112 | walk_state->parser_state.aml_start); | ||
113 | walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state)); | ||
114 | |||
115 | /* | ||
116 | * First cut to determine what we have found: | ||
117 | * 1) A valid AML opcode | ||
118 | * 2) A name string | ||
119 | * 3) An unknown/invalid opcode | ||
120 | */ | ||
121 | walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode); | ||
122 | |||
123 | switch (walk_state->op_info->class) { | ||
124 | case AML_CLASS_ASCII: | ||
125 | case AML_CLASS_PREFIX: | ||
126 | /* | ||
127 | * Starts with a valid prefix or ASCII char, this is a name | ||
128 | * string. Convert the bare name string to a namepath. | ||
129 | */ | ||
130 | walk_state->opcode = AML_INT_NAMEPATH_OP; | ||
131 | walk_state->arg_types = ARGP_NAMESTRING; | ||
132 | break; | ||
133 | |||
134 | case AML_CLASS_UNKNOWN: | ||
135 | |||
136 | /* The opcode is unrecognized. Complain and skip unknown opcodes */ | ||
137 | |||
138 | if (walk_state->pass_number == 2) { | ||
139 | ACPI_ERROR((AE_INFO, | ||
140 | "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring", | ||
141 | walk_state->opcode, | ||
142 | (u32)(walk_state->aml_offset + | ||
143 | sizeof(struct acpi_table_header)))); | ||
144 | |||
145 | ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16), | ||
146 | 48); | ||
147 | |||
148 | #ifdef ACPI_ASL_COMPILER | ||
149 | /* | ||
150 | * This is executed for the disassembler only. Output goes | ||
151 | * to the disassembled ASL output file. | ||
152 | */ | ||
153 | acpi_os_printf | ||
154 | ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n", | ||
155 | walk_state->opcode, | ||
156 | (u32)(walk_state->aml_offset + | ||
157 | sizeof(struct acpi_table_header))); | ||
158 | |||
159 | /* Dump the context surrounding the invalid opcode */ | ||
160 | |||
161 | acpi_ut_dump_buffer(((u8 *)walk_state->parser_state. | ||
162 | aml - 16), 48, DB_BYTE_DISPLAY, | ||
163 | (walk_state->aml_offset + | ||
164 | sizeof(struct acpi_table_header) - | ||
165 | 16)); | ||
166 | acpi_os_printf(" */\n"); | ||
167 | #endif | ||
168 | } | ||
169 | |||
170 | /* Increment past one-byte or two-byte opcode */ | ||
171 | |||
172 | walk_state->parser_state.aml++; | ||
173 | if (walk_state->opcode > 0xFF) { /* Can only happen if first byte is 0x5B */ | ||
174 | walk_state->parser_state.aml++; | ||
175 | } | ||
176 | |||
177 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); | ||
178 | |||
179 | default: | ||
180 | |||
181 | /* Found opcode info, this is a normal opcode */ | ||
182 | |||
183 | walk_state->parser_state.aml += | ||
184 | acpi_ps_get_opcode_size(walk_state->opcode); | ||
185 | walk_state->arg_types = walk_state->op_info->parse_args; | ||
186 | break; | ||
187 | } | ||
188 | |||
189 | return_ACPI_STATUS(AE_OK); | ||
190 | } | ||
191 | |||
192 | /******************************************************************************* | ||
193 | * | ||
194 | * FUNCTION: acpi_ps_build_named_op | ||
195 | * | ||
196 | * PARAMETERS: walk_state - Current state | ||
197 | * aml_op_start - Begin of named Op in AML | ||
198 | * unnamed_op - Early Op (not a named Op) | ||
199 | * op - Returned Op | ||
200 | * | ||
201 | * RETURN: Status | ||
202 | * | ||
203 | * DESCRIPTION: Parse a named Op | ||
204 | * | ||
205 | ******************************************************************************/ | ||
206 | |||
207 | static acpi_status | ||
208 | acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | ||
209 | u8 * aml_op_start, | ||
210 | union acpi_parse_object *unnamed_op, | ||
211 | union acpi_parse_object **op) | ||
212 | { | ||
213 | acpi_status status = AE_OK; | ||
214 | union acpi_parse_object *arg = NULL; | ||
215 | |||
216 | ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state); | ||
217 | |||
218 | unnamed_op->common.value.arg = NULL; | ||
219 | unnamed_op->common.arg_list_length = 0; | ||
220 | unnamed_op->common.aml_opcode = walk_state->opcode; | ||
221 | |||
222 | /* | ||
223 | * Get and append arguments until we find the node that contains | ||
224 | * the name (the type ARGP_NAME). | ||
225 | */ | ||
226 | while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) && | ||
227 | (GET_CURRENT_ARG_TYPE(walk_state->arg_types) != ARGP_NAME)) { | ||
228 | status = | ||
229 | acpi_ps_get_next_arg(walk_state, | ||
230 | &(walk_state->parser_state), | ||
231 | GET_CURRENT_ARG_TYPE(walk_state-> | ||
232 | arg_types), &arg); | ||
233 | if (ACPI_FAILURE(status)) { | ||
234 | return_ACPI_STATUS(status); | ||
235 | } | ||
236 | |||
237 | acpi_ps_append_arg(unnamed_op, arg); | ||
238 | INCREMENT_ARG_LIST(walk_state->arg_types); | ||
239 | } | ||
240 | |||
241 | /* | ||
242 | * Make sure that we found a NAME and didn't run out of arguments | ||
243 | */ | ||
244 | if (!GET_CURRENT_ARG_TYPE(walk_state->arg_types)) { | ||
245 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | ||
246 | } | ||
247 | |||
248 | /* We know that this arg is a name, move to next arg */ | ||
249 | |||
250 | INCREMENT_ARG_LIST(walk_state->arg_types); | ||
251 | |||
252 | /* | ||
253 | * Find the object. This will either insert the object into | ||
254 | * the namespace or simply look it up | ||
255 | */ | ||
256 | walk_state->op = NULL; | ||
257 | |||
258 | status = walk_state->descending_callback(walk_state, op); | ||
259 | if (ACPI_FAILURE(status)) { | ||
260 | ACPI_EXCEPTION((AE_INFO, status, "During name lookup/catalog")); | ||
261 | return_ACPI_STATUS(status); | ||
262 | } | ||
263 | |||
264 | if (!*op) { | ||
265 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); | ||
266 | } | ||
267 | |||
268 | status = acpi_ps_next_parse_state(walk_state, *op, status); | ||
269 | if (ACPI_FAILURE(status)) { | ||
270 | if (status == AE_CTRL_PENDING) { | ||
271 | return_ACPI_STATUS(AE_CTRL_PARSE_PENDING); | ||
272 | } | ||
273 | return_ACPI_STATUS(status); | ||
274 | } | ||
275 | |||
276 | acpi_ps_append_arg(*op, unnamed_op->common.value.arg); | ||
277 | acpi_gbl_depth++; | ||
278 | |||
279 | if ((*op)->common.aml_opcode == AML_REGION_OP || | ||
280 | (*op)->common.aml_opcode == AML_DATA_REGION_OP) { | ||
281 | /* | ||
282 | * Defer final parsing of an operation_region body, because we don't | ||
283 | * have enough info in the first pass to parse it correctly (i.e., | ||
284 | * there may be method calls within the term_arg elements of the body.) | ||
285 | * | ||
286 | * However, we must continue parsing because the opregion is not a | ||
287 | * standalone package -- we don't know where the end is at this point. | ||
288 | * | ||
289 | * (Length is unknown until parse of the body complete) | ||
290 | */ | ||
291 | (*op)->named.data = aml_op_start; | ||
292 | (*op)->named.length = 0; | ||
293 | } | ||
294 | |||
295 | return_ACPI_STATUS(AE_OK); | ||
296 | } | ||
297 | |||
298 | /******************************************************************************* | ||
299 | * | ||
300 | * FUNCTION: acpi_ps_create_op | ||
301 | * | ||
302 | * PARAMETERS: walk_state - Current state | ||
303 | * aml_op_start - Op start in AML | ||
304 | * new_op - Returned Op | ||
305 | * | ||
306 | * RETURN: Status | ||
307 | * | ||
308 | * DESCRIPTION: Get Op from AML | ||
309 | * | ||
310 | ******************************************************************************/ | ||
311 | |||
312 | static acpi_status | ||
313 | acpi_ps_create_op(struct acpi_walk_state *walk_state, | ||
314 | u8 * aml_op_start, union acpi_parse_object **new_op) | ||
315 | { | ||
316 | acpi_status status = AE_OK; | ||
317 | union acpi_parse_object *op; | ||
318 | union acpi_parse_object *named_op = NULL; | ||
319 | union acpi_parse_object *parent_scope; | ||
320 | u8 argument_count; | ||
321 | const struct acpi_opcode_info *op_info; | ||
322 | |||
323 | ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state); | ||
324 | |||
325 | status = acpi_ps_get_aml_opcode(walk_state); | ||
326 | if (status == AE_CTRL_PARSE_CONTINUE) { | ||
327 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); | ||
328 | } | ||
329 | |||
330 | /* Create Op structure and append to parent's argument list */ | ||
331 | |||
332 | walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode); | ||
333 | op = acpi_ps_alloc_op(walk_state->opcode); | ||
334 | if (!op) { | ||
335 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
336 | } | ||
337 | |||
338 | if (walk_state->op_info->flags & AML_NAMED) { | ||
339 | status = | ||
340 | acpi_ps_build_named_op(walk_state, aml_op_start, op, | ||
341 | &named_op); | ||
342 | acpi_ps_free_op(op); | ||
343 | if (ACPI_FAILURE(status)) { | ||
344 | return_ACPI_STATUS(status); | ||
345 | } | ||
346 | |||
347 | *new_op = named_op; | ||
348 | return_ACPI_STATUS(AE_OK); | ||
349 | } | ||
350 | |||
351 | /* Not a named opcode, just allocate Op and append to parent */ | ||
352 | |||
353 | if (walk_state->op_info->flags & AML_CREATE) { | ||
354 | /* | ||
355 | * Backup to beginning of create_XXXfield declaration | ||
356 | * body_length is unknown until we parse the body | ||
357 | */ | ||
358 | op->named.data = aml_op_start; | ||
359 | op->named.length = 0; | ||
360 | } | ||
361 | |||
362 | if (walk_state->opcode == AML_BANK_FIELD_OP) { | ||
363 | /* | ||
364 | * Backup to beginning of bank_field declaration | ||
365 | * body_length is unknown until we parse the body | ||
366 | */ | ||
367 | op->named.data = aml_op_start; | ||
368 | op->named.length = 0; | ||
369 | } | ||
370 | |||
371 | parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state)); | ||
372 | acpi_ps_append_arg(parent_scope, op); | ||
373 | |||
374 | if (parent_scope) { | ||
375 | op_info = | ||
376 | acpi_ps_get_opcode_info(parent_scope->common.aml_opcode); | ||
377 | if (op_info->flags & AML_HAS_TARGET) { | ||
378 | argument_count = | ||
379 | acpi_ps_get_argument_count(op_info->type); | ||
380 | if (parent_scope->common.arg_list_length > | ||
381 | argument_count) { | ||
382 | op->common.flags |= ACPI_PARSEOP_TARGET; | ||
383 | } | ||
384 | } else if (parent_scope->common.aml_opcode == AML_INCREMENT_OP) { | ||
385 | op->common.flags |= ACPI_PARSEOP_TARGET; | ||
386 | } | ||
387 | } | ||
388 | |||
389 | if (walk_state->descending_callback != NULL) { | ||
390 | /* | ||
391 | * Find the object. This will either insert the object into | ||
392 | * the namespace or simply look it up | ||
393 | */ | ||
394 | walk_state->op = *new_op = op; | ||
395 | |||
396 | status = walk_state->descending_callback(walk_state, &op); | ||
397 | status = acpi_ps_next_parse_state(walk_state, op, status); | ||
398 | if (status == AE_CTRL_PENDING) { | ||
399 | status = AE_CTRL_PARSE_PENDING; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | return_ACPI_STATUS(status); | ||
404 | } | ||
405 | |||
406 | /******************************************************************************* | ||
407 | * | ||
408 | * FUNCTION: acpi_ps_get_arguments | 72 | * FUNCTION: acpi_ps_get_arguments |
409 | * | 73 | * |
410 | * PARAMETERS: walk_state - Current state | 74 | * PARAMETERS: walk_state - Current state |
@@ -712,288 +376,6 @@ acpi_ps_link_module_code(union acpi_parse_object *parent_op, | |||
712 | 376 | ||
713 | /******************************************************************************* | 377 | /******************************************************************************* |
714 | * | 378 | * |
715 | * FUNCTION: acpi_ps_complete_op | ||
716 | * | ||
717 | * PARAMETERS: walk_state - Current state | ||
718 | * op - Returned Op | ||
719 | * status - Parse status before complete Op | ||
720 | * | ||
721 | * RETURN: Status | ||
722 | * | ||
723 | * DESCRIPTION: Complete Op | ||
724 | * | ||
725 | ******************************************************************************/ | ||
726 | |||
727 | static acpi_status | ||
728 | acpi_ps_complete_op(struct acpi_walk_state *walk_state, | ||
729 | union acpi_parse_object **op, acpi_status status) | ||
730 | { | ||
731 | acpi_status status2; | ||
732 | |||
733 | ACPI_FUNCTION_TRACE_PTR(ps_complete_op, walk_state); | ||
734 | |||
735 | /* | ||
736 | * Finished one argument of the containing scope | ||
737 | */ | ||
738 | walk_state->parser_state.scope->parse_scope.arg_count--; | ||
739 | |||
740 | /* Close this Op (will result in parse subtree deletion) */ | ||
741 | |||
742 | status2 = acpi_ps_complete_this_op(walk_state, *op); | ||
743 | if (ACPI_FAILURE(status2)) { | ||
744 | return_ACPI_STATUS(status2); | ||
745 | } | ||
746 | |||
747 | *op = NULL; | ||
748 | |||
749 | switch (status) { | ||
750 | case AE_OK: | ||
751 | break; | ||
752 | |||
753 | case AE_CTRL_TRANSFER: | ||
754 | |||
755 | /* We are about to transfer to a called method */ | ||
756 | |||
757 | walk_state->prev_op = NULL; | ||
758 | walk_state->prev_arg_types = walk_state->arg_types; | ||
759 | return_ACPI_STATUS(status); | ||
760 | |||
761 | case AE_CTRL_END: | ||
762 | |||
763 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
764 | &walk_state->arg_types, | ||
765 | &walk_state->arg_count); | ||
766 | |||
767 | if (*op) { | ||
768 | walk_state->op = *op; | ||
769 | walk_state->op_info = | ||
770 | acpi_ps_get_opcode_info((*op)->common.aml_opcode); | ||
771 | walk_state->opcode = (*op)->common.aml_opcode; | ||
772 | |||
773 | status = walk_state->ascending_callback(walk_state); | ||
774 | status = | ||
775 | acpi_ps_next_parse_state(walk_state, *op, status); | ||
776 | |||
777 | status2 = acpi_ps_complete_this_op(walk_state, *op); | ||
778 | if (ACPI_FAILURE(status2)) { | ||
779 | return_ACPI_STATUS(status2); | ||
780 | } | ||
781 | } | ||
782 | |||
783 | status = AE_OK; | ||
784 | break; | ||
785 | |||
786 | case AE_CTRL_BREAK: | ||
787 | case AE_CTRL_CONTINUE: | ||
788 | |||
789 | /* Pop off scopes until we find the While */ | ||
790 | |||
791 | while (!(*op) || ((*op)->common.aml_opcode != AML_WHILE_OP)) { | ||
792 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
793 | &walk_state->arg_types, | ||
794 | &walk_state->arg_count); | ||
795 | } | ||
796 | |||
797 | /* Close this iteration of the While loop */ | ||
798 | |||
799 | walk_state->op = *op; | ||
800 | walk_state->op_info = | ||
801 | acpi_ps_get_opcode_info((*op)->common.aml_opcode); | ||
802 | walk_state->opcode = (*op)->common.aml_opcode; | ||
803 | |||
804 | status = walk_state->ascending_callback(walk_state); | ||
805 | status = acpi_ps_next_parse_state(walk_state, *op, status); | ||
806 | |||
807 | status2 = acpi_ps_complete_this_op(walk_state, *op); | ||
808 | if (ACPI_FAILURE(status2)) { | ||
809 | return_ACPI_STATUS(status2); | ||
810 | } | ||
811 | |||
812 | status = AE_OK; | ||
813 | break; | ||
814 | |||
815 | case AE_CTRL_TERMINATE: | ||
816 | |||
817 | /* Clean up */ | ||
818 | do { | ||
819 | if (*op) { | ||
820 | status2 = | ||
821 | acpi_ps_complete_this_op(walk_state, *op); | ||
822 | if (ACPI_FAILURE(status2)) { | ||
823 | return_ACPI_STATUS(status2); | ||
824 | } | ||
825 | |||
826 | acpi_ut_delete_generic_state | ||
827 | (acpi_ut_pop_generic_state | ||
828 | (&walk_state->control_state)); | ||
829 | } | ||
830 | |||
831 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
832 | &walk_state->arg_types, | ||
833 | &walk_state->arg_count); | ||
834 | |||
835 | } while (*op); | ||
836 | |||
837 | return_ACPI_STATUS(AE_OK); | ||
838 | |||
839 | default: /* All other non-AE_OK status */ | ||
840 | |||
841 | do { | ||
842 | if (*op) { | ||
843 | status2 = | ||
844 | acpi_ps_complete_this_op(walk_state, *op); | ||
845 | if (ACPI_FAILURE(status2)) { | ||
846 | return_ACPI_STATUS(status2); | ||
847 | } | ||
848 | } | ||
849 | |||
850 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
851 | &walk_state->arg_types, | ||
852 | &walk_state->arg_count); | ||
853 | |||
854 | } while (*op); | ||
855 | |||
856 | #if 0 | ||
857 | /* | ||
858 | * TBD: Cleanup parse ops on error | ||
859 | */ | ||
860 | if (*op == NULL) { | ||
861 | acpi_ps_pop_scope(parser_state, op, | ||
862 | &walk_state->arg_types, | ||
863 | &walk_state->arg_count); | ||
864 | } | ||
865 | #endif | ||
866 | walk_state->prev_op = NULL; | ||
867 | walk_state->prev_arg_types = walk_state->arg_types; | ||
868 | return_ACPI_STATUS(status); | ||
869 | } | ||
870 | |||
871 | /* This scope complete? */ | ||
872 | |||
873 | if (acpi_ps_has_completed_scope(&(walk_state->parser_state))) { | ||
874 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
875 | &walk_state->arg_types, | ||
876 | &walk_state->arg_count); | ||
877 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *op)); | ||
878 | } else { | ||
879 | *op = NULL; | ||
880 | } | ||
881 | |||
882 | return_ACPI_STATUS(AE_OK); | ||
883 | } | ||
884 | |||
885 | /******************************************************************************* | ||
886 | * | ||
887 | * FUNCTION: acpi_ps_complete_final_op | ||
888 | * | ||
889 | * PARAMETERS: walk_state - Current state | ||
890 | * op - Current Op | ||
891 | * status - Current parse status before complete last | ||
892 | * Op | ||
893 | * | ||
894 | * RETURN: Status | ||
895 | * | ||
896 | * DESCRIPTION: Complete last Op. | ||
897 | * | ||
898 | ******************************************************************************/ | ||
899 | |||
900 | static acpi_status | ||
901 | acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, | ||
902 | union acpi_parse_object *op, acpi_status status) | ||
903 | { | ||
904 | acpi_status status2; | ||
905 | |||
906 | ACPI_FUNCTION_TRACE_PTR(ps_complete_final_op, walk_state); | ||
907 | |||
908 | /* | ||
909 | * Complete the last Op (if not completed), and clear the scope stack. | ||
910 | * It is easily possible to end an AML "package" with an unbounded number | ||
911 | * of open scopes (such as when several ASL blocks are closed with | ||
912 | * sequential closing braces). We want to terminate each one cleanly. | ||
913 | */ | ||
914 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n", | ||
915 | op)); | ||
916 | do { | ||
917 | if (op) { | ||
918 | if (walk_state->ascending_callback != NULL) { | ||
919 | walk_state->op = op; | ||
920 | walk_state->op_info = | ||
921 | acpi_ps_get_opcode_info(op->common. | ||
922 | aml_opcode); | ||
923 | walk_state->opcode = op->common.aml_opcode; | ||
924 | |||
925 | status = | ||
926 | walk_state->ascending_callback(walk_state); | ||
927 | status = | ||
928 | acpi_ps_next_parse_state(walk_state, op, | ||
929 | status); | ||
930 | if (status == AE_CTRL_PENDING) { | ||
931 | status = | ||
932 | acpi_ps_complete_op(walk_state, &op, | ||
933 | AE_OK); | ||
934 | if (ACPI_FAILURE(status)) { | ||
935 | return_ACPI_STATUS(status); | ||
936 | } | ||
937 | } | ||
938 | |||
939 | if (status == AE_CTRL_TERMINATE) { | ||
940 | status = AE_OK; | ||
941 | |||
942 | /* Clean up */ | ||
943 | do { | ||
944 | if (op) { | ||
945 | status2 = | ||
946 | acpi_ps_complete_this_op | ||
947 | (walk_state, op); | ||
948 | if (ACPI_FAILURE | ||
949 | (status2)) { | ||
950 | return_ACPI_STATUS | ||
951 | (status2); | ||
952 | } | ||
953 | } | ||
954 | |||
955 | acpi_ps_pop_scope(& | ||
956 | (walk_state-> | ||
957 | parser_state), | ||
958 | &op, | ||
959 | &walk_state-> | ||
960 | arg_types, | ||
961 | &walk_state-> | ||
962 | arg_count); | ||
963 | |||
964 | } while (op); | ||
965 | |||
966 | return_ACPI_STATUS(status); | ||
967 | } | ||
968 | |||
969 | else if (ACPI_FAILURE(status)) { | ||
970 | |||
971 | /* First error is most important */ | ||
972 | |||
973 | (void) | ||
974 | acpi_ps_complete_this_op(walk_state, | ||
975 | op); | ||
976 | return_ACPI_STATUS(status); | ||
977 | } | ||
978 | } | ||
979 | |||
980 | status2 = acpi_ps_complete_this_op(walk_state, op); | ||
981 | if (ACPI_FAILURE(status2)) { | ||
982 | return_ACPI_STATUS(status2); | ||
983 | } | ||
984 | } | ||
985 | |||
986 | acpi_ps_pop_scope(&(walk_state->parser_state), &op, | ||
987 | &walk_state->arg_types, | ||
988 | &walk_state->arg_count); | ||
989 | |||
990 | } while (op); | ||
991 | |||
992 | return_ACPI_STATUS(status); | ||
993 | } | ||
994 | |||
995 | /******************************************************************************* | ||
996 | * | ||
997 | * FUNCTION: acpi_ps_parse_loop | 379 | * FUNCTION: acpi_ps_parse_loop |
998 | * | 380 | * |
999 | * PARAMETERS: walk_state - Current state | 381 | * PARAMETERS: walk_state - Current state |
@@ -1178,10 +560,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
1178 | walk_state->op_info = | 560 | walk_state->op_info = |
1179 | acpi_ps_get_opcode_info(op->common.aml_opcode); | 561 | acpi_ps_get_opcode_info(op->common.aml_opcode); |
1180 | if (walk_state->op_info->flags & AML_NAMED) { | 562 | if (walk_state->op_info->flags & AML_NAMED) { |
1181 | if (acpi_gbl_depth) { | ||
1182 | acpi_gbl_depth--; | ||
1183 | } | ||
1184 | |||
1185 | if (op->common.aml_opcode == AML_REGION_OP || | 563 | if (op->common.aml_opcode == AML_REGION_OP || |
1186 | op->common.aml_opcode == AML_DATA_REGION_OP) { | 564 | op->common.aml_opcode == AML_DATA_REGION_OP) { |
1187 | /* | 565 | /* |