summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/psparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/psparse.c')
-rw-r--r--sys/contrib/dev/acpica/psparse.c207
1 files changed, 106 insertions, 101 deletions
diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c
index 5783fa6..fc98019 100644
--- a/sys/contrib/dev/acpica/psparse.c
+++ b/sys/contrib/dev/acpica/psparse.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
- * $Revision: 144 $
+ * $Revision: 146 $
*
*****************************************************************************/
@@ -240,141 +240,143 @@ AcpiPsCompleteThisOp (
/* Delete this op and the subtree below it if asked to */
- if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) == ACPI_PARSE_DELETE_TREE) &&
- (WalkState->OpInfo->Class != AML_CLASS_ARGUMENT))
+ if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
+ (WalkState->OpInfo->Class == AML_CLASS_ARGUMENT))
{
- /* Make sure that we only delete this subtree */
+ return_VOID;
+ }
+
+ /* Make sure that we only delete this subtree */
- if (Op->Common.Parent)
+ if (Op->Common.Parent)
+ {
+ /*
+ * Check if we need to replace the operator and its subtree
+ * with a return value op (placeholder op)
+ */
+ ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
+
+ switch (ParentInfo->Class)
{
+ case AML_CLASS_CONTROL:
+ break;
+
+ case AML_CLASS_CREATE:
+
/*
- * Check if we need to replace the operator and its subtree
- * with a return value op (placeholder op)
+ * These opcodes contain TermArg operands. The current
+ * op must be replaced by a placeholder return op
*/
- ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
-
- switch (ParentInfo->Class)
+ ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+ if (!ReplacementOp)
{
- case AML_CLASS_CONTROL:
- break;
+ goto Cleanup;
+ }
+ break;
- case AML_CLASS_CREATE:
+ case AML_CLASS_NAMED_OBJECT:
- /*
- * These opcodes contain TermArg operands. The current
- * op must be replaced by a placeholder return op
- */
+ /*
+ * These opcodes contain TermArg operands. The current
+ * op must be replaced by a placeholder return op
+ */
+ if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+ {
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
{
- return_VOID;
+ goto Cleanup;
}
- break;
+ }
- case AML_CLASS_NAMED_OBJECT:
+ if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
+ (WalkState->DescendingCallback != AcpiDsExecBeginOp))
- /*
- * These opcodes contain TermArg operands. The current
- * op must be replaced by a placeholder return op
- */
- if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) ||
- (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) ||
- (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
- (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
- (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+ {
+ if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||
+ (Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
{
- ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+ ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
if (!ReplacementOp)
{
- return_VOID;
+ goto Cleanup;
}
+
+ ReplacementOp->Named.Data = Op->Named.Data;
+ ReplacementOp->Named.Length = Op->Named.Length;
}
+ }
+ break;
- if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
- (WalkState->DescendingCallback != AcpiDsExecBeginOp))
+ default:
+ ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+ if (!ReplacementOp)
+ {
+ goto Cleanup;
+ }
+ }
- {
- if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||
- (Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
- (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
- {
- ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
- if (!ReplacementOp)
- {
- return_VOID;
- }
+ /* We must unlink this op from the parent tree */
- ReplacementOp->Named.Data = Op->Named.Data;
- ReplacementOp->Named.Length = Op->Named.Length;
- }
- }
- break;
+ Prev = Op->Common.Parent->Common.Value.Arg;
+ if (Prev == Op)
+ {
+ /* This op is the first in the list */
- default:
- ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
- if (!ReplacementOp)
- {
- return_VOID;
- }
+ if (ReplacementOp)
+ {
+ ReplacementOp->Common.Parent = Op->Common.Parent;
+ ReplacementOp->Common.Value.Arg = NULL;
+ ReplacementOp->Common.Node = Op->Common.Node;
+ Op->Common.Parent->Common.Value.Arg = ReplacementOp;
+ ReplacementOp->Common.Next = Op->Common.Next;
}
+ else
+ {
+ Op->Common.Parent->Common.Value.Arg = Op->Common.Next;
+ }
+ }
- /* We must unlink this op from the parent tree */
+ /* Search the parent list */
- Prev = Op->Common.Parent->Common.Value.Arg;
- if (Prev == Op)
- {
- /* This op is the first in the list */
+ else while (Prev)
+ {
+ /* Traverse all siblings in the parent's argument list */
+ Next = Prev->Common.Next;
+ if (Next == Op)
+ {
if (ReplacementOp)
{
- ReplacementOp->Common.Parent = Op->Common.Parent;
- ReplacementOp->Common.Value.Arg = NULL;
- ReplacementOp->Common.Node = Op->Common.Node;
- Op->Common.Parent->Common.Value.Arg = ReplacementOp;
- ReplacementOp->Common.Next = Op->Common.Next;
+ ReplacementOp->Common.Parent = Op->Common.Parent;
+ ReplacementOp->Common.Value.Arg = NULL;
+ ReplacementOp->Common.Node = Op->Common.Node;
+ Prev->Common.Next = ReplacementOp;
+ ReplacementOp->Common.Next = Op->Common.Next;
+ Next = NULL;
}
else
{
- Op->Common.Parent->Common.Value.Arg = Op->Common.Next;
+ Prev->Common.Next = Op->Common.Next;
+ Next = NULL;
}
}
- /* Search the parent list */
-
- else while (Prev)
- {
- /* Traverse all siblings in the parent's argument list */
-
- Next = Prev->Common.Next;
- if (Next == Op)
- {
- if (ReplacementOp)
- {
- ReplacementOp->Common.Parent = Op->Common.Parent;
- ReplacementOp->Common.Value.Arg = NULL;
- ReplacementOp->Common.Node = Op->Common.Node;
- Prev->Common.Next = ReplacementOp;
- ReplacementOp->Common.Next = Op->Common.Next;
- Next = NULL;
- }
- else
- {
- Prev->Common.Next = Op->Common.Next;
- Next = NULL;
- }
- }
-
- Prev = Next;
- }
+ Prev = Next;
}
+ }
- /* Now we can actually delete the subtree rooted at op */
- AcpiPsDeleteParseTree (Op);
+Cleanup:
- return_VOID;
- }
+ /* Now we can actually delete the subtree rooted at op */
+ AcpiPsDeleteParseTree (Op);
return_VOID;
}
@@ -661,7 +663,8 @@ AcpiPsParseLoop (
PreOp = AcpiPsAllocOp (WalkState->Opcode);
if (!PreOp)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto CloseThisOp;
}
}
@@ -690,7 +693,8 @@ AcpiPsParseLoop (
if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
{
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ Status = AE_AML_NO_OPERAND;
+ goto CloseThisOp;
}
/* We know that this arg is a name, move to next arg */
@@ -757,7 +761,8 @@ AcpiPsParseLoop (
Op = AcpiPsAllocOp (WalkState->Opcode);
if (!Op)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto CloseThisOp;
}
if (WalkState->OpInfo->Flags & AML_CREATE)
@@ -936,7 +941,7 @@ AcpiPsParseLoop (
WalkState->ArgTypes, WalkState->ArgCount);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto CloseThisOp;
}
Op = NULL;
continue;
@@ -1293,7 +1298,7 @@ AcpiPsParseAml (
{
Status = AE_OK;
}
- else if (Status != AE_OK)
+ else if ((Status != AE_OK) && (WalkState->MethodDesc))
{
ACPI_REPORT_METHOD_ERROR ("Method execution failed",
WalkState->MethodNode, NULL, Status);
OpenPOWER on IntegriCloud