From 2c075154faae7ec6a4eac3766cfa49a956ae883e Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Wed, 7 Aug 2013 10:16:18 -0700 Subject: [PATCH] Revert "Add support for method invocation as a target operand for ASL operators." This reverts commit f2fd7294de5b93a778160064f6d61df1792f0d0f. Change was seen to cause problems with the ASLTS test suite and will need to be reworked/readdressed. --- source/components/parser/psargs.c | 68 ++++++++++++++++++++++++++++--- source/components/parser/psloop.c | 4 -- 2 files changed, 62 insertions(+), 10 deletions(-) diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c index fc06e4f72..938a4f1f8 100644 --- a/source/components/parser/psargs.c +++ b/source/components/parser/psargs.c @@ -335,6 +335,7 @@ AcpiPsGetNextNamepath ( ACPI_PARSE_OBJECT *NameOp; ACPI_OPERAND_OBJECT *MethodDesc; ACPI_NAMESPACE_NODE *Node; + UINT8 *Start = ParserState->Aml; ACPI_FUNCTION_TRACE (PsGetNextNamepath); @@ -371,10 +372,24 @@ AcpiPsGetNextNamepath ( PossibleMethodCall && (Node->Type == ACPI_TYPE_METHOD)) { + if (WalkState->Opcode == AML_UNLOAD_OP) + { + /* + * AcpiPsGetNextNamestring has increased the AML pointer, + * so we need to restore the saved AML pointer for method call. + */ + WalkState->ParserState.Aml = Start; + WalkState->ArgCount = 1; + AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); + return_ACPI_STATUS (AE_OK); + } /* This name is actually a control method invocation */ MethodDesc = AcpiNsGetAttachedObject (Node); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Control Method - %p Desc %p Path=%p\n", Node, MethodDesc, Path)); + NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); if (!NameOp) { @@ -400,8 +415,8 @@ AcpiPsGetNextNamepath ( } ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Method invocation [%4.4s] - Args %X, %p\n", - Node->Name.Ascii, MethodDesc->Method.ParamCount, Node)); + "Control Method - %p Args %X\n", + Node, MethodDesc->Method.ParamCount)); /* Get the number of arguments to expect */ @@ -825,6 +840,7 @@ AcpiPsGetNextArg ( ACPI_PARSE_OBJECT *Arg = NULL; ACPI_PARSE_OBJECT *Prev = NULL; ACPI_PARSE_OBJECT *Field; + UINT32 Subop; ACPI_STATUS Status = AE_OK; @@ -915,12 +931,52 @@ AcpiPsGetNextArg ( case ARGP_TARGET: case ARGP_SUPERNAME: case ARGP_SIMPLENAME: + + Subop = AcpiPsPeekOpcode (ParserState); + if (Subop == 0 || + AcpiPsIsLeadingChar (Subop) || + ACPI_IS_ROOT_PREFIX (Subop) || + ACPI_IS_PARENT_PREFIX (Subop)) + { + /* NullName or NameString */ + + Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); + if (!Arg) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* To support SuperName arg of Unload */ + + if (WalkState->Opcode == AML_UNLOAD_OP) + { + Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 1); + + /* + * If the SuperName arg of Unload is a method call, + * we have restored the AML pointer, just free this Arg + */ + if (Arg->Common.AmlOpcode == AML_INT_METHODCALL_OP) + { + AcpiPsFreeOp (Arg); + Arg = NULL; + } + } + else + { + Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 0); + } + } + else + { + /* Single complex argument, nothing returned */ + + WalkState->ArgCount = 1; + } + break; + case ARGP_DATAOBJ: case ARGP_TERMARG: - /* - * These terms must be treated as a possible complex argument - * (such as a method invocation). - */ /* Single complex argument, nothing returned */ diff --git a/source/components/parser/psloop.c b/source/components/parser/psloop.c index 8849f961f..d9d454857 100644 --- a/source/components/parser/psloop.c +++ b/source/components/parser/psloop.c @@ -217,10 +217,6 @@ AcpiPsGetArguments ( return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Pass1: GetNextArg loop - Arg %p, Count %d\n", - Arg, WalkState->ArgCount)); - if (Arg) { Arg->Common.AmlOffset = WalkState->AmlOffset;