summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler/aslfold.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/aslfold.c')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslfold.c87
1 files changed, 60 insertions, 27 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslfold.c b/sys/contrib/dev/acpica/compiler/aslfold.c
index 73d100e..8ee845f 100644
--- a/sys/contrib/dev/acpica/compiler/aslfold.c
+++ b/sys/contrib/dev/acpica/compiler/aslfold.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslfold - Constant folding
- * $Revision: 9 $
+ * $Revision: 1.18 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,16 +116,36 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "amlcode.h"
+#include <contrib/dev/acpica/amlcode.h>
-#include "acdispat.h"
-#include "acparser.h"
+#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/acparser.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslfold")
+/* Local prototypes */
+
+static ACPI_STATUS
+OpcAmlEvaluationWalk1 (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+OpcAmlEvaluationWalk2 (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+OpcAmlCheckForConstant (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
/*******************************************************************************
*
@@ -139,7 +159,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
OpcAmlEvaluationWalk1 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -186,7 +206,7 @@ OpcAmlEvaluationWalk1 (
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
OpcAmlEvaluationWalk2 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -232,7 +252,7 @@ OpcAmlEvaluationWalk2 (
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
OpcAmlCheckForConstant (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -254,11 +274,13 @@ OpcAmlCheckForConstant (
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
- DbgPrint (ASL_PARSE_OUTPUT, "**** Valid Target, cannot reduce ****\n");
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "**** Valid Target, cannot reduce ****\n");
}
else
{
- DbgPrint (ASL_PARSE_OUTPUT, "**** Not a Type 3/4/5 opcode ****\n");
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "**** Not a Type 3/4/5 opcode ****\n");
}
if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL)
@@ -276,11 +298,13 @@ OpcAmlCheckForConstant (
*/
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
- AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op, Op->Asl.ParseOpName);
+ AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op,
+ Op->Asl.ParseOpName);
}
else
{
- AslError (ASL_ERROR, ASL_MSG_INVALID_CONSTANT_OP, Op, Op->Asl.ParseOpName);
+ AslError (ASL_ERROR, ASL_MSG_INVALID_CONSTANT_OP, Op,
+ Op->Asl.ParseOpName);
}
return (AE_TYPE);
@@ -340,9 +364,8 @@ OpcAmlConstantWalk (
return (AE_OK);
}
- /*
- * Set the walk type based on the reduction used for this op
- */
+ /* Set the walk type based on the reduction used for this op */
+
if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG)
{
/* Op is a TermArg, constant folding is merely optional */
@@ -374,8 +397,10 @@ OpcAmlConstantWalk (
WalkState->CallerReturnDesc = &ObjDesc;
WalkState->WalkType = WalkType;
- /* Examine the entire subtree -- all nodes must be constants or type 3/4/5 opcodes */
-
+ /*
+ * Examine the entire subtree -- all nodes must be constants
+ * or type 3/4/5 opcodes
+ */
Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD,
OpcAmlCheckForConstant, NULL, WalkState);
@@ -414,10 +439,10 @@ OpcAmlConstantWalk (
OriginalParentOp = Op->Common.Parent;
Op->Common.Parent = RootOp;
- /*
- * Hand off the subtree to the AML interpreter
- */
- Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState);
+ /* Hand off the subtree to the AML interpreter */
+
+ Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE,
+ OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState);
Op->Common.Parent = OriginalParentOp;
/* TBD: we really *should* release the RootOp node */
@@ -436,7 +461,10 @@ OpcAmlConstantWalk (
{
/* We could not resolve the subtree for some reason */
- AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op, Op->Asl.ParseOpName);
+ AslCoreSubsystemError (Op, Status,
+ "Failure during constant evaluation", FALSE);
+ AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op,
+ Op->Asl.ParseOpName);
/* Set the subtree value to ZERO anyway. Eliminates further errors */
@@ -446,7 +474,8 @@ OpcAmlConstantWalk (
}
else
{
- AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op, Op->Asl.ParseOpName);
+ AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op,
+ Op->Asl.ParseOpName);
/*
* Because we know we executed type 3/4/5 opcodes above, we know that
@@ -460,7 +489,8 @@ OpcAmlConstantWalk (
Op->Common.Value.Integer = ObjDesc->Integer.Value;
OpcSetOptimalIntegerSize (Op);
- DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (INTEGER) %8.8X%8.8X\n",
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "Constant expression reduced to (INTEGER) %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
break;
@@ -472,7 +502,8 @@ OpcAmlConstantWalk (
Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1;
Op->Common.Value.String = ObjDesc->String.Pointer;
- DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (STRING) %s\n",
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "Constant expression reduced to (STRING) %s\n",
Op->Common.Value.String);
break;
@@ -482,6 +513,7 @@ OpcAmlConstantWalk (
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Common.AmlOpcode = AML_BUFFER_OP;
+ Op->Asl.CompileFlags = NODE_AML_PACKAGE;
UtSetParseOpName (Op);
/* Child node is the buffer length */
@@ -509,7 +541,8 @@ OpcAmlConstantWalk (
Op->Asl.Next = RootOp;
Op = RootOp;
- DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (BUFFER) length %X\n",
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "Constant expression reduced to (BUFFER) length %X\n",
ObjDesc->Buffer.Length);
break;
OpenPOWER on IntegriCloud