X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Facpi%2Fparser%2Fpsloop.c;h=e1541db3753a75a41a813171d741d3329a73a114;hb=81a07d7588d376c530d006e24d7981304ce96e16;hp=088d33999d9076b17575502b0bb5fc99906e51a0;hpb=35d91f75c2c9548e606e813413f03c5cc35da969;p=powerpc.git diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index 088d33999d..e1541db375 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -83,7 +83,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) struct acpi_parse_state *parser_state; u8 *aml_op_start = NULL; - ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state); + ACPI_FUNCTION_TRACE_PTR(ps_parse_loop, walk_state); if (walk_state->descending_callback == NULL) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -95,6 +95,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { + /* We are restarting a preempted control method */ if (acpi_ps_has_completed_scope(parser_state)) { @@ -123,16 +124,12 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) && ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) { if (status == AE_AML_NO_RETURN_VALUE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invoked method did not return a value, %s\n", - acpi_format_exception - (status))); + ACPI_EXCEPTION((AE_INFO, status, + "Invoked method did not return a value")); } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "get_predicate Failed, %s\n", - acpi_format_exception - (status))); + ACPI_EXCEPTION((AE_INFO, status, + "GetPredicate Failed")); return_ACPI_STATUS(status); } @@ -147,6 +144,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op)); } else if (walk_state->prev_op) { + /* We were in the middle of an op */ op = walk_state->prev_op; @@ -160,6 +158,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) while ((parser_state->aml < parser_state->aml_end) || (op)) { aml_op_start = parser_state->aml; if (!op) { + /* Get the next opcode from the AML stream */ walk_state->aml_offset = @@ -190,11 +189,11 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) /* The opcode is unrecognized. Just skip unknown opcodes */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Found unknown opcode %X at AML address %p offset %X, ignoring\n", - walk_state->opcode, - parser_state->aml, - walk_state->aml_offset)); + ACPI_ERROR((AE_INFO, + "Found unknown opcode %X at AML address %p offset %X, ignoring", + walk_state->opcode, + parser_state->aml, + walk_state->aml_offset)); ACPI_DUMP_BUFFER(parser_state->aml, 128); @@ -217,6 +216,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) /* Create Op structure and append to parent's argument list */ if (walk_state->op_info->flags & AML_NAMED) { + /* Allocate a new pre_op if necessary */ if (!pre_op) { @@ -281,10 +281,8 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) walk_state->descending_callback(walk_state, &op); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "During name lookup/catalog, %s\n", - acpi_format_exception - (status))); + ACPI_EXCEPTION((AE_INFO, status, + "During name lookup/catalog")); goto close_this_op; } @@ -377,7 +375,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) if (walk_state->op_info) { ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n", + "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n", (u32) op->common.aml_opcode, walk_state->op_info->name, op, parser_state->aml, @@ -394,6 +392,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) /* Are there any arguments that must be processed? */ if (walk_state->arg_types) { + /* Get arguments */ switch (op->common.aml_opcode) { @@ -704,6 +703,15 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types, &walk_state->arg_count); + + if (op->common.aml_opcode != AML_WHILE_OP) { + status2 = + acpi_ds_result_stack_pop + (walk_state); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); + } + } } /* Close this iteration of the While loop */ @@ -739,7 +747,19 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) if (ACPI_FAILURE(status2)) { return_ACPI_STATUS(status2); } + + status2 = + acpi_ds_result_stack_pop + (walk_state); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); + } + + acpi_ut_delete_generic_state + (acpi_ut_pop_generic_state + (&walk_state->control_state)); } + acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types, &walk_state->arg_count); @@ -759,6 +779,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) return_ACPI_STATUS(status2); } } + acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types, &walk_state->arg_count); @@ -850,6 +871,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) } else if (ACPI_FAILURE(status)) { + /* First error is most important */ (void)