summaryrefslogtreecommitdiff
path: root/source/components
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2015-07-20 22:31:50 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2015-07-20 22:31:50 +0000
commit136eac2a0638d3c751b1987603f71a9ae26879fd (patch)
tree1e61df024e8a47b6bc4e25d07f455c9dcd7e2dc8 /source/components
parentf3bbb1ca6c1b2b877d015a8f5f0c67e48a7a57ae (diff)
Notes
Diffstat (limited to 'source/components')
-rw-r--r--source/components/debugger/dbcmds.c86
-rw-r--r--source/components/debugger/dbdisply.c11
-rw-r--r--source/components/debugger/dbinput.c29
-rw-r--r--source/components/debugger/dbmethod.c20
-rw-r--r--source/components/debugger/dbnames.c6
-rw-r--r--source/components/debugger/dbobject.c (renamed from source/components/disassembler/dmobject.c)119
-rw-r--r--source/components/debugger/dbutils.c3
-rw-r--r--source/components/debugger/dbxface.c16
-rw-r--r--source/components/disassembler/dmdeferred.c10
-rw-r--r--source/components/disassembler/dmnames.c2
-rw-r--r--source/components/disassembler/dmopcode.c3
-rw-r--r--source/components/disassembler/dmwalk.c22
-rw-r--r--source/components/dispatcher/dsargs.c4
-rw-r--r--source/components/dispatcher/dsdebug.c249
-rw-r--r--source/components/dispatcher/dsmethod.c34
-rw-r--r--source/components/dispatcher/dswload.c2
-rw-r--r--source/components/dispatcher/dswload2.c2
-rw-r--r--source/components/executer/excreate.c1
-rw-r--r--source/components/executer/exdebug.c372
-rw-r--r--source/components/executer/exdump.c3
-rw-r--r--source/components/namespace/nsnames.c308
-rw-r--r--source/components/namespace/nsparse.c44
-rw-r--r--source/components/namespace/nsutils.c2
-rw-r--r--source/components/namespace/nsxfname.c6
-rw-r--r--source/components/parser/psargs.c23
-rw-r--r--source/components/parser/psloop.c15
-rw-r--r--source/components/parser/psobject.c16
-rw-r--r--source/components/parser/psparse.c14
-rw-r--r--source/components/parser/psutils.c9
-rw-r--r--source/components/parser/psxface.c145
-rw-r--r--source/components/resources/rscreate.c3
-rw-r--r--source/components/utilities/utclib.c11
-rw-r--r--source/components/utilities/utdebug.c37
-rw-r--r--source/components/utilities/utdelete.c4
-rw-r--r--source/components/utilities/utinit.c2
-rw-r--r--source/components/utilities/utmisc.c2
-rw-r--r--source/components/utilities/utnonansi.c453
-rw-r--r--source/components/utilities/utstring.c412
38 files changed, 1600 insertions, 900 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c
index 4a2c4e850107..d22bf4ca79e2 100644
--- a/source/components/debugger/dbcmds.c
+++ b/source/components/debugger/dbcmds.c
@@ -86,6 +86,8 @@ AcpiDbDoOneSleepState (
UINT8 SleepState);
+static char *AcpiDbTraceMethodName = NULL;
+
/*******************************************************************************
*
* FUNCTION: AcpiDbConvertToNode
@@ -1226,4 +1228,88 @@ AcpiDbGenerateSci (
#endif /* !ACPI_REDUCED_HARDWARE */
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbTrace
+ *
+ * PARAMETERS: EnableArg - ENABLE/AML to enable tracer
+ * DISABLE to disable tracer
+ * MethodArg - Method to trace
+ * OnceArg - Whether trace once
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Control method tracing facility
+ *
+ ******************************************************************************/
+
+void
+AcpiDbTrace (
+ char *EnableArg,
+ char *MethodArg,
+ char *OnceArg)
+{
+ UINT32 DebugLevel = 0;
+ UINT32 DebugLayer = 0;
+ UINT32 Flags = 0;
+
+
+ if (EnableArg)
+ {
+ AcpiUtStrupr (EnableArg);
+ }
+ if (OnceArg)
+ {
+ AcpiUtStrupr (OnceArg);
+ }
+ if (MethodArg)
+ {
+ if (AcpiDbTraceMethodName)
+ {
+ ACPI_FREE (AcpiDbTraceMethodName);
+ AcpiDbTraceMethodName = NULL;
+ }
+ AcpiDbTraceMethodName = ACPI_ALLOCATE (strlen (MethodArg) + 1);
+ if (!AcpiDbTraceMethodName)
+ {
+ AcpiOsPrintf ("Failed to allocate method name (%s)\n", MethodArg);
+ return;
+ }
+ strcpy (AcpiDbTraceMethodName, MethodArg);
+ }
+ if (!strcmp (EnableArg, "ENABLE") ||
+ !strcmp (EnableArg, "METHOD") ||
+ !strcmp (EnableArg, "OPCODE"))
+ {
+ if (!strcmp (EnableArg, "ENABLE"))
+ {
+ /* Inherit current console settings */
+
+ DebugLevel = AcpiGbl_DbConsoleDebugLevel;
+ DebugLayer = AcpiDbgLayer;
+ }
+ else
+ {
+ /* Restrict console output to trace points only */
+
+ DebugLevel = ACPI_LV_TRACE_POINT;
+ DebugLayer = ACPI_EXECUTER;
+ }
+
+ Flags = ACPI_TRACE_ENABLED;
+ if (!strcmp (EnableArg, "OPCODE"))
+ {
+ Flags |= ACPI_TRACE_OPCODE;
+ }
+ if (OnceArg && !strcmp (OnceArg, "ONCE"))
+ {
+ Flags |= ACPI_TRACE_ONESHOT;
+ }
+ }
+
+ (void) AcpiDebugTrace (AcpiDbTraceMethodName,
+ DebugLevel, DebugLayer, Flags);
+}
+
#endif /* ACPI_DEBUGGER */
diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c
index aedc8bfb8258..10821a2f4a0d 100644
--- a/source/components/debugger/dbdisply.c
+++ b/source/components/debugger/dbdisply.c
@@ -49,7 +49,6 @@
#include "acparser.h"
#include "acinterp.h"
#include "acdebug.h"
-#include "acdisasm.h"
#ifdef ACPI_DEBUGGER
@@ -513,7 +512,7 @@ AcpiDbDisplayLocals (
return;
}
- AcpiDmDisplayLocals (WalkState);
+ AcpiDbDecodeLocals (WalkState);
}
@@ -543,7 +542,7 @@ AcpiDbDisplayArguments (
return;
}
- AcpiDmDisplayArguments (WalkState);
+ AcpiDbDecodeArguments (WalkState);
}
@@ -599,7 +598,7 @@ AcpiDbDisplayResults (
{
ObjDesc = Frame->Results.ObjDesc[Index];
AcpiOsPrintf ("Result%u: ", i);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
if (Index == 0)
{
Frame = Frame->Results.Next;
@@ -763,7 +762,7 @@ AcpiDbDisplayResultObject (
}
AcpiOsPrintf ("ResultObj: ");
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
AcpiOsPrintf ("\n");
}
@@ -793,7 +792,7 @@ AcpiDbDisplayArgumentObject (
}
AcpiOsPrintf ("ArgObj: ");
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
}
diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c
index e588167dd03e..15dfb4b3a70c 100644
--- a/source/components/debugger/dbinput.c
+++ b/source/components/debugger/dbinput.c
@@ -218,7 +218,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
{"TABLES", 0},
{"TEMPLATE", 1},
{"TERMINATE", 0},
- {"TEST", 1},
+ {"TEST", 1},
{"THREADS", 3},
{"TRACE", 1},
{"TREE", 0},
@@ -270,7 +270,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
{1, " Paths", "Display full pathnames of namespace objects\n"},
{1, " Predefined", "Check all predefined names\n"},
- {1, " Prefix [<NamePath>]", "Set or Get current execution prefix\n"},
+ {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
{1, " References <Addr>", "Find all references to object at addr\n"},
{1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
{1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
@@ -297,8 +297,12 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Results", "Display method result stack\n"},
{1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
{1, " Stop", "Terminate control method\n"},
- {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"},
- {1, " Trace <method name>", "Trace method execution\n"},
+ {1, " Thread <Threads><Loops><Namepath>", "Spawn threads to execute method(s)\n"},
+ {5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"},
+ {1, " Enable", "Enable all messages\n"},
+ {1, " Disable", "Disable tracing\n"},
+ {1, " Method", "Enable method execution messages\n"},
+ {1, " Opcode", "Enable opcode execution messages\n"},
{1, " Tree", "Display control method calling tree\n"},
{1, " <Enter>", "Single step next AML opcode (over calls)\n"},
@@ -749,15 +753,22 @@ AcpiDbCommandDispatch (
return (AE_CTRL_TERMINATE);
}
-
- /* Add all commands that come here to the history buffer */
-
- AcpiDbAddToHistory (InputBuffer);
+ /* Find command and add to the history buffer */
ParamCount = AcpiDbGetLine (InputBuffer);
CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
Temp = 0;
+ /*
+ * We don't want to add the !! command to the history buffer. It
+ * would cause an infinite loop because it would always be the
+ * previous command.
+ */
+ if (CommandIndex != CMD_HISTORY_LAST)
+ {
+ AcpiDbAddToHistory (InputBuffer);
+ }
+
/* Verify that we have the minimum number of params */
if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
@@ -1110,7 +1121,7 @@ AcpiDbCommandDispatch (
case CMD_TRACE:
- (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1);
+ AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
break;
case CMD_TREE:
diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c
index 2b03d359f3c7..f42496a399b7 100644
--- a/source/components/debugger/dbmethod.c
+++ b/source/components/debugger/dbmethod.c
@@ -46,7 +46,9 @@
#include "acdispat.h"
#include "acnamesp.h"
#include "acdebug.h"
+#ifdef ACPI_DISASSEMBLER
#include "acdisasm.h"
+#endif
#include "acparser.h"
#include "acpredef.h"
@@ -79,6 +81,7 @@ AcpiDbSetMethodBreakpoint (
ACPI_PARSE_OBJECT *Op)
{
UINT32 Address;
+ UINT32 AmlOffset;
if (!Op)
@@ -90,10 +93,12 @@ AcpiDbSetMethodBreakpoint (
/* Get and verify the breakpoint address */
Address = strtoul (Location, NULL, 16);
- if (Address <= Op->Common.AmlOffset)
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
+ WalkState->ParserState.AmlStart);
+ if (Address <= AmlOffset)
{
AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
- Address, Op->Common.AmlOffset);
+ Address, AmlOffset);
}
/* Save breakpoint in current walk */
@@ -238,7 +243,7 @@ AcpiDbSetMethodData (
ObjDesc = WalkState->Arguments[Index].Object;
AcpiOsPrintf ("Arg%u: ", Index);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
break;
case 'L':
@@ -261,7 +266,7 @@ AcpiDbSetMethodData (
ObjDesc = WalkState->LocalVariables[Index].Object;
AcpiOsPrintf ("Local%u: ", Index);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
break;
default:
@@ -307,7 +312,9 @@ AcpiDbDisassembleAml (
NumStatements = strtoul (Statements, NULL, 0);
}
+#ifdef ACPI_DISASSEMBLER
AcpiDmDisassemble (NULL, Op, NumStatements);
+#endif
}
@@ -350,7 +357,7 @@ AcpiDbDisassembleMethod (
ObjDesc = Method->Object;
- Op = AcpiPsCreateScopeOp ();
+ Op = AcpiPsCreateScopeOp (ObjDesc->Method.AmlStart);
if (!Op)
{
return (AE_NO_MEMORY);
@@ -390,6 +397,8 @@ AcpiDbDisassembleMethod (
WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
+
+#ifdef ACPI_DISASSEMBER
(void) AcpiDmParseDeferredOps (Op);
/* Now we can disassemble the method */
@@ -397,6 +406,7 @@ AcpiDbDisassembleMethod (
AcpiGbl_DbOpt_Verbose = FALSE;
AcpiDmDisassemble (NULL, Op, 0);
AcpiGbl_DbOpt_Verbose = TRUE;
+#endif
AcpiPsDeleteParseTree (Op);
diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c
index 0b56f076bf7f..716fd3ce5cb6 100644
--- a/source/components/debugger/dbnames.c
+++ b/source/components/debugger/dbnames.c
@@ -385,7 +385,7 @@ AcpiDbWalkAndMatchName (
/* Get the full pathname to this object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
@@ -582,7 +582,7 @@ AcpiDbWalkForSpecificObjects (
/* Get and display the full pathname to this object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
@@ -886,7 +886,7 @@ AcpiDbBusWalk (
/* Get the full path to this device object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
diff --git a/source/components/disassembler/dmobject.c b/source/components/debugger/dbobject.c
index 6023c786b1e7..c7447af6d9d8 100644
--- a/source/components/disassembler/dmobject.c
+++ b/source/components/debugger/dbobject.c
@@ -1,6 +1,6 @@
/*******************************************************************************
*
- * Module Name: dmobject - ACPI object decode and display
+ * Module Name: dbobject - ACPI object decode and display
*
******************************************************************************/
@@ -44,28 +44,30 @@
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
+#include "acdebug.h"
+#ifdef ACPI_DISASSEMBLER
#include "acdisasm.h"
+#endif
-#ifdef ACPI_DISASSEMBLER
+#ifdef ACPI_DEBUGGER
#define _COMPONENT ACPI_CA_DEBUGGER
- ACPI_MODULE_NAME ("dmnames")
+ ACPI_MODULE_NAME ("dbobject")
/* Local prototypes */
static void
-AcpiDmDecodeNode (
+AcpiDbDecodeNode (
ACPI_NAMESPACE_NODE *Node);
/*******************************************************************************
*
- * FUNCTION: AcpiDmDumpMethodInfo
+ * FUNCTION: AcpiDbDumpMethodInfo
*
* PARAMETERS: Status - Method execution status
* WalkState - Current state of the parse tree walk
- * Op - Executing parse op
*
* RETURN: None
*
@@ -76,15 +78,11 @@ AcpiDmDecodeNode (
******************************************************************************/
void
-AcpiDmDumpMethodInfo (
+AcpiDbDumpMethodInfo (
ACPI_STATUS Status,
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
+ ACPI_WALK_STATE *WalkState)
{
- ACPI_PARSE_OBJECT *Next;
ACPI_THREAD_STATE *Thread;
- ACPI_WALK_STATE *NextWalkState;
- ACPI_NAMESPACE_NODE *PreviousMethod = NULL;
/* Ignore control codes, they are not errors */
@@ -113,68 +111,19 @@ AcpiDmDumpMethodInfo (
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);
+ AcpiDbDecodeLocals (WalkState);
AcpiOsPrintf ("\n");
- AcpiDmDisplayArguments (WalkState);
+ AcpiDbDecodeArguments (WalkState);
AcpiOsPrintf ("\n");
}
/*******************************************************************************
*
- * FUNCTION: AcpiDmDecodeInternalObject
+ * FUNCTION: AcpiDbDecodeInternalObject
*
* PARAMETERS: ObjDesc - Object to be displayed
*
@@ -185,7 +134,7 @@ AcpiDmDumpMethodInfo (
******************************************************************************/
void
-AcpiDmDecodeInternalObject (
+AcpiDbDecodeInternalObject (
ACPI_OPERAND_OBJECT *ObjDesc)
{
UINT32 i;
@@ -247,7 +196,7 @@ AcpiDmDecodeInternalObject (
/*******************************************************************************
*
- * FUNCTION: AcpiDmDecodeNode
+ * FUNCTION: AcpiDbDecodeNode
*
* PARAMETERS: Node - Object to be displayed
*
@@ -258,7 +207,7 @@ AcpiDmDecodeInternalObject (
******************************************************************************/
static void
-AcpiDmDecodeNode (
+AcpiDbDecodeNode (
ACPI_NAMESPACE_NODE *Node)
{
@@ -290,7 +239,7 @@ AcpiDmDecodeNode (
default:
- AcpiDmDecodeInternalObject (AcpiNsGetAttachedObject (Node));
+ AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node));
break;
}
}
@@ -298,7 +247,7 @@ AcpiDmDecodeNode (
/*******************************************************************************
*
- * FUNCTION: AcpiDmDisplayInternalObject
+ * FUNCTION: AcpiDbDisplayInternalObject
*
* PARAMETERS: ObjDesc - Object to be displayed
* WalkState - Current walk state
@@ -310,7 +259,7 @@ AcpiDmDecodeNode (
******************************************************************************/
void
-AcpiDmDisplayInternalObject (
+AcpiDbDisplayInternalObject (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState)
{
@@ -336,7 +285,7 @@ AcpiDmDisplayInternalObject (
case ACPI_DESC_TYPE_NAMED:
- AcpiDmDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc);
+ AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc);
break;
case ACPI_DESC_TYPE_OPERAND:
@@ -368,7 +317,7 @@ AcpiDmDisplayInternalObject (
ObjDesc = WalkState->LocalVariables
[ObjDesc->Reference.Value].Object;
AcpiOsPrintf ("%p", ObjDesc);
- AcpiDmDecodeInternalObject (ObjDesc);
+ AcpiDbDecodeInternalObject (ObjDesc);
}
break;
@@ -380,7 +329,7 @@ AcpiDmDisplayInternalObject (
ObjDesc = WalkState->Arguments
[ObjDesc->Reference.Value].Object;
AcpiOsPrintf ("%p", ObjDesc);
- AcpiDmDecodeInternalObject (ObjDesc);
+ AcpiDbDecodeInternalObject (ObjDesc);
}
break;
@@ -391,7 +340,7 @@ AcpiDmDisplayInternalObject (
case ACPI_TYPE_BUFFER_FIELD:
AcpiOsPrintf ("%p", ObjDesc->Reference.Object);
- AcpiDmDecodeInternalObject (ObjDesc->Reference.Object);
+ AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
break;
case ACPI_TYPE_PACKAGE:
@@ -403,7 +352,7 @@ AcpiDmDisplayInternalObject (
}
else
{
- AcpiDmDecodeInternalObject (
+ AcpiDbDecodeInternalObject (
*(ObjDesc->Reference.Where));
}
break;
@@ -428,11 +377,11 @@ AcpiDmDisplayInternalObject (
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object))
{
case ACPI_DESC_TYPE_NAMED:
- AcpiDmDecodeNode (ObjDesc->Reference.Object);
+ AcpiDbDecodeNode (ObjDesc->Reference.Object);
break;
case ACPI_DESC_TYPE_OPERAND:
- AcpiDmDecodeInternalObject (ObjDesc->Reference.Object);
+ AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
break;
default:
@@ -442,7 +391,7 @@ AcpiDmDisplayInternalObject (
case ACPI_REFCLASS_NAME:
- AcpiDmDecodeNode (ObjDesc->Reference.Node);
+ AcpiDbDecodeNode (ObjDesc->Reference.Node);
break;
case ACPI_REFCLASS_DEBUG:
@@ -461,7 +410,7 @@ AcpiDmDisplayInternalObject (
default:
AcpiOsPrintf ("<Obj> ");
- AcpiDmDecodeInternalObject (ObjDesc);
+ AcpiDbDecodeInternalObject (ObjDesc);
break;
}
break;
@@ -479,7 +428,7 @@ AcpiDmDisplayInternalObject (
/*******************************************************************************
*
- * FUNCTION: AcpiDmDisplayLocals
+ * FUNCTION: AcpiDbDecodeLocals
*
* PARAMETERS: WalkState - State for current method
*
@@ -490,7 +439,7 @@ AcpiDmDisplayInternalObject (
******************************************************************************/
void
-AcpiDmDisplayLocals (
+AcpiDbDecodeLocals (
ACPI_WALK_STATE *WalkState)
{
UINT32 i;
@@ -520,14 +469,14 @@ AcpiDmDisplayLocals (
{
ObjDesc = WalkState->LocalVariables[i].Object;
AcpiOsPrintf (" Local%X: ", i);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
}
}
/*******************************************************************************
*
- * FUNCTION: AcpiDmDisplayArguments
+ * FUNCTION: AcpiDbDecodeArguments
*
* PARAMETERS: WalkState - State for current method
*
@@ -538,7 +487,7 @@ AcpiDmDisplayLocals (
******************************************************************************/
void
-AcpiDmDisplayArguments (
+AcpiDbDecodeArguments (
ACPI_WALK_STATE *WalkState)
{
UINT32 i;
@@ -569,7 +518,7 @@ AcpiDmDisplayArguments (
{
ObjDesc = WalkState->Arguments[i].Object;
AcpiOsPrintf (" Arg%u: ", i);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
}
}
diff --git a/source/components/debugger/dbutils.c b/source/components/debugger/dbutils.c
index a089344e2297..4a7cf4144208 100644
--- a/source/components/debugger/dbutils.c
+++ b/source/components/debugger/dbutils.c
@@ -45,7 +45,6 @@
#include "accommon.h"
#include "acnamesp.h"
#include "acdebug.h"
-#include "acdisasm.h"
#ifdef ACPI_DEBUGGER
@@ -223,7 +222,7 @@ AcpiDbDumpExternalObject (
case ACPI_TYPE_LOCAL_REFERENCE:
AcpiOsPrintf ("[Object Reference] = ");
- AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL);
+ AcpiDbDisplayInternalObject (ObjDesc->Reference.Handle, NULL);
break;
case ACPI_TYPE_PROCESSOR:
diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c
index 33d5e363b649..6dcf1e54c8d0 100644
--- a/source/components/debugger/dbxface.c
+++ b/source/components/debugger/dbxface.c
@@ -45,7 +45,9 @@
#include "accommon.h"
#include "amlcode.h"
#include "acdebug.h"
+#ifdef ACPI_DISASSEMBLER
#include "acdisasm.h"
+#endif
#ifdef ACPI_DEBUGGER
@@ -179,6 +181,7 @@ AcpiDbSingleStep (
UINT32 OriginalDebugLevel;
ACPI_PARSE_OBJECT *DisplayOp;
ACPI_PARSE_OBJECT *ParentOp;
+ UINT32 AmlOffset;
ACPI_FUNCTION_ENTRY ();
@@ -192,15 +195,18 @@ AcpiDbSingleStep (
return (AE_ABORT_METHOD);
}
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
+ WalkState->ParserState.AmlStart);
+
/* Check for single-step breakpoint */
if (WalkState->MethodBreakpoint &&
- (WalkState->MethodBreakpoint <= Op->Common.AmlOffset))
+ (WalkState->MethodBreakpoint <= AmlOffset))
{
/* Check if the breakpoint has been reached or passed */
/* Hit the breakpoint, resume single step, reset breakpoint */
- AcpiOsPrintf ("***Break*** at AML offset %X\n", Op->Common.AmlOffset);
+ AcpiOsPrintf ("***Break*** at AML offset %X\n", AmlOffset);
AcpiGbl_CmSingleStep = TRUE;
AcpiGbl_StepToNextCall = FALSE;
WalkState->MethodBreakpoint = 0;
@@ -209,10 +215,10 @@ AcpiDbSingleStep (
/* Check for user breakpoint (Must be on exact Aml offset) */
else if (WalkState->UserBreakpoint &&
- (WalkState->UserBreakpoint == Op->Common.AmlOffset))
+ (WalkState->UserBreakpoint == AmlOffset))
{
AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n",
- Op->Common.AmlOffset);
+ AmlOffset);
AcpiGbl_CmSingleStep = TRUE;
AcpiGbl_StepToNextCall = FALSE;
WalkState->MethodBreakpoint = 0;
@@ -308,7 +314,9 @@ AcpiDbSingleStep (
/* Now we can display it */
+#ifdef ACPI_DISASSEMBLER
AcpiDmDisassemble (WalkState, DisplayOp, ACPI_UINT32_MAX);
+#endif
if ((Op->Common.AmlOpcode == AML_IF_OP) ||
(Op->Common.AmlOpcode == AML_WHILE_OP))
diff --git a/source/components/disassembler/dmdeferred.c b/source/components/disassembler/dmdeferred.c
index 1b4ef2057edd..35d5650f82ee 100644
--- a/source/components/disassembler/dmdeferred.c
+++ b/source/components/disassembler/dmdeferred.c
@@ -165,7 +165,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 +201,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/source/components/disassembler/dmnames.c b/source/components/disassembler/dmnames.c
index f942aead0f72..fc6a2cc6c381 100644
--- a/source/components/disassembler/dmnames.c
+++ b/source/components/disassembler/dmnames.c
@@ -179,7 +179,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****)");
diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c
index 60345fcaa599..35f9eef8251d 100644
--- a/source/components/disassembler/dmopcode.c
+++ b/source/components/disassembler/dmopcode.c
@@ -48,6 +48,7 @@
#include "acdisasm.h"
#include "acinterp.h"
#include "acnamesp.h"
+#include "acdebug.h"
#ifdef ACPI_DISASSEMBLER
@@ -967,7 +968,7 @@ AcpiDmDisassembleOneOp (
(WalkState->Results) &&
(WalkState->ResultCount))
{
- AcpiDmDecodeInternalObject (
+ AcpiDbDecodeInternalObject (
WalkState->Results->Results.ObjDesc [
(WalkState->ResultCount - 1) %
ACPI_RESULTS_FRAME_OBJ_NUM]);
diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c
index 6a8c505439f4..8ae0dc8d86d2 100644
--- a/source/components/disassembler/dmwalk.c
+++ b/source/components/disassembler/dmwalk.c
@@ -313,6 +313,8 @@ AcpiDmBlockType (
return (BLOCK_NONE);
}
+ /*lint -fallthrough */
+
default:
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
@@ -410,7 +412,23 @@ AcpiDmDescendingOp (
const ACPI_OPCODE_INFO *OpInfo;
UINT32 Name;
ACPI_PARSE_OBJECT *NextOp;
+ UINT32 AmlOffset;
+
+
+ if (AcpiGbl_DbOpt_Verbose && AcpiGbl_PreviousOp)
+ {
+ /* Dump the entire statement in AML byte code */
+ if (Op->Common.Aml > AcpiGbl_PreviousOp->Common.Aml)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiUtDumpBuffer (AcpiGbl_PreviousOp->Common.Aml,
+ (Op->Common.Aml - AcpiGbl_PreviousOp->Common.Aml),
+ DB_BYTE_DISPLAY, 0);
+ AcpiDmIndent (Level);
+ }
+ }
+ AcpiGbl_PreviousOp = Op;
if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
{
@@ -427,10 +445,12 @@ AcpiDmDescendingOp (
if (Info->WalkState)
{
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
+ Info->WalkState->ParserState.AmlStart);
VERBOSE_PRINT ((DB_FULL_OP_INFO,
(Info->WalkState->MethodNode ?
Info->WalkState->MethodNode->Name.Ascii : " "),
- Op->Common.AmlOffset, (UINT32) Op->Common.AmlOpcode));
+ AmlOffset, (UINT32) Op->Common.AmlOpcode));
}
if (Op->Common.AmlOpcode == AML_SCOPE_OP)
diff --git a/source/components/dispatcher/dsargs.c b/source/components/dispatcher/dsargs.c
index c9a1709a64aa..5d2d5f5684ad 100644
--- a/source/components/dispatcher/dsargs.c
+++ b/source/components/dispatcher/dsargs.c
@@ -94,7 +94,7 @@ AcpiDsExecuteArguments (
/* Allocate a new parser op to be the root of the parsed tree */
- Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
+ Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -141,7 +141,7 @@ AcpiDsExecuteArguments (
/* Evaluate the deferred arguments */
- Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
+ Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
diff --git a/source/components/dispatcher/dsdebug.c b/source/components/dispatcher/dsdebug.c
new file mode 100644
index 000000000000..527bbf7461d2
--- /dev/null
+++ b/source/components/dispatcher/dsdebug.c
@@ -0,0 +1,249 @@
+/******************************************************************************
+ *
+ * Module Name: dsdebug - Parser/Interpreter interface - debugging
+ *
+ *****************************************************************************/
+
+/*
+ * 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 "acpi.h"
+#include "accommon.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "acdisasm.h"
+#include "acinterp.h"
+
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dsdebug")
+
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
+/* Local prototypes */
+
+static void
+AcpiDsPrintNodePathname (
+ ACPI_NAMESPACE_NODE *Node,
+ const char *Message);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsPrintNodePathname
+ *
+ * PARAMETERS: Node - Object
+ * Message - Prefix message
+ *
+ * DESCRIPTION: Print an object's full namespace pathname
+ * Manages allocation/freeing of a pathname buffer
+ *
+ ******************************************************************************/
+
+static void
+AcpiDsPrintNodePathname (
+ ACPI_NAMESPACE_NODE *Node,
+ const char *Message)
+{
+ ACPI_BUFFER Buffer;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (DsPrintNodePathname);
+
+ if (!Node)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[NULL NAME]"));
+ return_VOID;
+ }
+
+ /* Convert handle to full pathname and print it (with supplied message) */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+ Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE);
+ if (ACPI_SUCCESS (Status))
+ {
+ if (Message)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "%s ", Message));
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[%s] (Node %p)",
+ (char *) Buffer.Pointer, Node));
+ ACPI_FREE (Buffer.Pointer);
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsDumpMethodStack
+ *
+ * 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.
+ *
+ ******************************************************************************/
+
+void
+AcpiDsDumpMethodStack (
+ 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;
+ ACPI_OPERAND_OBJECT *MethodDesc;
+
+
+ ACPI_FUNCTION_TRACE (DsDumpMethodStack);
+
+ /* Ignore control codes, they are not errors */
+
+ if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL)
+ {
+ return_VOID;
+ }
+
+ /* We may be executing a deferred opcode */
+
+ if (WalkState->DeferredNode)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Executing subtree for Buffer/Package/Region\n"));
+ return_VOID;
+ }
+
+ /*
+ * 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_VOID;
+ }
+
+ /* Display exception and method name */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "\n**** Exception %s during execution of method ",
+ AcpiFormatException (Status)));
+ AcpiDsPrintNodePathname (WalkState->MethodNode, NULL);
+
+ /* Display stack of executing methods */
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH,
+ "\n\nMethod Execution Stack:\n"));
+ NextWalkState = Thread->WalkStateList;
+
+ /* Walk list of linked walk states */
+
+ while (NextWalkState)
+ {
+ MethodDesc = NextWalkState->MethodDesc;
+ if (MethodDesc)
+ {
+ AcpiExStopTraceMethod (
+ (ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node,
+ MethodDesc, WalkState);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ " 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;
+
+#ifdef ACPI_DISASSEMBLER
+ AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX);
+#endif
+ 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.
+ */
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Call to method "));
+ AcpiDsPrintNodePathname (PreviousMethod, NULL);
+ }
+
+ PreviousMethod = NextWalkState->MethodNode;
+ NextWalkState = NextWalkState->Next;
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "\n"));
+ }
+
+ return_VOID;
+}
+
+#else
+
+void
+AcpiDsDumpMethodStack (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ return;
+}
+
+#endif
diff --git a/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c
index f1c3be8b1953..95e0cb3f2a00 100644
--- a/source/components/dispatcher/dsmethod.c
+++ b/source/components/dispatcher/dsmethod.c
@@ -46,9 +46,9 @@
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
-#include "acdisasm.h"
#include "acparser.h"
#include "amlcode.h"
+#include "acdebug.h"
#define _COMPONENT ACPI_DISPATCHER
@@ -109,7 +109,7 @@ AcpiDsAutoSerializeMethod (
/* Create/Init a root op for the method parse tree */
- Op = AcpiPsAllocOp (AML_METHOD_OP);
+ Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -213,7 +213,7 @@ AcpiDsDetectNamedOpcodes (
* RETURN: Status
*
* DESCRIPTION: Called on method error. Invoke the global exception handler if
- * present, dump the method data if the disassembler is configured
+ * present, dump the method data if the debugger is configured
*
* Note: Allows the exception handler to change the status code
*
@@ -224,6 +224,9 @@ AcpiDsMethodError (
ACPI_STATUS Status,
ACPI_WALK_STATE *WalkState)
{
+ UINT32 AmlOffset;
+
+
ACPI_FUNCTION_ENTRY ();
@@ -247,23 +250,28 @@ AcpiDsMethodError (
* Handler can map the exception code to anything it wants, including
* AE_OK, in which case the executing method will not be aborted.
*/
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml,
+ WalkState->ParserState.AmlStart);
+
Status = AcpiGbl_ExceptionHandler (Status,
WalkState->MethodNode ?
WalkState->MethodNode->Name.Integer : 0,
- WalkState->Opcode, WalkState->AmlOffset, NULL);
+ WalkState->Opcode, AmlOffset, NULL);
AcpiExEnterInterpreter ();
}
AcpiDsClearImplicitReturn (WalkState);
-#ifdef ACPI_DISASSEMBLER
if (ACPI_FAILURE (Status))
{
- /* Display method locals/args if disassembler is present */
+ AcpiDsDumpMethodStack (Status, WalkState, WalkState->Op);
- AcpiDmDumpMethodInfo (Status, WalkState, WalkState->Op);
- }
+ /* Display method locals/args if debugger is present */
+
+#ifdef ACPI_DEBUGGER
+ AcpiDbDumpMethodInfo (Status, WalkState);
#endif
+ }
return (Status);
}
@@ -349,6 +357,8 @@ AcpiDsBeginMethodExecution (
return_ACPI_STATUS (AE_NULL_ENTRY);
}
+ AcpiExStartTraceMethod (MethodNode, ObjDesc, WalkState);
+
/* Prevent wraparound of thread count */
if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX)
@@ -610,10 +620,7 @@ Cleanup:
/* On error, we must terminate the method properly */
AcpiDsTerminateControlMethod (ObjDesc, NextWalkState);
- if (NextWalkState)
- {
- AcpiDsDeleteWalkState (NextWalkState);
- }
+ AcpiDsDeleteWalkState (NextWalkState);
return_ACPI_STATUS (Status);
}
@@ -870,5 +877,8 @@ AcpiDsTerminateControlMethod (
}
}
+ AcpiExStopTraceMethod ((ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node,
+ MethodDesc, WalkState);
+
return_VOID;
}
diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c
index 37b7b39cbccc..bcc786801154 100644
--- a/source/components/dispatcher/dswload.c
+++ b/source/components/dispatcher/dswload.c
@@ -398,7 +398,7 @@ AcpiDsLoad1BeginOp (
{
/* Create a new op */
- Op = AcpiPsAllocOp (WalkState->Opcode);
+ Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
diff --git a/source/components/dispatcher/dswload2.c b/source/components/dispatcher/dswload2.c
index f7d43fe19e8a..f6095d971900 100644
--- a/source/components/dispatcher/dswload2.c
+++ b/source/components/dispatcher/dswload2.c
@@ -344,7 +344,7 @@ AcpiDsLoad2BeginOp (
{
/* Create a new op */
- Op = AcpiPsAllocOp (WalkState->Opcode);
+ Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
diff --git a/source/components/executer/excreate.c b/source/components/executer/excreate.c
index c7f945b048e6..9a002b88b657 100644
--- a/source/components/executer/excreate.c
+++ b/source/components/executer/excreate.c
@@ -526,6 +526,7 @@ AcpiExCreateMethod (
ObjDesc->Method.AmlStart = AmlStart;
ObjDesc->Method.AmlLength = AmlLength;
+ ObjDesc->Method.Node = Operand[0];
/*
* Disassemble the method flags. Split off the ArgCount, Serialized
diff --git a/source/components/executer/exdebug.c b/source/components/executer/exdebug.c
index 6ca866c01b04..f50d07b17945 100644
--- a/source/components/executer/exdebug.c
+++ b/source/components/executer/exdebug.c
@@ -43,13 +43,26 @@
#include "acpi.h"
#include "accommon.h"
+#include "acnamesp.h"
#include "acinterp.h"
+#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdebug")
+static ACPI_OPERAND_OBJECT *AcpiGbl_TraceMethodObject = NULL;
+
+/* Local prototypes */
+
+#ifdef ACPI_DEBUG_OUTPUT
+static const char *
+AcpiExGetTraceEventName (
+ ACPI_TRACE_EVENT_TYPE Type);
+#endif
+
+
#ifndef ACPI_NO_ERROR_MESSAGES
/*******************************************************************************
*
@@ -314,3 +327,362 @@ AcpiExDoDebugObject (
return_VOID;
}
#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExInterpreterTraceEnabled
+ *
+ * PARAMETERS: Name - Whether method name should be matched,
+ * this should be checked before starting
+ * the tracer
+ *
+ * RETURN: TRUE if interpreter trace is enabled.
+ *
+ * DESCRIPTION: Check whether interpreter trace is enabled
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiExInterpreterTraceEnabled (
+ char *Name)
+{
+
+ /* Check if tracing is enabled */
+
+ if (!(AcpiGbl_TraceFlags & ACPI_TRACE_ENABLED))
+ {
+ return (FALSE);
+ }
+
+ /*
+ * Check if tracing is filtered:
+ *
+ * 1. If the tracer is started, AcpiGbl_TraceMethodObject should have
+ * been filled by the trace starter
+ * 2. If the tracer is not started, AcpiGbl_TraceMethodName should be
+ * matched if it is specified
+ * 3. If the tracer is oneshot style, AcpiGbl_TraceMethodName should
+ * not be cleared by the trace stopper during the first match
+ */
+ if (AcpiGbl_TraceMethodObject)
+ {
+ return (TRUE);
+ }
+ if (Name &&
+ (AcpiGbl_TraceMethodName &&
+ strcmp (AcpiGbl_TraceMethodName, Name)))
+ {
+ return (FALSE);
+ }
+ if ((AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) &&
+ !AcpiGbl_TraceMethodName)
+ {
+ return (FALSE);
+ }
+
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExGetTraceEventName
+ *
+ * PARAMETERS: Type - Trace event type
+ *
+ * RETURN: Trace event name.
+ *
+ * DESCRIPTION: Used to obtain the full trace event name.
+ *
+ ******************************************************************************/
+
+#ifdef ACPI_DEBUG_OUTPUT
+
+static const char *
+AcpiExGetTraceEventName (
+ ACPI_TRACE_EVENT_TYPE Type)
+{
+ switch (Type)
+ {
+ case ACPI_TRACE_AML_METHOD:
+
+ return "Method";
+
+ case ACPI_TRACE_AML_OPCODE:
+
+ return "Opcode";
+
+ case ACPI_TRACE_AML_REGION:
+
+ return "Region";
+
+ default:
+
+ return "";
+ }
+}
+
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExTracePoint
+ *
+ * PARAMETERS: Type - Trace event type
+ * Begin - TRUE if before execution
+ * Aml - Executed AML address
+ * Pathname - Object path
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Internal interpreter execution trace.
+ *
+ ******************************************************************************/
+
+void
+AcpiExTracePoint (
+ ACPI_TRACE_EVENT_TYPE Type,
+ BOOLEAN Begin,
+ UINT8 *Aml,
+ char *Pathname)
+{
+
+ ACPI_FUNCTION_NAME (ExTracePoint);
+
+
+ if (Pathname)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT,
+ "%s %s [0x%p:%s] execution.\n",
+ AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End",
+ Aml, Pathname));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT,
+ "%s %s [0x%p] execution.\n",
+ AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End",
+ Aml));
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStartTraceMethod
+ *
+ * PARAMETERS: MethodNode - Node of the method
+ * ObjDesc - The method object
+ * WalkState - current state, NULL if not yet executing
+ * a method.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Start control method execution trace
+ *
+ ******************************************************************************/
+
+void
+AcpiExStartTraceMethod (
+ ACPI_NAMESPACE_NODE *MethodNode,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ char *Pathname = NULL;
+ BOOLEAN Enabled = FALSE;
+
+
+ ACPI_FUNCTION_NAME (ExStartTraceMethod);
+
+
+ if (MethodNode)
+ {
+ Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Exit;
+ }
+
+ Enabled = AcpiExInterpreterTraceEnabled (Pathname);
+ if (Enabled && !AcpiGbl_TraceMethodObject)
+ {
+ AcpiGbl_TraceMethodObject = ObjDesc;
+ AcpiGbl_OriginalDbgLevel = AcpiDbgLevel;
+ AcpiGbl_OriginalDbgLayer = AcpiDbgLayer;
+ AcpiDbgLevel = ACPI_TRACE_LEVEL_ALL;
+ AcpiDbgLayer = ACPI_TRACE_LAYER_ALL;
+
+ if (AcpiGbl_TraceDbgLevel)
+ {
+ AcpiDbgLevel = AcpiGbl_TraceDbgLevel;
+ }
+ if (AcpiGbl_TraceDbgLayer)
+ {
+ AcpiDbgLayer = AcpiGbl_TraceDbgLayer;
+ }
+ }
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+Exit:
+ if (Enabled)
+ {
+ ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, TRUE,
+ ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname);
+ }
+ if (Pathname)
+ {
+ ACPI_FREE (Pathname);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStopTraceMethod
+ *
+ * PARAMETERS: MethodNode - Node of the method
+ * ObjDesc - The method object
+ * WalkState - current state, NULL if not yet executing
+ * a method.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Stop control method execution trace
+ *
+ ******************************************************************************/
+
+void
+AcpiExStopTraceMethod (
+ ACPI_NAMESPACE_NODE *MethodNode,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ char *Pathname = NULL;
+ BOOLEAN Enabled;
+
+
+ ACPI_FUNCTION_NAME (ExStopTraceMethod);
+
+
+ if (MethodNode)
+ {
+ Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ExitPath;
+ }
+
+ Enabled = AcpiExInterpreterTraceEnabled (NULL);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+ if (Enabled)
+ {
+ ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, FALSE,
+ ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ExitPath;
+ }
+
+ /* Check whether the tracer should be stopped */
+
+ if (AcpiGbl_TraceMethodObject == ObjDesc)
+ {
+ /* Disable further tracing if type is one-shot */
+
+ if (AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT)
+ {
+ AcpiGbl_TraceMethodName = NULL;
+ }
+
+ AcpiDbgLevel = AcpiGbl_OriginalDbgLevel;
+ AcpiDbgLayer = AcpiGbl_OriginalDbgLayer;
+ AcpiGbl_TraceMethodObject = NULL;
+ }
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+ExitPath:
+ if (Pathname)
+ {
+ ACPI_FREE (Pathname);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStartTraceOpcode
+ *
+ * PARAMETERS: Op - The parser opcode object
+ * WalkState - current state, NULL if not yet executing
+ * a method.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Start opcode execution trace
+ *
+ ******************************************************************************/
+
+void
+AcpiExStartTraceOpcode (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+
+ ACPI_FUNCTION_NAME (ExStartTraceOpcode);
+
+
+ if (AcpiExInterpreterTraceEnabled (NULL) &&
+ (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE))
+ {
+ ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, TRUE,
+ Op->Common.Aml, Op->Common.AmlOpName);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStopTraceOpcode
+ *
+ * PARAMETERS: Op - The parser opcode object
+ * WalkState - current state, NULL if not yet executing
+ * a method.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Stop opcode execution trace
+ *
+ ******************************************************************************/
+
+void
+AcpiExStopTraceOpcode (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+
+ ACPI_FUNCTION_NAME (ExStopTraceOpcode);
+
+
+ if (AcpiExInterpreterTraceEnabled (NULL) &&
+ (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE))
+ {
+ ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, FALSE,
+ Op->Common.Aml, Op->Common.AmlOpName);
+ }
+}
diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c
index 299a1a0928ed..3142e62c088b 100644
--- a/source/components/executer/exdump.c
+++ b/source/components/executer/exdump.c
@@ -1039,7 +1039,8 @@ AcpiExDumpReferenceObj (
{
AcpiOsPrintf (" %p ", ObjDesc->Reference.Node);
- Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
+ Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node,
+ &RetBuf, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf (" Could not convert name to pathname\n");
diff --git a/source/components/namespace/nsnames.c b/source/components/namespace/nsnames.c
index 22e697b592b7..ea10930d1e4b 100644
--- a/source/components/namespace/nsnames.c
+++ b/source/components/namespace/nsnames.c
@@ -53,82 +53,6 @@
/*******************************************************************************
*
- * FUNCTION: AcpiNsBuildExternalPath
- *
- * PARAMETERS: Node - NS node whose pathname is needed
- * Size - Size of the pathname
- * *NameBuffer - Where to return the pathname
- *
- * RETURN: Status
- * Places the pathname into the NameBuffer, in external format
- * (name segments separated by path separators)
- *
- * DESCRIPTION: Generate a full pathaname
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiNsBuildExternalPath (
- ACPI_NAMESPACE_NODE *Node,
- ACPI_SIZE Size,
- char *NameBuffer)
-{
- ACPI_SIZE Index;
- ACPI_NAMESPACE_NODE *ParentNode;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- /* Special case for root */
-
- Index = Size - 1;
- if (Index < ACPI_NAME_SIZE)
- {
- NameBuffer[0] = AML_ROOT_PREFIX;
- NameBuffer[1] = 0;
- return (AE_OK);
- }
-
- /* Store terminator byte, then build name backwards */
-
- ParentNode = Node;
- NameBuffer[Index] = 0;
-
- while ((Index > ACPI_NAME_SIZE) && (ParentNode != AcpiGbl_RootNode))
- {
- Index -= ACPI_NAME_SIZE;
-
- /* Put the name into the buffer */
-
- ACPI_MOVE_32_TO_32 ((NameBuffer + Index), &ParentNode->Name);
- ParentNode = ParentNode->Parent;
-
- /* Prefix name with the path separator */
-
- Index--;
- NameBuffer[Index] = ACPI_PATH_SEPARATOR;
- }
-
- /* Overwrite final separator with the root prefix character */
-
- NameBuffer[Index] = AML_ROOT_PREFIX;
-
- if (Index != 0)
- {
- ACPI_ERROR ((AE_INFO,
- "Could not construct external pathname; index=%u, size=%u, Path=%s",
- (UINT32) Index, (UINT32) Size, &NameBuffer[Size]));
-
- return (AE_BAD_PARAMETER);
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiNsGetExternalPathname
*
* PARAMETERS: Node - Namespace node whose pathname is needed
@@ -146,39 +70,13 @@ char *
AcpiNsGetExternalPathname (
ACPI_NAMESPACE_NODE *Node)
{
- ACPI_STATUS Status;
char *NameBuffer;
- ACPI_SIZE Size;
ACPI_FUNCTION_TRACE_PTR (NsGetExternalPathname, Node);
- /* Calculate required buffer size based on depth below root */
-
- Size = AcpiNsGetPathnameLength (Node);
- if (!Size)
- {
- return_PTR (NULL);
- }
-
- /* Allocate a buffer to be returned to caller */
-
- NameBuffer = ACPI_ALLOCATE_ZEROED (Size);
- if (!NameBuffer)
- {
- ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size));
- return_PTR (NULL);
- }
-
- /* Build the path in the allocated buffer */
-
- Status = AcpiNsBuildExternalPath (Node, Size, NameBuffer);
- if (ACPI_FAILURE (Status))
- {
- ACPI_FREE (NameBuffer);
- return_PTR (NULL);
- }
+ NameBuffer = AcpiNsGetNormalizedPathname (Node, FALSE);
return_PTR (NameBuffer);
}
@@ -201,38 +99,14 @@ AcpiNsGetPathnameLength (
ACPI_NAMESPACE_NODE *Node)
{
ACPI_SIZE Size;
- ACPI_NAMESPACE_NODE *NextNode;
ACPI_FUNCTION_ENTRY ();
- /*
- * Compute length of pathname as 5 * number of name segments.
- * Go back up the parent tree to the root
- */
- Size = 0;
- NextNode = Node;
+ Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, FALSE);
- while (NextNode && (NextNode != AcpiGbl_RootNode))
- {
- if (ACPI_GET_DESCRIPTOR_TYPE (NextNode) != ACPI_DESC_TYPE_NAMED)
- {
- ACPI_ERROR ((AE_INFO,
- "Invalid Namespace Node (%p) while traversing namespace",
- NextNode));
- return (0);
- }
- Size += ACPI_PATH_SEGMENT_LENGTH;
- NextNode = NextNode->Parent;
- }
-
- if (!Size)
- {
- Size = 1; /* Root node case */
- }
-
- return (Size + 1); /* +1 for null string terminator */
+ return (Size);
}
@@ -243,6 +117,8 @@ AcpiNsGetPathnameLength (
* PARAMETERS: TargetHandle - Handle of named object whose name is
* to be found
* Buffer - Where the pathname is returned
+ * NoTrailing - Remove trailing '_' for each name
+ * segment
*
* RETURN: Status, Buffer is filled with pathname if status is AE_OK
*
@@ -253,7 +129,8 @@ AcpiNsGetPathnameLength (
ACPI_STATUS
AcpiNsHandleToPathname (
ACPI_HANDLE TargetHandle,
- ACPI_BUFFER *Buffer)
+ ACPI_BUFFER *Buffer,
+ BOOLEAN NoTrailing)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
@@ -271,7 +148,7 @@ AcpiNsHandleToPathname (
/* Determine size required for the caller buffer */
- RequiredSize = AcpiNsGetPathnameLength (Node);
+ RequiredSize = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing);
if (!RequiredSize)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -287,7 +164,8 @@ AcpiNsHandleToPathname (
/* Build the path in the caller buffer */
- Status = AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer);
+ (void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer,
+ RequiredSize, NoTrailing);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -297,3 +175,169 @@ AcpiNsHandleToPathname (
(char *) Buffer->Pointer, (UINT32) RequiredSize));
return_ACPI_STATUS (AE_OK);
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsBuildNormalizedPath
+ *
+ * PARAMETERS: Node - Namespace node
+ * FullPath - Where the path name is returned
+ * PathSize - Size of returned path name buffer
+ * NoTrailing - Remove trailing '_' from each name segment
+ *
+ * RETURN: Return 1 if the AML path is empty, otherwise returning (length
+ * of pathname + 1) which means the 'FullPath' contains a trailing
+ * null.
+ *
+ * DESCRIPTION: Build and return a full namespace pathname.
+ * Note that if the size of 'FullPath' isn't large enough to
+ * contain the namespace node's path name, the actual required
+ * buffer length is returned, and it should be greater than
+ * 'PathSize'. So callers are able to check the returning value
+ * to determine the buffer size of 'FullPath'.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiNsBuildNormalizedPath (
+ ACPI_NAMESPACE_NODE *Node,
+ char *FullPath,
+ UINT32 PathSize,
+ BOOLEAN NoTrailing)
+{
+ UINT32 Length = 0, i;
+ char Name[ACPI_NAME_SIZE];
+ BOOLEAN DoNoTrailing;
+ char c, *Left, *Right;
+ ACPI_NAMESPACE_NODE *NextNode;
+
+
+ ACPI_FUNCTION_TRACE_PTR (NsBuildNormalizedPath, Node);
+
+
+#define ACPI_PATH_PUT8(Path, Size, Byte, Length) \
+ do { \
+ if ((Length) < (Size)) \
+ { \
+ (Path)[(Length)] = (Byte); \
+ } \
+ (Length)++; \
+ } while (0)
+
+ /*
+ * Make sure the PathSize is correct, so that we don't need to
+ * validate both FullPath and PathSize.
+ */
+ if (!FullPath)
+ {
+ PathSize = 0;
+ }
+
+ if (!Node)
+ {
+ goto BuildTrailingNull;
+ }
+
+ NextNode = Node;
+ while (NextNode && NextNode != AcpiGbl_RootNode)
+ {
+ if (NextNode != Node)
+ {
+ ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length);
+ }
+ ACPI_MOVE_32_TO_32 (Name, &NextNode->Name);
+ DoNoTrailing = NoTrailing;
+ for (i = 0; i < 4; i++)
+ {
+ c = Name[4-i-1];
+ if (DoNoTrailing && c != '_')
+ {
+ DoNoTrailing = FALSE;
+ }
+ if (!DoNoTrailing)
+ {
+ ACPI_PATH_PUT8(FullPath, PathSize, c, Length);
+ }
+ }
+ NextNode = NextNode->Parent;
+ }
+ ACPI_PATH_PUT8(FullPath, PathSize, AML_ROOT_PREFIX, Length);
+
+ /* Reverse the path string */
+
+ if (Length <= PathSize)
+ {
+ Left = FullPath;
+ Right = FullPath+Length-1;
+ while (Left < Right)
+ {
+ c = *Left;
+ *Left++ = *Right;
+ *Right-- = c;
+ }
+ }
+
+ /* Append the trailing null */
+
+BuildTrailingNull:
+ ACPI_PATH_PUT8(FullPath, PathSize, '\0', Length);
+
+#undef ACPI_PATH_PUT8
+
+ return_UINT32 (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetNormalizedPathname
+ *
+ * PARAMETERS: Node - Namespace node whose pathname is needed
+ * NoTrailing - Remove trailing '_' from each name segment
+ *
+ * RETURN: Pointer to storage containing the fully qualified name of
+ * the node, In external format (name segments separated by path
+ * separators.)
+ *
+ * DESCRIPTION: Used to obtain the full pathname to a namespace node, usually
+ * for error and debug statements. All trailing '_' will be
+ * removed from the full pathname if 'NoTrailing' is specified..
+ *
+ ******************************************************************************/
+
+char *
+AcpiNsGetNormalizedPathname (
+ ACPI_NAMESPACE_NODE *Node,
+ BOOLEAN NoTrailing)
+{
+ char *NameBuffer;
+ ACPI_SIZE Size;
+
+
+ ACPI_FUNCTION_TRACE_PTR (NsGetNormalizedPathname, Node);
+
+
+ /* Calculate required buffer size based on depth below root */
+
+ Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing);
+ if (!Size)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Allocate a buffer to be returned to caller */
+
+ NameBuffer = ACPI_ALLOCATE_ZEROED (Size);
+ if (!NameBuffer)
+ {
+ ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size));
+ return_PTR (NULL);
+ }
+
+ /* Build the path in the allocated buffer */
+
+ (void) AcpiNsBuildNormalizedPath (Node, NameBuffer, Size, NoTrailing);
+
+ return_PTR (NameBuffer);
+}
diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c
index bfc5615ade68..996db01747fb 100644
--- a/source/components/namespace/nsparse.c
+++ b/source/components/namespace/nsparse.c
@@ -84,6 +84,22 @@ AcpiNsOneCompleteParse (
ACPI_FUNCTION_TRACE (NsOneCompleteParse);
+ Status = AcpiGetTableByIndex (TableIndex, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Table must consist of at least a complete header */
+
+ if (Table->Length < sizeof (ACPI_TABLE_HEADER))
+ {
+ return_ACPI_STATUS (AE_BAD_HEADER);
+ }
+
+ AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
+ AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+
Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
if (ACPI_FAILURE (Status))
{
@@ -92,7 +108,7 @@ AcpiNsOneCompleteParse (
/* Create and init a Root Node */
- ParseRoot = AcpiPsCreateScopeOp ();
+ ParseRoot = AcpiPsCreateScopeOp (AmlStart);
if (!ParseRoot)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -107,26 +123,12 @@ AcpiNsOneCompleteParse (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiGetTableByIndex (TableIndex, &Table);
+ Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
+ AmlStart, AmlLength, NULL, (UINT8) PassNumber);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
- AcpiPsFreeOp (ParseRoot);
- return_ACPI_STATUS (Status);
- }
-
- /* Table must consist of at least a complete header */
-
- if (Table->Length < sizeof (ACPI_TABLE_HEADER))
- {
- Status = AE_BAD_HEADER;
- }
- else
- {
- AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
- AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
- Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
- AmlStart, AmlLength, NULL, (UINT8) PassNumber);
+ goto Cleanup;
}
/* Found OSDT table, enable the namespace override feature */
@@ -137,12 +139,6 @@ AcpiNsOneCompleteParse (
WalkState->NamespaceOverride = TRUE;
}
- if (ACPI_FAILURE (Status))
- {
- AcpiDsDeleteWalkState (WalkState);
- goto Cleanup;
- }
-
/* StartNode is the default location to load the table */
if (StartNode && StartNode != AcpiGbl_RootNode)
diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c
index 5335810c6028..83d75d0207ed 100644
--- a/source/components/namespace/nsutils.c
+++ b/source/components/namespace/nsutils.c
@@ -90,7 +90,7 @@ AcpiNsPrintNodePathname (
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (Node, &Buffer);
+ Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE);
if (ACPI_SUCCESS (Status))
{
if (Message)
diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c
index 7f92201843aa..311431b2de84 100644
--- a/source/components/namespace/nsxfname.c
+++ b/source/components/namespace/nsxfname.c
@@ -193,11 +193,13 @@ AcpiGetName (
return (Status);
}
- if (NameType == ACPI_FULL_PATHNAME)
+ if (NameType == ACPI_FULL_PATHNAME ||
+ NameType == ACPI_FULL_PATHNAME_NO_TRAILING)
{
/* Get the full pathname (From the namespace root) */
- Status = AcpiNsHandleToPathname (Handle, Buffer);
+ Status = AcpiNsHandleToPathname (Handle, Buffer,
+ NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE);
return (Status);
}
diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c
index ae6807304a8d..538b73eebd1f 100644
--- a/source/components/parser/psargs.c
+++ b/source/components/parser/psargs.c
@@ -316,7 +316,7 @@ AcpiPsGetNextNamepath (
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Control Method - %p Desc %p Path=%p\n", Node, MethodDesc, Path));
- NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+ NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, Start);
if (!NameOp)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -524,7 +524,7 @@ static ACPI_PARSE_OBJECT *
AcpiPsGetNextField (
ACPI_PARSE_STATE *ParserState)
{
- UINT32 AmlOffset;
+ UINT8 *Aml;
ACPI_PARSE_OBJECT *Field;
ACPI_PARSE_OBJECT *Arg = NULL;
UINT16 Opcode;
@@ -540,8 +540,7 @@ AcpiPsGetNextField (
ACPI_FUNCTION_TRACE (PsGetNextField);
- AmlOffset = (UINT32) ACPI_PTR_DIFF (
- ParserState->Aml, ParserState->AmlStart);
+ Aml = ParserState->Aml;
/* Determine field type */
@@ -579,14 +578,12 @@ AcpiPsGetNextField (
/* Allocate a new field op */
- Field = AcpiPsAllocOp (Opcode);
+ Field = AcpiPsAllocOp (Opcode, Aml);
if (!Field)
{
return_PTR (NULL);
}
- Field->Common.AmlOffset = AmlOffset;
-
/* Decode the field type */
switch (Opcode)
@@ -650,6 +647,7 @@ AcpiPsGetNextField (
* Argument for Connection operator can be either a Buffer
* (resource descriptor), or a NameString.
*/
+ Aml = ParserState->Aml;
if (ACPI_GET8 (ParserState->Aml) == AML_BUFFER_OP)
{
ParserState->Aml++;
@@ -662,7 +660,7 @@ AcpiPsGetNextField (
{
/* Non-empty list */
- Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP);
+ Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP, Aml);
if (!Arg)
{
AcpiPsFreeOp (Field);
@@ -712,7 +710,7 @@ AcpiPsGetNextField (
}
else
{
- Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+ Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, Aml);
if (!Arg)
{
AcpiPsFreeOp (Field);
@@ -784,7 +782,7 @@ AcpiPsGetNextArg (
/* Constants, strings, and namestrings are all the same size */
- Arg = AcpiPsAllocOp (AML_BYTE_OP);
+ Arg = AcpiPsAllocOp (AML_BYTE_OP, ParserState->Aml);
if (!Arg)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -836,7 +834,8 @@ AcpiPsGetNextArg (
{
/* Non-empty list */
- Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP);
+ Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP,
+ ParserState->Aml);
if (!Arg)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -866,7 +865,7 @@ AcpiPsGetNextArg (
{
/* NullName or NameString */
- Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+ Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, ParserState->Aml);
if (!Arg)
{
return_ACPI_STATUS (AE_NO_MEMORY);
diff --git a/source/components/parser/psloop.c b/source/components/parser/psloop.c
index 4e1eb29b6978..7c079444bb11 100644
--- a/source/components/parser/psloop.c
+++ b/source/components/parser/psloop.c
@@ -51,6 +51,7 @@
#include "acpi.h"
#include "accommon.h"
+#include "acinterp.h"
#include "acparser.h"
#include "acdispat.h"
#include "amlcode.h"
@@ -134,8 +135,7 @@ AcpiPsGetArguments (
*/
while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount)
{
- WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,
- WalkState->ParserState.AmlStart);
+ WalkState->Aml = WalkState->ParserState.Aml;
Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
@@ -146,7 +146,6 @@ AcpiPsGetArguments (
if (Arg)
{
- Arg->Common.AmlOffset = WalkState->AmlOffset;
AcpiPsAppendArg (Op, Arg);
}
@@ -502,15 +501,7 @@ AcpiPsParseLoop (
continue;
}
- Op->Common.AmlOffset = WalkState->AmlOffset;
-
- if (WalkState->OpInfo)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
- (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name,
- Op, ParserState->Aml, Op->Common.AmlOffset));
- }
+ AcpiExStartTraceOpcode (Op, WalkState);
}
diff --git a/source/components/parser/psobject.c b/source/components/parser/psobject.c
index ed65495d9322..b9d8e8ce69bb 100644
--- a/source/components/parser/psobject.c
+++ b/source/components/parser/psobject.c
@@ -73,12 +73,13 @@ static ACPI_STATUS
AcpiPsGetAmlOpcode (
ACPI_WALK_STATE *WalkState)
{
+ UINT32 AmlOffset;
+
ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState);
- WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,
- WalkState->ParserState.AmlStart);
+ WalkState->Aml = WalkState->ParserState.Aml;
WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState));
/*
@@ -107,10 +108,13 @@ AcpiPsGetAmlOpcode (
if (WalkState->PassNumber == 2)
{
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml,
+ WalkState->ParserState.AmlStart);
+
ACPI_ERROR ((AE_INFO,
"Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
WalkState->Opcode,
- (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER))));
+ (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER))));
ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48);
@@ -122,13 +126,13 @@ AcpiPsGetAmlOpcode (
AcpiOsPrintf (
"/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
WalkState->Opcode,
- (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER)));
+ (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER)));
/* Dump the context surrounding the invalid opcode */
AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16),
48, DB_BYTE_DISPLAY,
- (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16));
+ (AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16));
AcpiOsPrintf (" */\n");
#endif
}
@@ -313,7 +317,7 @@ AcpiPsCreateOp (
/* Create Op structure and append to parent's argument list */
WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
- Op = AcpiPsAllocOp (WalkState->Opcode);
+ Op = AcpiPsAllocOp (WalkState->Opcode, AmlOpStart);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
diff --git a/source/components/parser/psparse.c b/source/components/parser/psparse.c
index 39520db3dfd4..49ab6313a1ac 100644
--- a/source/components/parser/psparse.c
+++ b/source/components/parser/psparse.c
@@ -161,6 +161,8 @@ AcpiPsCompleteThisOp (
return_ACPI_STATUS (AE_OK); /* OK for now */
}
+ AcpiExStopTraceOpcode (Op, WalkState);
+
/* Delete this op and the subtree below it if asked to */
if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
@@ -198,7 +200,8 @@ AcpiPsCompleteThisOp (
* These opcodes contain TermArg operands. The current
* op must be replaced by a placeholder return op
*/
- ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+ ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP,
+ Op->Common.Aml);
if (!ReplacementOp)
{
Status = AE_NO_MEMORY;
@@ -217,7 +220,8 @@ AcpiPsCompleteThisOp (
(Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP) ||
(Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
{
- ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+ ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP,
+ Op->Common.Aml);
if (!ReplacementOp)
{
Status = AE_NO_MEMORY;
@@ -230,7 +234,8 @@ AcpiPsCompleteThisOp (
(Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
(Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
{
- ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
+ ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode,
+ Op->Common.Aml);
if (!ReplacementOp)
{
Status = AE_NO_MEMORY;
@@ -246,7 +251,8 @@ AcpiPsCompleteThisOp (
default:
- ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
+ ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP,
+ Op->Common.Aml);
if (!ReplacementOp)
{
Status = AE_NO_MEMORY;
diff --git a/source/components/parser/psutils.c b/source/components/parser/psutils.c
index 55bf2ccff1b0..ec0d20c8e082 100644
--- a/source/components/parser/psutils.c
+++ b/source/components/parser/psutils.c
@@ -64,12 +64,12 @@
ACPI_PARSE_OBJECT *
AcpiPsCreateScopeOp (
- void)
+ UINT8 *Aml)
{
ACPI_PARSE_OBJECT *ScopeOp;
- ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP);
+ ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP, Aml);
if (!ScopeOp)
{
return (NULL);
@@ -115,6 +115,7 @@ AcpiPsInitOp (
* FUNCTION: AcpiPsAllocOp
*
* PARAMETERS: Opcode - Opcode that will be stored in the new Op
+ * Aml - Address of the opcode
*
* RETURN: Pointer to the new Op, null on failure
*
@@ -126,7 +127,8 @@ AcpiPsInitOp (
ACPI_PARSE_OBJECT*
AcpiPsAllocOp (
- UINT16 Opcode)
+ UINT16 Opcode,
+ UINT8 *Aml)
{
ACPI_PARSE_OBJECT *Op;
const ACPI_OPCODE_INFO *OpInfo;
@@ -173,6 +175,7 @@ AcpiPsAllocOp (
if (Op)
{
AcpiPsInitOp (Op, Opcode);
+ Op->Common.Aml = Aml;
Op->Common.Flags = Flags;
}
diff --git a/source/components/parser/psxface.c b/source/components/parser/psxface.c
index 85eea33bb9be..ae072b7dce7b 100644
--- a/source/components/parser/psxface.c
+++ b/source/components/parser/psxface.c
@@ -47,6 +47,7 @@
#include "acdispat.h"
#include "acinterp.h"
#include "actables.h"
+#include "acnamesp.h"
#define _COMPONENT ACPI_PARSER
@@ -55,14 +56,6 @@
/* Local Prototypes */
static void
-AcpiPsStartTrace (
- ACPI_EVALUATE_INFO *Info);
-
-static void
-AcpiPsStopTrace (
- ACPI_EVALUATE_INFO *Info);
-
-static void
AcpiPsUpdateParameterList (
ACPI_EVALUATE_INFO *Info,
UINT16 Action);
@@ -86,7 +79,7 @@ AcpiPsUpdateParameterList (
ACPI_STATUS
AcpiDebugTrace (
- char *Name,
+ const char *Name,
UINT32 DebugLevel,
UINT32 DebugLayer,
UINT32 Flags)
@@ -100,128 +93,14 @@ AcpiDebugTrace (
return (Status);
}
- /* TBDs: Validate name, allow full path or just nameseg */
-
- AcpiGbl_TraceMethodName = *ACPI_CAST_PTR (UINT32, Name);
+ AcpiGbl_TraceMethodName = Name;
AcpiGbl_TraceFlags = Flags;
-
- if (DebugLevel)
- {
- AcpiGbl_TraceDbgLevel = DebugLevel;
- }
- if (DebugLayer)
- {
- AcpiGbl_TraceDbgLayer = DebugLayer;
- }
+ AcpiGbl_TraceDbgLevel = DebugLevel;
+ AcpiGbl_TraceDbgLayer = DebugLayer;
+ Status = AE_OK;
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiPsStartTrace
- *
- * PARAMETERS: Info - Method info struct
- *
- * RETURN: None
- *
- * DESCRIPTION: Start control method execution trace
- *
- ******************************************************************************/
-
-static void
-AcpiPsStartTrace (
- ACPI_EVALUATE_INFO *Info)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return;
- }
-
- if ((!AcpiGbl_TraceMethodName) ||
- (AcpiGbl_TraceMethodName != Info->Node->Name.Integer))
- {
- goto Exit;
- }
-
- AcpiGbl_OriginalDbgLevel = AcpiDbgLevel;
- AcpiGbl_OriginalDbgLayer = AcpiDbgLayer;
-
- AcpiDbgLevel = 0x00FFFFFF;
- AcpiDbgLayer = ACPI_UINT32_MAX;
-
- if (AcpiGbl_TraceDbgLevel)
- {
- AcpiDbgLevel = AcpiGbl_TraceDbgLevel;
- }
- if (AcpiGbl_TraceDbgLayer)
- {
- AcpiDbgLayer = AcpiGbl_TraceDbgLayer;
- }
-
-
-Exit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiPsStopTrace
- *
- * PARAMETERS: Info - Method info struct
- *
- * RETURN: None
- *
- * DESCRIPTION: Stop control method execution trace
- *
- ******************************************************************************/
-
-static void
-AcpiPsStopTrace (
- ACPI_EVALUATE_INFO *Info)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return;
- }
-
- if ((!AcpiGbl_TraceMethodName) ||
- (AcpiGbl_TraceMethodName != Info->Node->Name.Integer))
- {
- goto Exit;
- }
-
- /* Disable further tracing if type is one-shot */
-
- if (AcpiGbl_TraceFlags & 1)
- {
- AcpiGbl_TraceMethodName = 0;
- AcpiGbl_TraceDbgLevel = 0;
- AcpiGbl_TraceDbgLayer = 0;
- }
-
- AcpiDbgLevel = AcpiGbl_OriginalDbgLevel;
- AcpiDbgLayer = AcpiGbl_OriginalDbgLayer;
-
-Exit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (Status);
}
@@ -284,10 +163,6 @@ AcpiPsExecuteMethod (
*/
AcpiPsUpdateParameterList (Info, REF_INCREMENT);
- /* Begin tracing if requested */
-
- AcpiPsStartTrace (Info);
-
/*
* Execute the method. Performs parse simultaneously
*/
@@ -297,7 +172,7 @@ AcpiPsExecuteMethod (
/* Create and init a Root Node */
- Op = AcpiPsCreateScopeOp ();
+ Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart);
if (!Op)
{
Status = AE_NO_MEMORY;
@@ -370,10 +245,6 @@ AcpiPsExecuteMethod (
Cleanup:
AcpiPsDeleteParseTree (Op);
- /* End optional tracing */
-
- AcpiPsStopTrace (Info);
-
/* Take away the extra reference that we gave the parameters above */
AcpiPsUpdateParameterList (Info, REF_DECREMENT);
diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c
index 551f59a6534c..926d79b768c8 100644
--- a/source/components/resources/rscreate.c
+++ b/source/components/resources/rscreate.c
@@ -370,7 +370,8 @@ AcpiRsCreatePciRoutingTable (
(UINT8 *) OutputBuffer->Pointer);
PathBuffer.Pointer = UserPrt->Source;
- Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer);
+ Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node,
+ &PathBuffer, FALSE);
/* +1 to include null terminator */
diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c
index a93ed867a4d8..76956d69f374 100644
--- a/source/components/utilities/utclib.c
+++ b/source/components/utilities/utclib.c
@@ -93,9 +93,6 @@
#ifndef ACPI_USE_SYSTEM_CLIBRARY /* Entire module */
-#define NEGATIVE 1
-#define POSITIVE 0
-
/*******************************************************************************
*
@@ -584,17 +581,17 @@ strtoul (
*/
if (*String == '-')
{
- sign = NEGATIVE;
+ sign = ACPI_SIGN_NEGATIVE;
++String;
}
else if (*String == '+')
{
++String;
- sign = POSITIVE;
+ sign = ACPI_SIGN_POSITIVE;
}
else
{
- sign = POSITIVE;
+ sign = ACPI_SIGN_POSITIVE;
}
/*
@@ -717,7 +714,7 @@ done:
/*
* If a minus sign was present, then "the conversion is negated":
*/
- if (sign == NEGATIVE)
+ if (sign == ACPI_SIGN_NEGATIVE)
{
ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
}
diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c
index 2aefacbd6a99..d88692a2d41c 100644
--- a/source/components/utilities/utdebug.c
+++ b/source/components/utilities/utdebug.c
@@ -45,6 +45,7 @@
#include "acpi.h"
#include "accommon.h"
+#include "acinterp.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utdebug")
@@ -634,6 +635,42 @@ AcpiUtPtrExit (
}
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTracePoint
+ *
+ * PARAMETERS: Type - Trace event type
+ * Begin - TRUE if before execution
+ * Aml - Executed AML address
+ * Pathname - Object path
+ * Pointer - Pointer to the related object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Interpreter execution trace.
+ *
+ ******************************************************************************/
+
+void
+AcpiTracePoint (
+ ACPI_TRACE_EVENT_TYPE Type,
+ BOOLEAN Begin,
+ UINT8 *Aml,
+ char *Pathname)
+{
+
+ ACPI_FUNCTION_ENTRY ();
+
+ AcpiExTracePoint (Type, Begin, Aml, Pathname);
+
+#ifdef ACPI_USE_SYSTEM_TRACER
+ AcpiOsTracePoint (Type, Begin, Aml, Pathname);
+#endif
+}
+
+ACPI_EXPORT_SYMBOL (AcpiTracePoint)
+
#endif
diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c
index 264b45de8e5d..17ccacb6e2a2 100644
--- a/source/components/utilities/utdelete.c
+++ b/source/components/utilities/utdelete.c
@@ -220,6 +220,10 @@ AcpiUtDeleteInternalObj (
AcpiUtDeleteObjectDesc (Object->Method.Mutex);
Object->Method.Mutex = NULL;
}
+ if (Object->Method.Node)
+ {
+ Object->Method.Node = NULL;
+ }
break;
case ACPI_TYPE_REGION:
diff --git a/source/components/utilities/utinit.c b/source/components/utilities/utinit.c
index d69599d4d1c0..5ac47bec03cf 100644
--- a/source/components/utilities/utinit.c
+++ b/source/components/utilities/utinit.c
@@ -224,8 +224,6 @@ AcpiUtInitGlobals (
AcpiGbl_AcpiHardwarePresent = TRUE;
AcpiGbl_LastOwnerIdIndex = 0;
AcpiGbl_NextOwnerIdOffset = 0;
- AcpiGbl_TraceDbgLevel = 0;
- AcpiGbl_TraceDbgLayer = 0;
AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING;
AcpiGbl_OsiMutex = NULL;
AcpiGbl_RegMethodsExecuted = FALSE;
diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c
index 8ac133a2c21a..a171aef2ec70 100644
--- a/source/components/utilities/utmisc.c
+++ b/source/components/utilities/utmisc.c
@@ -418,7 +418,7 @@ AcpiUtDisplayInitPathname (
/* Get the full pathname to the node */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE);
if (ACPI_FAILURE (Status))
{
return;
diff --git a/source/components/utilities/utnonansi.c b/source/components/utilities/utnonansi.c
new file mode 100644
index 000000000000..3c64eaa1f5f1
--- /dev/null
+++ b/source/components/utilities/utnonansi.c
@@ -0,0 +1,453 @@
+/*******************************************************************************
+ *
+ * Module Name: utnonansi - Non-ansi C library functions
+ *
+ ******************************************************************************/
+
+/*
+ * 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 "acpi.h"
+#include "accommon.h"
+
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utnonansi")
+
+
+/*
+ * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit
+ * version of strtoul.
+ */
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtStrlwr (strlwr)
+ *
+ * PARAMETERS: SrcString - The source string to convert
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert a string to lowercase
+ *
+ ******************************************************************************/
+
+void
+AcpiUtStrlwr (
+ char *SrcString)
+{
+ char *String;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!SrcString)
+ {
+ return;
+ }
+
+ /* Walk entire string, lowercasing the letters */
+
+ for (String = SrcString; *String; String++)
+ {
+ *String = (char) tolower ((int) *String);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtStrupr (strupr)
+ *
+ * PARAMETERS: SrcString - The source string to convert
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert a string to uppercase
+ *
+ ******************************************************************************/
+
+void
+AcpiUtStrupr (
+ char *SrcString)
+{
+ char *String;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!SrcString)
+ {
+ return;
+ }
+
+ /* Walk entire string, uppercasing the letters */
+
+ for (String = SrcString; *String; String++)
+ {
+ *String = (char) toupper ((int) *String);
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiUtStricmp (stricmp)
+ *
+ * PARAMETERS: String1 - first string to compare
+ * String2 - second string to compare
+ *
+ * RETURN: int that signifies string relationship. Zero means strings
+ * are equal.
+ *
+ * DESCRIPTION: Case-insensitive string compare. Implementation of the
+ * non-ANSI stricmp function.
+ *
+ ******************************************************************************/
+
+int
+AcpiUtStricmp (
+ char *String1,
+ char *String2)
+{
+ int c1;
+ int c2;
+
+
+ do
+ {
+ c1 = tolower ((int) *String1);
+ c2 = tolower ((int) *String2);
+
+ String1++;
+ String2++;
+ }
+ while ((c1 == c2) && (c1));
+
+ return (c1 - c2);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtStrtoul64
+ *
+ * PARAMETERS: String - Null terminated string
+ * Base - Radix of the string: 16 or ACPI_ANY_BASE;
+ * ACPI_ANY_BASE means 'in behalf of ToInteger'
+ * RetInteger - Where the converted integer is returned
+ *
+ * RETURN: Status and Converted value
+ *
+ * DESCRIPTION: Convert a string into an unsigned value. Performs either a
+ * 32-bit or 64-bit conversion, depending on the current mode
+ * of the interpreter.
+ *
+ * NOTE: Does not support Octal strings, not needed.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtStrtoul64 (
+ char *String,
+ UINT32 Base,
+ UINT64 *RetInteger)
+{
+ UINT32 ThisDigit = 0;
+ UINT64 ReturnValue = 0;
+ UINT64 Quotient;
+ UINT64 Dividend;
+ UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE);
+ UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4);
+ UINT8 ValidDigits = 0;
+ UINT8 SignOf0x = 0;
+ UINT8 Term = 0;
+
+
+ ACPI_FUNCTION_TRACE_STR (UtStroul64, String);
+
+
+ switch (Base)
+ {
+ case ACPI_ANY_BASE:
+ case 16:
+
+ break;
+
+ default:
+
+ /* Invalid Base */
+
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (!String)
+ {
+ goto ErrorExit;
+ }
+
+ /* Skip over any white space in the buffer */
+
+ while ((*String) && (isspace ((int) *String) || *String == '\t'))
+ {
+ String++;
+ }
+
+ if (ToIntegerOp)
+ {
+ /*
+ * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
+ * We need to determine if it is decimal or hexadecimal.
+ */
+ if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x'))
+ {
+ SignOf0x = 1;
+ Base = 16;
+
+ /* Skip over the leading '0x' */
+ String += 2;
+ }
+ else
+ {
+ Base = 10;
+ }
+ }
+
+ /* Any string left? Check that '0x' is not followed by white space. */
+
+ if (!(*String) || isspace ((int) *String) || *String == '\t')
+ {
+ if (ToIntegerOp)
+ {
+ goto ErrorExit;
+ }
+ else
+ {
+ goto AllDone;
+ }
+ }
+
+ /*
+ * Perform a 32-bit or 64-bit conversion, depending upon the current
+ * execution mode of the interpreter
+ */
+ Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
+
+ /* Main loop: convert the string to a 32- or 64-bit integer */
+
+ while (*String)
+ {
+ if (isdigit ((int) *String))
+ {
+ /* Convert ASCII 0-9 to Decimal value */
+
+ ThisDigit = ((UINT8) *String) - '0';
+ }
+ else if (Base == 10)
+ {
+ /* Digit is out of range; possible in ToInteger case only */
+
+ Term = 1;
+ }
+ else
+ {
+ ThisDigit = (UINT8) toupper ((int) *String);
+ if (isxdigit ((int) ThisDigit))
+ {
+ /* Convert ASCII Hex char to value */
+
+ ThisDigit = ThisDigit - 'A' + 10;
+ }
+ else
+ {
+ Term = 1;
+ }
+ }
+
+ if (Term)
+ {
+ if (ToIntegerOp)
+ {
+ goto ErrorExit;
+ }
+ else
+ {
+ break;
+ }
+ }
+ else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x)
+ {
+ /* Skip zeros */
+ String++;
+ continue;
+ }
+
+ ValidDigits++;
+
+ if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32)))
+ {
+ /*
+ * This is ToInteger operation case.
+ * No any restrictions for string-to-integer conversion,
+ * see ACPI spec.
+ */
+ goto ErrorExit;
+ }
+
+ /* Divide the digit into the correct position */
+
+ (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit),
+ Base, &Quotient, NULL);
+
+ if (ReturnValue > Quotient)
+ {
+ if (ToIntegerOp)
+ {
+ goto ErrorExit;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ ReturnValue *= Base;
+ ReturnValue += ThisDigit;
+ String++;
+ }
+
+ /* All done, normal exit */
+
+AllDone:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (ReturnValue)));
+
+ *RetInteger = ReturnValue;
+ return_ACPI_STATUS (AE_OK);
+
+
+ErrorExit:
+ /* Base was set/validated above */
+
+ if (Base == 10)
+ {
+ return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT);
+ }
+ else
+ {
+ return_ACPI_STATUS (AE_BAD_HEX_CONSTANT);
+ }
+}
+
+
+#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat
+ *
+ * PARAMETERS: Adds a "DestSize" parameter to each of the standard string
+ * functions. This is the size of the Destination buffer.
+ *
+ * RETURN: TRUE if the operation would overflow the destination buffer.
+ *
+ * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that
+ * the result of the operation will not overflow the output string
+ * buffer.
+ *
+ * NOTE: These functions are typically only helpful for processing
+ * user input and command lines. For most ACPICA code, the
+ * required buffer length is precisely calculated before buffer
+ * allocation, so the use of these functions is unnecessary.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtSafeStrcpy (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source)
+{
+
+ if (strlen (Source) >= DestSize)
+ {
+ return (TRUE);
+ }
+
+ strcpy (Dest, Source);
+ return (FALSE);
+}
+
+BOOLEAN
+AcpiUtSafeStrcat (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source)
+{
+
+ if ((strlen (Dest) + strlen (Source)) >= DestSize)
+ {
+ return (TRUE);
+ }
+
+ strcat (Dest, Source);
+ return (FALSE);
+}
+
+BOOLEAN
+AcpiUtSafeStrncat (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source,
+ ACPI_SIZE MaxTransferLength)
+{
+ ACPI_SIZE ActualTransferLength;
+
+
+ ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source));
+
+ if ((strlen (Dest) + ActualTransferLength) >= DestSize)
+ {
+ return (TRUE);
+ }
+
+ strncat (Dest, Source, MaxTransferLength);
+ return (FALSE);
+}
+#endif
diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c
index 33060f063fec..af7b4af761da 100644
--- a/source/components/utilities/utstring.c
+++ b/source/components/utilities/utstring.c
@@ -50,343 +50,6 @@
ACPI_MODULE_NAME ("utstring")
-/*
- * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit
- * version of strtoul.
- */
-
-#ifdef ACPI_ASL_COMPILER
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtStrlwr (strlwr)
- *
- * PARAMETERS: SrcString - The source string to convert
- *
- * RETURN: None
- *
- * DESCRIPTION: Convert string to lowercase
- *
- * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
- *
- ******************************************************************************/
-
-void
-AcpiUtStrlwr (
- char *SrcString)
-{
- char *String;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- if (!SrcString)
- {
- return;
- }
-
- /* Walk entire string, lowercasing the letters */
-
- for (String = SrcString; *String; String++)
- {
- *String = (char) tolower ((int) *String);
- }
-
- return;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiUtStricmp (stricmp)
- *
- * PARAMETERS: String1 - first string to compare
- * String2 - second string to compare
- *
- * RETURN: int that signifies string relationship. Zero means strings
- * are equal.
- *
- * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare
- * strings with no case sensitivity)
- *
- ******************************************************************************/
-
-int
-AcpiUtStricmp (
- char *String1,
- char *String2)
-{
- int c1;
- int c2;
-
-
- do
- {
- c1 = tolower ((int) *String1);
- c2 = tolower ((int) *String2);
-
- String1++;
- String2++;
- }
- while ((c1 == c2) && (c1));
-
- return (c1 - c2);
-}
-#endif
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtStrupr (strupr)
- *
- * PARAMETERS: SrcString - The source string to convert
- *
- * RETURN: None
- *
- * DESCRIPTION: Convert string to uppercase
- *
- * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
- *
- ******************************************************************************/
-
-void
-AcpiUtStrupr (
- char *SrcString)
-{
- char *String;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- if (!SrcString)
- {
- return;
- }
-
- /* Walk entire string, uppercasing the letters */
-
- for (String = SrcString; *String; String++)
- {
- *String = (char) toupper ((int) *String);
- }
-
- return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtStrtoul64
- *
- * PARAMETERS: String - Null terminated string
- * Base - Radix of the string: 16 or ACPI_ANY_BASE;
- * ACPI_ANY_BASE means 'in behalf of ToInteger'
- * RetInteger - Where the converted integer is returned
- *
- * RETURN: Status and Converted value
- *
- * DESCRIPTION: Convert a string into an unsigned value. Performs either a
- * 32-bit or 64-bit conversion, depending on the current mode
- * of the interpreter.
- * NOTE: Does not support Octal strings, not needed.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtStrtoul64 (
- char *String,
- UINT32 Base,
- UINT64 *RetInteger)
-{
- UINT32 ThisDigit = 0;
- UINT64 ReturnValue = 0;
- UINT64 Quotient;
- UINT64 Dividend;
- UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE);
- UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4);
- UINT8 ValidDigits = 0;
- UINT8 SignOf0x = 0;
- UINT8 Term = 0;
-
-
- ACPI_FUNCTION_TRACE_STR (UtStroul64, String);
-
-
- switch (Base)
- {
- case ACPI_ANY_BASE:
- case 16:
-
- break;
-
- default:
-
- /* Invalid Base */
-
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- if (!String)
- {
- goto ErrorExit;
- }
-
- /* Skip over any white space in the buffer */
-
- while ((*String) && (isspace ((int) *String) || *String == '\t'))
- {
- String++;
- }
-
- if (ToIntegerOp)
- {
- /*
- * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
- * We need to determine if it is decimal or hexadecimal.
- */
- if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x'))
- {
- SignOf0x = 1;
- Base = 16;
-
- /* Skip over the leading '0x' */
- String += 2;
- }
- else
- {
- Base = 10;
- }
- }
-
- /* Any string left? Check that '0x' is not followed by white space. */
-
- if (!(*String) || isspace ((int) *String) || *String == '\t')
- {
- if (ToIntegerOp)
- {
- goto ErrorExit;
- }
- else
- {
- goto AllDone;
- }
- }
-
- /*
- * Perform a 32-bit or 64-bit conversion, depending upon the current
- * execution mode of the interpreter
- */
- Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
-
- /* Main loop: convert the string to a 32- or 64-bit integer */
-
- while (*String)
- {
- if (isdigit ((int) *String))
- {
- /* Convert ASCII 0-9 to Decimal value */
-
- ThisDigit = ((UINT8) *String) - '0';
- }
- else if (Base == 10)
- {
- /* Digit is out of range; possible in ToInteger case only */
-
- Term = 1;
- }
- else
- {
- ThisDigit = (UINT8) toupper ((int) *String);
- if (isxdigit ((int) ThisDigit))
- {
- /* Convert ASCII Hex char to value */
-
- ThisDigit = ThisDigit - 'A' + 10;
- }
- else
- {
- Term = 1;
- }
- }
-
- if (Term)
- {
- if (ToIntegerOp)
- {
- goto ErrorExit;
- }
- else
- {
- break;
- }
- }
- else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x)
- {
- /* Skip zeros */
- String++;
- continue;
- }
-
- ValidDigits++;
-
- if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32)))
- {
- /*
- * This is ToInteger operation case.
- * No any restrictions for string-to-integer conversion,
- * see ACPI spec.
- */
- goto ErrorExit;
- }
-
- /* Divide the digit into the correct position */
-
- (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit),
- Base, &Quotient, NULL);
-
- if (ReturnValue > Quotient)
- {
- if (ToIntegerOp)
- {
- goto ErrorExit;
- }
- else
- {
- break;
- }
- }
-
- ReturnValue *= Base;
- ReturnValue += ThisDigit;
- String++;
- }
-
- /* All done, normal exit */
-
-AllDone:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (ReturnValue)));
-
- *RetInteger = ReturnValue;
- return_ACPI_STATUS (AE_OK);
-
-
-ErrorExit:
- /* Base was set/validated above */
-
- if (Base == 10)
- {
- return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT);
- }
- else
- {
- return_ACPI_STATUS (AE_BAD_HEX_CONSTANT);
- }
-}
-
-
/*******************************************************************************
*
* FUNCTION: AcpiUtPrintString
@@ -682,78 +345,3 @@ UtConvertBackslashes (
}
}
#endif
-
-#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat
- *
- * PARAMETERS: Adds a "DestSize" parameter to each of the standard string
- * functions. This is the size of the Destination buffer.
- *
- * RETURN: TRUE if the operation would overflow the destination buffer.
- *
- * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that
- * the result of the operation will not overflow the output string
- * buffer.
- *
- * NOTE: These functions are typically only helpful for processing
- * user input and command lines. For most ACPICA code, the
- * required buffer length is precisely calculated before buffer
- * allocation, so the use of these functions is unnecessary.
- *
- ******************************************************************************/
-
-BOOLEAN
-AcpiUtSafeStrcpy (
- char *Dest,
- ACPI_SIZE DestSize,
- char *Source)
-{
-
- if (strlen (Source) >= DestSize)
- {
- return (TRUE);
- }
-
- strcpy (Dest, Source);
- return (FALSE);
-}
-
-BOOLEAN
-AcpiUtSafeStrcat (
- char *Dest,
- ACPI_SIZE DestSize,
- char *Source)
-{
-
- if ((strlen (Dest) + strlen (Source)) >= DestSize)
- {
- return (TRUE);
- }
-
- strcat (Dest, Source);
- return (FALSE);
-}
-
-BOOLEAN
-AcpiUtSafeStrncat (
- char *Dest,
- ACPI_SIZE DestSize,
- char *Source,
- ACPI_SIZE MaxTransferLength)
-{
- ACPI_SIZE ActualTransferLength;
-
-
- ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source));
-
- if ((strlen (Dest) + ActualTransferLength) >= DestSize)
- {
- return (TRUE);
- }
-
- strncat (Dest, Source, MaxTransferLength);
- return (FALSE);
-}
-#endif