summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/common/adwalk.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/common/adwalk.c')
-rw-r--r--sys/contrib/dev/acpica/common/adwalk.c135
1 files changed, 99 insertions, 36 deletions
diff --git a/sys/contrib/dev/acpica/common/adwalk.c b/sys/contrib/dev/acpica/common/adwalk.c
index b1dcf87..dcf3989 100644
--- a/sys/contrib/dev/acpica/common/adwalk.c
+++ b/sys/contrib/dev/acpica/common/adwalk.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2015, Intel Corp.
+ * Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -135,6 +135,7 @@ AcpiDmDumpTree (
Info.Count = 0;
Info.Level = 0;
Info.WalkState = NULL;
+
AcpiDmWalkParseTree (Origin, AcpiDmDumpDescending, NULL, &Info);
AcpiOsPrintf ("*/\n\n");
}
@@ -168,6 +169,7 @@ AcpiDmFindOrphanMethods (
Info.Flags = 0;
Info.Level = 0;
Info.WalkState = NULL;
+
AcpiDmWalkParseTree (Origin, AcpiDmFindOrphanDescending, NULL, &Info);
}
@@ -211,7 +213,8 @@ AcpiDmFinishNamespaceLoad (
return;
}
- Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type,
+ WalkState);
if (ACPI_FAILURE (Status))
{
return;
@@ -220,6 +223,7 @@ AcpiDmFinishNamespaceLoad (
Info.Flags = 0;
Info.Level = 0;
Info.WalkState = WalkState;
+
AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmLoadDescendingOp,
AcpiDmCommonAscendingOp, &Info);
ACPI_FREE (WalkState);
@@ -264,7 +268,8 @@ AcpiDmCrossReferenceNamespace (
return;
}
- Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type,
+ WalkState);
if (ACPI_FAILURE (Status))
{
return;
@@ -273,6 +278,7 @@ AcpiDmCrossReferenceNamespace (
Info.Flags = 0;
Info.Level = 0;
Info.WalkState = WalkState;
+
AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmXrefDescendingOp,
AcpiDmCommonAscendingOp, &Info);
ACPI_FREE (WalkState);
@@ -317,15 +323,18 @@ AcpiDmConvertResourceIndexes (
return;
}
- Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type,
+ WalkState);
if (ACPI_FAILURE (Status))
{
+ ACPI_FREE (WalkState);
return;
}
Info.Flags = 0;
Info.Level = 0;
Info.WalkState = WalkState;
+
AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp,
AcpiDmCommonAscendingOp, &Info);
ACPI_FREE (WalkState);
@@ -396,7 +405,7 @@ AcpiDmDumpDescending (
if (Op->Common.Value.String)
{
AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String,
- NULL, &Path);
+ NULL, &Path);
AcpiOsPrintf ("%s %p", Path, Op->Common.Node);
ACPI_FREE (Path);
}
@@ -434,7 +443,7 @@ AcpiDmDumpDescending (
*
* DESCRIPTION: Check namepath Ops for orphaned method invocations
*
- * Note: Experimental.
+ * Note: Parts of this are experimental, under possible further development.
*
******************************************************************************/
@@ -500,6 +509,7 @@ AcpiDmFindOrphanDescending (
ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount, 0);
}
break;
+
#endif
case AML_STORE_OP:
@@ -524,7 +534,7 @@ AcpiDmFindOrphanDescending (
/* One Arg means this is just a Store(Name,Target) */
AcpiDmAddOpToExternalList (ChildOp,
- ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0);
+ ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, ArgCount, 0);
return (AE_OK);
}
@@ -546,7 +556,7 @@ AcpiDmFindOrphanDescending (
(ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&
!Op->Common.Node)
{
- ArgCount = AcpiDmInspectPossibleArgs (0, 0, Op->Common.Next);
+ ArgCount = AcpiDmInspectPossibleArgs (0, 0, Op);
/*
* Check if namepath is a predicate for if/while or lone parameter to
@@ -655,6 +665,7 @@ AcpiDmLoadDescendingOp (
{
NextOp = NextOp->Common.Next;
}
+
Path = NextOp->Common.Value.String;
}
@@ -666,8 +677,8 @@ AcpiDmLoadDescendingOp (
/* Insert the name into the namespace */
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
- ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE,
- WalkState, &Node);
+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
Op->Common.Node = Node;
@@ -708,7 +719,8 @@ Exit:
{
if (Op->Common.Node)
{
- Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType,
+ WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -750,6 +762,7 @@ AcpiDmXrefDescendingOp (
ACPI_OPERAND_OBJECT *Object;
UINT32 ParamCount = 0;
char *Pathname;
+ UINT16 Flags = 0;
WalkState = Info->WalkState;
@@ -764,7 +777,25 @@ AcpiDmXrefDescendingOp (
{
goto Exit;
}
+ else if (Op->Common.Parent &&
+ Op->Common.Parent->Common.AmlOpcode == AML_EXTERNAL_OP)
+ {
+ /* External() NamePath */
+ Path = Op->Common.Value.String;
+ ObjectType = (ACPI_OBJECT_TYPE) Op->Common.Next->Common.Value.Integer;
+ if (ObjectType == ACPI_TYPE_METHOD)
+ {
+ ParamCount = (UINT32)
+ Op->Common.Next->Common.Next->Common.Value.Integer;
+ }
+
+ Flags |= ACPI_EXT_RESOLVED_REFERENCE | ACPI_EXT_ORIGIN_FROM_OPCODE;
+ AcpiDmAddOpToExternalList (Op, Path,
+ (UINT8) ObjectType, ParamCount, Flags);
+
+ goto Exit;
+ }
/* Get the NamePath from the appropriate place */
@@ -825,8 +856,9 @@ AcpiDmXrefDescendingOp (
*/
Node = NULL;
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
- WalkState, &Node);
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
+
if (ACPI_SUCCESS (Status) && (Node->Flags & ANOBJ_IS_EXTERNAL))
{
/* Node was created by an External() statement */
@@ -851,12 +883,12 @@ AcpiDmXrefDescendingOp (
if (Node)
{
AcpiDmAddNodeToExternalList (Node,
- (UINT8) ObjectType, 0, 0);
+ (UINT8) ObjectType, 7, Flags);
}
else
{
AcpiDmAddOpToExternalList (Op, Path,
- (UINT8) ObjectType, 0, 0);
+ (UINT8) ObjectType, 7, Flags);
}
}
}
@@ -908,7 +940,8 @@ Exit:
{
if (Op->Common.Node)
{
- Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType,
+ WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -956,7 +989,8 @@ AcpiDmResourceDescendingOp (
if (Op->Common.Node)
{
- Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType,
+ WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -1036,40 +1070,69 @@ AcpiDmInspectPossibleArgs (
{
const ACPI_OPCODE_INFO *OpInfo;
UINT32 i;
- UINT32 Last = 0;
- UINT32 Lookahead;
+ UINT32 ArgumentCount = 0;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_PARSE_OBJECT *ExecuteOp;
- Lookahead = (ACPI_METHOD_NUM_ARGS + TargetCount) - CurrentOpArgCount;
+ if (!Op)
+ {
+ return (0);
+ }
/* Lookahead for the maximum number of possible arguments */
- for (i = 0; i < Lookahead; i++)
+ NextOp = Op->Common.Next;
+
+ for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && NextOp; i++)
{
- if (!Op)
- {
- break;
- }
+ OpInfo = AcpiPsGetOpcodeInfo (NextOp->Common.AmlOpcode);
- OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ /* Any one of these operators is "very probably" not a method arg */
- /*
- * Any one of these operators is "very probably" not a method arg
- */
- if ((Op->Common.AmlOpcode == AML_STORE_OP) ||
- (Op->Common.AmlOpcode == AML_NOTIFY_OP))
+ if ((NextOp->Common.AmlOpcode == AML_STORE_OP) ||
+ (NextOp->Common.AmlOpcode == AML_NOTIFY_OP) ||
+ (OpInfo->Class == AML_CLASS_CONTROL) ||
+ (OpInfo->Class == AML_CLASS_CREATE) ||
+ (OpInfo->Class == AML_CLASS_NAMED_OBJECT))
{
break;
}
- if ((OpInfo->Class != AML_CLASS_EXECUTE) &&
- (OpInfo->Class != AML_CLASS_CONTROL))
+ if (OpInfo->Class == AML_CLASS_EXECUTE)
{
- Last = i+1;
+ /* Probable that this is method arg if there is no target */
+
+ ExecuteOp = NextOp->Common.Value.Arg;
+ while (ExecuteOp)
+ {
+ if ((ExecuteOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ (ExecuteOp->Common.Value.Arg == NULL))
+ {
+ /* No target, could be a method arg */
+
+ break;
+ }
+
+ if (NextOp->Common.AmlOpcode == AML_REF_OF_OP)
+ {
+ break;
+ }
+
+ ExecuteOp = ExecuteOp->Common.Next;
+ }
+
+ if (!ExecuteOp)
+ {
+ /* Has a target, not method arg */
+
+ return (ArgumentCount);
+ }
}
- Op = Op->Common.Next;
+ ArgumentCount++;
+ NextOp = NextOp->Common.Next;
}
- return (Last);
+ return (ArgumentCount);
}
OpenPOWER on IntegriCloud