summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/disassembler
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/components/disassembler')
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmbuffer.c122
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmcstyle.c162
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmdeferred.c15
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmnames.c26
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmobject.c576
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmopcode.c175
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmresrc.c20
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmresrcl.c30
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c40
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmresrcs.c9
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmutils.c15
-rw-r--r--sys/contrib/dev/acpica/components/disassembler/dmwalk.c194
12 files changed, 539 insertions, 845 deletions
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c b/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c
index 15b7e87..d4a9570 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmbuffer.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
@@ -50,8 +50,6 @@
#include <contrib/dev/acpica/include/acinterp.h>
-#ifdef ACPI_DISASSEMBLER
-
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dmbuffer")
@@ -75,53 +73,13 @@ AcpiDmPldBuffer (
UINT8 *ByteData,
UINT32 ByteCount);
+static const char *
+AcpiDmFindNameByIndex (
+ UINT64 Index,
+ const char **List);
-#define ACPI_BUFFER_BYTES_PER_LINE 8
-
-
-/* Strings for ToPld */
-
-static char *DmPanelList[] =
-{
- "TOP",
- "BOTTOM",
- "LEFT",
- "RIGHT",
- "FRONT",
- "BACK",
- "UNKNOWN",
- NULL
-};
-
-static char *DmVerticalPositionList[] =
-{
- "UPPER",
- "CENTER",
- "LOWER",
- NULL
-};
-
-static char *DmHorizontalPositionList[] =
-{
- "LEFT",
- "CENTER",
- "RIGHT",
- NULL
-};
-static char *DmShapeList[] =
-{
- "ROUND",
- "OVAL",
- "SQUARE",
- "VERTICALRECTANGLE",
- "HORIZONTALRECTANGLE",
- "VERTICALTRAPEZOID",
- "HORIZONTALTRAPEZOID",
- "UNKNOWN",
- "CHAMFERED",
- NULL
-};
+#define ACPI_BUFFER_BYTES_PER_LINE 8
/*******************************************************************************
@@ -205,7 +163,7 @@ AcpiDmDisasmByteList (
}
BufChar = ByteData[CurrentIndex];
- if (ACPI_IS_PRINT (BufChar))
+ if (isprint (BufChar))
{
AcpiOsPrintf ("%c", BufChar);
}
@@ -256,7 +214,8 @@ AcpiDmByteList (
{
case ACPI_DASM_RESOURCE:
- AcpiDmResourceTemplate (Info, Op->Common.Parent, ByteData, ByteCount);
+ AcpiDmResourceTemplate (
+ Info, Op->Common.Parent, ByteData, ByteCount);
break;
case ACPI_DASM_STRING:
@@ -554,7 +513,7 @@ AcpiDmIsStringBuffer (
* they will be handled in the string output routine
*/
- if (!ACPI_IS_PRINT (ByteData[i]))
+ if (!isprint (ByteData[i]))
{
return (FALSE);
}
@@ -654,24 +613,24 @@ AcpiDmIsPldBuffer (
*
******************************************************************************/
-static char *
+static const char *
AcpiDmFindNameByIndex (
UINT64 Index,
- char **List)
+ const char **List)
{
- char *Str;
- UINT32 i;
+ const char *NameString;
+ UINT32 i;
/* Bounds check */
- Str = List[0];
+ NameString = List[0];
i = 0;
- while(Str)
+ while (NameString)
{
i++;
- Str = List[i];
+ NameString = List[i];
}
if (Index >= i)
@@ -699,12 +658,12 @@ AcpiDmFindNameByIndex (
*
******************************************************************************/
-#define ACPI_PLD_OUTPUT08 "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " "
-#define ACPI_PLD_OUTPUT08P "%*.s%-18s = 0x%X)\n", ACPI_MUL_4 (Level), " "
-#define ACPI_PLD_OUTPUT16 "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " "
-#define ACPI_PLD_OUTPUT16P "%*.s%-18s = 0x%X)\n", ACPI_MUL_4 (Level), " "
-#define ACPI_PLD_OUTPUT24 "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " "
-#define ACPI_PLD_OUTPUTSTR "%*.s%-18s = \"%s\",\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUT08 "%*.s%-22s = 0x%X,\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUT08P "%*.s%-22s = 0x%X)\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUT16 "%*.s%-22s = 0x%X,\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUT16P "%*.s%-22s = 0x%X)\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUT24 "%*.s%-22s = 0x%X,\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUTSTR "%*.s%-22s = \"%s\",\n", ACPI_MUL_4 (Level), " "
static void
AcpiDmPldBuffer (
@@ -752,14 +711,18 @@ AcpiDmPldBuffer (
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Dock", PldInfo->Dock);
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Lid", PldInfo->Lid);
AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Panel",
- AcpiDmFindNameByIndex(PldInfo->Panel, DmPanelList));
+ AcpiDmFindNameByIndex(PldInfo->Panel, AcpiGbl_PldPanelList));
+
AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_VerticalPosition",
- AcpiDmFindNameByIndex(PldInfo->VerticalPosition, DmVerticalPositionList));
+ AcpiDmFindNameByIndex(PldInfo->VerticalPosition, AcpiGbl_PldVerticalPositionList));
+
AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_HorizontalPosition",
- AcpiDmFindNameByIndex(PldInfo->HorizontalPosition, DmHorizontalPositionList));
+ AcpiDmFindNameByIndex(PldInfo->HorizontalPosition, AcpiGbl_PldHorizontalPositionList));
+
AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Shape",
- AcpiDmFindNameByIndex(PldInfo->Shape, DmShapeList));
+ AcpiDmFindNameByIndex(PldInfo->Shape, AcpiGbl_PldShapeList));
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupOrientation", PldInfo->GroupOrientation);
+
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupToken", PldInfo->GroupToken);
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupPosition", PldInfo->GroupPosition);
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Bay", PldInfo->Bay);
@@ -773,22 +736,19 @@ AcpiDmPldBuffer (
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Reference", PldInfo->Reference);
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Rotation", PldInfo->Rotation);
- if (ByteCount < ACPI_PLD_REV1_BUFFER_SIZE)
- {
- AcpiOsPrintf (ACPI_PLD_OUTPUT08P, "PLD_Order", PldInfo->Order);
- }
- else
+ if (ByteCount >= ACPI_PLD_REV2_BUFFER_SIZE)
{
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Order", PldInfo->Order);
- }
- /* Fifth 32-bit dword */
+ /* Fifth 32-bit dword */
- if (ByteCount >= ACPI_PLD_REV1_BUFFER_SIZE)
- {
- AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_VerticalOffset", PldInfo->VerticalOffset);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_VerticalOffset", PldInfo->VerticalOffset);
AcpiOsPrintf (ACPI_PLD_OUTPUT16P, "PLD_HorizontalOffset", PldInfo->HorizontalOffset);
}
+ else /* Rev 1 buffer */
+ {
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08P, "PLD_Order", PldInfo->Order);
+ }
ACPI_FREE (PldInfo);
}
@@ -836,7 +796,7 @@ AcpiDmUnicode (
{
AcpiOsPrintf ("\\%c", OutputValue);
}
- else if (!ACPI_IS_PRINT (OutputValue))
+ else if (!isprint (OutputValue))
{
AcpiOsPrintf ("\\x%2.2X", OutputValue);
}
@@ -902,7 +862,7 @@ AcpiDmGetHardwareIdType (
for (i = 0; i < 3; i++)
{
if (!ACPI_IS_ASCII (Prefix[i]) ||
- !ACPI_IS_ALPHA (Prefix[i]))
+ !isalpha (Prefix[i]))
{
return;
}
@@ -1030,5 +990,3 @@ AcpiDmDecompressEisaId (
AcpiOsPrintf (" /* %s */", Info->Description);
}
}
-
-#endif
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c b/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c
index b66dbed..a7049ef 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmcstyle.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
@@ -45,10 +45,8 @@
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acparser.h>
#include <contrib/dev/acpica/include/amlcode.h>
-#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/acdebug.h>
-#ifdef ACPI_DISASSEMBLER
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dmcstyle")
@@ -217,6 +215,7 @@ AcpiDmCheckForSymbolicOpcode (
Child1->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX;
Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND_ASSIGNMENT;
/* Save symbol string in the next child (not peer) */
@@ -229,12 +228,27 @@ AcpiDmCheckForSymbolicOpcode (
Child2->Common.OperatorSymbol = OperatorSymbol;
return (TRUE);
-#ifdef INDEX_SUPPORT
case AML_INDEX_OP:
+ /*
+ * Check for constant source operand. Note: although technically
+ * legal syntax, the iASL compiler does not support this with
+ * the symbolic operators for Index(). It doesn't make sense to
+ * use Index() with a constant anyway.
+ */
+ if ((Child1->Common.AmlOpcode == AML_STRING_OP) ||
+ (Child1->Common.AmlOpcode == AML_BUFFER_OP) ||
+ (Child1->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Child1->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+ {
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_CLOSING_PAREN;
+ return (FALSE);
+ }
+
+ /* Index operator is [] */
+
Child1->Common.OperatorSymbol = " [";
Child2->Common.OperatorSymbol = "]";
break;
-#endif
/* Unary operators */
@@ -337,23 +351,70 @@ AcpiDmCheckForSymbolicOpcode (
*/
AcpiDmPromoteTarget (Op, Target);
- /*
- * Check for possible conversion to a "Compound Assignment".
- *
- * Determine if either operand is the same as the target
- * and display compound assignment operator and other operand.
- */
- if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE)) ||
- (AcpiDmIsTargetAnOperand (Target, Child2, TRUE)))
+ /* Check operands for conversion to a "Compound Assignment" */
+
+ switch (Op->Common.AmlOpcode)
{
- Target->Common.OperatorSymbol =
- AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode);
+ /* Commutative operators */
- /* Convert operator to compound assignment */
+ case AML_ADD_OP:
+ case AML_MULTIPLY_OP:
+ case AML_BIT_AND_OP:
+ case AML_BIT_OR_OP:
+ case AML_BIT_XOR_OP:
+ /*
+ * For the commutative operators, we can convert to a
+ * compound statement only if at least one (either) operand
+ * is the same as the target.
+ *
+ * Add (A, B, A) --> A += B
+ * Add (B, A, A) --> A += B
+ * Add (B, C, A) --> A = (B + C)
+ */
+ if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE)) ||
+ (AcpiDmIsTargetAnOperand (Target, Child2, TRUE)))
+ {
+ Target->Common.OperatorSymbol =
+ AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode);
- Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND;
- Child1->Common.OperatorSymbol = NULL;
- return (TRUE);
+ /* Convert operator to compound assignment */
+
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND_ASSIGNMENT;
+ Child1->Common.OperatorSymbol = NULL;
+ return (TRUE);
+ }
+ break;
+
+ /* Non-commutative operators */
+
+ case AML_SUBTRACT_OP:
+ case AML_DIVIDE_OP:
+ case AML_MOD_OP:
+ case AML_SHIFT_LEFT_OP:
+ case AML_SHIFT_RIGHT_OP:
+ /*
+ * For the non-commutative operators, we can convert to a
+ * compound statement only if the target is the same as the
+ * first operand.
+ *
+ * Subtract (A, B, A) --> A -= B
+ * Subtract (B, A, A) --> A = (B - A)
+ */
+ if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE)))
+ {
+ Target->Common.OperatorSymbol =
+ AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode);
+
+ /* Convert operator to compound assignment */
+
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND_ASSIGNMENT;
+ Child1->Common.OperatorSymbol = NULL;
+ return (TRUE);
+ }
+ break;
+
+ default:
+ break;
}
/*
@@ -397,7 +458,6 @@ AcpiDmCheckForSymbolicOpcode (
case AML_INCREMENT_OP:
return (TRUE);
-#ifdef INDEX_SUPPORT
case AML_INDEX_OP:
/* Target is optional, 3rd operand */
@@ -413,7 +473,6 @@ AcpiDmCheckForSymbolicOpcode (
}
}
return (TRUE);
-#endif
case AML_STORE_OP:
/*
@@ -423,8 +482,12 @@ AcpiDmCheckForSymbolicOpcode (
* source so that the target is processed first.
*/
Target = Child1->Common.Next;
- AcpiDmPromoteTarget (Op, Target);
+ if (!Target)
+ {
+ return (FALSE);
+ }
+ AcpiDmPromoteTarget (Op, Target);
if (!Target->Common.OperatorSymbol)
{
Target->Common.OperatorSymbol = " = ";
@@ -460,6 +523,19 @@ AcpiDmCheckForSymbolicOpcode (
break;
}
+ /*
+ * Nodes marked with ACPI_PARSEOP_PARAMLIST don't need a parens
+ * output here. We also need to check the parent to see if this op
+ * is part of a compound test (!=, >=, <=).
+ */
+ if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) ||
+ ((Op->Common.Parent->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) &&
+ (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_SUFFIX)))
+ {
+ /* Do Nothing. Paren already generated */
+ return (TRUE);
+ }
+
/* All other operators, emit an open paren */
AcpiOsPrintf ("(");
@@ -485,6 +561,7 @@ void
AcpiDmCloseOperator (
ACPI_PARSE_OBJECT *Op)
{
+ BOOLEAN IsCStyleOp = FALSE;
/* Always emit paren if ASL+ disassembly disabled */
@@ -516,7 +593,7 @@ AcpiDmCloseOperator (
/* Emit paren only if this is not a compound assignment */
- if (Op->Common.DisasmFlags & ACPI_PARSEOP_COMPOUND)
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_COMPOUND_ASSIGNMENT)
{
return;
}
@@ -527,14 +604,22 @@ AcpiDmCloseOperator (
{
AcpiOsPrintf (")");
}
+
+ IsCStyleOp = TRUE;
break;
+ case AML_INDEX_OP:
+
+ /* This is case for unsupported Index() source constants */
+
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_CLOSING_PAREN)
+ {
+ AcpiOsPrintf (")");
+ }
+ return;
/* No need for parens for these */
-#ifdef INDEX_SUPPORT
- case AML_INDEX_OP:
-#endif
case AML_DECREMENT_OP:
case AML_INCREMENT_OP:
case AML_LNOT_OP:
@@ -548,7 +633,21 @@ AcpiDmCloseOperator (
break;
}
+ /*
+ * Nodes marked with ACPI_PARSEOP_PARAMLIST don't need a parens
+ * output here. We also need to check the parent to see if this op
+ * is part of a compound test (!=, >=, <=).
+ */
+ if (IsCStyleOp &&
+ ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) ||
+ ((Op->Common.Parent->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) &&
+ (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_SUFFIX))))
+ {
+ return;
+ }
+
AcpiOsPrintf (")");
+ return;
}
@@ -617,6 +716,7 @@ AcpiDmGetCompoundSymbol (
default:
/* No operator string for all other opcodes */
+
return (NULL);
}
@@ -674,7 +774,8 @@ AcpiDmPromoteTarget (
*
* DESCRIPTION: Determine if a Target Op is a placeholder Op or a real Target.
* In other words, determine if the optional target is used or
- * not.
+ * not. Note: If Target is NULL, something is seriously wrong,
+ * probably with the parse tree.
*
******************************************************************************/
@@ -683,6 +784,11 @@ AcpiDmIsValidTarget (
ACPI_PARSE_OBJECT *Target)
{
+ if (!Target)
+ {
+ return (FALSE);
+ }
+
if ((Target->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
(Target->Common.Value.Arg == NULL))
{
@@ -769,5 +875,3 @@ AcpiDmIsTargetAnOperand (
}
return (TRUE);
}
-
-#endif
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c b/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c
index 9bf7451..5900614 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmdeferred.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
@@ -105,7 +105,8 @@ AcpiDmParseDeferredOps (
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
- Status = AcpiDmDeferredParse (Op, Op->Named.Data, Op->Named.Length);
+ Status = AcpiDmDeferredParse (
+ Op, Op->Named.Data, Op->Named.Length);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -165,7 +166,6 @@ AcpiDmDeferredParse (
ACPI_STATUS Status;
ACPI_PARSE_OBJECT *SearchOp;
ACPI_PARSE_OBJECT *StartOp;
- UINT32 BaseAmlOffset;
ACPI_PARSE_OBJECT *NewRootOp;
ACPI_PARSE_OBJECT *ExtraOp;
@@ -202,19 +202,10 @@ AcpiDmDeferredParse (
WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
- /*
- * We need to update all of the AML offsets, since the parser thought
- * that the method began at offset zero. In reality, it began somewhere
- * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that
- * was just created and update the AmlOffset in each Op.
- */
- BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1;
StartOp = (Op->Common.Value.Arg)->Common.Next;
SearchOp = StartOp;
-
while (SearchOp)
{
- SearchOp->Common.AmlOffset += BaseAmlOffset;
SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
}
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmnames.c b/sys/contrib/dev/acpica/components/disassembler/dmnames.c
index 07a90ff..d75db19 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmnames.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmnames.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
@@ -48,8 +48,6 @@
#include <contrib/dev/acpica/include/acdisasm.h>
-#ifdef ACPI_DISASSEMBLER
-
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dmnames")
@@ -157,15 +155,15 @@ AcpiPsDisplayObjectPathname (
/* Node not defined in this scope, look it up */
Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String,
- ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
- WalkState, &(Node));
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+ WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
/*
- * We can't get the pathname since the object
- * is not in the namespace. This can happen during single
- * stepping where a dynamic named object is *about* to be created.
+ * We can't get the pathname since the object is not in the
+ * namespace. This can happen during single stepping
+ * where a dynamic named object is *about* to be created.
*/
AcpiOsPrintf (" [Path not found]");
goto Exit;
@@ -179,7 +177,7 @@ AcpiPsDisplayObjectPathname (
/* Convert NamedDesc/handle to a full pathname */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (Node, &Buffer);
+ Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("****Could not get pathname****)");
@@ -271,6 +269,7 @@ AcpiDmNamestring (
AcpiOsPrintf (".");
}
+
Name += ACPI_NAME_SIZE;
}
}
@@ -334,7 +333,6 @@ AcpiDmDisplayPath (
}
Prev = NULL; /* Start with Root Node */
-
while (Prev != Op)
{
/* Search upwards in the tree to find scope with "prev" as its parent */
@@ -392,6 +390,7 @@ AcpiDmDisplayPath (
DoDot = TRUE;
}
}
+
Prev = Search;
}
}
@@ -414,6 +413,8 @@ AcpiDmValidateName (
char *Name,
ACPI_PARSE_OBJECT *Op)
{
+ ACPI_PARSE_OBJECT *TargetOp;
+
if ((!Name) ||
(!Op->Common.Parent))
@@ -427,9 +428,6 @@ AcpiDmValidateName (
" /**** Name not found or not accessible from this scope ****/ ");
}
- ACPI_PARSE_OBJECT *TargetOp;
-
-
if ((!Name) ||
(!Op->Common.Parent))
{
@@ -450,5 +448,3 @@ AcpiDmValidateName (
}
}
#endif
-
-#endif
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmobject.c b/sys/contrib/dev/acpica/components/disassembler/dmobject.c
deleted file mode 100644
index 6559ec0..0000000
--- a/sys/contrib/dev/acpica/components/disassembler/dmobject.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: dmobject - ACPI object decode and display
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2015, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <contrib/dev/acpica/include/acpi.h>
-#include <contrib/dev/acpica/include/accommon.h>
-#include <contrib/dev/acpica/include/acnamesp.h>
-#include <contrib/dev/acpica/include/acdisasm.h>
-
-
-#ifdef ACPI_DISASSEMBLER
-
-#define _COMPONENT ACPI_CA_DEBUGGER
- ACPI_MODULE_NAME ("dmnames")
-
-/* Local prototypes */
-
-static void
-AcpiDmDecodeNode (
- ACPI_NAMESPACE_NODE *Node);
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDmDumpMethodInfo
- *
- * PARAMETERS: Status - Method execution status
- * WalkState - Current state of the parse tree walk
- * Op - Executing parse op
- *
- * RETURN: None
- *
- * DESCRIPTION: Called when a method has been aborted because of an error.
- * Dumps the method execution stack, and the method locals/args,
- * and disassembles the AML opcode that failed.
- *
- ******************************************************************************/
-
-void
-AcpiDmDumpMethodInfo (
- ACPI_STATUS Status,
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_PARSE_OBJECT *Next;
- ACPI_THREAD_STATE *Thread;
- ACPI_WALK_STATE *NextWalkState;
- ACPI_NAMESPACE_NODE *PreviousMethod = NULL;
-
-
- /* Ignore control codes, they are not errors */
-
- if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL)
- {
- return;
- }
-
- /* We may be executing a deferred opcode */
-
- if (WalkState->DeferredNode)
- {
- AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n");
- return;
- }
-
- /*
- * If there is no Thread, we are not actually executing a method.
- * This can happen when the iASL compiler calls the interpreter
- * to perform constant folding.
- */
- Thread = WalkState->Thread;
- if (!Thread)
- {
- return;
- }
-
- /* Display exception and method name */
-
- AcpiOsPrintf ("\n**** Exception %s during execution of method ",
- AcpiFormatException (Status));
- AcpiNsPrintNodePathname (WalkState->MethodNode, NULL);
-
- /* Display stack of executing methods */
-
- AcpiOsPrintf ("\n\nMethod Execution Stack:\n");
- NextWalkState = Thread->WalkStateList;
-
- /* Walk list of linked walk states */
-
- while (NextWalkState)
- {
- AcpiOsPrintf (" Method [%4.4s] executing: ",
- AcpiUtGetNodeName (NextWalkState->MethodNode));
-
- /* First method is the currently executing method */
-
- if (NextWalkState == WalkState)
- {
- if (Op)
- {
- /* Display currently executing ASL statement */
-
- Next = Op->Common.Next;
- Op->Common.Next = NULL;
-
- AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX);
- Op->Common.Next = Next;
- }
- }
- else
- {
- /*
- * This method has called another method
- * NOTE: the method call parse subtree is already deleted at this
- * point, so we cannot disassemble the method invocation.
- */
- AcpiOsPrintf ("Call to method ");
- AcpiNsPrintNodePathname (PreviousMethod, NULL);
- }
-
- PreviousMethod = NextWalkState->MethodNode;
- NextWalkState = NextWalkState->Next;
- AcpiOsPrintf ("\n");
- }
-
- /* Display the method locals and arguments */
-
- AcpiOsPrintf ("\n");
- AcpiDmDisplayLocals (WalkState);
- AcpiOsPrintf ("\n");
- AcpiDmDisplayArguments (WalkState);
- AcpiOsPrintf ("\n");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDmDecodeInternalObject
- *
- * PARAMETERS: ObjDesc - Object to be displayed
- *
- * RETURN: None
- *
- * DESCRIPTION: Short display of an internal object. Numbers/Strings/Buffers.
- *
- ******************************************************************************/
-
-void
-AcpiDmDecodeInternalObject (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- UINT32 i;
-
-
- if (!ObjDesc)
- {
- AcpiOsPrintf (" Uninitialized");
- return;
- }
-
- if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
- {
- AcpiOsPrintf (" %p [%s]", ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
- return;
- }
-
- AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
-
- switch (ObjDesc->Common.Type)
- {
- case ACPI_TYPE_INTEGER:
-
- AcpiOsPrintf (" %8.8X%8.8X",
- ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
- break;
-
- case ACPI_TYPE_STRING:
-
- AcpiOsPrintf ("(%u) \"%.24s",
- ObjDesc->String.Length, ObjDesc->String.Pointer);
-
- if (ObjDesc->String.Length > 24)
- {
- AcpiOsPrintf ("...");
- }
- else
- {
- AcpiOsPrintf ("\"");
- }
- break;
-
- case ACPI_TYPE_BUFFER:
-
- AcpiOsPrintf ("(%u)", ObjDesc->Buffer.Length);
- for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
- {
- AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
- }
- break;
-
- default:
-
- AcpiOsPrintf (" %p", ObjDesc);
- break;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDmDecodeNode
- *
- * PARAMETERS: Node - Object to be displayed
- *
- * RETURN: None
- *
- * DESCRIPTION: Short display of a namespace node
- *
- ******************************************************************************/
-
-static void
-AcpiDmDecodeNode (
- ACPI_NAMESPACE_NODE *Node)
-{
-
- AcpiOsPrintf ("<Node> Name %4.4s",
- AcpiUtGetNodeName (Node));
-
- if (Node->Flags & ANOBJ_METHOD_ARG)
- {
- AcpiOsPrintf (" [Method Arg]");
- }
- if (Node->Flags & ANOBJ_METHOD_LOCAL)
- {
- AcpiOsPrintf (" [Method Local]");
- }
-
- switch (Node->Type)
- {
- /* These types have no attached object */
-
- case ACPI_TYPE_DEVICE:
-
- AcpiOsPrintf (" Device");
- break;
-
- case ACPI_TYPE_THERMAL:
-
- AcpiOsPrintf (" Thermal Zone");
- break;
-
- default:
-
- AcpiDmDecodeInternalObject (AcpiNsGetAttachedObject (Node));
- break;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDmDisplayInternalObject
- *
- * PARAMETERS: ObjDesc - Object to be displayed
- * WalkState - Current walk state
- *
- * RETURN: None
- *
- * DESCRIPTION: Short display of an internal object
- *
- ******************************************************************************/
-
-void
-AcpiDmDisplayInternalObject (
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_WALK_STATE *WalkState)
-{
- UINT8 Type;
-
-
- AcpiOsPrintf ("%p ", ObjDesc);
-
- if (!ObjDesc)
- {
- AcpiOsPrintf ("<Null Object>\n");
- return;
- }
-
- /* Decode the object type */
-
- switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
- {
- case ACPI_DESC_TYPE_PARSER:
-
- AcpiOsPrintf ("<Parser> ");
- break;
-
- case ACPI_DESC_TYPE_NAMED:
-
- AcpiDmDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc);
- break;
-
- case ACPI_DESC_TYPE_OPERAND:
-
- Type = ObjDesc->Common.Type;
- if (Type > ACPI_TYPE_LOCAL_MAX)
- {
- AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type);
- return;
- }
-
- /* Decode the ACPI object type */
-
- switch (ObjDesc->Common.Type)
- {
- case ACPI_TYPE_LOCAL_REFERENCE:
-
- AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc));
-
- /* Decode the refererence */
-
- switch (ObjDesc->Reference.Class)
- {
- case ACPI_REFCLASS_LOCAL:
-
- AcpiOsPrintf ("%X ", ObjDesc->Reference.Value);
- if (WalkState)
- {
- ObjDesc = WalkState->LocalVariables
- [ObjDesc->Reference.Value].Object;
- AcpiOsPrintf ("%p", ObjDesc);
- AcpiDmDecodeInternalObject (ObjDesc);
- }
- break;
-
- case ACPI_REFCLASS_ARG:
-
- AcpiOsPrintf ("%X ", ObjDesc->Reference.Value);
- if (WalkState)
- {
- ObjDesc = WalkState->Arguments
- [ObjDesc->Reference.Value].Object;
- AcpiOsPrintf ("%p", ObjDesc);
- AcpiDmDecodeInternalObject (ObjDesc);
- }
- break;
-
- case ACPI_REFCLASS_INDEX:
-
- switch (ObjDesc->Reference.TargetType)
- {
- case ACPI_TYPE_BUFFER_FIELD:
-
- AcpiOsPrintf ("%p", ObjDesc->Reference.Object);
- AcpiDmDecodeInternalObject (ObjDesc->Reference.Object);
- break;
-
- case ACPI_TYPE_PACKAGE:
-
- AcpiOsPrintf ("%p", ObjDesc->Reference.Where);
- if (!ObjDesc->Reference.Where)
- {
- AcpiOsPrintf (" Uninitialized WHERE pointer");
- }
- else
- {
- AcpiDmDecodeInternalObject (
- *(ObjDesc->Reference.Where));
- }
- break;
-
- default:
-
- AcpiOsPrintf ("Unknown index target type");
- break;
- }
- break;
-
- case ACPI_REFCLASS_REFOF:
-
- if (!ObjDesc->Reference.Object)
- {
- AcpiOsPrintf ("Uninitialized reference subobject pointer");
- break;
- }
-
- /* Reference can be to a Node or an Operand object */
-
- switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object))
- {
- case ACPI_DESC_TYPE_NAMED:
- AcpiDmDecodeNode (ObjDesc->Reference.Object);
- break;
-
- case ACPI_DESC_TYPE_OPERAND:
- AcpiDmDecodeInternalObject (ObjDesc->Reference.Object);
- break;
-
- default:
- break;
- }
- break;
-
- case ACPI_REFCLASS_NAME:
-
- AcpiDmDecodeNode (ObjDesc->Reference.Node);
- break;
-
- case ACPI_REFCLASS_DEBUG:
- case ACPI_REFCLASS_TABLE:
-
- AcpiOsPrintf ("\n");
- break;
-
- default: /* Unknown reference class */
-
- AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
- break;
- }
- break;
-
- default:
-
- AcpiOsPrintf ("<Obj> ");
- AcpiDmDecodeInternalObject (ObjDesc);
- break;
- }
- break;
-
- default:
-
- AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]",
- AcpiUtGetDescriptorName (ObjDesc));
- break;
- }
-
- AcpiOsPrintf ("\n");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDmDisplayLocals
- *
- * PARAMETERS: WalkState - State for current method
- *
- * RETURN: None
- *
- * DESCRIPTION: Display all locals for the currently running control method
- *
- ******************************************************************************/
-
-void
-AcpiDmDisplayLocals (
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 i;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *Node;
-
-
- ObjDesc = WalkState->MethodDesc;
- Node = WalkState->MethodNode;
- if (!Node)
- {
- AcpiOsPrintf (
- "No method node (Executing subtree for buffer or opregion)\n");
- return;
- }
-
- if (Node->Type != ACPI_TYPE_METHOD)
- {
- AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n");
- return;
- }
-
- AcpiOsPrintf ("Local Variables for method [%4.4s]:\n",
- AcpiUtGetNodeName (Node));
-
- for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
- {
- ObjDesc = WalkState->LocalVariables[i].Object;
- AcpiOsPrintf (" Local%X: ", i);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDmDisplayArguments
- *
- * PARAMETERS: WalkState - State for current method
- *
- * RETURN: None
- *
- * DESCRIPTION: Display all arguments for the currently running control method
- *
- ******************************************************************************/
-
-void
-AcpiDmDisplayArguments (
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 i;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *Node;
-
-
- ObjDesc = WalkState->MethodDesc;
- Node = WalkState->MethodNode;
- if (!Node)
- {
- AcpiOsPrintf (
- "No method node (Executing subtree for buffer or opregion)\n");
- return;
- }
-
- if (Node->Type != ACPI_TYPE_METHOD)
- {
- AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n");
- return;
- }
-
- AcpiOsPrintf (
- "Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n",
- AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount, ObjDesc->Method.SyncLevel);
-
- for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
- {
- ObjDesc = WalkState->Arguments[i].Object;
- AcpiOsPrintf (" Arg%u: ", i);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
- }
-}
-
-#endif
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
index b10d433..2ca1c85 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmopcode.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
@@ -45,11 +45,10 @@
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acparser.h>
#include <contrib/dev/acpica/include/amlcode.h>
-#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/acinterp.h>
#include <contrib/dev/acpica/include/acnamesp.h>
+#include <contrib/dev/acpica/include/acdebug.h>
-#ifdef ACPI_DISASSEMBLER
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dmopcode")
@@ -61,6 +60,10 @@ static void
AcpiDmMatchKeyword (
ACPI_PARSE_OBJECT *Op);
+static void
+AcpiDmConvertToElseIf (
+ ACPI_PARSE_OBJECT *Op);
+
/*******************************************************************************
*
@@ -246,11 +249,11 @@ AcpiDmPredefinedDescription (
/* Ensure that the comment field is emitted only once */
- if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED)
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEFINED_CHECKED)
{
return;
}
- Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEF_CHECKED;
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEFINED_CHECKED;
/* Predefined name must start with an underscore */
@@ -269,10 +272,10 @@ AcpiDmPredefinedDescription (
* Note: NameString is guaranteed to be upper case here.
*/
LastCharIsDigit =
- (ACPI_IS_DIGIT (NameString[3])); /* d */
+ (isdigit ((int) NameString[3])); /* d */
LastCharsAreHex =
- (ACPI_IS_XDIGIT (NameString[2]) && /* xx */
- ACPI_IS_XDIGIT (NameString[3]));
+ (isxdigit ((int) NameString[2]) && /* xx */
+ isxdigit ((int) NameString[3]));
switch (NameString[1])
{
@@ -382,11 +385,11 @@ AcpiDmFieldPredefinedDescription (
/* Ensure that the comment field is emitted only once */
- if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED)
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEFINED_CHECKED)
{
return;
}
- Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEF_CHECKED;
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEFINED_CHECKED;
/*
* Op must be one of the Create* operators: CreateField, CreateBitField,
@@ -643,8 +646,8 @@ AcpiDmMatchKeyword (
}
else
{
- AcpiOsPrintf ("%s", ACPI_CAST_PTR (char,
- AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]));
+ AcpiOsPrintf ("%s",
+ AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]);
}
}
@@ -684,6 +687,11 @@ AcpiDmDisassembleOneOp (
return;
}
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_ELSEIF)
+ {
+ return; /* ElseIf macro was already emitted */
+ }
+
switch (Op->Common.DisasmOpcode)
{
case ACPI_DASM_MATCHOP:
@@ -821,7 +829,9 @@ AcpiDmDisassembleOneOp (
}
else if (Status == AE_AML_NO_RESOURCE_END_TAG)
{
- AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ ");
+ AcpiOsPrintf (
+ "/**** Is ResourceTemplate, "
+ "but EndTag not at buffer end ****/ ");
}
}
@@ -896,7 +906,8 @@ AcpiDmDisassembleOneOp (
if (Op->Common.AmlOpcode == AML_INT_EXTACCESSFIELD_OP)
{
- AcpiOsPrintf (" (0x%2.2X)", (unsigned) ((Op->Common.Value.Integer >> 16) & 0xFF));
+ AcpiOsPrintf (" (0x%2.2X)", (unsigned)
+ ((Op->Common.Value.Integer >> 16) & 0xFF));
}
AcpiOsPrintf (")");
@@ -953,6 +964,24 @@ AcpiDmDisassembleOneOp (
AcpiDmNamestring (Op->Common.Value.Name);
break;
+ case AML_ELSE_OP:
+
+ AcpiDmConvertToElseIf (Op);
+ break;
+
+ case AML_EXTERNAL_OP:
+
+ if (AcpiGbl_DmEmitExternalOpcodes)
+ {
+ AcpiOsPrintf ("/* Opcode 0x15 */ ");
+
+ /* Fallthrough */
+ }
+ else
+ {
+ break;
+ }
+
default:
/* Just get the opcode name and print it */
@@ -967,7 +996,7 @@ AcpiDmDisassembleOneOp (
(WalkState->Results) &&
(WalkState->ResultCount))
{
- AcpiDmDecodeInternalObject (
+ AcpiDbDecodeInternalObject (
WalkState->Results->Results.ObjDesc [
(WalkState->ResultCount - 1) %
ACPI_RESULTS_FRAME_OBJ_NUM]);
@@ -978,4 +1007,118 @@ AcpiDmDisassembleOneOp (
}
}
-#endif /* ACPI_DISASSEMBLER */
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmConvertToElseIf
+ *
+ * PARAMETERS: OriginalElseOp - ELSE Object to be examined
+ *
+ * RETURN: None. Emits either an "Else" or an "ElseIf" ASL operator.
+ *
+ * DESCRIPTION: Detect and convert an If..Else..If sequence to If..ElseIf
+ *
+ * EXAMPLE:
+ *
+ * This If..Else..If nested sequence:
+ *
+ * If (Arg0 == 1)
+ * {
+ * Local0 = 4
+ * }
+ * Else
+ * {
+ * If (Arg0 == 2)
+ * {
+ * Local0 = 5
+ * }
+ * }
+ *
+ * Is converted to this simpler If..ElseIf sequence:
+ *
+ * If (Arg0 == 1)
+ * {
+ * Local0 = 4
+ * }
+ * ElseIf (Arg0 == 2)
+ * {
+ * Local0 = 5
+ * }
+ *
+ * NOTE: There is no actual ElseIf AML opcode. ElseIf is essentially an ASL
+ * macro that emits an Else opcode followed by an If opcode. This function
+ * reverses these AML sequences back to an ElseIf macro where possible. This
+ * can make the disassembled ASL code simpler and more like the original code.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmConvertToElseIf (
+ ACPI_PARSE_OBJECT *OriginalElseOp)
+{
+ ACPI_PARSE_OBJECT *IfOp;
+ ACPI_PARSE_OBJECT *ElseOp;
+
+
+ /*
+ * To be able to perform the conversion, two conditions must be satisfied:
+ * 1) The first child of the Else must be an If statement.
+ * 2) The If block can only be followed by an Else block and these must
+ * be the only blocks under the original Else.
+ */
+ IfOp = OriginalElseOp->Common.Value.Arg;
+ if (!IfOp ||
+ (IfOp->Common.AmlOpcode != AML_IF_OP) ||
+ (IfOp->Asl.Next && (IfOp->Asl.Next->Common.AmlOpcode != AML_ELSE_OP)))
+ {
+ /* Not an Else..If sequence, cannot convert to ElseIf */
+
+ AcpiOsPrintf ("%s", "Else");
+ return;
+ }
+
+ /* Emit ElseIf, mark the IF as now an ELSEIF */
+
+ AcpiOsPrintf ("%s", "ElseIf");
+ IfOp->Common.DisasmFlags |= ACPI_PARSEOP_ELSEIF;
+
+ /* The IF parent will now be the same as the original ELSE parent */
+
+ IfOp->Common.Parent = OriginalElseOp->Common.Parent;
+
+ /*
+ * Update the NEXT pointers to restructure the parse tree, essentially
+ * promoting an If..Else block up to the same level as the original
+ * Else.
+ *
+ * Check if the IF has a corresponding ELSE peer
+ */
+ ElseOp = IfOp->Common.Next;
+ if (ElseOp &&
+ (ElseOp->Common.AmlOpcode == AML_ELSE_OP))
+ {
+ /* If an ELSE matches the IF, promote it also */
+
+ ElseOp->Common.Parent = OriginalElseOp->Common.Parent;
+ ElseOp->Common.Next = OriginalElseOp->Common.Next;
+ }
+ else
+ {
+ /* Otherwise, set the IF NEXT to the original ELSE NEXT */
+
+ IfOp->Common.Next = OriginalElseOp->Common.Next;
+ }
+
+ /* Detach the child IF block from the original ELSE */
+
+ OriginalElseOp->Common.Value.Arg = NULL;
+
+ /* Ignore the original ELSE from now on */
+
+ OriginalElseOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ OriginalElseOp->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
+
+ /* Insert IF (now ELSEIF) as next peer of the original ELSE */
+
+ OriginalElseOp->Common.Next = IfOp;
+}
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrc.c b/sys/contrib/dev/acpica/components/disassembler/dmresrc.c
index 2a8147e..57903a9 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmresrc.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmresrc.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
@@ -46,7 +46,6 @@
#include <contrib/dev/acpica/include/amlcode.h>
#include <contrib/dev/acpica/include/acdisasm.h>
-#ifdef ACPI_DISASSEMBLER
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbresrc")
@@ -146,7 +145,7 @@ AcpiDmDescriptorName (
void
AcpiDmDumpInteger8 (
UINT8 Value,
- char *Name)
+ const char *Name)
{
AcpiOsPrintf ("0x%2.2X, // %s\n", Value, Name);
}
@@ -154,7 +153,7 @@ AcpiDmDumpInteger8 (
void
AcpiDmDumpInteger16 (
UINT16 Value,
- char *Name)
+ const char *Name)
{
AcpiOsPrintf ("0x%4.4X, // %s\n", Value, Name);
}
@@ -162,7 +161,7 @@ AcpiDmDumpInteger16 (
void
AcpiDmDumpInteger32 (
UINT32 Value,
- char *Name)
+ const char *Name)
{
AcpiOsPrintf ("0x%8.8X, // %s\n", Value, Name);
}
@@ -170,7 +169,7 @@ AcpiDmDumpInteger32 (
void
AcpiDmDumpInteger64 (
UINT64 Value,
- char *Name)
+ const char *Name)
{
AcpiOsPrintf ("0x%8.8X%8.8X, // %s\n", ACPI_FORMAT_UINT64 (Value), Name);
}
@@ -213,6 +212,7 @@ AcpiDmBitList (
{
AcpiOsPrintf (",");
}
+
Previous = TRUE;
AcpiOsPrintf ("%u", i);
}
@@ -286,7 +286,8 @@ AcpiDmResourceTemplate (
Status = AcpiUtValidateResource (NULL, Aml, &ResourceIndex);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n",
+ AcpiOsPrintf (
+ "/*** Could not validate Resource, type (%X) %s***/\n",
ResourceType, AcpiFormatException (Status));
return;
}
@@ -336,7 +337,8 @@ AcpiDmResourceTemplate (
AcpiDmIndent (Level);
AcpiOsPrintf (
- "/*** Disassembler: inserted missing EndDependentFn () ***/\n");
+ "/*** Disassembler: inserted "
+ "missing EndDependentFn () ***/\n");
}
return;
@@ -444,5 +446,3 @@ AcpiDmIsResourceTemplate (
*/
return (AE_OK);
}
-
-#endif
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c
index b0cf41e..50b4bd6 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.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
@@ -46,15 +46,13 @@
#include <contrib/dev/acpica/include/acdisasm.h>
-#ifdef ACPI_DISASSEMBLER
-
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbresrcl")
/* Common names for address and memory descriptors */
-static char *AcpiDmAddressNames[] =
+static const char *AcpiDmAddressNames[] =
{
"Granularity",
"Range Minimum",
@@ -63,7 +61,7 @@ static char *AcpiDmAddressNames[] =
"Length"
};
-static char *AcpiDmMemoryNames[] =
+static const char *AcpiDmMemoryNames[] =
{
"Range Minimum",
"Range Maximum",
@@ -309,7 +307,8 @@ AcpiDmAddressCommon (
if ((ResourceType > 2) && (ResourceType < 0xC0))
{
- AcpiOsPrintf ("/**** Invalid Resource Type: 0x%X ****/", ResourceType);
+ AcpiOsPrintf (
+ "/**** Invalid Resource Type: 0x%X ****/", ResourceType);
return;
}
@@ -329,7 +328,8 @@ AcpiDmAddressCommon (
/* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
- AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]);
+ AcpiOsPrintf ("%s (",
+ AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]);
/* Decode the general and type-specific flags */
@@ -342,7 +342,8 @@ AcpiDmAddressCommon (
AcpiDmIoFlags (Flags);
if (ResourceType == ACPI_IO_RANGE)
{
- AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]);
+ AcpiOsPrintf (" %s,",
+ AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]);
}
}
}
@@ -737,7 +738,8 @@ AcpiDmExtendedDescriptor (
/* Dump resource name and flags */
- AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);
+ AcpiDmAddressCommon (
+ Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);
/* Dump the 5 contiguous QWORD values */
@@ -873,10 +875,12 @@ AcpiDmFixedMemory32Descriptor (
AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
+ AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,
+ "Address Base");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length");
+ AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength,
+ "Address Length");
/* Insert a descriptor name */
@@ -1024,7 +1028,7 @@ AcpiDmInterruptDescriptor (
void
AcpiDmVendorCommon (
- char *Name,
+ const char *Name,
UINT8 *ByteData,
UINT32 Length,
UINT32 Level)
@@ -1079,5 +1083,3 @@ AcpiDmVendorLargeDescriptor (
ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
Length, Level);
}
-
-#endif
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c
index ff5fabc..58cdd7b 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.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
@@ -46,8 +46,6 @@
#include <contrib/dev/acpica/include/acdisasm.h>
-#ifdef ACPI_DISASSEMBLER
-
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbresrcl2")
@@ -154,6 +152,7 @@ AcpiDmDumpRawDataBuffer (
AcpiOsPrintf (", ");
}
+
AcpiOsPrintf ("\n");
AcpiDmIndent (Level + 2);
@@ -199,7 +198,8 @@ AcpiDmGpioCommon (
AcpiDmIndent (Level + 1);
if (Resource->Gpio.ResSourceOffset)
{
- DeviceName = ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset),
+ DeviceName = ACPI_ADD_PTR (char,
+ Resource, Resource->Gpio.ResSourceOffset),
AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
}
@@ -243,14 +243,16 @@ AcpiDmGpioCommon (
for (i = 0; i < PinCount; i++)
{
AcpiDmIndent (Level + 2);
- AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], ((i + 1) < PinCount) ? "," : "");
+ AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
+ ((i + 1) < PinCount) ? "," : "");
}
AcpiDmIndent (Level + 1);
AcpiOsPrintf ("}\n");
#ifndef _KERNEL
- MpSaveGpioInfo (Info->MappingOp, Resource, PinCount, PinList, DeviceName);
+ MpSaveGpioInfo (Info->MappingOp, Resource,
+ PinCount, PinList, DeviceName);
#endif
}
@@ -500,7 +502,7 @@ AcpiDmI2cSerialBusDescriptor (
/* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
AcpiDmIndent (Level);
- AcpiOsPrintf ("I2cSerialBus (0x%4.4X, %s, 0x%8.8X,\n",
+ AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
Resource->I2cSerialBus.SlaveAddress,
AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
Resource->I2cSerialBus.ConnectionSpeed);
@@ -529,7 +531,11 @@ AcpiDmI2cSerialBusDescriptor (
/* Insert a descriptor name */
AcpiDmDescriptorName ();
- AcpiOsPrintf (",\n");
+
+ /* Share */
+
+ AcpiOsPrintf (", %s,\n",
+ AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]);
/* Dump the vendor data */
@@ -572,7 +578,7 @@ AcpiDmSpiSerialBusDescriptor (
/* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
AcpiDmIndent (Level);
- AcpiOsPrintf ("SpiSerialBus (0x%4.4X, %s, %s, 0x%2.2X,\n",
+ AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
Resource->SpiSerialBus.DeviceSelection,
AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
@@ -610,7 +616,11 @@ AcpiDmSpiSerialBusDescriptor (
/* Insert a descriptor name */
AcpiDmDescriptorName ();
- AcpiOsPrintf (",\n");
+
+ /* Share */
+
+ AcpiOsPrintf (", %s,\n",
+ AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]);
/* Dump the vendor data */
@@ -653,7 +663,7 @@ AcpiDmUartSerialBusDescriptor (
/* ConnectionSpeed, BitsPerByte, StopBits */
AcpiDmIndent (Level);
- AcpiOsPrintf ("UartSerialBus (0x%8.8X, %s, %s,\n",
+ AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
Resource->UartSerialBus.DefaultBaudRate,
AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
@@ -694,7 +704,11 @@ AcpiDmUartSerialBusDescriptor (
/* Insert a descriptor name */
AcpiDmDescriptorName ();
- AcpiOsPrintf (",\n");
+
+ /* Share */
+
+ AcpiOsPrintf (", %s,\n",
+ AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]);
/* Dump the vendor data */
@@ -734,5 +748,3 @@ AcpiDmSerialBusDescriptor (
SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
Info, Resource, Length, Level);
}
-
-#endif
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c
index 31b68b2..2840f80 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcs.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
@@ -46,8 +46,6 @@
#include <contrib/dev/acpica/include/acdisasm.h>
-#ifdef ACPI_DISASSEMBLER
-
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbresrcs")
@@ -173,7 +171,8 @@ AcpiDmFixedDmaDescriptor (
}
else
{
- AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ", Resource->FixedDma.Width);
+ AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ",
+ Resource->FixedDma.Width);
}
/* Insert a descriptor name */
@@ -368,5 +367,3 @@ AcpiDmVendorSmallDescriptor (
ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)),
Length, Level);
}
-
-#endif
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmutils.c b/sys/contrib/dev/acpica/components/disassembler/dmutils.c
index bdc252e..32cc4b6 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmutils.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmutils.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
@@ -50,7 +50,6 @@
#include <contrib/dev/acpica/include/acnamesp.h>
#endif
-#ifdef ACPI_DISASSEMBLER
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dmutils")
@@ -228,7 +227,7 @@ AcpiDmIndent (
return;
}
- AcpiOsPrintf ("%*.s", ACPI_MUL_4 (Level), " ");
+ AcpiOsPrintf ("%*.s", (Level * 4), " ");
}
@@ -280,8 +279,8 @@ AcpiDmCommaIfListMember (
}
}
- if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
- (!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)))
+ if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) &&
+ (!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)))
{
return (FALSE);
}
@@ -296,8 +295,8 @@ AcpiDmCommaIfListMember (
return (TRUE);
}
- else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
- (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
+ else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) &&
+ (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST))
{
AcpiOsPrintf (", ");
return (TRUE);
@@ -329,5 +328,3 @@ AcpiDmCommaIfFieldMember (
AcpiOsPrintf (", ");
}
}
-
-#endif
diff --git a/sys/contrib/dev/acpica/components/disassembler/dmwalk.c b/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
index 2dbaa84..9621862 100644
--- a/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
+++ b/sys/contrib/dev/acpica/components/disassembler/dmwalk.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
@@ -45,12 +45,9 @@
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acparser.h>
#include <contrib/dev/acpica/include/amlcode.h>
-#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/acdebug.h>
-#ifdef ACPI_DISASSEMBLER
-
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dmwalk")
@@ -117,10 +114,11 @@ AcpiDmDisassemble (
return;
}
- Info.Flags = 0;
- Info.Level = 0;
- Info.Count = 0;
+ memset (&Info, 0, sizeof (ACPI_OP_WALK_INFO));
Info.WalkState = WalkState;
+ Info.StartAml = Op->Common.Aml - sizeof (ACPI_TABLE_HEADER);
+ Info.AmlOffset = Op->Common.Aml - Info.StartAml;
+
AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info);
return;
}
@@ -313,6 +311,8 @@ AcpiDmBlockType (
return (BLOCK_NONE);
}
+ /*lint -fallthrough */
+
default:
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
@@ -410,7 +410,43 @@ AcpiDmDescendingOp (
const ACPI_OPCODE_INFO *OpInfo;
UINT32 Name;
ACPI_PARSE_OBJECT *NextOp;
+ ACPI_PARSE_OBJECT *NextOp2;
+ UINT32 AmlOffset;
+
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ /* Listing support to dump the AML code after the ASL statement */
+
+ if (AcpiGbl_DmOpt_Listing)
+ {
+ /* We only care about these classes of objects */
+
+ if ((OpInfo->Class == AML_CLASS_NAMED_OBJECT) ||
+ (OpInfo->Class == AML_CLASS_CONTROL) ||
+ (OpInfo->Class == AML_CLASS_CREATE) ||
+ ((OpInfo->Class == AML_CLASS_EXECUTE) && (!Op->Common.Next)))
+ {
+ if (AcpiGbl_DmOpt_Listing && Info->PreviousAml)
+ {
+ /* Dump the AML byte code for the previous Op */
+
+ if (Op->Common.Aml > Info->PreviousAml)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiUtDumpBuffer (
+ (Info->StartAml + Info->AmlOffset),
+ (Op->Common.Aml - Info->PreviousAml),
+ DB_BYTE_DISPLAY, Info->AmlOffset);
+ AcpiOsPrintf ("\n");
+ }
+
+ Info->AmlOffset = (Op->Common.Aml - Info->StartAml);
+ }
+ Info->PreviousAml = Op->Common.Aml;
+ }
+ }
if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
{
@@ -419,6 +455,38 @@ AcpiDmDescendingOp (
return (AE_CTRL_DEPTH);
}
+ if (Op->Common.AmlOpcode == AML_IF_OP)
+ {
+ NextOp = AcpiPsGetDepthNext (NULL, Op);
+ if (NextOp)
+ {
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
+
+ /* Don't emit the actual embedded externals unless asked */
+
+ if (!AcpiGbl_DmEmitExternalOpcodes)
+ {
+ /*
+ * A Zero predicate indicates the possibility of one or more
+ * External() opcodes within the If() block.
+ */
+ if (NextOp->Common.AmlOpcode == AML_ZERO_OP)
+ {
+ NextOp2 = NextOp->Common.Next;
+
+ if (NextOp2 &&
+ (NextOp2->Common.AmlOpcode == AML_EXTERNAL_OP))
+ {
+ /* Ignore the If 0 block and all children */
+
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ return (AE_CTRL_DEPTH);
+ }
+ }
+ }
+ }
+ }
+
/* Level 0 is at the Definition Block level */
if (Level == 0)
@@ -427,10 +495,15 @@ AcpiDmDescendingOp (
if (Info->WalkState)
{
- VERBOSE_PRINT ((DB_FULL_OP_INFO,
- (Info->WalkState->MethodNode ?
- Info->WalkState->MethodNode->Name.Ascii : " "),
- Op->Common.AmlOffset, (UINT32) Op->Common.AmlOpcode));
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
+ Info->WalkState->ParserState.AmlStart);
+ if (AcpiGbl_DmOpt_Verbose)
+ {
+ AcpiOsPrintf (DB_FULL_OP_INFO,
+ (Info->WalkState->MethodNode ?
+ Info->WalkState->MethodNode->Name.Ascii : " "),
+ AmlOffset, (UINT32) Op->Common.AmlOpcode);
+ }
}
if (Op->Common.AmlOpcode == AML_SCOPE_OP)
@@ -446,40 +519,41 @@ AcpiDmDescendingOp (
}
}
else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
- (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
- (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
+ (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) &&
+ (!(Op->Common.DisasmFlags & ACPI_PARSEOP_ELSEIF)) &&
+ (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
{
+ /*
+ * This is a first-level element of a term list,
+ * indent a new line
+ */
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_NOOP_OP:
/*
- * This is a first-level element of a term list,
- * indent a new line
+ * Optionally just ignore this opcode. Some tables use
+ * NoOp opcodes for "padding" out packages that the BIOS
+ * changes dynamically. This can leave hundreds or
+ * thousands of NoOp opcodes that if disassembled,
+ * cannot be compiled because they are syntactically
+ * incorrect.
*/
- switch (Op->Common.AmlOpcode)
+ if (AcpiGbl_IgnoreNoopOperator)
{
- case AML_NOOP_OP:
- /*
- * Optionally just ignore this opcode. Some tables use
- * NoOp opcodes for "padding" out packages that the BIOS
- * changes dynamically. This can leave hundreds or
- * thousands of NoOp opcodes that if disassembled,
- * cannot be compiled because they are syntactically
- * incorrect.
- */
- if (AcpiGbl_IgnoreNoopOperator)
- {
- Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
- return (AE_OK);
- }
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ return (AE_OK);
+ }
- /* Fallthrough */
+ /* Fallthrough */
- default:
+ default:
- AcpiDmIndent (Level);
- break;
- }
+ AcpiDmIndent (Level);
+ break;
+ }
- Info->LastLevel = Level;
- Info->Count = 0;
+ Info->LastLevel = Level;
+ Info->Count = 0;
}
/*
@@ -521,8 +595,6 @@ AcpiDmDescendingOp (
/* Start the opcode argument list if necessary */
- OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
-
if ((OpInfo->Flags & AML_HAS_ARGS) ||
(Op->Common.AmlOpcode == AML_EVENT_OP))
{
@@ -562,7 +634,7 @@ AcpiDmDescendingOp (
if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)
{
- if (AcpiGbl_DbOpt_Verbose)
+ if (AcpiGbl_DmOpt_Verbose)
{
(void) AcpiPsDisplayObjectPathname (NULL, Op);
}
@@ -601,10 +673,10 @@ AcpiDmDescendingOp (
AcpiOsPrintf (", ");
NextOp = AcpiPsGetDepthNext (NULL, Op);
- NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
NextOp = NextOp->Common.Next;
- NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
return (AE_OK);
case AML_PROCESSOR_OP:
@@ -613,13 +685,13 @@ AcpiDmDescendingOp (
AcpiOsPrintf (", ");
NextOp = AcpiPsGetDepthNext (NULL, Op);
- NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
NextOp = NextOp->Common.Next;
- NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
NextOp = NextOp->Common.Next;
- NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
return (AE_OK);
case AML_MUTEX_OP:
@@ -678,12 +750,12 @@ AcpiDmDescendingOp (
* Bank Value. This is a TermArg in the middle of the parameter
* list, must handle it here.
*
- * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMLIST
+ * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMETER_LIST
* eliminates newline in the output.
*/
NextOp = NextOp->Common.Next;
- Info->Flags = ACPI_PARSEOP_PARAMLIST;
+ Info->Flags = ACPI_PARSEOP_PARAMETER_LIST;
AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp,
AcpiDmAscendingOp, Info);
Info->Flags = 0;
@@ -745,11 +817,11 @@ AcpiDmDescendingOp (
/* Normal Buffer, mark size as in the parameter list */
- NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
return (AE_OK);
- case AML_VAR_PACKAGE_OP:
case AML_IF_OP:
+ case AML_VAR_PACKAGE_OP:
case AML_WHILE_OP:
/* The next op is the size or predicate parameter */
@@ -757,7 +829,7 @@ AcpiDmDescendingOp (
NextOp = AcpiPsGetDepthNext (NULL, Op);
if (NextOp)
{
- NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
}
return (AE_OK);
@@ -768,7 +840,7 @@ AcpiDmDescendingOp (
NextOp = AcpiPsGetDepthNext (NULL, Op);
if (NextOp)
{
- NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
+ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
}
return (AE_OK);
@@ -867,14 +939,14 @@ AcpiDmAscendingOp (
if (!AcpiDmCommaIfListMember (Op))
{
if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
- (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
- (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
+ (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) &&
+ (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
{
/*
* This is a first-level element of a term list
* start a new line
*/
- if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST))
+ if (!(Info->Flags & ACPI_PARSEOP_PARAMETER_LIST))
{
AcpiOsPrintf ("\n");
}
@@ -929,8 +1001,8 @@ AcpiDmAscendingOp (
if (!AcpiDmCommaIfListMember (Op))
{
if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
- (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
- (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
+ (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) &&
+ (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
{
/*
* This is a first-level element of a term list
@@ -946,7 +1018,7 @@ AcpiDmAscendingOp (
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
- if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
+ if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST))
{
AcpiOsPrintf ("\n");
}
@@ -960,17 +1032,17 @@ AcpiDmAscendingOp (
break;
}
- if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)
{
if ((Op->Common.Next) &&
- (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
+ (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST))
{
return (AE_OK);
}
/*
* The parent Op is guaranteed to be valid because of the flag
- * ACPI_PARSEOP_PARAMLIST -- which means that this op is part of
+ * ACPI_PARSEOP_PARAMETER_LIST -- which means that this op is part of
* a parameter list and thus has a valid parent.
*/
ParentOp = Op->Common.Parent;
@@ -1026,5 +1098,3 @@ AcpiDmAscendingOp (
return (AE_OK);
}
-
-#endif /* ACPI_DISASSEMBLER */
OpenPOWER on IntegriCloud