diff options
author | Robert Moore <Robert.Moore@intel.com> | 2020-02-11 09:31:11 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 09:31:11 -0800 |
commit | fd581820348b6c00454f8b97c5d8fa02b73441b1 (patch) | |
tree | aa2f6f8354d49f597fb7cb5dc01a5a08cbd2a4c0 | |
parent | e93a53d4d312a83a3ec72aa9cfb12d781b4fefca (diff) | |
parent | adb3ecfc0590a6d5852b39447a0779b5fc6c70d4 (diff) | |
download | acpica-fd581820348b6c00454f8b97c5d8fa02b73441b1.tar.gz |
Merge pull request #559 from SchmErik/bz1500
iASL: process return type and parameter types in external declaration
-rw-r--r-- | source/compiler/aslcompiler.h | 9 | ||||
-rw-r--r-- | source/compiler/aslexternal.c | 29 | ||||
-rw-r--r-- | source/compiler/aslload.c | 12 | ||||
-rw-r--r-- | source/compiler/aslmethod.c | 19 |
4 files changed, 39 insertions, 30 deletions
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 8b9d6b1cc..9bebc3801 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -373,6 +373,15 @@ MtMethodAnalysisWalkEnd ( UINT32 Level, void *Context); +UINT32 +MtProcessTypeOp ( + ACPI_PARSE_OBJECT *TypeOp); + +UINT8 +MtProcessParameterTypeList ( + ACPI_PARSE_OBJECT *ParamTypeOp, + UINT32 *TypeList); + /* * aslbtypes - bitfield data types diff --git a/source/compiler/aslexternal.c b/source/compiler/aslexternal.c index a42d383b7..20f54168e 100644 --- a/source/compiler/aslexternal.c +++ b/source/compiler/aslexternal.c @@ -195,6 +195,8 @@ ExDoExternal ( ACPI_PARSE_OBJECT *TypeOp; ACPI_PARSE_OBJECT *ExternTypeOp = Op->Asl.Child->Asl.Next; UINT32 ExternType; + UINT8 ParamCount = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS; + UINT32 ParamTypes[ACPI_METHOD_NUM_ARGS]; ExternType = AnMapObjTypeToBtype (ExternTypeOp); @@ -202,26 +204,31 @@ ExDoExternal ( /* * The parser allows optional parameter return types regardless of the * type. Check object type keyword emit error if optional parameter/return - * types exist + * types exist. + * + * Check the parameter return type */ - if (ExternType != ACPI_BTYPE_METHOD) + TypeOp = ExternTypeOp->Asl.Next; + if (TypeOp->Asl.Child) { - /* Check the parameter return type */ + /* Ignore the return type for now. */ - TypeOp = ExternTypeOp->Asl.Next; - if (TypeOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG || - (TypeOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG && TypeOp->Asl.Child)) + (void) MtProcessTypeOp (TypeOp->Asl.Child); + if (ExternType != ACPI_BTYPE_METHOD) { sprintf (AslGbl_MsgBuffer, "Found type [%s]", AcpiUtGetTypeName(ExternType)); AslError (ASL_ERROR, ASL_MSG_EXTERN_INVALID_RET_TYPE, TypeOp, AslGbl_MsgBuffer); } + } - /* Check the parameter types */ + /* Check the parameter types */ - TypeOp = TypeOp->Asl.Next; - if (TypeOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG || - (TypeOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG && TypeOp->Asl.Child)) + TypeOp = TypeOp->Asl.Next; + if (TypeOp->Asl.Child) + { + ParamCount = MtProcessParameterTypeList (TypeOp, ParamTypes); + if (ExternType != ACPI_BTYPE_METHOD) { sprintf (AslGbl_MsgBuffer, "Found type [%s]", AcpiUtGetTypeName(ExternType)); AslError (ASL_ERROR, ASL_MSG_EXTERN_INVALID_PARAM_TYPE, TypeOp, @@ -232,7 +239,7 @@ ExDoExternal ( ArgCountOp = Op->Asl.Child->Asl.Next->Asl.Next; ArgCountOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST; - ArgCountOp->Asl.Value.Integer = 0; + ArgCountOp->Asl.Value.Integer = ParamCount; UtSetParseOpName (ArgCountOp); /* Create new list node of arbitrary type */ diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index d54cad4c7..284e54269 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -992,15 +992,17 @@ FinishNode: * Set the actual data type if appropriate (EXTERNAL term only) * As of 11/19/2019, ASL External() does not support parameter * counts. When an External method is loaded, the parameter count is - * unknown setting Node->Value to ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS - * indicates that the parameter count for this method is unknown. - * This information is used in ASL cross reference to help determine the - * parameter count through method calls. + * recorded in the external's arg count parameter. The parameter count may + * or may not be known in the declaration. If the value of this node turns + * out to be ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS, it indicates that + * we do not know the parameter count and that we must look at the usage of + * the External method call to get this information. */ if (ActualObjectType != ACPI_TYPE_ANY) { Node->Type = (UINT8) ActualObjectType; - Node->Value = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS; + Node->Value = + Op->Asl.Child->Asl.Next->Asl.Next->Asl.Value.Integer; } if (Op->Asl.ParseOpcode == PARSEOP_METHOD) diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c index 1e1d830d2..d56f4817c 100644 --- a/source/compiler/aslmethod.c +++ b/source/compiler/aslmethod.c @@ -171,15 +171,6 @@ static void MtCheckStaticOperationRegionInMethod ( ACPI_PARSE_OBJECT *Op); -static UINT32 -MtProcessTypeOp ( - ACPI_PARSE_OBJECT *TypeOp); - -static UINT8 -MtProcessParameterTypeList ( - ACPI_PARSE_OBJECT *ParamTypeOp, - UINT32 *TypeList); - /******************************************************************************* * @@ -641,7 +632,7 @@ MtMethodAnalysisWalkBegin ( * ******************************************************************************/ -static UINT32 +UINT32 MtProcessTypeOp ( ACPI_PARSE_OBJECT *TypeOp) { @@ -661,18 +652,18 @@ MtProcessTypeOp ( /******************************************************************************* * - * FUNCTION: MtProcessTypeOp + * FUNCTION: MtProcessParameterTypeList * * PARAMETERS: Op - Op representing a btype * * RETURN: Btype represented by Op * - * DESCRIPTION: Process a parse object that represents single parameter type or - * a return type in method, function, and external declarations. + * DESCRIPTION: Process a parse object that represents a parameter type list in + * method, function, and external declarations. * ******************************************************************************/ -static UINT8 +UINT8 MtProcessParameterTypeList ( ACPI_PARSE_OBJECT *ParamTypeOp, UINT32 *TypeList) |