summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/psparse.c
diff options
context:
space:
mode:
authormarks <marks@FreeBSD.org>2004-12-01 23:34:39 +0000
committermarks <marks@FreeBSD.org>2004-12-01 23:34:39 +0000
commit6a7971435d4a4cf5b94e36f74f8dd1afd193d7f4 (patch)
tree3d11959e087160ea4035bce2b6f20012e4ff9e83 /sys/contrib/dev/acpica/psparse.c
parent8dd5ee861a65f226f97ebb9ac6693a5de16886f1 (diff)
downloadFreeBSD-src-6a7971435d4a4cf5b94e36f74f8dd1afd193d7f4.zip
FreeBSD-src-6a7971435d4a4cf5b94e36f74f8dd1afd193d7f4.tar.gz
Unchanged files that are off the vendor branch.
Approved by: njl MFC after: 1 week
Diffstat (limited to 'sys/contrib/dev/acpica/psparse.c')
-rw-r--r--sys/contrib/dev/acpica/psparse.c238
1 files changed, 106 insertions, 132 deletions
diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c
index 570d252..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;
@@ -1227,10 +1232,6 @@ AcpiPsParseAml (
ACPI_THREAD_STATE *Thread;
ACPI_THREAD_STATE *PrevWalkList = AcpiGbl_CurrentWalkList;
ACPI_WALK_STATE *PreviousWalkState;
-#ifndef ACPICA_PEDANTIC
- ACPI_OPERAND_OBJECT **CallerReturnDesc = WalkState->CallerReturnDesc;
- ACPI_OPERAND_OBJECT *EffectiveReturnDesc = NULL;
-#endif
ACPI_FUNCTION_TRACE ("PsParseAml");
@@ -1297,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);
@@ -1331,17 +1332,6 @@ AcpiPsParseAml (
WalkState = AcpiDsPopWalkState (Thread);
-#ifndef ACPICA_PEDANTIC
- /* Save the last effective return value */
-
- if (CallerReturnDesc && WalkState->ReturnDesc)
- {
- AcpiUtRemoveReference (EffectiveReturnDesc);
- EffectiveReturnDesc = WalkState->ReturnDesc;
- AcpiUtAddReference (EffectiveReturnDesc);
- }
-#endif
-
/* Reset the current scope to the beginning of scope stack */
AcpiDsScopeStackClear (WalkState);
@@ -1404,19 +1394,6 @@ AcpiPsParseAml (
*/
else if (PreviousWalkState->CallerReturnDesc)
{
-#ifndef ACPICA_PEDANTIC
- /*
- * Some AML code expects a return value without a ReturnOp.
- * Return the saved effective return value instead.
- */
-
- if (PreviousWalkState->ReturnDesc == NULL && EffectiveReturnDesc != NULL)
- {
- PreviousWalkState->ReturnDesc = EffectiveReturnDesc;
- AcpiUtAddReference (PreviousWalkState->ReturnDesc);
- }
-#endif
-
*(PreviousWalkState->CallerReturnDesc) = PreviousWalkState->ReturnDesc; /* NULL if no return value */
}
else if (PreviousWalkState->ReturnDesc)
@@ -1431,9 +1408,6 @@ AcpiPsParseAml (
/* Normal exit */
-#ifndef ACPICA_PEDANTIC
- AcpiUtRemoveReference (EffectiveReturnDesc);
-#endif
AcpiExReleaseAllMutexes (Thread);
AcpiUtDeleteGenericState (ACPI_CAST_PTR (ACPI_GENERIC_STATE, Thread));
AcpiGbl_CurrentWalkList = PrevWalkList;
OpenPOWER on IntegriCloud