]> Git Repo - linux.git/blob - drivers/acpi/acpica/psobject.c
ACPICA: macros: fix ACPI_ERROR_NAMESPACE macro
[linux.git] / drivers / acpi / acpica / psobject.c
1 /******************************************************************************
2  *
3  * Module Name: psobject - Support for parse objects
4  *
5  *****************************************************************************/
6
7 /*
8  * Copyright (C) 2000 - 2018, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43
44 #include <acpi/acpi.h>
45 #include "accommon.h"
46 #include "acparser.h"
47 #include "amlcode.h"
48 #include "acconvert.h"
49
50 #define _COMPONENT          ACPI_PARSER
51 ACPI_MODULE_NAME("psobject")
52
53 /* Local prototypes */
54 static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state);
55
56 /*******************************************************************************
57  *
58  * FUNCTION:    acpi_ps_get_aml_opcode
59  *
60  * PARAMETERS:  walk_state          - Current state
61  *
62  * RETURN:      Status
63  *
64  * DESCRIPTION: Extract the next AML opcode from the input stream.
65  *
66  ******************************************************************************/
67
68 static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
69 {
70         ACPI_ERROR_ONLY(u32 aml_offset);
71
72         ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state);
73
74         walk_state->aml = walk_state->parser_state.aml;
75         walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state));
76
77         /*
78          * First cut to determine what we have found:
79          * 1) A valid AML opcode
80          * 2) A name string
81          * 3) An unknown/invalid opcode
82          */
83         walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);
84
85         switch (walk_state->op_info->class) {
86         case AML_CLASS_ASCII:
87         case AML_CLASS_PREFIX:
88                 /*
89                  * Starts with a valid prefix or ASCII char, this is a name
90                  * string. Convert the bare name string to a namepath.
91                  */
92                 walk_state->opcode = AML_INT_NAMEPATH_OP;
93                 walk_state->arg_types = ARGP_NAMESTRING;
94                 break;
95
96         case AML_CLASS_UNKNOWN:
97
98                 /* The opcode is unrecognized. Complain and skip unknown opcodes */
99
100                 if (walk_state->pass_number == 2) {
101                         ACPI_ERROR_ONLY(aml_offset =
102                                         (u32)ACPI_PTR_DIFF(walk_state->aml,
103                                                            walk_state->
104                                                            parser_state.
105                                                            aml_start));
106
107                         ACPI_ERROR((AE_INFO,
108                                     "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
109                                     walk_state->opcode,
110                                     (u32)(aml_offset +
111                                           sizeof(struct acpi_table_header))));
112
113                         ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16),
114                                          48);
115
116 #ifdef ACPI_ASL_COMPILER
117                         /*
118                          * This is executed for the disassembler only. Output goes
119                          * to the disassembled ASL output file.
120                          */
121                         acpi_os_printf
122                             ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
123                              walk_state->opcode,
124                              (u32)(aml_offset +
125                                    sizeof(struct acpi_table_header)));
126
127                         ACPI_ERROR((AE_INFO,
128                                     "Aborting disassembly, AML byte code is corrupt"));
129
130                         /* Dump the context surrounding the invalid opcode */
131
132                         acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.
133                                              aml - 16), 48, DB_BYTE_DISPLAY,
134                                             (aml_offset +
135                                              sizeof(struct acpi_table_header) -
136                                              16));
137                         acpi_os_printf(" */\n");
138
139                         /*
140                          * Just abort the disassembly, cannot continue because the
141                          * parser is essentially lost. The disassembler can then
142                          * randomly fail because an ill-constructed parse tree
143                          * can result.
144                          */
145                         return_ACPI_STATUS(AE_AML_BAD_OPCODE);
146 #endif
147                 }
148
149                 /* Increment past one-byte or two-byte opcode */
150
151                 walk_state->parser_state.aml++;
152                 if (walk_state->opcode > 0xFF) {        /* Can only happen if first byte is 0x5B */
153                         walk_state->parser_state.aml++;
154                 }
155
156                 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
157
158         default:
159
160                 /* Found opcode info, this is a normal opcode */
161
162                 walk_state->parser_state.aml +=
163                     acpi_ps_get_opcode_size(walk_state->opcode);
164                 walk_state->arg_types = walk_state->op_info->parse_args;
165                 break;
166         }
167
168         return_ACPI_STATUS(AE_OK);
169 }
170
171 /*******************************************************************************
172  *
173  * FUNCTION:    acpi_ps_build_named_op
174  *
175  * PARAMETERS:  walk_state          - Current state
176  *              aml_op_start        - Begin of named Op in AML
177  *              unnamed_op          - Early Op (not a named Op)
178  *              op                  - Returned Op
179  *
180  * RETURN:      Status
181  *
182  * DESCRIPTION: Parse a named Op
183  *
184  ******************************************************************************/
185
186 acpi_status
187 acpi_ps_build_named_op(struct acpi_walk_state *walk_state,
188                        u8 *aml_op_start,
189                        union acpi_parse_object *unnamed_op,
190                        union acpi_parse_object **op)
191 {
192         acpi_status status = AE_OK;
193         union acpi_parse_object *arg = NULL;
194
195         ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state);
196
197         unnamed_op->common.value.arg = NULL;
198         unnamed_op->common.arg_list_length = 0;
199         unnamed_op->common.aml_opcode = walk_state->opcode;
200
201         /*
202          * Get and append arguments until we find the node that contains
203          * the name (the type ARGP_NAME).
204          */
205         while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) &&
206                (GET_CURRENT_ARG_TYPE(walk_state->arg_types) != ARGP_NAME)) {
207                 ASL_CV_CAPTURE_COMMENTS(walk_state);
208                 status =
209                     acpi_ps_get_next_arg(walk_state,
210                                          &(walk_state->parser_state),
211                                          GET_CURRENT_ARG_TYPE(walk_state->
212                                                               arg_types), &arg);
213                 if (ACPI_FAILURE(status)) {
214                         return_ACPI_STATUS(status);
215                 }
216
217                 acpi_ps_append_arg(unnamed_op, arg);
218                 INCREMENT_ARG_LIST(walk_state->arg_types);
219         }
220
221         /* are there any inline comments associated with the name_seg?? If so, save this. */
222
223         ASL_CV_CAPTURE_COMMENTS(walk_state);
224
225 #ifdef ACPI_ASL_COMPILER
226         if (acpi_gbl_current_inline_comment != NULL) {
227                 unnamed_op->common.name_comment =
228                     acpi_gbl_current_inline_comment;
229                 acpi_gbl_current_inline_comment = NULL;
230         }
231 #endif
232
233         /*
234          * Make sure that we found a NAME and didn't run out of arguments
235          */
236         if (!GET_CURRENT_ARG_TYPE(walk_state->arg_types)) {
237                 return_ACPI_STATUS(AE_AML_NO_OPERAND);
238         }
239
240         /* We know that this arg is a name, move to next arg */
241
242         INCREMENT_ARG_LIST(walk_state->arg_types);
243
244         /*
245          * Find the object. This will either insert the object into
246          * the namespace or simply look it up
247          */
248         walk_state->op = NULL;
249
250         status = walk_state->descending_callback(walk_state, op);
251         if (ACPI_FAILURE(status)) {
252                 if (status != AE_CTRL_TERMINATE) {
253                         ACPI_EXCEPTION((AE_INFO, status,
254                                         "During name lookup/catalog"));
255                 }
256                 return_ACPI_STATUS(status);
257         }
258
259         if (!*op) {
260                 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
261         }
262
263         status = acpi_ps_next_parse_state(walk_state, *op, status);
264         if (ACPI_FAILURE(status)) {
265                 if (status == AE_CTRL_PENDING) {
266                         status = AE_CTRL_PARSE_PENDING;
267                 }
268                 return_ACPI_STATUS(status);
269         }
270
271         acpi_ps_append_arg(*op, unnamed_op->common.value.arg);
272
273 #ifdef ACPI_ASL_COMPILER
274
275         /* save any comments that might be associated with unnamed_op. */
276
277         (*op)->common.inline_comment = unnamed_op->common.inline_comment;
278         (*op)->common.end_node_comment = unnamed_op->common.end_node_comment;
279         (*op)->common.close_brace_comment =
280             unnamed_op->common.close_brace_comment;
281         (*op)->common.name_comment = unnamed_op->common.name_comment;
282         (*op)->common.comment_list = unnamed_op->common.comment_list;
283         (*op)->common.end_blk_comment = unnamed_op->common.end_blk_comment;
284         (*op)->common.cv_filename = unnamed_op->common.cv_filename;
285         (*op)->common.cv_parent_filename =
286             unnamed_op->common.cv_parent_filename;
287         (*op)->named.aml = unnamed_op->common.aml;
288
289         unnamed_op->common.inline_comment = NULL;
290         unnamed_op->common.end_node_comment = NULL;
291         unnamed_op->common.close_brace_comment = NULL;
292         unnamed_op->common.name_comment = NULL;
293         unnamed_op->common.comment_list = NULL;
294         unnamed_op->common.end_blk_comment = NULL;
295 #endif
296
297         if ((*op)->common.aml_opcode == AML_REGION_OP ||
298             (*op)->common.aml_opcode == AML_DATA_REGION_OP) {
299                 /*
300                  * Defer final parsing of an operation_region body, because we don't
301                  * have enough info in the first pass to parse it correctly (i.e.,
302                  * there may be method calls within the term_arg elements of the body.)
303                  *
304                  * However, we must continue parsing because the opregion is not a
305                  * standalone package -- we don't know where the end is at this point.
306                  *
307                  * (Length is unknown until parse of the body complete)
308                  */
309                 (*op)->named.data = aml_op_start;
310                 (*op)->named.length = 0;
311         }
312
313         return_ACPI_STATUS(AE_OK);
314 }
315
316 /*******************************************************************************
317  *
318  * FUNCTION:    acpi_ps_create_op
319  *
320  * PARAMETERS:  walk_state          - Current state
321  *              aml_op_start        - Op start in AML
322  *              new_op              - Returned Op
323  *
324  * RETURN:      Status
325  *
326  * DESCRIPTION: Get Op from AML
327  *
328  ******************************************************************************/
329
330 acpi_status
331 acpi_ps_create_op(struct acpi_walk_state *walk_state,
332                   u8 *aml_op_start, union acpi_parse_object **new_op)
333 {
334         acpi_status status = AE_OK;
335         union acpi_parse_object *op;
336         union acpi_parse_object *named_op = NULL;
337         union acpi_parse_object *parent_scope;
338         u8 argument_count;
339         const struct acpi_opcode_info *op_info;
340
341         ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state);
342
343         status = acpi_ps_get_aml_opcode(walk_state);
344         if (status == AE_CTRL_PARSE_CONTINUE) {
345                 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
346         }
347         if (ACPI_FAILURE(status)) {
348                 return_ACPI_STATUS(status);
349         }
350
351         /* Create Op structure and append to parent's argument list */
352
353         walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);
354         op = acpi_ps_alloc_op(walk_state->opcode, aml_op_start);
355         if (!op) {
356                 return_ACPI_STATUS(AE_NO_MEMORY);
357         }
358
359         if (walk_state->op_info->flags & AML_NAMED) {
360                 status =
361                     acpi_ps_build_named_op(walk_state, aml_op_start, op,
362                                            &named_op);
363                 acpi_ps_free_op(op);
364
365 #ifdef ACPI_ASL_COMPILER
366                 if (acpi_gbl_disasm_flag
367                     && walk_state->opcode == AML_EXTERNAL_OP
368                     && status == AE_NOT_FOUND) {
369                         /*
370                          * If parsing of AML_EXTERNAL_OP's name path fails, then skip
371                          * past this opcode and keep parsing. This is a much better
372                          * alternative than to abort the entire disassembler. At this
373                          * point, the parser_state is at the end of the namepath of the
374                          * external declaration opcode. Setting walk_state->Aml to
375                          * walk_state->parser_state.Aml + 2 moves increments the
376                          * walk_state->Aml past the object type and the paramcount of the
377                          * external opcode.
378                          */
379                         walk_state->aml = walk_state->parser_state.aml + 2;
380                         walk_state->parser_state.aml = walk_state->aml;
381                         return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
382                 }
383 #endif
384                 if (ACPI_FAILURE(status)) {
385                         return_ACPI_STATUS(status);
386                 }
387
388                 *new_op = named_op;
389                 return_ACPI_STATUS(AE_OK);
390         }
391
392         /* Not a named opcode, just allocate Op and append to parent */
393
394         if (walk_state->op_info->flags & AML_CREATE) {
395                 /*
396                  * Backup to beginning of create_XXXfield declaration
397                  * body_length is unknown until we parse the body
398                  */
399                 op->named.data = aml_op_start;
400                 op->named.length = 0;
401         }
402
403         if (walk_state->opcode == AML_BANK_FIELD_OP) {
404                 /*
405                  * Backup to beginning of bank_field declaration
406                  * body_length is unknown until we parse the body
407                  */
408                 op->named.data = aml_op_start;
409                 op->named.length = 0;
410         }
411
412         parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state));
413         acpi_ps_append_arg(parent_scope, op);
414
415         if (parent_scope) {
416                 op_info =
417                     acpi_ps_get_opcode_info(parent_scope->common.aml_opcode);
418                 if (op_info->flags & AML_HAS_TARGET) {
419                         argument_count =
420                             acpi_ps_get_argument_count(op_info->type);
421                         if (parent_scope->common.arg_list_length >
422                             argument_count) {
423                                 op->common.flags |= ACPI_PARSEOP_TARGET;
424                         }
425                 }
426
427                 /*
428                  * Special case for both Increment() and Decrement(), where
429                  * the lone argument is both a source and a target.
430                  */
431                 else if ((parent_scope->common.aml_opcode == AML_INCREMENT_OP)
432                          || (parent_scope->common.aml_opcode ==
433                              AML_DECREMENT_OP)) {
434                         op->common.flags |= ACPI_PARSEOP_TARGET;
435                 }
436         }
437
438         if (walk_state->descending_callback != NULL) {
439                 /*
440                  * Find the object. This will either insert the object into
441                  * the namespace or simply look it up
442                  */
443                 walk_state->op = *new_op = op;
444
445                 status = walk_state->descending_callback(walk_state, &op);
446                 status = acpi_ps_next_parse_state(walk_state, op, status);
447                 if (status == AE_CTRL_PENDING) {
448                         status = AE_CTRL_PARSE_PENDING;
449                 }
450         }
451
452         return_ACPI_STATUS(status);
453 }
454
455 /*******************************************************************************
456  *
457  * FUNCTION:    acpi_ps_complete_op
458  *
459  * PARAMETERS:  walk_state          - Current state
460  *              op                  - Returned Op
461  *              status              - Parse status before complete Op
462  *
463  * RETURN:      Status
464  *
465  * DESCRIPTION: Complete Op
466  *
467  ******************************************************************************/
468
469 acpi_status
470 acpi_ps_complete_op(struct acpi_walk_state *walk_state,
471                     union acpi_parse_object **op, acpi_status status)
472 {
473         acpi_status status2;
474
475         ACPI_FUNCTION_TRACE_PTR(ps_complete_op, walk_state);
476
477         /*
478          * Finished one argument of the containing scope
479          */
480         walk_state->parser_state.scope->parse_scope.arg_count--;
481
482         /* Close this Op (will result in parse subtree deletion) */
483
484         status2 = acpi_ps_complete_this_op(walk_state, *op);
485         if (ACPI_FAILURE(status2)) {
486                 return_ACPI_STATUS(status2);
487         }
488
489         *op = NULL;
490
491         switch (status) {
492         case AE_OK:
493
494                 break;
495
496         case AE_CTRL_TRANSFER:
497
498                 /* We are about to transfer to a called method */
499
500                 walk_state->prev_op = NULL;
501                 walk_state->prev_arg_types = walk_state->arg_types;
502                 return_ACPI_STATUS(status);
503
504         case AE_CTRL_END:
505
506                 acpi_ps_pop_scope(&(walk_state->parser_state), op,
507                                   &walk_state->arg_types,
508                                   &walk_state->arg_count);
509
510                 if (*op) {
511                         walk_state->op = *op;
512                         walk_state->op_info =
513                             acpi_ps_get_opcode_info((*op)->common.aml_opcode);
514                         walk_state->opcode = (*op)->common.aml_opcode;
515
516                         status = walk_state->ascending_callback(walk_state);
517                         status =
518                             acpi_ps_next_parse_state(walk_state, *op, status);
519
520                         status2 = acpi_ps_complete_this_op(walk_state, *op);
521                         if (ACPI_FAILURE(status2)) {
522                                 return_ACPI_STATUS(status2);
523                         }
524                 }
525
526                 status = AE_OK;
527                 break;
528
529         case AE_CTRL_BREAK:
530         case AE_CTRL_CONTINUE:
531
532                 /* Pop off scopes until we find the While */
533
534                 while (!(*op) || ((*op)->common.aml_opcode != AML_WHILE_OP)) {
535                         acpi_ps_pop_scope(&(walk_state->parser_state), op,
536                                           &walk_state->arg_types,
537                                           &walk_state->arg_count);
538                 }
539
540                 /* Close this iteration of the While loop */
541
542                 walk_state->op = *op;
543                 walk_state->op_info =
544                     acpi_ps_get_opcode_info((*op)->common.aml_opcode);
545                 walk_state->opcode = (*op)->common.aml_opcode;
546
547                 status = walk_state->ascending_callback(walk_state);
548                 status = acpi_ps_next_parse_state(walk_state, *op, status);
549
550                 status2 = acpi_ps_complete_this_op(walk_state, *op);
551                 if (ACPI_FAILURE(status2)) {
552                         return_ACPI_STATUS(status2);
553                 }
554
555                 status = AE_OK;
556                 break;
557
558         case AE_CTRL_TERMINATE:
559
560                 /* Clean up */
561                 do {
562                         if (*op) {
563                                 status2 =
564                                     acpi_ps_complete_this_op(walk_state, *op);
565                                 if (ACPI_FAILURE(status2)) {
566                                         return_ACPI_STATUS(status2);
567                                 }
568
569                                 acpi_ut_delete_generic_state
570                                     (acpi_ut_pop_generic_state
571                                      (&walk_state->control_state));
572                         }
573
574                         acpi_ps_pop_scope(&(walk_state->parser_state), op,
575                                           &walk_state->arg_types,
576                                           &walk_state->arg_count);
577
578                 } while (*op);
579
580                 return_ACPI_STATUS(AE_OK);
581
582         default:                /* All other non-AE_OK status */
583
584                 do {
585                         if (*op) {
586                                 status2 =
587                                     acpi_ps_complete_this_op(walk_state, *op);
588                                 if (ACPI_FAILURE(status2)) {
589                                         return_ACPI_STATUS(status2);
590                                 }
591                         }
592
593                         acpi_ps_pop_scope(&(walk_state->parser_state), op,
594                                           &walk_state->arg_types,
595                                           &walk_state->arg_count);
596
597                 } while (*op);
598
599 #if 0
600                 /*
601                  * TBD: Cleanup parse ops on error
602                  */
603                 if (*op == NULL) {
604                         acpi_ps_pop_scope(parser_state, op,
605                                           &walk_state->arg_types,
606                                           &walk_state->arg_count);
607                 }
608 #endif
609                 walk_state->prev_op = NULL;
610                 walk_state->prev_arg_types = walk_state->arg_types;
611                 return_ACPI_STATUS(status);
612         }
613
614         /* This scope complete? */
615
616         if (acpi_ps_has_completed_scope(&(walk_state->parser_state))) {
617                 acpi_ps_pop_scope(&(walk_state->parser_state), op,
618                                   &walk_state->arg_types,
619                                   &walk_state->arg_count);
620                 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *op));
621         } else {
622                 *op = NULL;
623         }
624
625         return_ACPI_STATUS(AE_OK);
626 }
627
628 /*******************************************************************************
629  *
630  * FUNCTION:    acpi_ps_complete_final_op
631  *
632  * PARAMETERS:  walk_state          - Current state
633  *              op                  - Current Op
634  *              status              - Current parse status before complete last
635  *                                    Op
636  *
637  * RETURN:      Status
638  *
639  * DESCRIPTION: Complete last Op.
640  *
641  ******************************************************************************/
642
643 acpi_status
644 acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
645                           union acpi_parse_object *op, acpi_status status)
646 {
647         acpi_status status2;
648
649         ACPI_FUNCTION_TRACE_PTR(ps_complete_final_op, walk_state);
650
651         /*
652          * Complete the last Op (if not completed), and clear the scope stack.
653          * It is easily possible to end an AML "package" with an unbounded number
654          * of open scopes (such as when several ASL blocks are closed with
655          * sequential closing braces). We want to terminate each one cleanly.
656          */
657         ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n",
658                           op));
659         do {
660                 if (op) {
661                         if (walk_state->ascending_callback != NULL) {
662                                 walk_state->op = op;
663                                 walk_state->op_info =
664                                     acpi_ps_get_opcode_info(op->common.
665                                                             aml_opcode);
666                                 walk_state->opcode = op->common.aml_opcode;
667
668                                 status =
669                                     walk_state->ascending_callback(walk_state);
670                                 status =
671                                     acpi_ps_next_parse_state(walk_state, op,
672                                                              status);
673                                 if (status == AE_CTRL_PENDING) {
674                                         status =
675                                             acpi_ps_complete_op(walk_state, &op,
676                                                                 AE_OK);
677                                         if (ACPI_FAILURE(status)) {
678                                                 return_ACPI_STATUS(status);
679                                         }
680                                 }
681
682                                 if (status == AE_CTRL_TERMINATE) {
683                                         status = AE_OK;
684
685                                         /* Clean up */
686                                         do {
687                                                 if (op) {
688                                                         status2 =
689                                                             acpi_ps_complete_this_op
690                                                             (walk_state, op);
691                                                         if (ACPI_FAILURE
692                                                             (status2)) {
693                                                                 return_ACPI_STATUS
694                                                                     (status2);
695                                                         }
696                                                 }
697
698                                                 acpi_ps_pop_scope(&
699                                                                   (walk_state->
700                                                                    parser_state),
701                                                                   &op,
702                                                                   &walk_state->
703                                                                   arg_types,
704                                                                   &walk_state->
705                                                                   arg_count);
706
707                                         } while (op);
708
709                                         return_ACPI_STATUS(status);
710                                 }
711
712                                 else if (ACPI_FAILURE(status)) {
713
714                                         /* First error is most important */
715
716                                         (void)
717                                             acpi_ps_complete_this_op(walk_state,
718                                                                      op);
719                                         return_ACPI_STATUS(status);
720                                 }
721                         }
722
723                         status2 = acpi_ps_complete_this_op(walk_state, op);
724                         if (ACPI_FAILURE(status2)) {
725                                 return_ACPI_STATUS(status2);
726                         }
727                 }
728
729                 acpi_ps_pop_scope(&(walk_state->parser_state), &op,
730                                   &walk_state->arg_types,
731                                   &walk_state->arg_count);
732
733         } while (op);
734
735         return_ACPI_STATUS(status);
736 }
This page took 0.076755 seconds and 4 git commands to generate.