summaryrefslogtreecommitdiff
path: root/source/components/parser
diff options
context:
space:
mode:
Diffstat (limited to 'source/components/parser')
-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
6 files changed, 48 insertions, 174 deletions
diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c
index ae6807304a8de..538b73eebd1fc 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 4e1eb29b69789..7c079444bb111 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 ed65495d9322a..b9d8e8ce69bb1 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 39520db3dfd47..49ab6313a1acb 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 55bf2ccff1b0c..ec0d20c8e0827 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 85eea33bb9be0..ae072b7dce7b4 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);