summaryrefslogtreecommitdiff
path: root/source/compiler/asltransform.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler/asltransform.c')
-rw-r--r--source/compiler/asltransform.c84
1 files changed, 79 insertions, 5 deletions
diff --git a/source/compiler/asltransform.c b/source/compiler/asltransform.c
index dcb60f7a31d9b..67adf82ee287f 100644
--- a/source/compiler/asltransform.c
+++ b/source/compiler/asltransform.c
@@ -205,6 +205,10 @@ TrCheckForBufferMatch (
ACPI_PARSE_OBJECT *Next1,
ACPI_PARSE_OBJECT *Next2);
+static void
+TrDoMethod (
+ ACPI_PARSE_OBJECT *Op);
+
/*******************************************************************************
*
@@ -463,11 +467,8 @@ TrTransformSubtree (
break;
case PARSEOP_METHOD:
- /*
- * TBD: Zero the tempname (_T_x) count. Probably shouldn't be a global,
- * however
- */
- AslGbl_TempCount = 0;
+
+ TrDoMethod (Op);
break;
case PARSEOP_EXTERNAL:
@@ -1240,3 +1241,76 @@ TrCheckForBufferMatch (
return (TRUE);
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrDoMethod
+ *
+ * PARAMETERS: Op - Parse node for SWITCH
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Determine that parameter count of an ASL method node by
+ * translating the parameter count parse node from
+ * PARSEOP_DEFAULT_ARG to PARSEOP_BYTECONST.
+ *
+ ******************************************************************************/
+
+static void
+TrDoMethod (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *ArgCountOp;
+ UINT8 ArgCount;
+ ACPI_PARSE_OBJECT *ParameterOp;
+
+
+ /*
+ * TBD: Zero the tempname (_T_x) count. Probably shouldn't be a global,
+ * however
+ */
+ AslGbl_TempCount = 0;
+
+ ArgCountOp = Op->Asl.Child->Asl.Next;
+ if (ArgCountOp->Asl.ParseOpcode == PARSEOP_BYTECONST)
+ {
+ /*
+ * Parameter count for this method has already been recorded in the
+ * method declaration.
+ */
+ return;
+ }
+
+ /*
+ * Parameter count has been omitted in the method declaration.
+ * Count the amount of arguments here.
+ */
+ ParameterOp = ArgCountOp->Asl.Next->Asl.Next->Asl.Next->Asl.Next;
+ if (ParameterOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ ArgCount = 0;
+ ParameterOp = ParameterOp->Asl.Child;
+
+ while (ParameterOp)
+ {
+ ParameterOp = ParameterOp->Asl.Next;
+ ArgCount++;
+ }
+
+ ArgCountOp->Asl.Value.Integer = ArgCount;
+ ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST;
+ }
+ else
+ {
+ /*
+ * Method parameters can be counted by analyzing the Parameter type
+ * list. If the Parameter list contains more than 1 parameter, it
+ * is nested under PARSEOP_DEFAULT_ARG. When there is only 1
+ * parameter, the parse tree contains a single node representing
+ * that type.
+ */
+ ArgCountOp->Asl.Value.Integer = 1;
+ ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST;
+ }
+}