mirror of
https://github.com/acpica/acpica/
synced 2025-01-18 15:39:18 +03:00
Added revision number to header
date 2000.08.16.21.41.00; author rmoore1; state Exp;
This commit is contained in:
parent
7a04d9fe0e
commit
abce4edd80
@ -1,6 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psargs - Parse AML opcode arguments
|
||||
* $Revision: 1.32 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -207,14 +209,14 @@ UINT32
|
||||
AcpiPsGetNextPackageLength (
|
||||
ACPI_PARSE_STATE *ParserState)
|
||||
{
|
||||
INT32 EncodedLength;
|
||||
INT32 Length = 0;
|
||||
UINT32 EncodedLength;
|
||||
UINT32 Length = 0;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("PsGetNextPackageLength");
|
||||
|
||||
|
||||
EncodedLength = (INT32) GET8 (ParserState->Aml);
|
||||
EncodedLength = (UINT32) GET8 (ParserState->Aml);
|
||||
ParserState->Aml++;
|
||||
|
||||
|
||||
@ -301,13 +303,13 @@ AcpiPsGetNextPackageEnd (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
INT8 *
|
||||
NATIVE_CHAR *
|
||||
AcpiPsGetNextNamestring (
|
||||
ACPI_PARSE_STATE *ParserState)
|
||||
{
|
||||
INT8 *Start = (INT8 *) ParserState->Aml;
|
||||
INT8 *End = (INT8 *) ParserState->Aml;
|
||||
INT32 Length;
|
||||
UINT8 *Start = ParserState->Aml;
|
||||
UINT8 *End = ParserState->Aml;
|
||||
UINT32 Length;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("PsGetNextNamestring");
|
||||
@ -350,7 +352,7 @@ AcpiPsGetNextNamestring (
|
||||
|
||||
/* multiple name segments */
|
||||
|
||||
Length = (INT32) GET8 (End + 1) * 4;
|
||||
Length = (UINT32) GET8 (End + 1) * 4;
|
||||
End += 2 + Length;
|
||||
break;
|
||||
|
||||
@ -366,7 +368,7 @@ AcpiPsGetNextNamestring (
|
||||
|
||||
ParserState->Aml = (UINT8*) End;
|
||||
|
||||
return_PTR (Start);
|
||||
return_PTR ((NATIVE_CHAR *) Start);
|
||||
}
|
||||
|
||||
|
||||
@ -401,7 +403,7 @@ AcpiPsGetNextNamepath (
|
||||
UINT32 *ArgCount,
|
||||
BOOLEAN MethodCall)
|
||||
{
|
||||
INT8 *Path;
|
||||
NATIVE_CHAR *Path;
|
||||
ACPI_GENERIC_OP *Name;
|
||||
ACPI_GENERIC_OP *Op;
|
||||
ACPI_GENERIC_OP *Count;
|
||||
@ -503,7 +505,7 @@ AcpiPsGetNextNamepath (
|
||||
UINT32 *ArgCount,
|
||||
BOOLEAN MethodCall)
|
||||
{
|
||||
INT8 *Path;
|
||||
NATIVE_CHAR *Path;
|
||||
ACPI_GENERIC_OP *Name;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_NAMED_OBJECT *Method = NULL;
|
||||
@ -616,7 +618,7 @@ AcpiPsGetNextNamepath (
|
||||
void
|
||||
AcpiPsGetNextSimpleArg (
|
||||
ACPI_PARSE_STATE *ParserState,
|
||||
INT32 ArgType,
|
||||
UINT32 ArgType,
|
||||
ACPI_GENERIC_OP *Arg)
|
||||
{
|
||||
|
||||
@ -801,13 +803,13 @@ AcpiPsGetNextField (
|
||||
ACPI_GENERIC_OP *
|
||||
AcpiPsGetNextArg (
|
||||
ACPI_PARSE_STATE *ParserState,
|
||||
INT32 ArgType,
|
||||
UINT32 ArgType,
|
||||
UINT32 *ArgCount)
|
||||
{
|
||||
ACPI_GENERIC_OP *Arg = NULL;
|
||||
ACPI_GENERIC_OP *Prev = NULL;
|
||||
ACPI_GENERIC_OP *Field;
|
||||
INT32 Subop;
|
||||
UINT32 Subop;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState);
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psopcode - Parser opcode information table
|
||||
* $Revision: 1.18 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -240,7 +242,7 @@ AcpiPsGetOpcodeInfo (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
INT8 *
|
||||
NATIVE_CHAR *
|
||||
AcpiPsGetOpcodeName (
|
||||
UINT16 Opcode)
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psparse - Parser top level AML parse routines
|
||||
* $Revision: 1.46 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -185,9 +187,12 @@ AcpiPsDeleteParseTree (
|
||||
ACPI_WALK_LIST WalkList;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot);
|
||||
|
||||
|
||||
if (!SubtreeRoot)
|
||||
{
|
||||
return;
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* Create and initialize a new walk list */
|
||||
@ -196,7 +201,7 @@ AcpiPsDeleteParseTree (
|
||||
WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, &WalkList);
|
||||
if (!WalkState)
|
||||
{
|
||||
return;
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
WalkState->ParserState = NULL;
|
||||
@ -224,6 +229,8 @@ AcpiPsDeleteParseTree (
|
||||
/* We are done with this walk */
|
||||
|
||||
AcpiDsDeleteWalkState (WalkState);
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -329,12 +336,12 @@ AcpiPsPeekOpcode (
|
||||
ACPI_PARSE_STATE *
|
||||
AcpiPsCreateState (
|
||||
UINT8 *Aml,
|
||||
INT32 AmlSize)
|
||||
UINT32 AmlSize)
|
||||
{
|
||||
ACPI_PARSE_STATE *ParserState;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("PsInitState");
|
||||
FUNCTION_TRACE ("PsCreateState");
|
||||
|
||||
|
||||
ParserState = AcpiCmCallocate (sizeof (ACPI_PARSE_STATE));
|
||||
@ -380,9 +387,17 @@ AcpiPsFindObject (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_GENERIC_OP **OutOp)
|
||||
{
|
||||
INT8 *Path;
|
||||
NATIVE_CHAR *Path;
|
||||
|
||||
|
||||
/* We are only interested in opcodes that have an associated name */
|
||||
|
||||
if (!AcpiPsIsNamedOp (Opcode))
|
||||
{
|
||||
*OutOp = Op;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/* Find the name in the parse tree */
|
||||
|
||||
Path = AcpiPsGetNextNamestring (WalkState->ParserState);
|
||||
@ -428,8 +443,7 @@ AcpiPsCompleteThisOp (
|
||||
ACPI_GENERIC_OP *ReplacementOp = NULL;
|
||||
|
||||
|
||||
DEBUG_PRINT (TRACE_PARSE,
|
||||
("CompleteThisOp: Completing Op=%p\n", Op));
|
||||
FUNCTION_TRACE_PTR ("PsCompleteThisOp", Op);
|
||||
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
|
||||
@ -468,7 +482,7 @@ AcpiPsCompleteThisOp (
|
||||
ReplacementOp = AcpiPsAllocOp (AML_RETURN_VALUE_OP);
|
||||
if (!ReplacementOp)
|
||||
{
|
||||
return FALSE;
|
||||
return_VALUE (FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,20 +537,16 @@ AcpiPsCompleteThisOp (
|
||||
|
||||
/* Now we can actually delete the subtree rooted at op */
|
||||
|
||||
if (Op->Opcode == AML_STORE_OP)
|
||||
{
|
||||
AcpiPsDeleteParseTree (Op);
|
||||
}
|
||||
|
||||
else {
|
||||
AcpiPsDeleteParseTree (Op);
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
return_VALUE (TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
return_VALUE (FALSE);
|
||||
|
||||
#else
|
||||
return (FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -587,8 +597,8 @@ AcpiPsNextParseState (
|
||||
* execution. Go back to the start of the loop and reevaluate the
|
||||
* predicate.
|
||||
*/
|
||||
// WalkState->ControlState->Common.State =
|
||||
// CONTROL_PREDICATE_EXECUTING;
|
||||
/* WalkState->ControlState->Common.State =
|
||||
CONTROL_PREDICATE_EXECUTING;*/
|
||||
|
||||
/* TBD: How to handle a break within a while. */
|
||||
/* This code attempts it */
|
||||
@ -619,11 +629,12 @@ AcpiPsNextParseState (
|
||||
* level.
|
||||
*/
|
||||
|
||||
ParserState->Aml = ParserState->PkgEnd;
|
||||
ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd;
|
||||
|
||||
/* In the case of a BREAK, just force a predicate (if any) to FALSE */
|
||||
|
||||
WalkState->ControlState->Common.Value = FALSE;
|
||||
Status = AE_CTRL_END;
|
||||
break;
|
||||
|
||||
|
||||
@ -653,8 +664,7 @@ AcpiPsNextParseState (
|
||||
}
|
||||
|
||||
|
||||
return_ACPI_STATUS (Status)
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
@ -679,14 +689,14 @@ AcpiPsParseLoop (
|
||||
ACPI_GENERIC_OP *Op = NULL; /* current op */
|
||||
ACPI_OP_INFO *OpInfo;
|
||||
ACPI_GENERIC_OP *Arg = NULL;
|
||||
ACPI_DEFERRED_OP *DeferredOp;
|
||||
ACPI_EXTENDED_OP *DeferredOp;
|
||||
UINT32 ArgCount; /* push for fixed or var args */
|
||||
UINT32 ArgTypes = 0;
|
||||
ACPI_PTRDIFF AmlOffset;
|
||||
UINT16 Opcode;
|
||||
ACPI_GENERIC_OP PreOp;
|
||||
ACPI_PARSE_STATE *ParserState;
|
||||
|
||||
ACPI_GENERIC_OP *NewOp;
|
||||
|
||||
FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
|
||||
|
||||
@ -805,7 +815,7 @@ AcpiPsParseLoop (
|
||||
|
||||
if (Op->Opcode == AML_REGION_OP)
|
||||
{
|
||||
DeferredOp = AcpiPsToDeferredOp (Op);
|
||||
DeferredOp = AcpiPsToExtendedOp (Op);
|
||||
if (DeferredOp)
|
||||
{
|
||||
/*
|
||||
@ -819,8 +829,8 @@ AcpiPsParseLoop (
|
||||
* BodyLength is unknown until we parse the body
|
||||
*/
|
||||
|
||||
DeferredOp->Body = ParserState->Aml - 6;
|
||||
DeferredOp->BodyLength = 0;
|
||||
DeferredOp->Data = ParserState->Aml - 6;
|
||||
DeferredOp->Length = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -837,6 +847,13 @@ AcpiPsParseLoop (
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
NewOp = AcpiPsGetParentScope (ParserState);
|
||||
if (NewOp->Value.Arg == (void *) 0x00DEAD00)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR, ("Deleted Op found: %p\n", NewOp));
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
AcpiPsAppendArg (AcpiPsGetParentScope (ParserState), Op);
|
||||
|
||||
if ((WalkState->DescendingCallback != NULL))
|
||||
@ -921,7 +938,7 @@ AcpiPsParseLoop (
|
||||
|
||||
if (Op->Opcode == AML_METHOD_OP)
|
||||
{
|
||||
DeferredOp = AcpiPsToDeferredOp (Op);
|
||||
DeferredOp = AcpiPsToExtendedOp (Op);
|
||||
if (DeferredOp)
|
||||
{
|
||||
/*
|
||||
@ -930,8 +947,8 @@ AcpiPsParseLoop (
|
||||
* to parse them correctly.
|
||||
*/
|
||||
|
||||
DeferredOp->Body = ParserState->Aml;
|
||||
DeferredOp->BodyLength = ParserState->PkgEnd -
|
||||
DeferredOp->Data = ParserState->Aml;
|
||||
DeferredOp->Length = ParserState->PkgEnd -
|
||||
ParserState->Aml;
|
||||
|
||||
/*
|
||||
@ -939,8 +956,8 @@ AcpiPsParseLoop (
|
||||
* parsing because the opregion is not a standalone
|
||||
* package (We don't know where the end is).
|
||||
*/
|
||||
ParserState->Aml = ParserState->PkgEnd;
|
||||
ArgCount = 0;
|
||||
ParserState->Aml = ParserState->PkgEnd;
|
||||
ArgCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -961,7 +978,7 @@ AcpiPsParseLoop (
|
||||
|
||||
if (Op->Opcode == AML_REGION_OP)
|
||||
{
|
||||
DeferredOp = AcpiPsToDeferredOp (Op);
|
||||
DeferredOp = AcpiPsToExtendedOp (Op);
|
||||
if (DeferredOp)
|
||||
{
|
||||
/*
|
||||
@ -973,8 +990,8 @@ AcpiPsParseLoop (
|
||||
* know the length.
|
||||
*/
|
||||
|
||||
DeferredOp->BodyLength = ParserState->Aml -
|
||||
DeferredOp->Body;
|
||||
DeferredOp->Length = ParserState->Aml -
|
||||
DeferredOp->Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -996,7 +1013,7 @@ AcpiPsParseLoop (
|
||||
|
||||
CloseThisOp:
|
||||
|
||||
ParserState->Scope->ArgCount--;
|
||||
ParserState->Scope->ParseScope.ArgCount--;
|
||||
|
||||
/* Close this Op (may result in parse subtree deletion) */
|
||||
|
||||
@ -1006,7 +1023,17 @@ CloseThisOp:
|
||||
}
|
||||
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
if (Status == AE_CTRL_END)
|
||||
{
|
||||
AcpiPsPopScope (ParserState, &Op, &ArgTypes);
|
||||
Status = WalkState->AscendingCallback (WalkState, Op);
|
||||
Status = AcpiPsNextParseState (WalkState, Op, Status);
|
||||
AcpiPsCompleteThisOp (WalkState, Op);
|
||||
Op = NULL;
|
||||
Status = AE_OK;
|
||||
}
|
||||
|
||||
else if (ACPI_FAILURE (Status))
|
||||
{
|
||||
if (Op == NULL)
|
||||
{
|
||||
@ -1026,12 +1053,12 @@ CloseThisOp:
|
||||
/* Clean up */
|
||||
do
|
||||
{
|
||||
AcpiPsPopScope (ParserState, &Op, &ArgTypes);
|
||||
if (Op)
|
||||
{
|
||||
AcpiPsCompleteThisOp (WalkState, Op);
|
||||
}
|
||||
|
||||
AcpiPsPopScope (ParserState, &Op, &ArgTypes);
|
||||
} while (Op);
|
||||
}
|
||||
return_ACPI_STATUS (Status);
|
||||
@ -1071,6 +1098,8 @@ CloseThisOp:
|
||||
* of open scopes (such as when several AML blocks are closed with
|
||||
* sequential closing braces). We want to terminate each one cleanly.
|
||||
*/
|
||||
|
||||
DEBUG_PRINT (TRACE_PARSE, ("PsParseLoop: Package complete at Op %p\n", Op));
|
||||
do
|
||||
{
|
||||
if (Op)
|
||||
@ -1084,7 +1113,27 @@ CloseThisOp:
|
||||
Status = AE_OK;
|
||||
goto CloseThisOp;
|
||||
}
|
||||
if (ACPI_FAILURE (Status))
|
||||
|
||||
if (Status == AE_CTRL_TERMINATE)
|
||||
{
|
||||
Status = AE_OK;
|
||||
|
||||
/* Clean up */
|
||||
do
|
||||
{
|
||||
if (Op)
|
||||
{
|
||||
AcpiPsCompleteThisOp (WalkState, Op);
|
||||
}
|
||||
|
||||
AcpiPsPopScope (ParserState, &Op, &ArgTypes);
|
||||
|
||||
} while (Op);
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
else if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiPsCompleteThisOp (WalkState, Op);
|
||||
return_ACPI_STATUS (Status);
|
||||
@ -1295,8 +1344,8 @@ AcpiPsParseAml (
|
||||
* there's lots of cleanup to do
|
||||
*/
|
||||
|
||||
if (WalkState->MethodDesc) // &&
|
||||
// WalkState->MethodDesc->Method.ParserOp)
|
||||
if (WalkState->MethodDesc) /*&&
|
||||
WalkState->MethodDesc->Method.ParserOp)*/
|
||||
{
|
||||
AcpiDsTerminateControlMethod (WalkState);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psscope - Parser scope stack management routines
|
||||
* $Revision: 1.16 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -137,7 +139,7 @@ ACPI_GENERIC_OP *
|
||||
AcpiPsGetParentScope (
|
||||
ACPI_PARSE_STATE *ParserState)
|
||||
{
|
||||
return ParserState->Scope->Op;
|
||||
return (ParserState->Scope->ParseScope.Op);
|
||||
}
|
||||
|
||||
|
||||
@ -159,8 +161,8 @@ BOOLEAN
|
||||
AcpiPsHasCompletedScope (
|
||||
ACPI_PARSE_STATE *ParserState)
|
||||
{
|
||||
return (BOOLEAN) ((ParserState->Aml >= ParserState->Scope->ArgEnd ||
|
||||
!ParserState->Scope->ArgCount));
|
||||
return ((BOOLEAN) ((ParserState->Aml >= ParserState->Scope->ParseScope.ArgEnd ||
|
||||
!ParserState->Scope->ParseScope.ArgCount)));
|
||||
}
|
||||
|
||||
|
||||
@ -180,25 +182,29 @@ AcpiPsHasCompletedScope (
|
||||
ACPI_STATUS
|
||||
AcpiPsInitScope (
|
||||
ACPI_PARSE_STATE *ParserState,
|
||||
ACPI_GENERIC_OP *Root)
|
||||
ACPI_GENERIC_OP *RootOp)
|
||||
{
|
||||
ACPI_PARSE_SCOPE *Scope;
|
||||
ACPI_GENERIC_STATE *Scope;
|
||||
|
||||
|
||||
Scope = AcpiCmCallocate (sizeof (ACPI_PARSE_SCOPE));
|
||||
FUNCTION_TRACE_PTR ("PsInitScope", RootOp);
|
||||
|
||||
|
||||
Scope = AcpiCmCreateGenericState ();
|
||||
if (!Scope)
|
||||
{
|
||||
return AE_NO_MEMORY;
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
Scope->Op = Root;
|
||||
Scope->ArgCount = ACPI_VAR_ARGS;
|
||||
Scope->ArgEnd = ParserState->AmlEnd;
|
||||
Scope->PkgEnd = ParserState->AmlEnd;
|
||||
ParserState->Scope = Scope;
|
||||
ParserState->StartOp = Root;
|
||||
Scope->ParseScope.Op = RootOp;
|
||||
Scope->ParseScope.ArgCount = ACPI_VAR_ARGS;
|
||||
Scope->ParseScope.ArgEnd = ParserState->AmlEnd;
|
||||
Scope->ParseScope.PkgEnd = ParserState->AmlEnd;
|
||||
|
||||
return AE_OK;
|
||||
ParserState->Scope = Scope;
|
||||
ParserState->StartOp = RootOp;
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
@ -224,53 +230,43 @@ AcpiPsPushScope (
|
||||
UINT32 RemainingArgs,
|
||||
UINT32 ArgCount)
|
||||
{
|
||||
ACPI_PARSE_SCOPE *Scope = ParserState->ScopeAvail;
|
||||
ACPI_GENERIC_STATE *Scope;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("PsPushScope");
|
||||
FUNCTION_TRACE_PTR ("PsPushScope", Op);
|
||||
|
||||
|
||||
if (Scope)
|
||||
|
||||
|
||||
Scope = AcpiCmCreateGenericState ();
|
||||
if (!Scope)
|
||||
{
|
||||
/* grabbed scope from available list */
|
||||
|
||||
ParserState->ScopeAvail = Scope->Parent;
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* allocate scope from the heap */
|
||||
|
||||
Scope = (ACPI_PARSE_SCOPE*) AcpiCmAllocate (sizeof (ACPI_PARSE_SCOPE));
|
||||
if (!Scope)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
}
|
||||
Scope->ParseScope.Op = Op;
|
||||
Scope->ParseScope.ArgList = RemainingArgs;
|
||||
Scope->ParseScope.ArgCount = ArgCount;
|
||||
Scope->ParseScope.PkgEnd = ParserState->PkgEnd;
|
||||
|
||||
/* Always zero out the scope before init */
|
||||
/* Push onto scope stack */
|
||||
|
||||
MEMSET (Scope, 0, sizeof (*Scope));
|
||||
AcpiCmPushGenericState (&ParserState->Scope, Scope);
|
||||
|
||||
Scope->Op = Op;
|
||||
Scope->ArgList = RemainingArgs;
|
||||
Scope->ArgCount = ArgCount;
|
||||
Scope->PkgEnd = ParserState->PkgEnd;
|
||||
Scope->Parent = ParserState->Scope;
|
||||
ParserState->Scope = Scope;
|
||||
|
||||
if (ArgCount == ACPI_VAR_ARGS)
|
||||
{
|
||||
/* multiple arguments */
|
||||
|
||||
Scope->ArgEnd = ParserState->PkgEnd;
|
||||
Scope->ParseScope.ArgEnd = ParserState->PkgEnd;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* single argument */
|
||||
|
||||
Scope->ArgEnd = ACPI_MAX_AML;
|
||||
Scope->ParseScope.ArgEnd = ACPI_MAX_AML;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
@ -298,25 +294,28 @@ AcpiPsPopScope (
|
||||
ACPI_GENERIC_OP **Op,
|
||||
UINT32 *ArgList)
|
||||
{
|
||||
ACPI_PARSE_SCOPE *Scope = ParserState->Scope;
|
||||
ACPI_GENERIC_STATE *Scope = ParserState->Scope;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("PsPopScope");
|
||||
|
||||
|
||||
if (Scope->Parent)
|
||||
/*
|
||||
* Only pop the scope if there is in fact a next scope
|
||||
*/
|
||||
if (Scope->Common.Next)
|
||||
{
|
||||
Scope = AcpiCmPopGenericState (&ParserState->Scope);
|
||||
|
||||
|
||||
/* return to parsing previous op */
|
||||
|
||||
*Op = Scope->Op;
|
||||
*ArgList = Scope->ArgList;
|
||||
ParserState->PkgEnd = Scope->PkgEnd;
|
||||
ParserState->Scope = Scope->Parent;
|
||||
*Op = Scope->ParseScope.Op;
|
||||
*ArgList = Scope->ParseScope.ArgList;
|
||||
ParserState->PkgEnd = Scope->ParseScope.PkgEnd;
|
||||
|
||||
/* add scope to available list */
|
||||
/* All done with this scope state structure */
|
||||
|
||||
Scope->Parent = ParserState->ScopeAvail;
|
||||
ParserState->ScopeAvail = Scope;
|
||||
AcpiCmDeleteGenericState (Scope);
|
||||
}
|
||||
|
||||
else
|
||||
@ -327,6 +326,8 @@ AcpiPsPopScope (
|
||||
*ArgList = 0;
|
||||
}
|
||||
|
||||
|
||||
DEBUG_PRINT (TRACE_PARSE, ("PsPopScope: Popped Op %p\n", *Op));
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
@ -348,8 +349,7 @@ void
|
||||
AcpiPsCleanupScope (
|
||||
ACPI_PARSE_STATE *ParserState)
|
||||
{
|
||||
ACPI_PARSE_SCOPE *Scope;
|
||||
|
||||
ACPI_GENERIC_STATE *Scope;
|
||||
|
||||
FUNCTION_TRACE_PTR ("PsCleanupScope", ParserState);
|
||||
|
||||
@ -359,22 +359,13 @@ AcpiPsCleanupScope (
|
||||
return;
|
||||
}
|
||||
|
||||
/* destroy available list */
|
||||
|
||||
while (ParserState->ScopeAvail)
|
||||
{
|
||||
Scope = ParserState->ScopeAvail;
|
||||
ParserState->ScopeAvail = Scope->Parent;
|
||||
AcpiCmFree (Scope);
|
||||
}
|
||||
|
||||
/* destroy scope stack */
|
||||
/* Delete anything on the scope stack */
|
||||
|
||||
while (ParserState->Scope)
|
||||
{
|
||||
Scope = ParserState->Scope;
|
||||
ParserState->Scope = Scope->Parent;
|
||||
AcpiCmFree (Scope);
|
||||
Scope = AcpiCmPopGenericState (&ParserState->Scope);
|
||||
AcpiCmDeleteGenericState (Scope);
|
||||
}
|
||||
|
||||
return_VOID;
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: pstree - Parser op tree manipulation/traversal/search
|
||||
* $Revision: 1.21 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -413,7 +415,7 @@ AcpiPsGetDepthNext (
|
||||
ACPI_GENERIC_OP *
|
||||
AcpiPsFetchPrefix (
|
||||
ACPI_GENERIC_OP *Scope,
|
||||
INT8 **Path,
|
||||
NATIVE_CHAR **Path,
|
||||
UINT32 io)
|
||||
{
|
||||
UINT32 prefix = io ? GET8 (*Path):**Path;
|
||||
@ -469,13 +471,13 @@ AcpiPsFetchPrefix (
|
||||
|
||||
UINT32
|
||||
AcpiPsFetchName (
|
||||
INT8 **Path,
|
||||
NATIVE_CHAR **Path,
|
||||
UINT32 io)
|
||||
{
|
||||
UINT32 Name = 0;
|
||||
INT8 *nm;
|
||||
NATIVE_CHAR *nm;
|
||||
UINT32 i;
|
||||
INT8 ch;
|
||||
NATIVE_CHAR ch;
|
||||
|
||||
|
||||
if (io)
|
||||
@ -493,7 +495,7 @@ AcpiPsFetchName (
|
||||
*Path += 1;
|
||||
}
|
||||
|
||||
nm = (char*) &Name;
|
||||
nm = (NATIVE_CHAR *) &Name;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
ch = **Path;
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
|
||||
* $Revision: 1.27 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -188,19 +190,19 @@ AcpiPsAllocOp (
|
||||
|
||||
if (AcpiPsIsDeferredOp (Opcode))
|
||||
{
|
||||
Size = sizeof (ACPI_DEFERRED_OP);
|
||||
Size = sizeof (ACPI_EXTENDED_OP);
|
||||
Flags = PARSEOP_DEFERRED;
|
||||
}
|
||||
|
||||
else if (AcpiPsIsNamedOp (Opcode))
|
||||
{
|
||||
Size = sizeof (ACPI_NAMED_OP);
|
||||
Size = sizeof (ACPI_EXTENDED_OP);
|
||||
Flags = PARSEOP_NAMED;
|
||||
}
|
||||
|
||||
else if (AcpiPsIsBytelistOp (Opcode))
|
||||
{
|
||||
Size = sizeof (ACPI_BYTELIST_OP);
|
||||
Size = sizeof (ACPI_EXTENDED_OP);
|
||||
Flags = PARSEOP_BYTELIST;
|
||||
}
|
||||
|
||||
@ -208,7 +210,11 @@ AcpiPsAllocOp (
|
||||
{
|
||||
Size = sizeof (ACPI_GENERIC_OP);
|
||||
Flags = PARSEOP_GENERIC;
|
||||
}
|
||||
|
||||
|
||||
if (Size == sizeof (ACPI_GENERIC_OP))
|
||||
{
|
||||
/*
|
||||
* The generic op is by far the most common (16 to 1), and therefore
|
||||
* the op cache is implemented with this type.
|
||||
@ -228,13 +234,59 @@ AcpiPsAllocOp (
|
||||
Op = AcpiGbl_ParseCache;
|
||||
AcpiGbl_ParseCache = Op->Next;
|
||||
|
||||
if (Op->DataType == 0xFF)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR, ("Op %p deleted while in cache!\n", Op));
|
||||
}
|
||||
|
||||
/* Clear the previously used Op */
|
||||
|
||||
MEMSET (Op, 0, sizeof (ACPI_GENERIC_OP));
|
||||
|
||||
DEBUG_PRINT (TRACE_PARSE,
|
||||
("PsAllocOp: Op %p from Parse Cache\n", Op));
|
||||
}
|
||||
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/*
|
||||
* The generic op is by far the most common (16 to 1), and therefore
|
||||
* the op cache is implemented with this type.
|
||||
*
|
||||
* Check if there is an Op already available in the cache
|
||||
*/
|
||||
|
||||
AcpiCmAcquireMutex (ACPI_MTX_CACHES);
|
||||
AcpiGbl_ExtParseCacheRequests++;
|
||||
if (AcpiGbl_ExtParseCache)
|
||||
{
|
||||
/* Extract an op from the front of the cache list */
|
||||
|
||||
AcpiGbl_ExtParseCacheDepth--;
|
||||
AcpiGbl_ExtParseCacheHits++;
|
||||
|
||||
Op = (ACPI_GENERIC_OP *) AcpiGbl_ExtParseCache;
|
||||
AcpiGbl_ExtParseCache = (ACPI_EXTENDED_OP *) Op->Next;
|
||||
|
||||
if (Op->DataType == 0xFF)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR, ("Op %p deleted while in cache!\n", Op));
|
||||
}
|
||||
|
||||
/* Clear the previously used Op */
|
||||
|
||||
MEMSET (Op, 0, sizeof (ACPI_EXTENDED_OP));
|
||||
|
||||
DEBUG_PRINT (TRACE_PARSE,
|
||||
("PsAllocOp: Op %p from ExtParse Cache\n", Op));
|
||||
}
|
||||
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Allocate a new Op if necessary */
|
||||
|
||||
if (!Op)
|
||||
@ -301,6 +353,31 @@ AcpiPsFreeOp (
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Is the cache full? */
|
||||
|
||||
if (AcpiGbl_ExtParseCacheDepth < MAX_EXTPARSE_CACHE_DEPTH)
|
||||
{
|
||||
/* Put a GENERIC_OP back into the cache */
|
||||
|
||||
/* Clear the previously used Op */
|
||||
|
||||
MEMSET (Op, 0, sizeof (ACPI_EXTENDED_OP));
|
||||
Op->Flags = PARSEOP_IN_CACHE;
|
||||
|
||||
AcpiCmAcquireMutex (ACPI_MTX_CACHES);
|
||||
AcpiGbl_ExtParseCacheDepth++;
|
||||
|
||||
Op->Next = (ACPI_GENERIC_OP *) AcpiGbl_ExtParseCache;
|
||||
AcpiGbl_ExtParseCache = (ACPI_EXTENDED_OP *) Op;
|
||||
|
||||
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Not a GENERIC OP, or the cache is full, just free the Op
|
||||
*/
|
||||
@ -343,6 +420,18 @@ AcpiPsDeleteParseCache (
|
||||
AcpiGbl_ParseCacheDepth--;
|
||||
}
|
||||
|
||||
/* Traverse the global cache list */
|
||||
|
||||
while (AcpiGbl_ExtParseCache)
|
||||
{
|
||||
/* Delete one cached state object */
|
||||
|
||||
Next = AcpiGbl_ExtParseCache->Next;
|
||||
AcpiCmFree (AcpiGbl_ExtParseCache);
|
||||
AcpiGbl_ExtParseCache = (ACPI_EXTENDED_OP *) Next;
|
||||
AcpiGbl_ExtParseCacheDepth--;
|
||||
}
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
@ -367,7 +456,7 @@ AcpiPsDeleteParseCache (
|
||||
|
||||
BOOLEAN
|
||||
AcpiPsIsLeadingChar (
|
||||
INT32 c)
|
||||
UINT32 c)
|
||||
{
|
||||
return ((BOOLEAN) (c == '_' || (c >= 'A' && c <= 'Z')));
|
||||
}
|
||||
@ -378,7 +467,7 @@ AcpiPsIsLeadingChar (
|
||||
*/
|
||||
BOOLEAN
|
||||
AcpiPsIsPrefixChar (
|
||||
INT32 c)
|
||||
UINT32 c)
|
||||
{
|
||||
return ((BOOLEAN) (c == '\\' || c == '^'));
|
||||
}
|
||||
@ -547,40 +636,19 @@ AcpiPsIsCreateFieldOp (
|
||||
|
||||
|
||||
/*
|
||||
* Cast an acpi_op to an acpi_deferred_op if possible
|
||||
* Cast an acpi_op to an acpi_extended_op if possible
|
||||
*/
|
||||
ACPI_DEFERRED_OP *
|
||||
AcpiPsToDeferredOp (
|
||||
|
||||
/* TBD: This is very inefficient, fix */
|
||||
ACPI_EXTENDED_OP *
|
||||
AcpiPsToExtendedOp (
|
||||
ACPI_GENERIC_OP *Op)
|
||||
{
|
||||
return (AcpiPsIsDeferredOp (Op->Opcode)
|
||||
? ( (ACPI_DEFERRED_OP *) Op) : NULL);
|
||||
return ((AcpiPsIsDeferredOp (Op->Opcode) || AcpiPsIsNamedOp (Op->Opcode) || AcpiPsIsBytelistOp (Op->Opcode))
|
||||
? ( (ACPI_EXTENDED_OP *) Op) : NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Cast an acpi_op to an acpi_named_op if possible
|
||||
*/
|
||||
ACPI_NAMED_OP*
|
||||
AcpiPsToNamedOp (
|
||||
ACPI_GENERIC_OP *Op)
|
||||
{
|
||||
return (AcpiPsIsNamedOp (Op->Opcode)
|
||||
? ( (ACPI_NAMED_OP *) Op) : NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Cast an acpi_op to an acpi_bytelist_op if possible
|
||||
*/
|
||||
ACPI_BYTELIST_OP*
|
||||
AcpiPsToBytelistOp (
|
||||
ACPI_GENERIC_OP *Op)
|
||||
{
|
||||
return (AcpiPsIsBytelistOp (Op->Opcode)
|
||||
? ( (ACPI_BYTELIST_OP*) Op) : NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get op's name (4-byte name segment) or 0 if unnamed
|
||||
@ -589,7 +657,7 @@ UINT32
|
||||
AcpiPsGetName (
|
||||
ACPI_GENERIC_OP *Op)
|
||||
{
|
||||
ACPI_NAMED_OP *Named = AcpiPsToNamedOp (Op);
|
||||
ACPI_EXTENDED_OP *Named = AcpiPsToExtendedOp (Op);
|
||||
|
||||
return (Named ? Named->Name : 0);
|
||||
}
|
||||
@ -603,7 +671,7 @@ AcpiPsSetName (
|
||||
ACPI_GENERIC_OP *Op,
|
||||
UINT32 name)
|
||||
{
|
||||
ACPI_NAMED_OP *Named = AcpiPsToNamedOp (Op);
|
||||
ACPI_EXTENDED_OP *Named = AcpiPsToExtendedOp (Op);
|
||||
|
||||
if (Named)
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
|
||||
* $Revision: 1.41 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psxface - Parser external interfaces
|
||||
* $Revision: 1.32 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -216,7 +217,6 @@ AcpiPsxExecute (
|
||||
AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
|
||||
AcpiPsDeleteParseTree (Op);
|
||||
|
||||
|
||||
/* Create and init a root object */
|
||||
|
||||
Op = AcpiPsAllocOp (AML_SCOPE_OP);
|
||||
@ -229,14 +229,6 @@ AcpiPsxExecute (
|
||||
ObjDesc->Method.PcodeLength, PARSE_DELETE_TREE,
|
||||
MethodEntry, Params, ReturnObjDesc,
|
||||
AcpiDsExecBeginOp, AcpiDsExecEndOp);
|
||||
/*
|
||||
Status = AcpiPsWalkParsedAml (ObjDesc->Method.ParserOp,
|
||||
ObjDesc->Method.ParserOp, ObjDesc,
|
||||
MethodEntry->ChildTable, Params, ReturnObjDesc,
|
||||
ObjDesc->Method.OwningId, AcpiDsExecBeginOp,
|
||||
AcpiDsExecEndOp);
|
||||
*/
|
||||
|
||||
AcpiPsDeleteParseTree (Op);
|
||||
|
||||
if (Params)
|
||||
|
Loading…
Reference in New Issue
Block a user